@grackle-ai/web 0.111.0 → 0.112.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,754 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-sxh-VcHe.js","assets/dagview-tHPW3Rz3.js","assets/grpc-Bj1y6sZz.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as N2,a as w2,b as y,j as a,d as fy,H as my,P as py,i as C2,B as E2,c as A2,C as D2,M as R2,e as M2}from"./dagview-tHPW3Rz3.js";import{c as I2,a as Cd,G as O2,b as L2,d as B2,e as $2,f as z2,M as H2,D as E_,A as A_,W as P2,O as U2,g as V2,C as da,h as D_,i as R_,w as q2,t as G2,p as $c,j as F2,R as Hr,S as hy}from"./grpc-Bj1y6sZz.js";import{v as Z2,r as K2,t as zc,i as Y2,f as J2,M as Ed,a as Ad}from"./markdown-Yr3vTPLR.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var tm={exports:{}},Pr={},nm={exports:{}},sm={};/**
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 gy;function W2(){return gy||(gy=1,(function(t){function s(B,R){var se=B.length;B.push(R);e:for(;0<se;){var oe=se-1>>>1,q=B[oe];if(0<c(q,R))B[oe]=R,B[se]=q,se=oe;else break e}}function o(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var R=B[0],se=B.pop();if(se!==R){B[0]=se;e:for(var oe=0,q=B.length,me=q>>>1;oe<me;){var de=2*(oe+1)-1,xe=B[de],Se=de+1,Pe=B[Se];if(0>c(xe,se))Se<q&&0>c(Pe,xe)?(B[oe]=Pe,B[Se]=se,oe=Se):(B[oe]=xe,B[de]=se,oe=de);else if(Se<q&&0>c(Pe,se))B[oe]=Pe,B[Se]=se,oe=Se;else break e}}return R}function c(B,R){var se=B.sortIndex-R.sortIndex;return se!==0?se:B.id-R.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,m=u.now();t.unstable_now=function(){return u.now()-m}}var p=[],g=[],v=1,_=null,b=3,x=!1,k=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function L(B){for(var R=o(g);R!==null;){if(R.callback===null)r(g);else if(R.startTime<=B)r(g),R.sortIndex=R.expirationTime,s(p,R);else break;R=o(g)}}function E(B){if(j=!1,L(B),!k)if(o(p)!==null)k=!0,O||(O=!0,X());else{var R=o(g);R!==null&&le(E,R.startTime-B)}}var O=!1,z=-1,D=5,H=-1;function Y(){return N?!0:!(t.unstable_now()-H<D)}function U(){if(N=!1,O){var B=t.unstable_now();H=B;var R=!0;try{e:{k=!1,j&&(j=!1,C(z),z=-1),x=!0;var se=b;try{t:{for(L(B),_=o(p);_!==null&&!(_.expirationTime>B&&Y());){var oe=_.callback;if(typeof oe=="function"){_.callback=null,b=_.priorityLevel;var q=oe(_.expirationTime<=B);if(B=t.unstable_now(),typeof q=="function"){_.callback=q,L(B),R=!0;break t}_===o(p)&&r(p),L(B)}else r(p);_=o(p)}if(_!==null)R=!0;else{var me=o(g);me!==null&&le(E,me.startTime-B),R=!1}}break e}finally{_=null,b=se,x=!1}R=void 0}}finally{R?X():O=!1}}}var X;if(typeof A=="function")X=function(){A(U)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,W=ge.port2;ge.port1.onmessage=U,X=function(){W.postMessage(null)}}else X=function(){T(U,0)};function le(B,R){z=T(function(){B(t.unstable_now())},R)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(B){switch(b){case 1:case 2:case 3:var R=3;break;default:R=b}var se=b;b=R;try{return B()}finally{b=se}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(B,R){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var se=b;b=B;try{return R()}finally{b=se}},t.unstable_scheduleCallback=function(B,R,se){var oe=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?oe+se:oe):se=oe,B){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=se+q,B={id:v++,callback:R,priorityLevel:B,startTime:se,expirationTime:q,sortIndex:-1},se>oe?(B.sortIndex=se,s(g,B),o(p)===null&&B===o(g)&&(j?(C(z),z=-1):j=!0,le(E,se-oe))):(B.sortIndex=q,s(p,B),k||x||(k=!0,O||(O=!0,X()))),B},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(B){var R=b;return function(){var se=b;b=R;try{return B.apply(this,arguments)}finally{b=se}}}})(sm)),sm}var vy;function X2(){return vy||(vy=1,nm.exports=W2()),nm.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 yy;function Q2(){if(yy)return Pr;yy=1;var t=X2(),s=N2(),o=w2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,l=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){i=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return p(f),e;if(h===l)return p(f),n;h=h.sibling}throw Error(r(188))}if(i.return!==l.return)i=f,l=h;else{for(var S=!1,w=f.child;w;){if(w===i){S=!0,i=f,l=h;break}if(w===l){S=!0,l=f,i=h;break}w=w.sibling}if(!S){for(w=h.child;w;){if(w===i){S=!0,i=h,l=f;break}if(w===l){S=!0,l=h,i=f;break}w=w.sibling}if(!S)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var _=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),A=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function W(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case E:return"Suspense";case O:return"SuspenseList";case H:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case A:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case L:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return n=e.displayName||null,n!==null?n:W(e.type)||"Memo";case D:n=e._payload,e=e._init;try{return W(e(n))}catch{}}return null}var le=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},oe=[],q=-1;function me(e){return{current:e}}function de(e){0>q||(e.current=oe[q],oe[q]=null,q--)}function xe(e,n){q++,oe[q]=e.current,e.current=n}var Se=me(null),Pe=me(null),gt=me(null),_e=me(null);function Ie(e,n){switch(xe(gt,n),xe(Pe,e),xe(Se,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?O0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=O0(n),e=L0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}de(Se),xe(Se,e)}function Mt(){de(Se),de(Pe),de(gt)}function hn(e){e.memoizedState!==null&&xe(_e,e);var n=Se.current,i=L0(n,e.type);n!==i&&(xe(Pe,e),xe(Se,i))}function ce(e){Pe.current===e&&(de(Se),de(Pe)),_e.current===e&&(de(_e),Lr._currentValue=se)}var Ue,ut;function te(e){if(Ue===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Ue=n&&n[1]||"",ut=-1<i.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Ue+e+ut}var re=!1;function ve(e,n){if(!e||re)return"";re=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(K){var Z=K}Reflect.construct(e,[],ae)}else{try{ae.call()}catch(K){Z=K}e.call(ae.prototype)}}else{try{throw Error()}catch(K){Z=K}(ae=e())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(K){if(K&&Z&&typeof K.stack=="string")return[K.stack,Z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),S=h[0],w=h[1];if(S&&w){var M=S.split(`
21
- `),F=w.split(`
22
- `);for(f=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;if(l===M.length||f===F.length)for(l=M.length-1,f=F.length-1;1<=l&&0<=f&&M[l]!==F[f];)f--;for(;1<=l&&0<=f;l--,f--)if(M[l]!==F[f]){if(l!==1||f!==1)do if(l--,f--,0>f||M[l]!==F[f]){var Q=`
23
- `+M[l].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=l&&0<=f);break}}}finally{re=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?te(i):""}function ft(e,n){switch(e.tag){case 26:case 27:case 5:return te(e.type);case 16:return te("Lazy");case 13:return e.child!==n&&n!==null?te("Suspense Fallback"):te("Suspense");case 19:return te("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return te("Activity");default:return""}}function Me(e){try{var n="",i=null;do n+=ft(e,i),i=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var rn=Object.prototype.hasOwnProperty,ga=t.unstable_scheduleCallback,fs=t.unstable_cancelCallback,ti=t.unstable_shouldYield,va=t.unstable_requestPaint,en=t.unstable_now,Hi=t.unstable_getCurrentPriorityLevel,ya=t.unstable_ImmediatePriority,ni=t.unstable_UserBlockingPriority,js=t.unstable_NormalPriority,Pi=t.unstable_LowPriority,Gn=t.unstable_IdlePriority,Ee=t.log,Ve=t.unstable_setDisableYieldValue,tn=null,Ct=null;function yn(e){if(typeof Ee=="function"&&Ve(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(tn,e)}catch{}}var nn=Math.clz32?Math.clz32:qi,Ui=Math.log,Vi=Math.LN2;function qi(e){return e>>>=0,e===0?32:31-(Ui(e)/Vi|0)|0}var si=256,ai=262144,ii=4194304;function Ts(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function oi(e,n,i){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,S=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=Ts(l):(S&=w,S!==0?f=Ts(S):i||(i=w&~e,i!==0&&(f=Ts(i))))):(w=l&~h,w!==0?f=Ts(w):S!==0?f=Ts(S):i||(i=l&~e,i!==0&&(f=Ts(i)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,i=n&-n,h>=i||h===32&&(i&4194048)!==0)?n:f}function ba(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function jl(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Tl(){var e=ii;return ii<<=1,(ii&62914560)===0&&(ii=4194304),e}function P(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function ee(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ue(e,n,i,l,f,h){var S=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,M=e.expirationTimes,F=e.hiddenUpdates;for(i=S&~i;0<i;){var Q=31-nn(i),ae=1<<Q;w[Q]=0,M[Q]=-1;var Z=F[Q];if(Z!==null)for(F[Q]=null,Q=0;Q<Z.length;Q++){var K=Z[Q];K!==null&&(K.lane&=-536870913)}i&=~ae}l!==0&&pe(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(S&~n))}function pe(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-nn(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function ye(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var l=31-nn(i),f=1<<l;f&n|e[l]&n&&(e[l]|=n),i&=~f}}function Ze(e,n){var i=n&-n;return i=(i&42)!==0?1:Te(i),(i&(e.suspendedLanes|n))!==0?0:i}function Te(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 Oe(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qe(){var e=R.p;return e!==0?e:(e=window.event,e===void 0?32:iy(e.type))}function _t(e,n){var i=R.p;try{return R.p=e,n()}finally{R.p=i}}var qe=Math.random().toString(36).slice(2),et="__reactFiber$"+qe,mt="__reactProps$"+qe,kt="__reactContainer$"+qe,Ns="__reactEvents$"+qe,zs="__reactListeners$"+qe,Jo="__reactHandles$"+qe,kh="__reactResources$"+qe,Wo="__reactMarker$"+qe;function Fd(e){delete e[et],delete e[mt],delete e[Ns],delete e[zs],delete e[Jo]}function Gi(e){var n=e[et];if(n)return n;for(var i=e.parentNode;i;){if(n=i[kt]||i[et]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=V0(e);e!==null;){if(i=e[et])return i;e=V0(e)}return n}e=i,i=e.parentNode}return null}function Fi(e){if(e=e[et]||e[kt]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Xo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Zi(e){var n=e[kh];return n||(n=e[kh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function sn(e){e[Wo]=!0}var Sh=new Set,jh={};function ri(e,n){Ki(e,n),Ki(e+"Capture",n)}function Ki(e,n){for(jh[e]=n,e=0;e<n.length;e++)Sh.add(n[e])}var vk=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]*$"),Th={},Nh={};function yk(e){return rn.call(Nh,e)?!0:rn.call(Th,e)?!1:vk.test(e)?Nh[e]=!0:(Th[e]=!0,!1)}function Nl(e,n,i){if(yk(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function wl(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function Hs(e,n,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+l)}}function Fn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function bk(e,n,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(S){i=""+S,h.call(this,S)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(S){i=""+S},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Zd(e){if(!e._valueTracker){var n=wh(e)?"checked":"value";e._valueTracker=bk(e,n,""+e[n])}}function Ch(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return e&&(l=wh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(n.setValue(e),!0):!1}function Cl(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 _k=/[\n"\\]/g;function Zn(e){return e.replace(_k,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Kd(e,n,i,l,f,h,S,w){e.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.type=S:e.removeAttribute("type"),n!=null?S==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Fn(n)):e.value!==""+Fn(n)&&(e.value=""+Fn(n)):S!=="submit"&&S!=="reset"||e.removeAttribute("value"),n!=null?Yd(e,S,Fn(n)):i!=null?Yd(e,S,Fn(i)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Fn(w):e.removeAttribute("name")}function Eh(e,n,i,l,f,h,S,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Zd(e);return}i=i!=null?""+Fn(i):"",n=n!=null?""+Fn(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(e.name=S),Zd(e)}function Yd(e,n,i){n==="number"&&Cl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Yi(e,n,i,l){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Fn(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Ah(e,n,i){if(n!=null&&(n=""+Fn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Fn(i):""}function Dh(e,n,i,l){if(n==null){if(l!=null){if(i!=null)throw Error(r(92));if(le(l)){if(1<l.length)throw Error(r(93));l=l[0]}i=l}i==null&&(i=""),n=i}i=Fn(n),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Zd(e)}function Ji(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var xk=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 Rh(e,n,i){var l=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,i):typeof i!="number"||i===0||xk.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function Mh(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&i[f]!==l&&Rh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&Rh(e,h,n[h])}function Jd(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 kk=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"]]),Sk=/^[\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 El(e){return Sk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ps(){}var Wd=null;function Xd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wi=null,Xi=null;function Ih(e){var n=Fi(e);if(n&&(e=n.stateNode)){var i=e[mt]||null;e:switch(e=n.stateNode,n.type){case"input":if(Kd(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Zn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var l=i[n];if(l!==e&&l.form===e.form){var f=l[mt]||null;if(!f)throw Error(r(90));Kd(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<i.length;n++)l=i[n],l.form===e.form&&Ch(l)}break e;case"textarea":Ah(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Yi(e,!!i.multiple,n,!1)}}}var Qd=!1;function Oh(e,n,i){if(Qd)return e(n,i);Qd=!0;try{var l=e(n);return l}finally{if(Qd=!1,(Wi!==null||Xi!==null)&&(gc(),Wi&&(n=Wi,e=Xi,Xi=Wi=null,Ih(n),e)))for(n=0;n<e.length;n++)Ih(e[n])}}function Qo(e,n){var i=e.stateNode;if(i===null)return null;var l=i[mt]||null;if(l===null)return null;i=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Us=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eu=!1;if(Us)try{var er={};Object.defineProperty(er,"passive",{get:function(){eu=!0}}),window.addEventListener("test",er,er),window.removeEventListener("test",er,er)}catch{eu=!1}var _a=null,tu=null,Al=null;function Lh(){if(Al)return Al;var e,n=tu,i=n.length,l,f="value"in _a?_a.value:_a.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var S=i-e;for(l=1;l<=S&&n[i-l]===f[h-l];l++);return Al=f.slice(e,1<l?1-l:void 0)}function Dl(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Rl(){return!0}function Bh(){return!1}function jn(e){function n(i,l,f,h,S){this._reactName=i,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=S,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Rl:Bh,this.isPropagationStopped=Bh,this}return _(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Rl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Rl)},persist:function(){},isPersistent:Rl}),n}var li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ml=jn(li),tr=_({},li,{view:0,detail:0}),jk=jn(tr),nu,su,nr,Il=_({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:iu,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!==nr&&(nr&&e.type==="mousemove"?(nu=e.screenX-nr.screenX,su=e.screenY-nr.screenY):su=nu=0,nr=e),nu)},movementY:function(e){return"movementY"in e?e.movementY:su}}),$h=jn(Il),Tk=_({},Il,{dataTransfer:0}),Nk=jn(Tk),wk=_({},tr,{relatedTarget:0}),au=jn(wk),Ck=_({},li,{animationName:0,elapsedTime:0,pseudoElement:0}),Ek=jn(Ck),Ak=_({},li,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Dk=jn(Ak),Rk=_({},li,{data:0}),zh=jn(Rk),Mk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ik={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"},Ok={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Lk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Ok[e])?!!n[e]:!1}function iu(){return Lk}var Bk=_({},tr,{key:function(e){if(e.key){var n=Mk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Dl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ik[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:iu,charCode:function(e){return e.type==="keypress"?Dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$k=jn(Bk),zk=_({},Il,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hh=jn(zk),Hk=_({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:iu}),Pk=jn(Hk),Uk=_({},li,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vk=jn(Uk),qk=_({},Il,{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}),Gk=jn(qk),Fk=_({},li,{newState:0,oldState:0}),Zk=jn(Fk),Kk=[9,13,27,32],ou=Us&&"CompositionEvent"in window,sr=null;Us&&"documentMode"in document&&(sr=document.documentMode);var Yk=Us&&"TextEvent"in window&&!sr,Ph=Us&&(!ou||sr&&8<sr&&11>=sr),Uh=" ",Vh=!1;function qh(e,n){switch(e){case"keyup":return Kk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qi=!1;function Jk(e,n){switch(e){case"compositionend":return Gh(n);case"keypress":return n.which!==32?null:(Vh=!0,Uh);case"textInput":return e=n.data,e===Uh&&Vh?null:e;default:return null}}function Wk(e,n){if(Qi)return e==="compositionend"||!ou&&qh(e,n)?(e=Lh(),Al=tu=_a=null,Qi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ph&&n.locale!=="ko"?null:n.data;default:return null}}var Xk={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 Fh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Xk[e.type]:n==="textarea"}function Zh(e,n,i,l){Wi?Xi?Xi.push(l):Xi=[l]:Wi=l,n=Sc(n,"onChange"),0<n.length&&(i=new Ml("onChange","change",null,i,l),e.push({event:i,listeners:n}))}var ar=null,ir=null;function Qk(e){E0(e,0)}function Ol(e){var n=Xo(e);if(Ch(n))return e}function Kh(e,n){if(e==="change")return n}var Yh=!1;if(Us){var ru;if(Us){var lu="oninput"in document;if(!lu){var Jh=document.createElement("div");Jh.setAttribute("oninput","return;"),lu=typeof Jh.oninput=="function"}ru=lu}else ru=!1;Yh=ru&&(!document.documentMode||9<document.documentMode)}function Wh(){ar&&(ar.detachEvent("onpropertychange",Xh),ir=ar=null)}function Xh(e){if(e.propertyName==="value"&&Ol(ir)){var n=[];Zh(n,ir,e,Xd(e)),Oh(Qk,n)}}function eS(e,n,i){e==="focusin"?(Wh(),ar=n,ir=i,ar.attachEvent("onpropertychange",Xh)):e==="focusout"&&Wh()}function tS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ol(ir)}function nS(e,n){if(e==="click")return Ol(n)}function sS(e,n){if(e==="input"||e==="change")return Ol(n)}function aS(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var An=typeof Object.is=="function"?Object.is:aS;function or(e,n){if(An(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var f=i[l];if(!rn.call(n,f)||!An(e[f],n[f]))return!1}return!0}function Qh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function eg(e,n){var i=Qh(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=n&&l>=n)return{node:i,offset:n-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Qh(i)}}function tg(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?tg(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function ng(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Cl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=Cl(e.document)}return n}function cu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var iS=Us&&"documentMode"in document&&11>=document.documentMode,eo=null,du=null,rr=null,uu=!1;function sg(e,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;uu||eo==null||eo!==Cl(l)||(l=eo,"selectionStart"in l&&cu(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),rr&&or(rr,l)||(rr=l,l=Sc(du,"onSelect"),0<l.length&&(n=new Ml("onSelect","select",null,n,i),e.push({event:n,listeners:l}),n.target=eo)))}function ci(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var to={animationend:ci("Animation","AnimationEnd"),animationiteration:ci("Animation","AnimationIteration"),animationstart:ci("Animation","AnimationStart"),transitionrun:ci("Transition","TransitionRun"),transitionstart:ci("Transition","TransitionStart"),transitioncancel:ci("Transition","TransitionCancel"),transitionend:ci("Transition","TransitionEnd")},fu={},ag={};Us&&(ag=document.createElement("div").style,"AnimationEvent"in window||(delete to.animationend.animation,delete to.animationiteration.animation,delete to.animationstart.animation),"TransitionEvent"in window||delete to.transitionend.transition);function di(e){if(fu[e])return fu[e];if(!to[e])return e;var n=to[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in ag)return fu[e]=n[i];return e}var ig=di("animationend"),og=di("animationiteration"),rg=di("animationstart"),oS=di("transitionrun"),rS=di("transitionstart"),lS=di("transitioncancel"),lg=di("transitionend"),cg=new Map,mu="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(" ");mu.push("scrollEnd");function ms(e,n){cg.set(e,n),ri(n,[e])}var Ll=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Kn=[],no=0,pu=0;function Bl(){for(var e=no,n=pu=no=0;n<e;){var i=Kn[n];Kn[n++]=null;var l=Kn[n];Kn[n++]=null;var f=Kn[n];Kn[n++]=null;var h=Kn[n];if(Kn[n++]=null,l!==null&&f!==null){var S=l.pending;S===null?f.next=f:(f.next=S.next,S.next=f),l.pending=f}h!==0&&dg(i,f,h)}}function $l(e,n,i,l){Kn[no++]=e,Kn[no++]=n,Kn[no++]=i,Kn[no++]=l,pu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function hu(e,n,i,l){return $l(e,n,i,l),zl(e)}function ui(e,n){return $l(e,null,null,n),zl(e)}function dg(e,n,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var f=!1,h=e.return;h!==null;)h.childLanes|=i,l=h.alternate,l!==null&&(l.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-nn(i),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=i|536870912),h):null}function zl(e){if(50<Er)throw Er=0,Tf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var so={};function cS(e,n,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(e,n,i,l){return new cS(e,n,i,l)}function gu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vs(e,n){var i=e.alternate;return i===null?(i=Dn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function ug(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Hl(e,n,i,l,f,h){var S=0;if(l=e,typeof e=="function")gu(e)&&(S=1);else if(typeof e=="string")S=p2(e,i,Se.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case H:return e=Dn(31,i,n,f),e.elementType=H,e.lanes=h,e;case j:return fi(i.children,f,h,n);case N:S=8,f|=24;break;case T:return e=Dn(12,i,n,f|2),e.elementType=T,e.lanes=h,e;case E:return e=Dn(13,i,n,f),e.elementType=E,e.lanes=h,e;case O:return e=Dn(19,i,n,f),e.elementType=O,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:S=10;break e;case C:S=9;break e;case L:S=11;break e;case z:S=14;break e;case D:S=16,l=null;break e}S=29,i=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Dn(S,i,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function fi(e,n,i,l){return e=Dn(7,e,l,n),e.lanes=i,e}function vu(e,n,i){return e=Dn(6,e,null,n),e.lanes=i,e}function fg(e){var n=Dn(18,null,null,0);return n.stateNode=e,n}function yu(e,n,i){return n=Dn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var mg=new WeakMap;function Yn(e,n){if(typeof e=="object"&&e!==null){var i=mg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:Me(n)},mg.set(e,n),n)}return{value:e,source:n,stack:Me(n)}}var ao=[],io=0,Pl=null,lr=0,Jn=[],Wn=0,xa=null,ws=1,Cs="";function qs(e,n){ao[io++]=lr,ao[io++]=Pl,Pl=e,lr=n}function pg(e,n,i){Jn[Wn++]=ws,Jn[Wn++]=Cs,Jn[Wn++]=xa,xa=e;var l=ws;e=Cs;var f=32-nn(l)-1;l&=~(1<<f),i+=1;var h=32-nn(n)+f;if(30<h){var S=f-f%5;h=(l&(1<<S)-1).toString(32),l>>=S,f-=S,ws=1<<32-nn(n)+f|i<<f|l,Cs=h+e}else ws=1<<h|i<<f|l,Cs=e}function bu(e){e.return!==null&&(qs(e,1),pg(e,1,0))}function _u(e){for(;e===Pl;)Pl=ao[--io],ao[io]=null,lr=ao[--io],ao[io]=null;for(;e===xa;)xa=Jn[--Wn],Jn[Wn]=null,Cs=Jn[--Wn],Jn[Wn]=null,ws=Jn[--Wn],Jn[Wn]=null}function hg(e,n){Jn[Wn++]=ws,Jn[Wn++]=Cs,Jn[Wn++]=xa,ws=n.id,Cs=n.overflow,xa=e}var ln=null,St=null,Je=!1,ka=null,Xn=!1,xu=Error(r(519));function Sa(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw cr(Yn(n,e)),xu}function gg(e){var n=e.stateNode,i=e.type,l=e.memoizedProps;switch(n[et]=e,n[mt]=l,i){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(i=0;i<Dr.length;i++)Fe(Dr[i],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Fe("invalid",n),Eh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Fe("invalid",n);break;case"textarea":Fe("invalid",n),Dh(n,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||l.suppressHydrationWarning===!0||M0(n.textContent,i)?(l.popover!=null&&(Fe("beforetoggle",n),Fe("toggle",n)),l.onScroll!=null&&Fe("scroll",n),l.onScrollEnd!=null&&Fe("scrollend",n),l.onClick!=null&&(n.onclick=Ps),n=!0):n=!1,n||Sa(e,!0)}function vg(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Xn=!1;return;case 27:case 3:Xn=!0;return;default:ln=ln.return}}function oo(e){if(e!==ln)return!1;if(!Je)return vg(e),Je=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Hf(e.type,e.memoizedProps)),i=!i),i&&St&&Sa(e),vg(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));St=U0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));St=U0(e)}else n===27?(n=St,Ba(e.type)?(e=Gf,Gf=null,St=e):St=n):St=ln?es(e.stateNode.nextSibling):null;return!0}function mi(){St=ln=null,Je=!1}function ku(){var e=ka;return e!==null&&(Cn===null?Cn=e:Cn.push.apply(Cn,e),ka=null),e}function cr(e){ka===null?ka=[e]:ka.push(e)}var Su=me(null),pi=null,Gs=null;function ja(e,n,i){xe(Su,n._currentValue),n._currentValue=i}function Fs(e){e._currentValue=Su.current,de(Su)}function ju(e,n,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===i)break;e=e.return}}function Tu(e,n,i,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var S=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var M=0;M<n.length;M++)if(w.context===n[M]){h.lanes|=i,w=h.alternate,w!==null&&(w.lanes|=i),ju(h.return,i,e),l||(S=null);break e}h=w.next}}else if(f.tag===18){if(S=f.return,S===null)throw Error(r(341));S.lanes|=i,h=S.alternate,h!==null&&(h.lanes|=i),ju(S,i,e),S=null}else S=f.child;if(S!==null)S.return=f;else for(S=f;S!==null;){if(S===e){S=null;break}if(f=S.sibling,f!==null){f.return=S.return,S=f;break}S=S.return}f=S}}function ro(e,n,i,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var S=f.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var w=f.type;An(f.pendingProps.value,S.value)||(e!==null?e.push(w):e=[w])}}else if(f===_e.current){if(S=f.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Lr):e=[Lr])}f=f.return}e!==null&&Tu(n,e,i,l),n.flags|=262144}function Ul(e){for(e=e.firstContext;e!==null;){if(!An(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function hi(e){pi=e,Gs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return yg(pi,e)}function Vl(e,n){return pi===null&&hi(e),yg(e,n)}function yg(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Gs===null){if(e===null)throw Error(r(308));Gs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Gs=Gs.next=n;return i}var dS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},uS=t.unstable_scheduleCallback,fS=t.unstable_NormalPriority,Gt={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nu(){return{controller:new dS,data:new Map,refCount:0}}function dr(e){e.refCount--,e.refCount===0&&uS(fS,function(){e.controller.abort()})}var ur=null,wu=0,lo=0,co=null;function mS(e,n){if(ur===null){var i=ur=[];wu=0,lo=Df(),co={status:"pending",value:void 0,then:function(l){i.push(l)}}}return wu++,n.then(bg,bg),n}function bg(){if(--wu===0&&ur!==null){co!==null&&(co.status="fulfilled");var e=ur;ur=null,lo=0,co=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function pS(e,n){var i=[],l={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<i.length;f++)(0,i[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),l}var _g=B.S;B.S=function(e,n){s0=en(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&mS(e,n),_g!==null&&_g(e,n)};var gi=me(null);function Cu(){var e=gi.current;return e!==null?e:xt.pooledCache}function ql(e,n){n===null?xe(gi,gi.current):xe(gi,n.pool)}function xg(){var e=Cu();return e===null?null:{parent:Gt._currentValue,pool:e}}var uo=Error(r(460)),Eu=Error(r(474)),Gl=Error(r(542)),Fl={then:function(){}};function kg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Sg(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Ps,Ps),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Tg(e),e;default:if(typeof n.status=="string")n.then(Ps,Ps);else{if(e=xt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Tg(e),e}throw yi=n,uo}}function vi(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(yi=i,uo):i}}var yi=null;function jg(){if(yi===null)throw Error(r(459));var e=yi;return yi=null,e}function Tg(e){if(e===uo||e===Gl)throw Error(r(483))}var fo=null,fr=0;function Zl(e){var n=fr;return fr+=1,fo===null&&(fo=[]),Sg(fo,e,n)}function mr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Kl(e,n){throw n.$$typeof===b?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Ng(e){function n(V,$){if(e){var G=V.deletions;G===null?(V.deletions=[$],V.flags|=16):G.push($)}}function i(V,$){if(!e)return null;for(;$!==null;)n(V,$),$=$.sibling;return null}function l(V){for(var $=new Map;V!==null;)V.key!==null?$.set(V.key,V):$.set(V.index,V),V=V.sibling;return $}function f(V,$){return V=Vs(V,$),V.index=0,V.sibling=null,V}function h(V,$,G){return V.index=G,e?(G=V.alternate,G!==null?(G=G.index,G<$?(V.flags|=67108866,$):G):(V.flags|=67108866,$)):(V.flags|=1048576,$)}function S(V){return e&&V.alternate===null&&(V.flags|=67108866),V}function w(V,$,G,ne){return $===null||$.tag!==6?($=vu(G,V.mode,ne),$.return=V,$):($=f($,G),$.return=V,$)}function M(V,$,G,ne){var Ce=G.type;return Ce===j?Q(V,$,G.props.children,ne,G.key):$!==null&&($.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&vi(Ce)===$.type)?($=f($,G.props),mr($,G),$.return=V,$):($=Hl(G.type,G.key,G.props,null,V.mode,ne),mr($,G),$.return=V,$)}function F(V,$,G,ne){return $===null||$.tag!==4||$.stateNode.containerInfo!==G.containerInfo||$.stateNode.implementation!==G.implementation?($=yu(G,V.mode,ne),$.return=V,$):($=f($,G.children||[]),$.return=V,$)}function Q(V,$,G,ne,Ce){return $===null||$.tag!==7?($=fi(G,V.mode,ne,Ce),$.return=V,$):($=f($,G),$.return=V,$)}function ae(V,$,G){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=vu(""+$,V.mode,G),$.return=V,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return G=Hl($.type,$.key,$.props,null,V.mode,G),mr(G,$),G.return=V,G;case k:return $=yu($,V.mode,G),$.return=V,$;case D:return $=vi($),ae(V,$,G)}if(le($)||X($))return $=fi($,V.mode,G,null),$.return=V,$;if(typeof $.then=="function")return ae(V,Zl($),G);if($.$$typeof===A)return ae(V,Vl(V,$),G);Kl(V,$)}return null}function Z(V,$,G,ne){var Ce=$!==null?$.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Ce!==null?null:w(V,$,""+G,ne);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case x:return G.key===Ce?M(V,$,G,ne):null;case k:return G.key===Ce?F(V,$,G,ne):null;case D:return G=vi(G),Z(V,$,G,ne)}if(le(G)||X(G))return Ce!==null?null:Q(V,$,G,ne,null);if(typeof G.then=="function")return Z(V,$,Zl(G),ne);if(G.$$typeof===A)return Z(V,$,Vl(V,G),ne);Kl(V,G)}return null}function K(V,$,G,ne,Ce){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return V=V.get(G)||null,w($,V,""+ne,Ce);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return V=V.get(ne.key===null?G:ne.key)||null,M($,V,ne,Ce);case k:return V=V.get(ne.key===null?G:ne.key)||null,F($,V,ne,Ce);case D:return ne=vi(ne),K(V,$,G,ne,Ce)}if(le(ne)||X(ne))return V=V.get(G)||null,Q($,V,ne,Ce,null);if(typeof ne.then=="function")return K(V,$,G,Zl(ne),Ce);if(ne.$$typeof===A)return K(V,$,G,Vl($,ne),Ce);Kl($,ne)}return null}function ke(V,$,G,ne){for(var Ce=null,tt=null,je=$,ze=$=0,Ye=null;je!==null&&ze<G.length;ze++){je.index>ze?(Ye=je,je=null):Ye=je.sibling;var nt=Z(V,je,G[ze],ne);if(nt===null){je===null&&(je=Ye);break}e&&je&&nt.alternate===null&&n(V,je),$=h(nt,$,ze),tt===null?Ce=nt:tt.sibling=nt,tt=nt,je=Ye}if(ze===G.length)return i(V,je),Je&&qs(V,ze),Ce;if(je===null){for(;ze<G.length;ze++)je=ae(V,G[ze],ne),je!==null&&($=h(je,$,ze),tt===null?Ce=je:tt.sibling=je,tt=je);return Je&&qs(V,ze),Ce}for(je=l(je);ze<G.length;ze++)Ye=K(je,V,ze,G[ze],ne),Ye!==null&&(e&&Ye.alternate!==null&&je.delete(Ye.key===null?ze:Ye.key),$=h(Ye,$,ze),tt===null?Ce=Ye:tt.sibling=Ye,tt=Ye);return e&&je.forEach(function(Ua){return n(V,Ua)}),Je&&qs(V,ze),Ce}function Ae(V,$,G,ne){if(G==null)throw Error(r(151));for(var Ce=null,tt=null,je=$,ze=$=0,Ye=null,nt=G.next();je!==null&&!nt.done;ze++,nt=G.next()){je.index>ze?(Ye=je,je=null):Ye=je.sibling;var Ua=Z(V,je,nt.value,ne);if(Ua===null){je===null&&(je=Ye);break}e&&je&&Ua.alternate===null&&n(V,je),$=h(Ua,$,ze),tt===null?Ce=Ua:tt.sibling=Ua,tt=Ua,je=Ye}if(nt.done)return i(V,je),Je&&qs(V,ze),Ce;if(je===null){for(;!nt.done;ze++,nt=G.next())nt=ae(V,nt.value,ne),nt!==null&&($=h(nt,$,ze),tt===null?Ce=nt:tt.sibling=nt,tt=nt);return Je&&qs(V,ze),Ce}for(je=l(je);!nt.done;ze++,nt=G.next())nt=K(je,V,ze,nt.value,ne),nt!==null&&(e&&nt.alternate!==null&&je.delete(nt.key===null?ze:nt.key),$=h(nt,$,ze),tt===null?Ce=nt:tt.sibling=nt,tt=nt);return e&&je.forEach(function(T2){return n(V,T2)}),Je&&qs(V,ze),Ce}function bt(V,$,G,ne){if(typeof G=="object"&&G!==null&&G.type===j&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case x:e:{for(var Ce=G.key;$!==null;){if($.key===Ce){if(Ce=G.type,Ce===j){if($.tag===7){i(V,$.sibling),ne=f($,G.props.children),ne.return=V,V=ne;break e}}else if($.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===D&&vi(Ce)===$.type){i(V,$.sibling),ne=f($,G.props),mr(ne,G),ne.return=V,V=ne;break e}i(V,$);break}else n(V,$);$=$.sibling}G.type===j?(ne=fi(G.props.children,V.mode,ne,G.key),ne.return=V,V=ne):(ne=Hl(G.type,G.key,G.props,null,V.mode,ne),mr(ne,G),ne.return=V,V=ne)}return S(V);case k:e:{for(Ce=G.key;$!==null;){if($.key===Ce)if($.tag===4&&$.stateNode.containerInfo===G.containerInfo&&$.stateNode.implementation===G.implementation){i(V,$.sibling),ne=f($,G.children||[]),ne.return=V,V=ne;break e}else{i(V,$);break}else n(V,$);$=$.sibling}ne=yu(G,V.mode,ne),ne.return=V,V=ne}return S(V);case D:return G=vi(G),bt(V,$,G,ne)}if(le(G))return ke(V,$,G,ne);if(X(G)){if(Ce=X(G),typeof Ce!="function")throw Error(r(150));return G=Ce.call(G),Ae(V,$,G,ne)}if(typeof G.then=="function")return bt(V,$,Zl(G),ne);if(G.$$typeof===A)return bt(V,$,Vl(V,G),ne);Kl(V,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,$!==null&&$.tag===6?(i(V,$.sibling),ne=f($,G),ne.return=V,V=ne):(i(V,$),ne=vu(G,V.mode,ne),ne.return=V,V=ne),S(V)):i(V,$)}return function(V,$,G,ne){try{fr=0;var Ce=bt(V,$,G,ne);return fo=null,Ce}catch(je){if(je===uo||je===Gl)throw je;var tt=Dn(29,je,null,V.mode);return tt.lanes=ne,tt.return=V,tt}finally{}}}var bi=Ng(!0),wg=Ng(!1),Ta=!1;function Au(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Du(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wa(e,n,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=zl(e),dg(e,null,i),n}return $l(e,l,n,i),zl(e)}function pr(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,ye(e,i)}}function Ru(e,n){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var f=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var S={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?f=h=S:h=h.next=S,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Mu=!1;function hr(){if(Mu){var e=co;if(e!==null)throw e}}function gr(e,n,i,l){Mu=!1;var f=e.updateQueue;Ta=!1;var h=f.firstBaseUpdate,S=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var M=w,F=M.next;M.next=null,S===null?h=F:S.next=F,S=M;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,w=Q.lastBaseUpdate,w!==S&&(w===null?Q.firstBaseUpdate=F:w.next=F,Q.lastBaseUpdate=M))}if(h!==null){var ae=f.baseState;S=0,Q=F=M=null,w=h;do{var Z=w.lane&-536870913,K=Z!==w.lane;if(K?(Ke&Z)===Z:(l&Z)===Z){Z!==0&&Z===lo&&(Mu=!0),Q!==null&&(Q=Q.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ke=e,Ae=w;Z=n;var bt=i;switch(Ae.tag){case 1:if(ke=Ae.payload,typeof ke=="function"){ae=ke.call(bt,ae,Z);break e}ae=ke;break e;case 3:ke.flags=ke.flags&-65537|128;case 0:if(ke=Ae.payload,Z=typeof ke=="function"?ke.call(bt,ae,Z):ke,Z==null)break e;ae=_({},ae,Z);break e;case 2:Ta=!0}}Z=w.callback,Z!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[Z]:K.push(Z))}else K={lane:Z,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Q===null?(F=Q=K,M=ae):Q=Q.next=K,S|=Z;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;K=w,w=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);Q===null&&(M=ae),f.baseState=M,f.firstBaseUpdate=F,f.lastBaseUpdate=Q,h===null&&(f.shared.lanes=0),Ra|=S,e.lanes=S,e.memoizedState=ae}}function Cg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Eg(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Cg(i[e],n)}var mo=me(null),Yl=me(0);function Ag(e,n){e=ta,xe(Yl,e),xe(mo,n),ta=e|n.baseLanes}function Iu(){xe(Yl,ta),xe(mo,mo.current)}function Ou(){ta=Yl.current,de(mo),de(Yl)}var Rn=me(null),Qn=null;function Ca(e){var n=e.alternate;xe(zt,zt.current&1),xe(Rn,e),Qn===null&&(n===null||mo.current!==null||n.memoizedState!==null)&&(Qn=e)}function Lu(e){xe(zt,zt.current),xe(Rn,e),Qn===null&&(Qn=e)}function Dg(e){e.tag===22?(xe(zt,zt.current),xe(Rn,e),Qn===null&&(Qn=e)):Ea()}function Ea(){xe(zt,zt.current),xe(Rn,Rn.current)}function Mn(e){de(Rn),Qn===e&&(Qn=null),de(zt)}var zt=me(0);function Jl(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Vf(i)||qf(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Zs=0,Be=null,vt=null,Ft=null,Wl=!1,po=!1,_i=!1,Xl=0,vr=0,ho=null,hS=0;function Lt(){throw Error(r(321))}function Bu(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!An(e[i],n[i]))return!1;return!0}function $u(e,n,i,l,f,h){return Zs=h,Be=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=e===null||e.memoizedState===null?pv:Qu,_i=!1,h=i(l,f),_i=!1,po&&(h=Mg(n,i,l,f)),Rg(e),h}function Rg(e){B.H=_r;var n=vt!==null&&vt.next!==null;if(Zs=0,Ft=vt=Be=null,Wl=!1,vr=0,ho=null,n)throw Error(r(300));e===null||Zt||(e=e.dependencies,e!==null&&Ul(e)&&(Zt=!0))}function Mg(e,n,i,l){Be=e;var f=0;do{if(po&&(ho=null),vr=0,po=!1,25<=f)throw Error(r(301));if(f+=1,Ft=vt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}B.H=hv,h=n(i,l)}while(po);return h}function gS(){var e=B.H,n=e.useState()[0];return n=typeof n.then=="function"?yr(n):n,e=e.useState()[0],(vt!==null?vt.memoizedState:null)!==e&&(Be.flags|=1024),n}function zu(){var e=Xl!==0;return Xl=0,e}function Hu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function Pu(e){if(Wl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Wl=!1}Zs=0,Ft=vt=Be=null,po=!1,vr=Xl=0,ho=null}function bn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?Be.memoizedState=Ft=e:Ft=Ft.next=e,Ft}function Ht(){if(vt===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var n=Ft===null?Be.memoizedState:Ft.next;if(n!==null)Ft=n,vt=e;else{if(e===null)throw Be.alternate===null?Error(r(467)):Error(r(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Ft===null?Be.memoizedState=Ft=e:Ft=Ft.next=e}return Ft}function Ql(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yr(e){var n=vr;return vr+=1,ho===null&&(ho=[]),e=Sg(ho,e,n),n=Be,(Ft===null?n.memoizedState:Ft.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?pv:Qu),e}function ec(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return yr(e);if(e.$$typeof===A)return cn(e)}throw Error(r(438,String(e)))}function Uu(e){var n=null,i=Be.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var l=Be.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=Ql(),Be.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),l=0;l<e;l++)i[l]=Y;return n.index++,i}function Ks(e,n){return typeof n=="function"?n(e):n}function tc(e){var n=Ht();return Vu(n,vt,e)}function Vu(e,n,i){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var S=f.next;f.next=h.next,h.next=S}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=S=null,M=null,F=n,Q=!1;do{var ae=F.lane&-536870913;if(ae!==F.lane?(Ke&ae)===ae:(Zs&ae)===ae){var Z=F.revertLane;if(Z===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ae===lo&&(Q=!0);else if((Zs&Z)===Z){F=F.next,Z===lo&&(Q=!0);continue}else ae={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(w=M=ae,S=h):M=M.next=ae,Be.lanes|=Z,Ra|=Z;ae=F.action,_i&&i(h,ae),h=F.hasEagerState?F.eagerState:i(h,ae)}else Z={lane:ae,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(w=M=Z,S=h):M=M.next=Z,Be.lanes|=ae,Ra|=ae;F=F.next}while(F!==null&&F!==n);if(M===null?S=h:M.next=w,!An(h,e.memoizedState)&&(Zt=!0,Q&&(i=co,i!==null)))throw i;e.memoizedState=h,e.baseState=S,e.baseQueue=M,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function qu(e){var n=Ht(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var l=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var S=f=f.next;do h=e(h,S.action),S=S.next;while(S!==f);An(h,n.memoizedState)||(Zt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,l]}function Ig(e,n,i){var l=Be,f=Ht(),h=Je;if(h){if(i===void 0)throw Error(r(407));i=i()}else i=n();var S=!An((vt||f).memoizedState,i);if(S&&(f.memoizedState=i,Zt=!0),f=f.queue,Zu(Bg.bind(null,l,f,e),[e]),f.getSnapshot!==n||S||Ft!==null&&Ft.memoizedState.tag&1){if(l.flags|=2048,go(9,{destroy:void 0},Lg.bind(null,l,f,i,n),null),xt===null)throw Error(r(349));h||(Zs&127)!==0||Og(l,n,i)}return i}function Og(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Be.updateQueue,n===null?(n=Ql(),Be.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Lg(e,n,i,l){n.value=i,n.getSnapshot=l,$g(n)&&zg(e)}function Bg(e,n,i){return i(function(){$g(n)&&zg(e)})}function $g(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!An(e,i)}catch{return!0}}function zg(e){var n=ui(e,2);n!==null&&En(n,e,2)}function Gu(e){var n=bn();if(typeof e=="function"){var i=e;if(e=i(),_i){yn(!0);try{i()}finally{yn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ks,lastRenderedState:e},n}function Hg(e,n,i,l){return e.baseState=i,Vu(e,vt,typeof l=="function"?l:Ks)}function vS(e,n,i,l,f){if(ac(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){h.listeners.push(S)}};B.T!==null?i(!0):h.isTransition=!1,l(h),i=n.pending,i===null?(h.next=n.pending=h,Pg(n,h)):(h.next=i.next,n.pending=i.next=h)}}function Pg(e,n){var i=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=B.T,S={};B.T=S;try{var w=i(f,l),M=B.S;M!==null&&M(S,w),Ug(e,n,w)}catch(F){Fu(e,n,F)}finally{h!==null&&S.types!==null&&(h.types=S.types),B.T=h}}else try{h=i(f,l),Ug(e,n,h)}catch(F){Fu(e,n,F)}}function Ug(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Vg(e,n,l)},function(l){return Fu(e,n,l)}):Vg(e,n,i)}function Vg(e,n,i){n.status="fulfilled",n.value=i,qg(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Pg(e,i)))}function Fu(e,n,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=i,qg(n),n=n.next;while(n!==l)}e.action=null}function qg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Gg(e,n){return n}function Fg(e,n){if(Je){var i=xt.formState;if(i!==null){e:{var l=Be;if(Je){if(St){t:{for(var f=St,h=Xn;f.nodeType!==8;){if(!h){f=null;break t}if(f=es(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){St=es(f.nextSibling),l=f.data==="F!";break e}}Sa(l)}l=!1}l&&(n=i[0])}}return i=bn(),i.memoizedState=i.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gg,lastRenderedState:n},i.queue=l,i=uv.bind(null,Be,l),l.dispatch=i,l=Gu(!1),h=Xu.bind(null,Be,!1,l.queue),l=bn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,i=vS.bind(null,Be,f,h,i),f.dispatch=i,l.memoizedState=e,[n,i,!1]}function Zg(e){var n=Ht();return Kg(n,vt,e)}function Kg(e,n,i){if(n=Vu(e,n,Gg)[0],e=tc(Ks)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=yr(n)}catch(S){throw S===uo?Gl:S}else l=n;n=Ht();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(Be.flags|=2048,go(9,{destroy:void 0},yS.bind(null,f,i),null)),[l,h,e]}function yS(e,n){e.action=n}function Yg(e){var n=Ht(),i=vt;if(i!==null)return Kg(n,i,e);Ht(),n=n.memoizedState,i=Ht();var l=i.queue.dispatch;return i.memoizedState=e,[n,l,!1]}function go(e,n,i,l){return e={tag:e,create:i,deps:l,inst:n,next:null},n=Be.updateQueue,n===null&&(n=Ql(),Be.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,n.lastEffect=e),e}function Jg(){return Ht().memoizedState}function nc(e,n,i,l){var f=bn();Be.flags|=e,f.memoizedState=go(1|n,{destroy:void 0},i,l===void 0?null:l)}function sc(e,n,i,l){var f=Ht();l=l===void 0?null:l;var h=f.memoizedState.inst;vt!==null&&l!==null&&Bu(l,vt.memoizedState.deps)?f.memoizedState=go(n,h,i,l):(Be.flags|=e,f.memoizedState=go(1|n,h,i,l))}function Wg(e,n){nc(8390656,8,e,n)}function Zu(e,n){sc(2048,8,e,n)}function bS(e){Be.flags|=4;var n=Be.updateQueue;if(n===null)n=Ql(),Be.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function Xg(e){var n=Ht().memoizedState;return bS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Qg(e,n){return sc(4,2,e,n)}function ev(e,n){return sc(4,4,e,n)}function tv(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function nv(e,n,i){i=i!=null?i.concat([e]):null,sc(4,4,tv.bind(null,n,e),i)}function Ku(){}function sv(e,n){var i=Ht();n=n===void 0?null:n;var l=i.memoizedState;return n!==null&&Bu(n,l[1])?l[0]:(i.memoizedState=[e,n],e)}function av(e,n){var i=Ht();n=n===void 0?null:n;var l=i.memoizedState;if(n!==null&&Bu(n,l[1]))return l[0];if(l=e(),_i){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[l,n],l}function Yu(e,n,i){return i===void 0||(Zs&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=i0(),Be.lanes|=e,Ra|=e,i)}function iv(e,n,i,l){return An(i,n)?i:mo.current!==null?(e=Yu(e,i,l),An(e,n)||(Zt=!0),e):(Zs&42)===0||(Zs&1073741824)!==0&&(Ke&261930)===0?(Zt=!0,e.memoizedState=i):(e=i0(),Be.lanes|=e,Ra|=e,n)}function ov(e,n,i,l,f){var h=R.p;R.p=h!==0&&8>h?h:8;var S=B.T,w={};B.T=w,Xu(e,!1,n,i);try{var M=f(),F=B.S;if(F!==null&&F(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var Q=pS(M,l);br(e,n,Q,Ln(e))}else br(e,n,l,Ln(e))}catch(ae){br(e,n,{then:function(){},status:"rejected",reason:ae},Ln())}finally{R.p=h,S!==null&&w.types!==null&&(S.types=w.types),B.T=S}}function _S(){}function Ju(e,n,i,l){if(e.tag!==5)throw Error(r(476));var f=rv(e).queue;ov(e,f,n,se,i===null?_S:function(){return lv(e),i(l)})}function rv(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ks,lastRenderedState:se},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ks,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function lv(e){var n=rv(e);n.next===null&&(n=e.alternate.memoizedState),br(e,n.next.queue,{},Ln())}function Wu(){return cn(Lr)}function cv(){return Ht().memoizedState}function dv(){return Ht().memoizedState}function xS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Ln();e=Na(i);var l=wa(n,e,i);l!==null&&(En(l,n,i),pr(l,n,i)),n={cache:Nu()},e.payload=n;return}n=n.return}}function kS(e,n,i){var l=Ln();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},ac(e)?fv(n,i):(i=hu(e,n,i,l),i!==null&&(En(i,e,l),mv(i,n,l)))}function uv(e,n,i){var l=Ln();br(e,n,i,l)}function br(e,n,i,l){var f={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(ac(e))fv(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var S=n.lastRenderedState,w=h(S,i);if(f.hasEagerState=!0,f.eagerState=w,An(w,S))return $l(e,n,f,0),xt===null&&Bl(),!1}catch{}finally{}if(i=hu(e,n,f,l),i!==null)return En(i,e,l),mv(i,n,l),!0}return!1}function Xu(e,n,i,l){if(l={lane:2,revertLane:Df(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ac(e)){if(n)throw Error(r(479))}else n=hu(e,i,l,2),n!==null&&En(n,e,2)}function ac(e){var n=e.alternate;return e===Be||n!==null&&n===Be}function fv(e,n){po=Wl=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function mv(e,n,i){if((i&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,ye(e,i)}}var _r={readContext:cn,use:ec,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt};_r.useEffectEvent=Lt;var pv={readContext:cn,use:ec,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:Wg,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,nc(4194308,4,tv.bind(null,n,e),i)},useLayoutEffect:function(e,n){return nc(4194308,4,e,n)},useInsertionEffect:function(e,n){nc(4,2,e,n)},useMemo:function(e,n){var i=bn();n=n===void 0?null:n;var l=e();if(_i){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[l,n],l},useReducer:function(e,n,i){var l=bn();if(i!==void 0){var f=i(n);if(_i){yn(!0);try{i(n)}finally{yn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=kS.bind(null,Be,e),[l.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:function(e){e=Gu(e);var n=e.queue,i=uv.bind(null,Be,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Ku,useDeferredValue:function(e,n){var i=bn();return Yu(i,e,n)},useTransition:function(){var e=Gu(!1);return e=ov.bind(null,Be,e.queue,!0,!1),bn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var l=Be,f=bn();if(Je){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),xt===null)throw Error(r(349));(Ke&127)!==0||Og(l,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,Wg(Bg.bind(null,l,h,e),[e]),l.flags|=2048,go(9,{destroy:void 0},Lg.bind(null,l,h,i,n),null),i},useId:function(){var e=bn(),n=xt.identifierPrefix;if(Je){var i=Cs,l=ws;i=(l&~(1<<32-nn(l)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Xl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=hS++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Wu,useFormState:Fg,useActionState:Fg,useOptimistic:function(e){var n=bn();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=Xu.bind(null,Be,!0,i),i.dispatch=n,[e,n]},useMemoCache:Uu,useCacheRefresh:function(){return bn().memoizedState=xS.bind(null,Be)},useEffectEvent:function(e){var n=bn(),i={impl:e};return n.memoizedState=i,function(){if((rt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Qu={readContext:cn,use:ec,useCallback:sv,useContext:cn,useEffect:Zu,useImperativeHandle:nv,useInsertionEffect:Qg,useLayoutEffect:ev,useMemo:av,useReducer:tc,useRef:Jg,useState:function(){return tc(Ks)},useDebugValue:Ku,useDeferredValue:function(e,n){var i=Ht();return iv(i,vt.memoizedState,e,n)},useTransition:function(){var e=tc(Ks)[0],n=Ht().memoizedState;return[typeof e=="boolean"?e:yr(e),n]},useSyncExternalStore:Ig,useId:cv,useHostTransitionStatus:Wu,useFormState:Zg,useActionState:Zg,useOptimistic:function(e,n){var i=Ht();return Hg(i,vt,e,n)},useMemoCache:Uu,useCacheRefresh:dv};Qu.useEffectEvent=Xg;var hv={readContext:cn,use:ec,useCallback:sv,useContext:cn,useEffect:Zu,useImperativeHandle:nv,useInsertionEffect:Qg,useLayoutEffect:ev,useMemo:av,useReducer:qu,useRef:Jg,useState:function(){return qu(Ks)},useDebugValue:Ku,useDeferredValue:function(e,n){var i=Ht();return vt===null?Yu(i,e,n):iv(i,vt.memoizedState,e,n)},useTransition:function(){var e=qu(Ks)[0],n=Ht().memoizedState;return[typeof e=="boolean"?e:yr(e),n]},useSyncExternalStore:Ig,useId:cv,useHostTransitionStatus:Wu,useFormState:Yg,useActionState:Yg,useOptimistic:function(e,n){var i=Ht();return vt!==null?Hg(i,vt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Uu,useCacheRefresh:dv};hv.useEffectEvent=Xg;function ef(e,n,i,l){n=e.memoizedState,i=i(l,n),i=i==null?n:_({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var tf={enqueueSetState:function(e,n,i){e=e._reactInternals;var l=Ln(),f=Na(l);f.payload=n,i!=null&&(f.callback=i),n=wa(e,f,l),n!==null&&(En(n,e,l),pr(n,e,l))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var l=Ln(),f=Na(l);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=wa(e,f,l),n!==null&&(En(n,e,l),pr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Ln(),l=Na(i);l.tag=2,n!=null&&(l.callback=n),n=wa(e,l,i),n!==null&&(En(n,e,i),pr(n,e,i))}};function gv(e,n,i,l,f,h,S){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,S):n.prototype&&n.prototype.isPureReactComponent?!or(i,l)||!or(f,h):!0}function vv(e,n,i,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,l),n.state!==e&&tf.enqueueReplaceState(n,n.state,null)}function xi(e,n){var i=n;if("ref"in n){i={};for(var l in n)l!=="ref"&&(i[l]=n[l])}if(e=e.defaultProps){i===n&&(i=_({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function yv(e){Ll(e)}function bv(e){console.error(e)}function _v(e){Ll(e)}function ic(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function xv(e,n,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function nf(e,n,i){return i=Na(i),i.tag=3,i.payload={element:null},i.callback=function(){ic(e,n)},i}function kv(e){return e=Na(e),e.tag=3,e}function Sv(e,n,i,l){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){xv(n,i,l)}}var S=i.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(e.callback=function(){xv(n,i,l),typeof f!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function SS(e,n,i,l,f){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=i.alternate,n!==null&&ro(n,i,f,!0),i=Rn.current,i!==null){switch(i.tag){case 31:case 13:return Qn===null?vc():i.alternate===null&&Bt===0&&(Bt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,l===Fl?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([l]):n.add(l),Cf(e,l,f)),!1;case 22:return i.flags|=65536,l===Fl?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([l]):i.add(l)),Cf(e,l,f)),!1}throw Error(r(435,i.tag))}return Cf(e,l,f),vc(),!1}if(Je)return n=Rn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==xu&&(e=Error(r(422),{cause:l}),cr(Yn(e,i)))):(l!==xu&&(n=Error(r(423),{cause:l}),cr(Yn(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Yn(l,i),f=nf(e.stateNode,l,f),Ru(e,f),Bt!==4&&(Bt=2)),!1;var h=Error(r(520),{cause:l});if(h=Yn(h,i),Cr===null?Cr=[h]:Cr.push(h),Bt!==4&&(Bt=2),n===null)return!0;l=Yn(l,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=f&-f,i.lanes|=e,e=nf(i.stateNode,l,e),Ru(i,e),!1;case 1:if(n=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ma===null||!Ma.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=kv(f),Sv(f,e,i,l),Ru(i,f),!1}i=i.return}while(i!==null);return!1}var sf=Error(r(461)),Zt=!1;function dn(e,n,i,l){n.child=e===null?wg(n,null,i,l):bi(n,e.child,i,l)}function jv(e,n,i,l,f){i=i.render;var h=n.ref;if("ref"in l){var S={};for(var w in l)w!=="ref"&&(S[w]=l[w])}else S=l;return hi(n),l=$u(e,n,i,S,h,f),w=zu(),e!==null&&!Zt?(Hu(e,n,f),Ys(e,n,f)):(Je&&w&&bu(n),n.flags|=1,dn(e,n,l,f),n.child)}function Tv(e,n,i,l,f){if(e===null){var h=i.type;return typeof h=="function"&&!gu(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,Nv(e,n,h,l,f)):(e=Hl(i.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!ff(e,f)){var S=h.memoizedProps;if(i=i.compare,i=i!==null?i:or,i(S,l)&&e.ref===n.ref)return Ys(e,n,f)}return n.flags|=1,e=Vs(h,l),e.ref=n.ref,e.return=n,n.child=e}function Nv(e,n,i,l,f){if(e!==null){var h=e.memoizedProps;if(or(h,l)&&e.ref===n.ref)if(Zt=!1,n.pendingProps=l=h,ff(e,f))(e.flags&131072)!==0&&(Zt=!0);else return n.lanes=e.lanes,Ys(e,n,f)}return af(e,n,i,l,f)}function wv(e,n,i,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return Cv(e,n,h,i,l)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&ql(n,h!==null?h.cachePool:null),h!==null?Ag(n,h):Iu(),Dg(n);else return l=n.lanes=536870912,Cv(e,n,h!==null?h.baseLanes|i:i,i,l)}else h!==null?(ql(n,h.cachePool),Ag(n,h),Ea(),n.memoizedState=null):(e!==null&&ql(n,null),Iu(),Ea());return dn(e,n,f,i),n.child}function xr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Cv(e,n,i,l,f){var h=Cu();return h=h===null?null:{parent:Gt._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&ql(n,null),Iu(),Dg(n),e!==null&&ro(e,n,l,!0),n.childLanes=f,null}function oc(e,n){return n=lc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Ev(e,n,i){return bi(n,e.child,null,i),e=oc(n,n.pendingProps),e.flags|=2,Mn(n),n.memoizedState=null,e}function jS(e,n,i){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=oc(n,l),n.lanes=536870912,xr(null,e);if(Lu(n),(e=St)?(e=P0(e,Xn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:xa!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=fg(e),i.return=n,n.child=i,ln=n,St=null)):e=null,e===null)throw Sa(n);return n.lanes=536870912,null}return oc(n,l)}var h=e.memoizedState;if(h!==null){var S=h.dehydrated;if(Lu(n),f)if(n.flags&256)n.flags&=-257,n=Ev(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Zt||ro(e,n,i,!1),f=(i&e.childLanes)!==0,Zt||f){if(l=xt,l!==null&&(S=Ze(l,i),S!==0&&S!==h.retryLane))throw h.retryLane=S,ui(e,S),En(l,e,S),sf;vc(),n=Ev(e,n,i)}else e=h.treeContext,St=es(S.nextSibling),ln=n,Je=!0,ka=null,Xn=!1,e!==null&&hg(n,e),n=oc(n,l),n.flags|=4096;return n}return e=Vs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function rc(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function af(e,n,i,l,f){return hi(n),i=$u(e,n,i,l,void 0,f),l=zu(),e!==null&&!Zt?(Hu(e,n,f),Ys(e,n,f)):(Je&&l&&bu(n),n.flags|=1,dn(e,n,i,f),n.child)}function Av(e,n,i,l,f,h){return hi(n),n.updateQueue=null,i=Mg(n,l,i,f),Rg(e),l=zu(),e!==null&&!Zt?(Hu(e,n,h),Ys(e,n,h)):(Je&&l&&bu(n),n.flags|=1,dn(e,n,i,h),n.child)}function Dv(e,n,i,l,f){if(hi(n),n.stateNode===null){var h=so,S=i.contextType;typeof S=="object"&&S!==null&&(h=cn(S)),h=new i(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=tf,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},Au(n),S=i.contextType,h.context=typeof S=="object"&&S!==null?cn(S):so,h.state=n.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(ef(n,i,S,l),h.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(S=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),S!==h.state&&tf.enqueueReplaceState(h,h.state,null),gr(n,l,h,f),hr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,M=xi(i,w);h.props=M;var F=h.context,Q=i.contextType;S=so,typeof Q=="object"&&Q!==null&&(S=cn(Q));var ae=i.getDerivedStateFromProps;Q=typeof ae=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,Q||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||F!==S)&&vv(n,h,l,S),Ta=!1;var Z=n.memoizedState;h.state=Z,gr(n,l,h,f),hr(),F=n.memoizedState,w||Z!==F||Ta?(typeof ae=="function"&&(ef(n,i,ae,l),F=n.memoizedState),(M=Ta||gv(n,i,M,l,Z,F,S))?(Q||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=F),h.props=l,h.state=F,h.context=S,l=M):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,Du(e,n),S=n.memoizedProps,Q=xi(i,S),h.props=Q,ae=n.pendingProps,Z=h.context,F=i.contextType,M=so,typeof F=="object"&&F!==null&&(M=cn(F)),w=i.getDerivedStateFromProps,(F=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(S!==ae||Z!==M)&&vv(n,h,l,M),Ta=!1,Z=n.memoizedState,h.state=Z,gr(n,l,h,f),hr();var K=n.memoizedState;S!==ae||Z!==K||Ta||e!==null&&e.dependencies!==null&&Ul(e.dependencies)?(typeof w=="function"&&(ef(n,i,w,l),K=n.memoizedState),(Q=Ta||gv(n,i,Q,l,Z,K,M)||e!==null&&e.dependencies!==null&&Ul(e.dependencies))?(F||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,K,M),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,K,M)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=M,l=Q):(typeof h.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,rc(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=bi(n,e.child,null,f),n.child=bi(n,null,i,f)):dn(e,n,i,f),n.memoizedState=h.state,e=n.child):e=Ys(e,n,f),e}function Rv(e,n,i,l){return mi(),n.flags|=256,dn(e,n,i,l),n.child}var of={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rf(e){return{baseLanes:e,cachePool:xg()}}function lf(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=On),e}function Mv(e,n,i){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,S;if((S=h)||(S=e!==null&&e.memoizedState===null?!1:(zt.current&2)!==0),S&&(f=!0,n.flags&=-129),S=(n.flags&32)!==0,n.flags&=-33,e===null){if(Je){if(f?Ca(n):Ea(),(e=St)?(e=P0(e,Xn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:xa!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=fg(e),i.return=n,n.child=i,ln=n,St=null)):e=null,e===null)throw Sa(n);return qf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(Ea(),f=n.mode,w=lc({mode:"hidden",children:w},f),l=fi(l,f,i,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=rf(i),l.childLanes=lf(e,S,i),n.memoizedState=of,xr(null,l)):(Ca(n),cf(n,w))}var M=e.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(h)n.flags&256?(Ca(n),n.flags&=-257,n=df(e,n,i)):n.memoizedState!==null?(Ea(),n.child=e.child,n.flags|=128,n=null):(Ea(),w=l.fallback,f=n.mode,l=lc({mode:"visible",children:l.children},f),w=fi(w,f,i,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,bi(n,e.child,null,i),l=n.child,l.memoizedState=rf(i),l.childLanes=lf(e,S,i),n.memoizedState=of,n=xr(null,l));else if(Ca(n),qf(w)){if(S=w.nextSibling&&w.nextSibling.dataset,S)var F=S.dgst;S=F,l=Error(r(419)),l.stack="",l.digest=S,cr({value:l,source:null,stack:null}),n=df(e,n,i)}else if(Zt||ro(e,n,i,!1),S=(i&e.childLanes)!==0,Zt||S){if(S=xt,S!==null&&(l=Ze(S,i),l!==0&&l!==M.retryLane))throw M.retryLane=l,ui(e,l),En(S,e,l),sf;Vf(w)||vc(),n=df(e,n,i)}else Vf(w)?(n.flags|=192,n.child=e.child,n=null):(e=M.treeContext,St=es(w.nextSibling),ln=n,Je=!0,ka=null,Xn=!1,e!==null&&hg(n,e),n=cf(n,l.children),n.flags|=4096);return n}return f?(Ea(),w=l.fallback,f=n.mode,M=e.child,F=M.sibling,l=Vs(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,F!==null?w=Vs(F,w):(w=fi(w,f,i,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,xr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=rf(i):(f=w.cachePool,f!==null?(M=Gt._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=xg(),w={baseLanes:w.baseLanes|i,cachePool:f}),l.memoizedState=w,l.childLanes=lf(e,S,i),n.memoizedState=of,xr(e.child,l)):(Ca(n),i=e.child,e=i.sibling,i=Vs(i,{mode:"visible",children:l.children}),i.return=n,i.sibling=null,e!==null&&(S=n.deletions,S===null?(n.deletions=[e],n.flags|=16):S.push(e)),n.child=i,n.memoizedState=null,i)}function cf(e,n){return n=lc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function lc(e,n){return e=Dn(22,e,null,n),e.lanes=0,e}function df(e,n,i){return bi(n,e.child,null,i),e=cf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Iv(e,n,i){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),ju(e.return,n,i)}function uf(e,n,i,l,f,h){var S=e.memoizedState;S===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:f,treeForkCount:h}:(S.isBackwards=n,S.rendering=null,S.renderingStartTime=0,S.last=l,S.tail=i,S.tailMode=f,S.treeForkCount=h)}function Ov(e,n,i){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var S=zt.current,w=(S&2)!==0;if(w?(S=S&1|2,n.flags|=128):S&=1,xe(zt,S),dn(e,n,l,i),l=Je?lr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Iv(e,i,n);else if(e.tag===19)Iv(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(i=n.child,f=null;i!==null;)e=i.alternate,e!==null&&Jl(e)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),uf(n,!1,f,i,h,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Jl(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}uf(n,!0,i,null,h,l);break;case"together":uf(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ys(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Ra|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(ro(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Vs(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Vs(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function ff(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ul(e)))}function TS(e,n,i){switch(n.tag){case 3:Ie(n,n.stateNode.containerInfo),ja(n,Gt,e.memoizedState.cache),mi();break;case 27:case 5:hn(n);break;case 4:Ie(n,n.stateNode.containerInfo);break;case 10:ja(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Lu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Ca(n),n.flags|=128,null):(i&n.child.childLanes)!==0?Mv(e,n,i):(Ca(n),e=Ys(e,n,i),e!==null?e.sibling:null);Ca(n);break;case 19:var f=(e.flags&128)!==0;if(l=(i&n.childLanes)!==0,l||(ro(e,n,i,!1),l=(i&n.childLanes)!==0),f){if(l)return Ov(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),xe(zt,zt.current),l)break;return null;case 22:return n.lanes=0,wv(e,n,i,n.pendingProps);case 24:ja(n,Gt,e.memoizedState.cache)}return Ys(e,n,i)}function Lv(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Zt=!0;else{if(!ff(e,i)&&(n.flags&128)===0)return Zt=!1,TS(e,n,i);Zt=(e.flags&131072)!==0}else Zt=!1,Je&&(n.flags&1048576)!==0&&pg(n,lr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=vi(n.elementType),n.type=e,typeof e=="function")gu(e)?(l=xi(e,l),n.tag=1,n=Dv(null,n,e,l,i)):(n.tag=0,n=af(null,n,e,l,i));else{if(e!=null){var f=e.$$typeof;if(f===L){n.tag=11,n=jv(null,n,e,l,i);break e}else if(f===z){n.tag=14,n=Tv(null,n,e,l,i);break e}}throw n=W(e)||e,Error(r(306,n,""))}}return n;case 0:return af(e,n,n.type,n.pendingProps,i);case 1:return l=n.type,f=xi(l,n.pendingProps),Dv(e,n,l,f,i);case 3:e:{if(Ie(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,Du(e,n),gr(n,l,null,i);var S=n.memoizedState;if(l=S.cache,ja(n,Gt,l),l!==h.cache&&Tu(n,[Gt],i,!0),hr(),l=S.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:S.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=Rv(e,n,l,i);break e}else if(l!==f){f=Yn(Error(r(424)),n),cr(f),n=Rv(e,n,l,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(St=es(e.firstChild),ln=n,Je=!0,ka=null,Xn=!0,i=wg(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(mi(),l===f){n=Ys(e,n,i);break e}dn(e,n,l,i)}n=n.child}return n;case 26:return rc(e,n),e===null?(i=Z0(n.type,null,n.pendingProps,null))?n.memoizedState=i:Je||(i=n.type,e=n.pendingProps,l=jc(gt.current).createElement(i),l[et]=n,l[mt]=e,un(l,i,e),sn(l),n.stateNode=l):n.memoizedState=Z0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return hn(n),e===null&&Je&&(l=n.stateNode=q0(n.type,n.pendingProps,gt.current),ln=n,Xn=!0,f=St,Ba(n.type)?(Gf=f,St=es(l.firstChild)):St=f),dn(e,n,n.pendingProps.children,i),rc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Je&&((f=l=St)&&(l=t2(l,n.type,n.pendingProps,Xn),l!==null?(n.stateNode=l,ln=n,St=es(l.firstChild),Xn=!1,f=!0):f=!1),f||Sa(n)),hn(n),f=n.type,h=n.pendingProps,S=e!==null?e.memoizedProps:null,l=h.children,Hf(f,h)?l=null:S!==null&&Hf(f,S)&&(n.flags|=32),n.memoizedState!==null&&(f=$u(e,n,gS,null,null,i),Lr._currentValue=f),rc(e,n),dn(e,n,l,i),n.child;case 6:return e===null&&Je&&((e=i=St)&&(i=n2(i,n.pendingProps,Xn),i!==null?(n.stateNode=i,ln=n,St=null,e=!0):e=!1),e||Sa(n)),null;case 13:return Mv(e,n,i);case 4:return Ie(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=bi(n,null,l,i):dn(e,n,l,i),n.child;case 11:return jv(e,n,n.type,n.pendingProps,i);case 7:return dn(e,n,n.pendingProps,i),n.child;case 8:return dn(e,n,n.pendingProps.children,i),n.child;case 12:return dn(e,n,n.pendingProps.children,i),n.child;case 10:return l=n.pendingProps,ja(n,n.type,l.value),dn(e,n,l.children,i),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,hi(n),f=cn(f),l=l(f),n.flags|=1,dn(e,n,l,i),n.child;case 14:return Tv(e,n,n.type,n.pendingProps,i);case 15:return Nv(e,n,n.type,n.pendingProps,i);case 19:return Ov(e,n,i);case 31:return jS(e,n,i);case 22:return wv(e,n,i,n.pendingProps);case 24:return hi(n),l=cn(Gt),e===null?(f=Cu(),f===null&&(f=xt,h=Nu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:l,cache:f},Au(n),ja(n,Gt,f)):((e.lanes&i)!==0&&(Du(e,n),gr(n,null,null,i),hr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),ja(n,Gt,l)):(l=h.cache,ja(n,Gt,l),l!==f.cache&&Tu(n,[Gt],i,!0))),dn(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Js(e){e.flags|=4}function mf(e,n,i,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(c0())e.flags|=8192;else throw yi=Fl,Eu}else e.flags&=-16777217}function Bv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!X0(n))if(c0())e.flags|=8192;else throw yi=Fl,Eu}function cc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Tl():536870912,e.lanes|=n,_o|=n)}function kr(e,n){if(!Je)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function jt(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=i,n}function NS(e,n,i){var l=n.pendingProps;switch(_u(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(n),null;case 1:return jt(n),null;case 3:return i=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Fs(Gt),Mt(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(oo(n)?Js(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ku())),jt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Js(n),h!==null?(jt(n),Bv(n,h)):(jt(n),mf(n,f,null,l,i))):h?h!==e.memoizedState?(Js(n),jt(n),Bv(n,h)):(jt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Js(n),jt(n),mf(n,f,e,l,i)),null;case 27:if(ce(n),i=gt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return jt(n),null}e=Se.current,oo(n)?gg(n):(e=q0(f,l,i),n.stateNode=e,Js(n))}return jt(n),null;case 5:if(ce(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return jt(n),null}if(h=Se.current,oo(n))gg(n);else{var S=jc(gt.current);switch(h){case 1:h=S.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=S.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=S.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=S.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=S.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?S.createElement("select",{is:l.is}):S.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?S.createElement(f,{is:l.is}):S.createElement(f)}}h[et]=n,h[mt]=l;e:for(S=n.child;S!==null;){if(S.tag===5||S.tag===6)h.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===n)break e;for(;S.sibling===null;){if(S.return===null||S.return===n)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}n.stateNode=h;e:switch(un(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Js(n)}}return jt(n),mf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=gt.current,oo(n)){if(e=n.stateNode,i=n.memoizedProps,l=null,f=ln,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[et]=n,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||M0(e.nodeValue,i)),e||Sa(n,!0)}else e=jc(e).createTextNode(l),e[et]=n,n.stateNode=e}return jt(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(l=oo(n),i!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[et]=n}else mi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),e=!1}else i=ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Mn(n),n):(Mn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return jt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=oo(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[et]=n}else mi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),f=!1}else f=ku(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Mn(n),n):(Mn(n),null)}return Mn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),cc(n,n.updateQueue),jt(n),null);case 4:return Mt(),e===null&&Of(n.stateNode.containerInfo),jt(n),null;case 10:return Fs(n.type),jt(n),null;case 19:if(de(zt),l=n.memoizedState,l===null)return jt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)kr(l,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Jl(e),h!==null){for(n.flags|=128,kr(l,!1),e=h.updateQueue,n.updateQueue=e,cc(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)ug(i,e),i=i.sibling;return xe(zt,zt.current&1|2),Je&&qs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&en()>pc&&(n.flags|=128,f=!0,kr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Jl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,cc(n,e),kr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return jt(n),null}else 2*en()-l.renderingStartTime>pc&&i!==536870912&&(n.flags|=128,f=!0,kr(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=en(),e.sibling=null,i=zt.current,xe(zt,f?i&1|2:i&1),Je&&qs(n,l.treeForkCount),e):(jt(n),null);case 22:case 23:return Mn(n),Ou(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(i&536870912)!==0&&(n.flags&128)===0&&(jt(n),n.subtreeFlags&6&&(n.flags|=8192)):jt(n),i=n.updateQueue,i!==null&&cc(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==i&&(n.flags|=2048),e!==null&&de(gi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Fs(Gt),jt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function wS(e,n){switch(_u(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Fs(Gt),Mt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ce(n),null;case 31:if(n.memoizedState!==null){if(Mn(n),n.alternate===null)throw Error(r(340));mi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Mn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));mi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return de(zt),null;case 4:return Mt(),null;case 10:return Fs(n.type),null;case 22:case 23:return Mn(n),Ou(),e!==null&&de(gi),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Fs(Gt),null;case 25:return null;default:return null}}function $v(e,n){switch(_u(n),n.tag){case 3:Fs(Gt),Mt();break;case 26:case 27:case 5:ce(n);break;case 4:Mt();break;case 31:n.memoizedState!==null&&Mn(n);break;case 13:Mn(n);break;case 19:de(zt);break;case 10:Fs(n.type);break;case 22:case 23:Mn(n),Ou(),e!==null&&de(gi);break;case 24:Fs(Gt)}}function Sr(e,n){try{var i=n.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var f=l.next;i=f;do{if((i.tag&e)===e){l=void 0;var h=i.create,S=i.inst;l=h(),S.destroy=l}i=i.next}while(i!==f)}}catch(w){ht(n,n.return,w)}}function Aa(e,n,i){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var S=l.inst,w=S.destroy;if(w!==void 0){S.destroy=void 0,f=n;var M=i,F=w;try{F()}catch(Q){ht(f,M,Q)}}}l=l.next}while(l!==h)}}catch(Q){ht(n,n.return,Q)}}function zv(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Eg(n,i)}catch(l){ht(e,e.return,l)}}}function Hv(e,n,i){i.props=xi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){ht(e,n,l)}}function jr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(f){ht(e,n,f)}}function Es(e,n){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(f){ht(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){ht(e,n,f)}else i.current=null}function Pv(e){var n=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(f){ht(e,e.return,f)}}function pf(e,n,i){try{var l=e.stateNode;YS(l,e.type,i,n),l[mt]=n}catch(f){ht(e,e.return,f)}}function Uv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ba(e.type)||e.tag===4}function hf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Uv(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&&Ba(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 gf(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Ps));else if(l!==4&&(l===27&&Ba(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(gf(e,n,i),e=e.sibling;e!==null;)gf(e,n,i),e=e.sibling}function dc(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(l!==4&&(l===27&&Ba(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(dc(e,n,i),e=e.sibling;e!==null;)dc(e,n,i),e=e.sibling}function Vv(e){var n=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,l,i),n[et]=e,n[mt]=i}catch(h){ht(e,e.return,h)}}var Ws=!1,Kt=!1,vf=!1,qv=typeof WeakSet=="function"?WeakSet:Set,an=null;function CS(e,n){if(e=e.containerInfo,$f=Dc,e=ng(e),cu(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var S=0,w=-1,M=-1,F=0,Q=0,ae=e,Z=null;t:for(;;){for(var K;ae!==i||f!==0&&ae.nodeType!==3||(w=S+f),ae!==h||l!==0&&ae.nodeType!==3||(M=S+l),ae.nodeType===3&&(S+=ae.nodeValue.length),(K=ae.firstChild)!==null;)Z=ae,ae=K;for(;;){if(ae===e)break t;if(Z===i&&++F===f&&(w=S),Z===h&&++Q===l&&(M=S),(K=ae.nextSibling)!==null)break;ae=Z,Z=ae.parentNode}ae=K}i=w===-1||M===-1?null:{start:w,end:M}}else i=null}i=i||{start:0,end:0}}else i=null;for(zf={focusedElem:e,selectionRange:i},Dc=!1,an=n;an!==null;)if(n=an,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,an=e;else for(;an!==null;){switch(n=an,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)f=e[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,i=n,f=h.memoizedProps,h=h.memoizedState,l=i.stateNode;try{var ke=xi(i.type,f);e=l.getSnapshotBeforeUpdate(ke,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){ht(i,i.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)Uf(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Uf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,an=e;break}an=n.return}}function Gv(e,n,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:Qs(e,i),l&4&&Sr(5,i);break;case 1:if(Qs(e,i),l&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(S){ht(i,i.return,S)}else{var f=xi(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(S){ht(i,i.return,S)}}l&64&&zv(i),l&512&&jr(i,i.return);break;case 3:if(Qs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Eg(e,n)}catch(S){ht(i,i.return,S)}}break;case 27:n===null&&l&4&&Vv(i);case 26:case 5:Qs(e,i),n===null&&l&4&&Pv(i),l&512&&jr(i,i.return);break;case 12:Qs(e,i);break;case 31:Qs(e,i),l&4&&Kv(e,i);break;case 13:Qs(e,i),l&4&&Yv(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=BS.bind(null,i),s2(e,i))));break;case 22:if(l=i.memoizedState!==null||Ws,!l){n=n!==null&&n.memoizedState!==null||Kt,f=Ws;var h=Kt;Ws=l,(Kt=n)&&!h?ea(e,i,(i.subtreeFlags&8772)!==0):Qs(e,i),Ws=f,Kt=h}break;case 30:break;default:Qs(e,i)}}function Fv(e){var n=e.alternate;n!==null&&(e.alternate=null,Fv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Fd(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Et=null,Tn=!1;function Xs(e,n,i){for(i=i.child;i!==null;)Zv(e,n,i),i=i.sibling}function Zv(e,n,i){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(tn,i)}catch{}switch(i.tag){case 26:Kt||Es(i,n),Xs(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Kt||Es(i,n);var l=Et,f=Tn;Ba(i.type)&&(Et=i.stateNode,Tn=!1),Xs(e,n,i),Mr(i.stateNode),Et=l,Tn=f;break;case 5:Kt||Es(i,n);case 6:if(l=Et,f=Tn,Et=null,Xs(e,n,i),Et=l,Tn=f,Et!==null)if(Tn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(i.stateNode)}catch(h){ht(i,n,h)}else try{Et.removeChild(i.stateNode)}catch(h){ht(i,n,h)}break;case 18:Et!==null&&(Tn?(e=Et,z0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Co(e)):z0(Et,i.stateNode));break;case 4:l=Et,f=Tn,Et=i.stateNode.containerInfo,Tn=!0,Xs(e,n,i),Et=l,Tn=f;break;case 0:case 11:case 14:case 15:Aa(2,i,n),Kt||Aa(4,i,n),Xs(e,n,i);break;case 1:Kt||(Es(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Hv(i,n,l)),Xs(e,n,i);break;case 21:Xs(e,n,i);break;case 22:Kt=(l=Kt)||i.memoizedState!==null,Xs(e,n,i),Kt=l;break;default:Xs(e,n,i)}}function Kv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Co(e)}catch(i){ht(n,n.return,i)}}}function Yv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Co(e)}catch(i){ht(n,n.return,i)}}function ES(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new qv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new qv),n;default:throw Error(r(435,e.tag))}}function uc(e,n){var i=ES(e);n.forEach(function(l){if(!i.has(l)){i.add(l);var f=$S.bind(null,e,l);l.then(f,f)}})}function Nn(e,n){var i=n.deletions;if(i!==null)for(var l=0;l<i.length;l++){var f=i[l],h=e,S=n,w=S;e:for(;w!==null;){switch(w.tag){case 27:if(Ba(w.type)){Et=w.stateNode,Tn=!1;break e}break;case 5:Et=w.stateNode,Tn=!1;break e;case 3:case 4:Et=w.stateNode.containerInfo,Tn=!0;break e}w=w.return}if(Et===null)throw Error(r(160));Zv(h,S,f),Et=null,Tn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Jv(n,e),n=n.sibling}var ps=null;function Jv(e,n){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Nn(n,e),wn(e),l&4&&(Aa(3,e,e.return),Sr(3,e),Aa(5,e,e.return));break;case 1:Nn(n,e),wn(e),l&512&&(Kt||i===null||Es(i,i.return)),l&64&&Ws&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var f=ps;if(Nn(n,e),wn(e),l&512&&(Kt||i===null||Es(i,i.return)),l&4){var h=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Wo]||h[et]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),un(h,l,i),h[et]=e,sn(h),l=h;break e;case"link":var S=J0("link","href",f).get(l+(i.href||""));if(S){for(var w=0;w<S.length;w++)if(h=S[w],h.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&h.getAttribute("rel")===(i.rel==null?null:i.rel)&&h.getAttribute("title")===(i.title==null?null:i.title)&&h.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){S.splice(w,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;case"meta":if(S=J0("meta","content",f).get(l+(i.content||""))){for(w=0;w<S.length;w++)if(h=S[w],h.getAttribute("content")===(i.content==null?null:""+i.content)&&h.getAttribute("name")===(i.name==null?null:i.name)&&h.getAttribute("property")===(i.property==null?null:i.property)&&h.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&h.getAttribute("charset")===(i.charSet==null?null:i.charSet)){S.splice(w,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[et]=e,sn(h),l=h}e.stateNode=l}else W0(f,e.type,e.stateNode);else e.stateNode=Y0(f,l,e.memoizedProps);else h!==l?(h===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):h.count--,l===null?W0(f,e.type,e.stateNode):Y0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&pf(e,e.memoizedProps,i.memoizedProps)}break;case 27:Nn(n,e),wn(e),l&512&&(Kt||i===null||Es(i,i.return)),i!==null&&l&4&&pf(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Nn(n,e),wn(e),l&512&&(Kt||i===null||Es(i,i.return)),e.flags&32){f=e.stateNode;try{Ji(f,"")}catch(ke){ht(e,e.return,ke)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,pf(e,f,i!==null?i.memoizedProps:f)),l&1024&&(vf=!0);break;case 6:if(Nn(n,e),wn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(ke){ht(e,e.return,ke)}}break;case 3:if(wc=null,f=ps,ps=Tc(n.containerInfo),Nn(n,e),ps=f,wn(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{Co(n.containerInfo)}catch(ke){ht(e,e.return,ke)}vf&&(vf=!1,Wv(e));break;case 4:l=ps,ps=Tc(e.stateNode.containerInfo),Nn(n,e),wn(e),ps=l;break;case 12:Nn(n,e),wn(e);break;case 31:Nn(n,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,uc(e,l)));break;case 13:Nn(n,e),wn(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(mc=en()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,uc(e,l)));break;case 22:f=e.memoizedState!==null;var M=i!==null&&i.memoizedState!==null,F=Ws,Q=Kt;if(Ws=F||f,Kt=Q||M,Nn(n,e),Kt=Q,Ws=F,wn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(i===null||M||Ws||Kt||ki(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){M=i=n;try{if(h=M.stateNode,f)S=h.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{w=M.stateNode;var ae=M.memoizedProps.style,Z=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;w.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(ke){ht(M,M.return,ke)}}}else if(n.tag===6){if(i===null){M=n;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(ke){ht(M,M.return,ke)}}}else if(n.tag===18){if(i===null){M=n;try{var K=M.stateNode;f?H0(K,!0):H0(M.stateNode,!1)}catch(ke){ht(M,M.return,ke)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,uc(e,i))));break;case 19:Nn(n,e),wn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,uc(e,l)));break;case 30:break;case 21:break;default:Nn(n,e),wn(e)}}function wn(e){var n=e.flags;if(n&2){try{for(var i,l=e.return;l!==null;){if(Uv(l)){i=l;break}l=l.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var f=i.stateNode,h=hf(e);dc(e,h,f);break;case 5:var S=i.stateNode;i.flags&32&&(Ji(S,""),i.flags&=-33);var w=hf(e);dc(e,w,S);break;case 3:case 4:var M=i.stateNode.containerInfo,F=hf(e);gf(e,F,M);break;default:throw Error(r(161))}}catch(Q){ht(e,e.return,Q)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Wv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Wv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Qs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Gv(e,n.alternate,n),n=n.sibling}function ki(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Aa(4,n,n.return),ki(n);break;case 1:Es(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Hv(n,n.return,i),ki(n);break;case 27:Mr(n.stateNode);case 26:case 5:Es(n,n.return),ki(n);break;case 22:n.memoizedState===null&&ki(n);break;case 30:ki(n);break;default:ki(n)}e=e.sibling}}function ea(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,S=h.flags;switch(h.tag){case 0:case 11:case 15:ea(f,h,i),Sr(4,h);break;case 1:if(ea(f,h,i),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(F){ht(l,l.return,F)}if(l=h,f=l.updateQueue,f!==null){var w=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)Cg(M[f],w)}catch(F){ht(l,l.return,F)}}i&&S&64&&zv(h),jr(h,h.return);break;case 27:Vv(h);case 26:case 5:ea(f,h,i),i&&l===null&&S&4&&Pv(h),jr(h,h.return);break;case 12:ea(f,h,i);break;case 31:ea(f,h,i),i&&S&4&&Kv(f,h);break;case 13:ea(f,h,i),i&&S&4&&Yv(f,h);break;case 22:h.memoizedState===null&&ea(f,h,i),jr(h,h.return);break;case 30:break;default:ea(f,h,i)}n=n.sibling}}function yf(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&dr(i))}function bf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e))}function hs(e,n,i,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Xv(e,n,i,l),n=n.sibling}function Xv(e,n,i,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:hs(e,n,i,l),f&2048&&Sr(9,n);break;case 1:hs(e,n,i,l);break;case 3:hs(e,n,i,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e)));break;case 12:if(f&2048){hs(e,n,i,l),e=n.stateNode;try{var h=n.memoizedProps,S=h.id,w=h.onPostCommit;typeof w=="function"&&w(S,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){ht(n,n.return,M)}}else hs(e,n,i,l);break;case 31:hs(e,n,i,l);break;case 13:hs(e,n,i,l);break;case 23:break;case 22:h=n.stateNode,S=n.alternate,n.memoizedState!==null?h._visibility&2?hs(e,n,i,l):Tr(e,n):h._visibility&2?hs(e,n,i,l):(h._visibility|=2,vo(e,n,i,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&yf(S,n);break;case 24:hs(e,n,i,l),f&2048&&bf(n.alternate,n);break;default:hs(e,n,i,l)}}function vo(e,n,i,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,S=n,w=i,M=l,F=S.flags;switch(S.tag){case 0:case 11:case 15:vo(h,S,w,M,f),Sr(8,S);break;case 23:break;case 22:var Q=S.stateNode;S.memoizedState!==null?Q._visibility&2?vo(h,S,w,M,f):Tr(h,S):(Q._visibility|=2,vo(h,S,w,M,f)),f&&F&2048&&yf(S.alternate,S);break;case 24:vo(h,S,w,M,f),f&&F&2048&&bf(S.alternate,S);break;default:vo(h,S,w,M,f)}n=n.sibling}}function Tr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,l=n,f=l.flags;switch(l.tag){case 22:Tr(i,l),f&2048&&yf(l.alternate,l);break;case 24:Tr(i,l),f&2048&&bf(l.alternate,l);break;default:Tr(i,l)}n=n.sibling}}var Nr=8192;function yo(e,n,i){if(e.subtreeFlags&Nr)for(e=e.child;e!==null;)Qv(e,n,i),e=e.sibling}function Qv(e,n,i){switch(e.tag){case 26:yo(e,n,i),e.flags&Nr&&e.memoizedState!==null&&h2(i,ps,e.memoizedState,e.memoizedProps);break;case 5:yo(e,n,i);break;case 3:case 4:var l=ps;ps=Tc(e.stateNode.containerInfo),yo(e,n,i),ps=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Nr,Nr=16777216,yo(e,n,i),Nr=l):yo(e,n,i));break;default:yo(e,n,i)}}function e0(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function wr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];an=l,n0(l,e)}e0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)t0(e),e=e.sibling}function t0(e){switch(e.tag){case 0:case 11:case 15:wr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:wr(e);break;case 12:wr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,fc(e)):wr(e);break;default:wr(e)}}function fc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];an=l,n0(l,e)}e0(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Aa(8,n,n.return),fc(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,fc(n));break;default:fc(n)}e=e.sibling}}function n0(e,n){for(;an!==null;){var i=an;switch(i.tag){case 0:case 11:case 15:Aa(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:dr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,an=l;else e:for(i=e;an!==null;){l=an;var f=l.sibling,h=l.return;if(Fv(l),l===i){an=null;break e}if(f!==null){f.return=h,an=f;break e}an=h}}}var AS={getCacheForType:function(e){var n=cn(Gt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return cn(Gt).controller.signal}},DS=typeof WeakMap=="function"?WeakMap:Map,rt=0,xt=null,Ge=null,Ke=0,pt=0,In=null,Da=!1,bo=!1,_f=!1,ta=0,Bt=0,Ra=0,Si=0,xf=0,On=0,_o=0,Cr=null,Cn=null,kf=!1,mc=0,s0=0,pc=1/0,hc=null,Ma=null,Wt=0,Ia=null,xo=null,na=0,Sf=0,jf=null,a0=null,Er=0,Tf=null;function Ln(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:B.T!==null?Df():Qe()}function i0(){if(On===0)if((Ke&536870912)===0||Je){var e=ai;ai<<=1,(ai&3932160)===0&&(ai=262144),On=e}else On=536870912;return e=Rn.current,e!==null&&(e.flags|=32),On}function En(e,n,i){(e===xt&&(pt===2||pt===9)||e.cancelPendingCommit!==null)&&(ko(e,0),Oa(e,Ke,On,!1)),ee(e,i),((rt&2)===0||e!==xt)&&(e===xt&&((rt&2)===0&&(Si|=i),Bt===4&&Oa(e,Ke,On,!1)),As(e))}function o0(e,n,i){if((rt&6)!==0)throw Error(r(327));var l=!i&&(n&127)===0&&(n&e.expiredLanes)===0||ba(e,n),f=l?IS(e,n):wf(e,n,!0),h=l;do{if(f===0){bo&&!l&&Oa(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!RS(i)){f=wf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var S=0;else S=e.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){n=S;e:{var w=e;f=Cr;var M=w.current.memoizedState.isDehydrated;if(M&&(ko(w,S).flags|=256),S=wf(w,S,!1),S!==2){if(_f&&!M){w.errorRecoveryDisabledLanes|=h,Si|=h,f=4;break e}h=Cn,Cn=f,h!==null&&(Cn===null?Cn=h:Cn.push.apply(Cn,h))}f=S}if(h=!1,f!==2)continue}}if(f===1){ko(e,0),Oa(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Oa(l,n,On,!Da);break e;case 2:Cn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=mc+300-en(),10<f)){if(Oa(l,n,On,!Da),oi(l,0,!0)!==0)break e;na=n,l.timeoutHandle=B0(r0.bind(null,l,i,Cn,hc,kf,n,On,Si,_o,Da,h,"Throttled",-0,0),f);break e}r0(l,i,Cn,hc,kf,n,On,Si,_o,Da,h,null,-0,0)}}break}while(!0);As(e)}function r0(e,n,i,l,f,h,S,w,M,F,Q,ae,Z,K){if(e.timeoutHandle=-1,ae=n.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ps},Qv(n,h,ae);var ke=(h&62914560)===h?mc-en():(h&4194048)===h?s0-en():0;if(ke=g2(ae,ke),ke!==null){na=h,e.cancelPendingCommit=ke(h0.bind(null,e,n,h,i,l,f,S,w,M,Q,ae,null,Z,K)),Oa(e,h,S,!F);return}}h0(e,n,h,i,l,f,S,w,M)}function RS(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var f=i[l],h=f.getSnapshot;f=f.value;try{if(!An(h(),f))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Oa(e,n,i,l){n&=~xf,n&=~Si,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-nn(f),S=1<<h;l[h]=-1,f&=~S}i!==0&&pe(e,i,n)}function gc(){return(rt&6)===0?(Ar(0),!1):!0}function Nf(){if(Ge!==null){if(pt===0)var e=Ge.return;else e=Ge,Gs=pi=null,Pu(e),fo=null,fr=0,e=Ge;for(;e!==null;)$v(e.alternate,e),e=e.return;Ge=null}}function ko(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,XS(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),na=0,Nf(),xt=e,Ge=i=Vs(e.current,null),Ke=n,pt=0,In=null,Da=!1,bo=ba(e,n),_f=!1,_o=On=xf=Si=Ra=Bt=0,Cn=Cr=null,kf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-nn(l),h=1<<f;n|=e[f],l&=~h}return ta=n,Bl(),i}function l0(e,n){Be=null,B.H=_r,n===uo||n===Gl?(n=jg(),pt=3):n===Eu?(n=jg(),pt=4):pt=n===sf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,Ge===null&&(Bt=1,ic(e,Yn(n,e.current)))}function c0(){var e=Rn.current;return e===null?!0:(Ke&4194048)===Ke?Qn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Qn:!1}function d0(){var e=B.H;return B.H=_r,e===null?_r:e}function u0(){var e=B.A;return B.A=AS,e}function vc(){Bt=4,Da||(Ke&4194048)!==Ke&&Rn.current!==null||(bo=!0),(Ra&134217727)===0&&(Si&134217727)===0||xt===null||Oa(xt,Ke,On,!1)}function wf(e,n,i){var l=rt;rt|=2;var f=d0(),h=u0();(xt!==e||Ke!==n)&&(hc=null,ko(e,n)),n=!1;var S=Bt;e:do try{if(pt!==0&&Ge!==null){var w=Ge,M=In;switch(pt){case 8:Nf(),S=6;break e;case 3:case 2:case 9:case 6:Rn.current===null&&(n=!0);var F=pt;if(pt=0,In=null,So(e,w,M,F),i&&bo){S=0;break e}break;default:F=pt,pt=0,In=null,So(e,w,M,F)}}MS(),S=Bt;break}catch(Q){l0(e,Q)}while(!0);return n&&e.shellSuspendCounter++,Gs=pi=null,rt=l,B.H=f,B.A=h,Ge===null&&(xt=null,Ke=0,Bl()),S}function MS(){for(;Ge!==null;)f0(Ge)}function IS(e,n){var i=rt;rt|=2;var l=d0(),f=u0();xt!==e||Ke!==n?(hc=null,pc=en()+500,ko(e,n)):bo=ba(e,n);e:do try{if(pt!==0&&Ge!==null){n=Ge;var h=In;t:switch(pt){case 1:pt=0,In=null,So(e,n,h,1);break;case 2:case 9:if(kg(h)){pt=0,In=null,m0(n);break}n=function(){pt!==2&&pt!==9||xt!==e||(pt=7),As(e)},h.then(n,n);break e;case 3:pt=7;break e;case 4:pt=5;break e;case 7:kg(h)?(pt=0,In=null,m0(n)):(pt=0,In=null,So(e,n,h,7));break;case 5:var S=null;switch(Ge.tag){case 26:S=Ge.memoizedState;case 5:case 27:var w=Ge;if(S?X0(S):w.stateNode.complete){pt=0,In=null;var M=w.sibling;if(M!==null)Ge=M;else{var F=w.return;F!==null?(Ge=F,yc(F)):Ge=null}break t}}pt=0,In=null,So(e,n,h,5);break;case 6:pt=0,In=null,So(e,n,h,6);break;case 8:Nf(),Bt=6;break e;default:throw Error(r(462))}}OS();break}catch(Q){l0(e,Q)}while(!0);return Gs=pi=null,B.H=l,B.A=f,rt=i,Ge!==null?0:(xt=null,Ke=0,Bl(),Bt)}function OS(){for(;Ge!==null&&!ti();)f0(Ge)}function f0(e){var n=Lv(e.alternate,e,ta);e.memoizedProps=e.pendingProps,n===null?yc(e):Ge=n}function m0(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Av(i,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Av(i,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Pu(n);default:$v(i,n),n=Ge=ug(n,ta),n=Lv(i,n,ta)}e.memoizedProps=e.pendingProps,n===null?yc(e):Ge=n}function So(e,n,i,l){Gs=pi=null,Pu(n),fo=null,fr=0;var f=n.return;try{if(SS(e,f,n,i,Ke)){Bt=1,ic(e,Yn(i,e.current)),Ge=null;return}}catch(h){if(f!==null)throw Ge=f,h;Bt=1,ic(e,Yn(i,e.current)),Ge=null;return}n.flags&32768?(Je||l===1?e=!0:bo||(Ke&536870912)!==0?e=!1:(Da=e=!0,(l===2||l===9||l===3||l===6)&&(l=Rn.current,l!==null&&l.tag===13&&(l.flags|=16384))),p0(n,e)):yc(n)}function yc(e){var n=e;do{if((n.flags&32768)!==0){p0(n,Da);return}e=n.return;var i=NS(n.alternate,n,ta);if(i!==null){Ge=i;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);Bt===0&&(Bt=5)}function p0(e,n){do{var i=wS(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);Bt=6,Ge=null}function h0(e,n,i,l,f,h,S,w,M){e.cancelPendingCommit=null;do bc();while(Wt!==0);if((rt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=pu,ue(e,i,h,S,w,M),e===xt&&(Ge=xt=null,Ke=0),xo=n,Ia=e,na=i,Sf=h,jf=f,a0=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,zS(js,function(){return _0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=R.p,R.p=2,S=rt,rt|=4;try{CS(e,n,i)}finally{rt=S,R.p=f,B.T=l}}Wt=1,g0(),v0(),y0()}}function g0(){if(Wt===1){Wt=0;var e=Ia,n=xo,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=B.T,B.T=null;var l=R.p;R.p=2;var f=rt;rt|=4;try{Jv(n,e);var h=zf,S=ng(e.containerInfo),w=h.focusedElem,M=h.selectionRange;if(S!==w&&w&&w.ownerDocument&&tg(w.ownerDocument.documentElement,w)){if(M!==null&&cu(w)){var F=M.start,Q=M.end;if(Q===void 0&&(Q=F),"selectionStart"in w)w.selectionStart=F,w.selectionEnd=Math.min(Q,w.value.length);else{var ae=w.ownerDocument||document,Z=ae&&ae.defaultView||window;if(Z.getSelection){var K=Z.getSelection(),ke=w.textContent.length,Ae=Math.min(M.start,ke),bt=M.end===void 0?Ae:Math.min(M.end,ke);!K.extend&&Ae>bt&&(S=bt,bt=Ae,Ae=S);var V=eg(w,Ae),$=eg(w,bt);if(V&&$&&(K.rangeCount!==1||K.anchorNode!==V.node||K.anchorOffset!==V.offset||K.focusNode!==$.node||K.focusOffset!==$.offset)){var G=ae.createRange();G.setStart(V.node,V.offset),K.removeAllRanges(),Ae>bt?(K.addRange(G),K.extend($.node,$.offset)):(G.setEnd($.node,$.offset),K.addRange(G))}}}}for(ae=[],K=w;K=K.parentNode;)K.nodeType===1&&ae.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ae.length;w++){var ne=ae[w];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}Dc=!!$f,zf=$f=null}finally{rt=f,R.p=l,B.T=i}}e.current=n,Wt=2}}function v0(){if(Wt===2){Wt=0;var e=Ia,n=xo,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=B.T,B.T=null;var l=R.p;R.p=2;var f=rt;rt|=4;try{Gv(e,n.alternate,n)}finally{rt=f,R.p=l,B.T=i}}Wt=3}}function y0(){if(Wt===4||Wt===3){Wt=0,va();var e=Ia,n=xo,i=na,l=a0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Wt=5:(Wt=0,xo=Ia=null,b0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ma=null),Oe(i),n=n.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(tn,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=B.T,f=R.p,R.p=2,B.T=null;try{for(var h=e.onRecoverableError,S=0;S<l.length;S++){var w=l[S];h(w.value,{componentStack:w.stack})}}finally{B.T=n,R.p=f}}(na&3)!==0&&bc(),As(e),f=e.pendingLanes,(i&261930)!==0&&(f&42)!==0?e===Tf?Er++:(Er=0,Tf=e):Er=0,Ar(0)}}function b0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,dr(n)))}function bc(){return g0(),v0(),y0(),_0()}function _0(){if(Wt!==5)return!1;var e=Ia,n=Sf;Sf=0;var i=Oe(na),l=B.T,f=R.p;try{R.p=32>i?32:i,B.T=null,i=jf,jf=null;var h=Ia,S=na;if(Wt=0,xo=Ia=null,na=0,(rt&6)!==0)throw Error(r(331));var w=rt;if(rt|=4,t0(h.current),Xv(h,h.current,S,i),rt=w,Ar(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(tn,h)}catch{}return!0}finally{R.p=f,B.T=l,b0(e,n)}}function x0(e,n,i){n=Yn(i,n),n=nf(e.stateNode,n,2),e=wa(e,n,2),e!==null&&(ee(e,2),As(e))}function ht(e,n,i){if(e.tag===3)x0(e,e,i);else for(;n!==null;){if(n.tag===3){x0(n,e,i);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ma===null||!Ma.has(l))){e=Yn(i,e),i=kv(2),l=wa(n,i,2),l!==null&&(Sv(i,l,n,e),ee(l,2),As(l));break}}n=n.return}}function Cf(e,n,i){var l=e.pingCache;if(l===null){l=e.pingCache=new DS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(i)||(_f=!0,f.add(i),e=LS.bind(null,e,n,i),n.then(e,e))}function LS(e,n,i){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,xt===e&&(Ke&i)===i&&(Bt===4||Bt===3&&(Ke&62914560)===Ke&&300>en()-mc?(rt&2)===0&&ko(e,0):xf|=i,_o===Ke&&(_o=0)),As(e)}function k0(e,n){n===0&&(n=Tl()),e=ui(e,n),e!==null&&(ee(e,n),As(e))}function BS(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),k0(e,i)}function $S(e,n){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),k0(e,i)}function zS(e,n){return ga(e,n)}var _c=null,jo=null,Ef=!1,xc=!1,Af=!1,La=0;function As(e){e!==jo&&e.next===null&&(jo===null?_c=jo=e:jo=jo.next=e),xc=!0,Ef||(Ef=!0,PS())}function Ar(e,n){if(!Af&&xc){Af=!0;do for(var i=!1,l=_c;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var S=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-nn(42|e)+1)-1,h&=f&~(S&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,N0(l,h))}else h=Ke,h=oi(l,l===xt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ba(l,h)||(i=!0,N0(l,h));l=l.next}while(i);Af=!1}}function HS(){S0()}function S0(){xc=Ef=!1;var e=0;La!==0&&WS()&&(e=La);for(var n=en(),i=null,l=_c;l!==null;){var f=l.next,h=j0(l,n);h===0?(l.next=null,i===null?_c=f:i.next=f,f===null&&(jo=i)):(i=l,(e!==0||(h&3)!==0)&&(xc=!0)),l=f}Wt!==0&&Wt!==5||Ar(e),La!==0&&(La=0)}function j0(e,n){for(var i=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var S=31-nn(h),w=1<<S,M=f[S];M===-1?((w&i)===0||(w&l)!==0)&&(f[S]=jl(w,n)):M<=n&&(e.expiredLanes|=w),h&=~w}if(n=xt,i=Ke,i=oi(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===n&&(pt===2||pt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&fs(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ba(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(l!==null&&fs(l),Oe(i)){case 2:case 8:i=ni;break;case 32:i=js;break;case 268435456:i=Gn;break;default:i=js}return l=T0.bind(null,e),i=ga(i,l),e.callbackPriority=n,e.callbackNode=i,n}return l!==null&&l!==null&&fs(l),e.callbackPriority=2,e.callbackNode=null,2}function T0(e,n){if(Wt!==0&&Wt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(bc()&&e.callbackNode!==i)return null;var l=Ke;return l=oi(e,e===xt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(o0(e,l,n),j0(e,en()),e.callbackNode!=null&&e.callbackNode===i?T0.bind(null,e):null)}function N0(e,n){if(bc())return null;o0(e,n,!0)}function PS(){QS(function(){(rt&6)!==0?ga(ya,HS):S0()})}function Df(){if(La===0){var e=lo;e===0&&(e=si,si<<=1,(si&261888)===0&&(si=256)),La=e}return La}function w0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:El(""+e)}function C0(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function US(e,n,i,l,f){if(n==="submit"&&i&&i.stateNode===f){var h=w0((f[mt]||null).action),S=l.submitter;S&&(n=(n=S[mt]||null)?w0(n.formAction):S.getAttribute("formAction"),n!==null&&(h=n,S=null));var w=new Ml("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(La!==0){var M=S?C0(f,S):new FormData(f);Ju(i,{pending:!0,data:M,method:f.method,action:h},null,M)}}else typeof h=="function"&&(w.preventDefault(),M=S?C0(f,S):new FormData(f),Ju(i,{pending:!0,data:M,method:f.method,action:h},h,M))},currentTarget:f}]})}}for(var Rf=0;Rf<mu.length;Rf++){var Mf=mu[Rf],VS=Mf.toLowerCase(),qS=Mf[0].toUpperCase()+Mf.slice(1);ms(VS,"on"+qS)}ms(ig,"onAnimationEnd"),ms(og,"onAnimationIteration"),ms(rg,"onAnimationStart"),ms("dblclick","onDoubleClick"),ms("focusin","onFocus"),ms("focusout","onBlur"),ms(oS,"onTransitionRun"),ms(rS,"onTransitionStart"),ms(lS,"onTransitionCancel"),ms(lg,"onTransitionEnd"),Ki("onMouseEnter",["mouseout","mouseover"]),Ki("onMouseLeave",["mouseout","mouseover"]),Ki("onPointerEnter",["pointerout","pointerover"]),Ki("onPointerLeave",["pointerout","pointerover"]),ri("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ri("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ri("onBeforeInput",["compositionend","keypress","textInput","paste"]),ri("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ri("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="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(" "),GS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dr));function E0(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var S=l.length-1;0<=S;S--){var w=l[S],M=w.instance,F=w.currentTarget;if(w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=F;try{h(f)}catch(Q){Ll(Q)}f.currentTarget=null,h=M}else for(S=0;S<l.length;S++){if(w=l[S],M=w.instance,F=w.currentTarget,w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=F;try{h(f)}catch(Q){Ll(Q)}f.currentTarget=null,h=M}}}}function Fe(e,n){var i=n[Ns];i===void 0&&(i=n[Ns]=new Set);var l=e+"__bubble";i.has(l)||(A0(n,e,2,!1),i.add(l))}function If(e,n,i){var l=0;n&&(l|=4),A0(i,e,l,n)}var kc="_reactListening"+Math.random().toString(36).slice(2);function Of(e){if(!e[kc]){e[kc]=!0,Sh.forEach(function(i){i!=="selectionchange"&&(GS.has(i)||If(i,!1,e),If(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[kc]||(n[kc]=!0,If("selectionchange",!1,n))}}function A0(e,n,i,l){switch(iy(n)){case 2:var f=b2;break;case 8:f=_2;break;default:f=Jf}i=f.bind(null,n,i,e),f=void 0,!eu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function Lf(e,n,i,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var S=l.tag;if(S===3||S===4){var w=l.stateNode.containerInfo;if(w===f)break;if(S===4)for(S=l.return;S!==null;){var M=S.tag;if((M===3||M===4)&&S.stateNode.containerInfo===f)return;S=S.return}for(;w!==null;){if(S=Gi(w),S===null)return;if(M=S.tag,M===5||M===6||M===26||M===27){l=h=S;continue e}w=w.parentNode}}l=l.return}Oh(function(){var F=h,Q=Xd(i),ae=[];e:{var Z=cg.get(e);if(Z!==void 0){var K=Ml,ke=e;switch(e){case"keypress":if(Dl(i)===0)break e;case"keydown":case"keyup":K=$k;break;case"focusin":ke="focus",K=au;break;case"focusout":ke="blur",K=au;break;case"beforeblur":case"afterblur":K=au;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=$h;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Nk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Pk;break;case ig:case og:case rg:K=Ek;break;case lg:K=Vk;break;case"scroll":case"scrollend":K=jk;break;case"wheel":K=Gk;break;case"copy":case"cut":case"paste":K=Dk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=Hh;break;case"toggle":case"beforetoggle":K=Zk}var Ae=(n&4)!==0,bt=!Ae&&(e==="scroll"||e==="scrollend"),V=Ae?Z!==null?Z+"Capture":null:Z;Ae=[];for(var $=F,G;$!==null;){var ne=$;if(G=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||G===null||V===null||(ne=Qo($,V),ne!=null&&Ae.push(Rr($,ne,G))),bt)break;$=$.return}0<Ae.length&&(Z=new K(Z,ke,null,i,Q),ae.push({event:Z,listeners:Ae}))}}if((n&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",Z&&i!==Wd&&(ke=i.relatedTarget||i.fromElement)&&(Gi(ke)||ke[kt]))break e;if((K||Z)&&(Z=Q.window===Q?Q:(Z=Q.ownerDocument)?Z.defaultView||Z.parentWindow:window,K?(ke=i.relatedTarget||i.toElement,K=F,ke=ke?Gi(ke):null,ke!==null&&(bt=d(ke),Ae=ke.tag,ke!==bt||Ae!==5&&Ae!==27&&Ae!==6)&&(ke=null)):(K=null,ke=F),K!==ke)){if(Ae=$h,ne="onMouseLeave",V="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=Hh,ne="onPointerLeave",V="onPointerEnter",$="pointer"),bt=K==null?Z:Xo(K),G=ke==null?Z:Xo(ke),Z=new Ae(ne,$+"leave",K,i,Q),Z.target=bt,Z.relatedTarget=G,ne=null,Gi(Q)===F&&(Ae=new Ae(V,$+"enter",ke,i,Q),Ae.target=G,Ae.relatedTarget=bt,ne=Ae),bt=ne,K&&ke)t:{for(Ae=FS,V=K,$=ke,G=0,ne=V;ne;ne=Ae(ne))G++;ne=0;for(var Ce=$;Ce;Ce=Ae(Ce))ne++;for(;0<G-ne;)V=Ae(V),G--;for(;0<ne-G;)$=Ae($),ne--;for(;G--;){if(V===$||$!==null&&V===$.alternate){Ae=V;break t}V=Ae(V),$=Ae($)}Ae=null}else Ae=null;K!==null&&D0(ae,Z,K,Ae,!1),ke!==null&&bt!==null&&D0(ae,bt,ke,Ae,!0)}}e:{if(Z=F?Xo(F):window,K=Z.nodeName&&Z.nodeName.toLowerCase(),K==="select"||K==="input"&&Z.type==="file")var tt=Kh;else if(Fh(Z))if(Yh)tt=sS;else{tt=tS;var je=eS}else K=Z.nodeName,!K||K.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?F&&Jd(F.elementType)&&(tt=Kh):tt=nS;if(tt&&(tt=tt(e,F))){Zh(ae,tt,i,Q);break e}je&&je(e,Z,F),e==="focusout"&&F&&Z.type==="number"&&F.memoizedProps.value!=null&&Yd(Z,"number",Z.value)}switch(je=F?Xo(F):window,e){case"focusin":(Fh(je)||je.contentEditable==="true")&&(eo=je,du=F,rr=null);break;case"focusout":rr=du=eo=null;break;case"mousedown":uu=!0;break;case"contextmenu":case"mouseup":case"dragend":uu=!1,sg(ae,i,Q);break;case"selectionchange":if(iS)break;case"keydown":case"keyup":sg(ae,i,Q)}var ze;if(ou)e:{switch(e){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else Qi?qh(e,i)&&(Ye="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ye="onCompositionStart");Ye&&(Ph&&i.locale!=="ko"&&(Qi||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&Qi&&(ze=Lh()):(_a=Q,tu="value"in _a?_a.value:_a.textContent,Qi=!0)),je=Sc(F,Ye),0<je.length&&(Ye=new zh(Ye,e,null,i,Q),ae.push({event:Ye,listeners:je}),ze?Ye.data=ze:(ze=Gh(i),ze!==null&&(Ye.data=ze)))),(ze=Yk?Jk(e,i):Wk(e,i))&&(Ye=Sc(F,"onBeforeInput"),0<Ye.length&&(je=new zh("onBeforeInput","beforeinput",null,i,Q),ae.push({event:je,listeners:Ye}),je.data=ze)),US(ae,e,F,i,Q)}E0(ae,n)})}function Rr(e,n,i){return{instance:e,listener:n,currentTarget:i}}function Sc(e,n){for(var i=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Qo(e,i),f!=null&&l.unshift(Rr(e,f,h)),f=Qo(e,n),f!=null&&l.push(Rr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function FS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function D0(e,n,i,l,f){for(var h=n._reactName,S=[];i!==null&&i!==l;){var w=i,M=w.alternate,F=w.stateNode;if(w=w.tag,M!==null&&M===l)break;w!==5&&w!==26&&w!==27||F===null||(M=F,f?(F=Qo(i,h),F!=null&&S.unshift(Rr(i,F,M))):f||(F=Qo(i,h),F!=null&&S.push(Rr(i,F,M)))),i=i.return}S.length!==0&&e.push({event:n,listeners:S})}var ZS=/\r\n?/g,KS=/\u0000|\uFFFD/g;function R0(e){return(typeof e=="string"?e:""+e).replace(ZS,`
26
- `).replace(KS,"")}function M0(e,n){return n=R0(n),R0(e)===n}function yt(e,n,i,l,f,h){switch(i){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ji(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ji(e,""+l);break;case"className":wl(e,"class",l);break;case"tabIndex":wl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":wl(e,i,l);break;case"style":Mh(e,l,h);break;case"data":if(n!=="object"){wl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=El(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(i==="formAction"?(n!=="input"&&yt(e,n,"name",f.name,f,null),yt(e,n,"formEncType",f.formEncType,f,null),yt(e,n,"formMethod",f.formMethod,f,null),yt(e,n,"formTarget",f.formTarget,f,null)):(yt(e,n,"encType",f.encType,f,null),yt(e,n,"method",f.method,f,null),yt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=El(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=El(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),Nl(e,"popover",l);break;case"xlinkActuate":Hs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Hs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Hs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Hs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Hs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Hs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Nl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=kk.get(i)||i,Nl(e,i,l))}}function Bf(e,n,i,l,f,h){switch(i){case"style":Mh(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ji(e,l):(typeof l=="number"||typeof l=="bigint")&&Ji(e,""+l);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!jh.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),n=i.slice(2,f?i.length-7:void 0),h=e[mt]||null,h=h!=null?h[i]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,l,f);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):Nl(e,i,l)}}}function un(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var l=!1,f=!1,h;for(h in i)if(i.hasOwnProperty(h)){var S=i[h];if(S!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:yt(e,n,h,S,i,null)}}f&&yt(e,n,"srcSet",i.srcSet,i,null),l&&yt(e,n,"src",i.src,i,null);return;case"input":Fe("invalid",e);var w=h=S=f=null,M=null,F=null;for(l in i)if(i.hasOwnProperty(l)){var Q=i[l];if(Q!=null)switch(l){case"name":f=Q;break;case"type":S=Q;break;case"checked":M=Q;break;case"defaultChecked":F=Q;break;case"value":h=Q;break;case"defaultValue":w=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,n));break;default:yt(e,n,l,Q,i,null)}}Eh(e,h,w,M,F,S,f,!1);return;case"select":Fe("invalid",e),l=S=h=null;for(f in i)if(i.hasOwnProperty(f)&&(w=i[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":S=w;break;case"multiple":l=w;default:yt(e,n,f,w,i,null)}n=h,i=S,e.multiple=!!l,n!=null?Yi(e,!!l,n,!1):i!=null&&Yi(e,!!l,i,!0);return;case"textarea":Fe("invalid",e),h=f=l=null;for(S in i)if(i.hasOwnProperty(S)&&(w=i[S],w!=null))switch(S){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:yt(e,n,S,w,i,null)}Dh(e,l,f,h);return;case"option":for(M in i)if(i.hasOwnProperty(M)&&(l=i[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:yt(e,n,M,l,i,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(l=0;l<Dr.length;l++)Fe(Dr[l],e);break;case"image":Fe("error",e),Fe("load",e);break;case"details":Fe("toggle",e);break;case"embed":case"source":case"link":Fe("error",e),Fe("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(F in i)if(i.hasOwnProperty(F)&&(l=i[F],l!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:yt(e,n,F,l,i,null)}return;default:if(Jd(n)){for(Q in i)i.hasOwnProperty(Q)&&(l=i[Q],l!==void 0&&Bf(e,n,Q,l,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(l=i[w],l!=null&&yt(e,n,w,l,i,null))}function YS(e,n,i,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,S=null,w=null,M=null,F=null,Q=null;for(K in i){var ae=i[K];if(i.hasOwnProperty(K)&&ae!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=ae;default:l.hasOwnProperty(K)||yt(e,n,K,null,l,ae)}}for(var Z in l){var K=l[Z];if(ae=i[Z],l.hasOwnProperty(Z)&&(K!=null||ae!=null))switch(Z){case"type":h=K;break;case"name":f=K;break;case"checked":F=K;break;case"defaultChecked":Q=K;break;case"value":S=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:K!==ae&&yt(e,n,Z,K,l,ae)}}Kd(e,S,w,M,F,Q,h,f);return;case"select":K=S=w=Z=null;for(h in i)if(M=i[h],i.hasOwnProperty(h)&&M!=null)switch(h){case"value":break;case"multiple":K=M;default:l.hasOwnProperty(h)||yt(e,n,h,null,l,M)}for(f in l)if(h=l[f],M=i[f],l.hasOwnProperty(f)&&(h!=null||M!=null))switch(f){case"value":Z=h;break;case"defaultValue":w=h;break;case"multiple":S=h;default:h!==M&&yt(e,n,f,h,l,M)}n=w,i=S,l=K,Z!=null?Yi(e,!!i,Z,!1):!!l!=!!i&&(n!=null?Yi(e,!!i,n,!0):Yi(e,!!i,i?[]:"",!1));return;case"textarea":K=Z=null;for(w in i)if(f=i[w],i.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:yt(e,n,w,null,l,f)}for(S in l)if(f=l[S],h=i[S],l.hasOwnProperty(S)&&(f!=null||h!=null))switch(S){case"value":Z=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&yt(e,n,S,f,l,h)}Ah(e,Z,K);return;case"option":for(var ke in i)if(Z=i[ke],i.hasOwnProperty(ke)&&Z!=null&&!l.hasOwnProperty(ke))switch(ke){case"selected":e.selected=!1;break;default:yt(e,n,ke,null,l,Z)}for(M in l)if(Z=l[M],K=i[M],l.hasOwnProperty(M)&&Z!==K&&(Z!=null||K!=null))switch(M){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:yt(e,n,M,Z,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in i)Z=i[Ae],i.hasOwnProperty(Ae)&&Z!=null&&!l.hasOwnProperty(Ae)&&yt(e,n,Ae,null,l,Z);for(F in l)if(Z=l[F],K=i[F],l.hasOwnProperty(F)&&Z!==K&&(Z!=null||K!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,n));break;default:yt(e,n,F,Z,l,K)}return;default:if(Jd(n)){for(var bt in i)Z=i[bt],i.hasOwnProperty(bt)&&Z!==void 0&&!l.hasOwnProperty(bt)&&Bf(e,n,bt,void 0,l,Z);for(Q in l)Z=l[Q],K=i[Q],!l.hasOwnProperty(Q)||Z===K||Z===void 0&&K===void 0||Bf(e,n,Q,Z,l,K);return}}for(var V in i)Z=i[V],i.hasOwnProperty(V)&&Z!=null&&!l.hasOwnProperty(V)&&yt(e,n,V,null,l,Z);for(ae in l)Z=l[ae],K=i[ae],!l.hasOwnProperty(ae)||Z===K||Z==null&&K==null||yt(e,n,ae,Z,l,K)}function I0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function JS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var f=i[l],h=f.transferSize,S=f.initiatorType,w=f.duration;if(h&&w&&I0(S)){for(S=0,w=f.responseEnd,l+=1;l<i.length;l++){var M=i[l],F=M.startTime;if(F>w)break;var Q=M.transferSize,ae=M.initiatorType;Q&&I0(ae)&&(M=M.responseEnd,S+=Q*(M<w?1:(w-F)/(M-F)))}if(--l,n+=8*(h+S)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var $f=null,zf=null;function jc(e){return e.nodeType===9?e:e.ownerDocument}function O0(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 L0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Hf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Pf=null;function WS(){var e=window.event;return e&&e.type==="popstate"?e===Pf?!1:(Pf=e,!0):(Pf=null,!1)}var B0=typeof setTimeout=="function"?setTimeout:void 0,XS=typeof clearTimeout=="function"?clearTimeout:void 0,$0=typeof Promise=="function"?Promise:void 0,QS=typeof queueMicrotask=="function"?queueMicrotask:typeof $0<"u"?function(e){return $0.resolve(null).then(e).catch(e2)}:B0;function e2(e){setTimeout(function(){throw e})}function Ba(e){return e==="head"}function z0(e,n){var i=n,l=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(f),Co(n);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")Mr(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Mr(i);for(var h=i.firstChild;h;){var S=h.nextSibling,w=h.nodeName;h[Wo]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=S}}else i==="body"&&Mr(e.ownerDocument.body);i=f}while(i);Co(n)}function H0(e,n){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Uf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Uf(i),Fd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function t2(e,n,i,l){for(;e.nodeType===1;){var f=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Wo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=es(e.nextSibling),e===null)break}return null}function n2(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=es(e.nextSibling),e===null))return null;return e}function P0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=es(e.nextSibling),e===null))return null;return e}function Vf(e){return e.data==="$?"||e.data==="$~"}function qf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function s2(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var l=function(){n(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function es(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Gf=null;function U0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return es(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function V0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function q0(e,n,i){switch(n=jc(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Mr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Fd(e)}var ts=new Map,G0=new Set;function Tc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var sa=R.d;R.d={f:a2,r:i2,D:o2,C:r2,L:l2,m:c2,X:u2,S:d2,M:f2};function a2(){var e=sa.f(),n=gc();return e||n}function i2(e){var n=Fi(e);n!==null&&n.tag===5&&n.type==="form"?lv(n):sa.r(e)}var To=typeof document>"u"?null:document;function F0(e,n,i){var l=To;if(l&&typeof n=="string"&&n){var f=Zn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),G0.has(f)||(G0.add(f),e={rel:e,crossOrigin:i,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),un(n,"link",e),sn(n),l.head.appendChild(n)))}}function o2(e){sa.D(e),F0("dns-prefetch",e,null)}function r2(e,n){sa.C(e,n),F0("preconnect",e,n)}function l2(e,n,i){sa.L(e,n,i);var l=To;if(l&&e&&n){var f='link[rel="preload"][as="'+Zn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+Zn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+Zn(i.imageSizes)+'"]')):f+='[href="'+Zn(e)+'"]';var h=f;switch(n){case"style":h=No(e);break;case"script":h=wo(e)}ts.has(h)||(e=_({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),ts.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Ir(h))||n==="script"&&l.querySelector(Or(h))||(n=l.createElement("link"),un(n,"link",e),sn(n),l.head.appendChild(n)))}}function c2(e,n){sa.m(e,n);var i=To;if(i&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Zn(l)+'"][href="'+Zn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=wo(e)}if(!ts.has(h)&&(e=_({rel:"modulepreload",href:e},n),ts.set(h,e),i.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Or(h)))return}l=i.createElement("link"),un(l,"link",e),sn(l),i.head.appendChild(l)}}}function d2(e,n,i){sa.S(e,n,i);var l=To;if(l&&e){var f=Zi(l).hoistableStyles,h=No(e);n=n||"default";var S=f.get(h);if(!S){var w={loading:0,preload:null};if(S=l.querySelector(Ir(h)))w.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":n},i),(i=ts.get(h))&&Ff(e,i);var M=S=l.createElement("link");sn(M),un(M,"link",e),M._p=new Promise(function(F,Q){M.onload=F,M.onerror=Q}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Nc(S,n,l)}S={type:"stylesheet",instance:S,count:1,state:w},f.set(h,S)}}}function u2(e,n){sa.X(e,n);var i=To;if(i&&e){var l=Zi(i).hoistableScripts,f=wo(e),h=l.get(f);h||(h=i.querySelector(Or(f)),h||(e=_({src:e,async:!0},n),(n=ts.get(f))&&Zf(e,n),h=i.createElement("script"),sn(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function f2(e,n){sa.M(e,n);var i=To;if(i&&e){var l=Zi(i).hoistableScripts,f=wo(e),h=l.get(f);h||(h=i.querySelector(Or(f)),h||(e=_({src:e,async:!0,type:"module"},n),(n=ts.get(f))&&Zf(e,n),h=i.createElement("script"),sn(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function Z0(e,n,i,l){var f=(f=gt.current)?Tc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=No(i.href),i=Zi(f).hoistableStyles,l=i.get(n),l||(l={type:"style",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=No(i.href);var h=Zi(f).hoistableStyles,S=h.get(e);if(S||(f=f.ownerDocument||f,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,S),(h=f.querySelector(Ir(e)))&&!h._p&&(S.instance=h,S.state.loading=5),ts.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ts.set(e,i),h||m2(f,e,i,S.state))),n&&l===null)throw Error(r(528,""));return S}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=wo(i),i=Zi(f).hoistableScripts,l=i.get(n),l||(l={type:"script",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function No(e){return'href="'+Zn(e)+'"'}function Ir(e){return'link[rel="stylesheet"]['+e+"]"}function K0(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function m2(e,n,i,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),un(n,"link",i),sn(n),e.head.appendChild(n))}function wo(e){return'[src="'+Zn(e)+'"]'}function Or(e){return"script[async]"+e}function Y0(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Zn(i.href)+'"]');if(l)return n.instance=l,sn(l),l;var f=_({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),sn(l),un(l,"style",f),Nc(l,i.precedence,e),n.instance=l;case"stylesheet":f=No(i.href);var h=e.querySelector(Ir(f));if(h)return n.state.loading|=4,n.instance=h,sn(h),h;l=K0(i),(f=ts.get(f))&&Ff(l,f),h=(e.ownerDocument||e).createElement("link"),sn(h);var S=h;return S._p=new Promise(function(w,M){S.onload=w,S.onerror=M}),un(h,"link",l),n.state.loading|=4,Nc(h,i.precedence,e),n.instance=h;case"script":return h=wo(i.src),(f=e.querySelector(Or(h)))?(n.instance=f,sn(f),f):(l=i,(f=ts.get(h))&&(l=_({},i),Zf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),sn(f),un(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,Nc(l,i.precedence,e));return n.instance}function Nc(e,n,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,S=0;S<l.length;S++){var w=l[S];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Ff(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Zf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var wc=null;function J0(e,n,i){if(wc===null){var l=new Map,f=wc=new Map;f.set(i,l)}else f=wc,l=f.get(i),l||(l=new Map,f.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),f=0;f<i.length;f++){var h=i[f];if(!(h[Wo]||h[et]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var S=h.getAttribute(n)||"";S=e+S;var w=l.get(S);w?w.push(h):l.set(S,[h])}}return l}function W0(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function p2(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function X0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function h2(e,n,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=No(l.href),h=n.querySelector(Ir(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Cc.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,sn(h);return}h=n.ownerDocument||n,l=K0(l),(f=ts.get(f))&&Ff(l,f),h=h.createElement("link"),sn(h);var S=h;S._p=new Promise(function(w,M){S.onload=w,S.onerror=M}),un(h,"link",l),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Cc.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Kf=0;function g2(e,n){return e.stylesheets&&e.count===0&&Ac(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&Ac(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Kf===0&&(Kf=62500*JS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ac(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Kf?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function Cc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ac(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ec=null;function Ac(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ec=new Map,n.forEach(v2,e),Ec=null,Cc.call(e))}function v2(e,n){if(!(n.state.loading&4)){var i=Ec.get(e);if(i)var l=i.get(null);else{i=new Map,Ec.set(e,i);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var S=f[h];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(i.set(S.dataset.precedence,S),l=S)}l&&i.set(null,l)}f=n.instance,S=f.getAttribute("data-precedence"),h=i.get(S)||l,h===l&&i.set(null,f),i.set(S,f),this.count++,l=Cc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Lr={$$typeof:A,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function y2(e,n,i,l,f,h,S,w,M){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=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Q0(e,n,i,l,f,h,S,w,M,F,Q,ae){return e=new y2(e,n,i,S,M,F,Q,ae,w),n=1,h===!0&&(n|=24),h=Dn(3,null,null,n),e.current=h,h.stateNode=e,n=Nu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:i,cache:n},Au(h),e}function ey(e){return e?(e=so,e):so}function ty(e,n,i,l,f,h){f=ey(f),l.context===null?l.context=f:l.pendingContext=f,l=Na(n),l.payload={element:i},h=h===void 0?null:h,h!==null&&(l.callback=h),i=wa(e,l,n),i!==null&&(En(i,e,n),pr(i,e,n))}function ny(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Yf(e,n){ny(e,n),(e=e.alternate)&&ny(e,n)}function sy(e){if(e.tag===13||e.tag===31){var n=ui(e,67108864);n!==null&&En(n,e,67108864),Yf(e,67108864)}}function ay(e){if(e.tag===13||e.tag===31){var n=Ln();n=Te(n);var i=ui(e,n);i!==null&&En(i,e,n),Yf(e,n)}}var Dc=!0;function b2(e,n,i,l){var f=B.T;B.T=null;var h=R.p;try{R.p=2,Jf(e,n,i,l)}finally{R.p=h,B.T=f}}function _2(e,n,i,l){var f=B.T;B.T=null;var h=R.p;try{R.p=8,Jf(e,n,i,l)}finally{R.p=h,B.T=f}}function Jf(e,n,i,l){if(Dc){var f=Wf(l);if(f===null)Lf(e,n,l,Rc,i),oy(e,l);else if(k2(f,e,n,i,l))l.stopPropagation();else if(oy(e,l),n&4&&-1<x2.indexOf(e)){for(;f!==null;){var h=Fi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var S=Ts(h.pendingLanes);if(S!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;S;){var M=1<<31-nn(S);w.entanglements[1]|=M,S&=~M}As(h),(rt&6)===0&&(pc=en()+500,Ar(0))}}break;case 31:case 13:w=ui(h,2),w!==null&&En(w,h,2),gc(),Yf(h,2)}if(h=Wf(l),h===null&&Lf(e,n,l,Rc,i),h===f)break;f=h}f!==null&&l.stopPropagation()}else Lf(e,n,l,null,i)}}function Wf(e){return e=Xd(e),Xf(e)}var Rc=null;function Xf(e){if(Rc=null,e=Gi(e),e!==null){var n=d(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=m(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Rc=e,null}function iy(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(Hi()){case ya:return 2;case ni:return 8;case js:case Pi:return 32;case Gn:return 268435456;default:return 32}default:return 32}}var Qf=!1,$a=null,za=null,Ha=null,Br=new Map,$r=new Map,Pa=[],x2="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 oy(e,n){switch(e){case"focusin":case"focusout":$a=null;break;case"dragenter":case"dragleave":za=null;break;case"mouseover":case"mouseout":Ha=null;break;case"pointerover":case"pointerout":Br.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":$r.delete(n.pointerId)}}function zr(e,n,i,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Fi(n),n!==null&&sy(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function k2(e,n,i,l,f){switch(n){case"focusin":return $a=zr($a,e,n,i,l,f),!0;case"dragenter":return za=zr(za,e,n,i,l,f),!0;case"mouseover":return Ha=zr(Ha,e,n,i,l,f),!0;case"pointerover":var h=f.pointerId;return Br.set(h,zr(Br.get(h)||null,e,n,i,l,f)),!0;case"gotpointercapture":return h=f.pointerId,$r.set(h,zr($r.get(h)||null,e,n,i,l,f)),!0}return!1}function ry(e){var n=Gi(e.target);if(n!==null){var i=d(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,_t(e.priority,function(){ay(i)});return}}else if(n===31){if(n=m(i),n!==null){e.blockedOn=n,_t(e.priority,function(){ay(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Wf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Wd=l,i.target.dispatchEvent(l),Wd=null}else return n=Fi(i),n!==null&&sy(n),e.blockedOn=i,!1;n.shift()}return!0}function ly(e,n,i){Mc(e)&&i.delete(n)}function S2(){Qf=!1,$a!==null&&Mc($a)&&($a=null),za!==null&&Mc(za)&&(za=null),Ha!==null&&Mc(Ha)&&(Ha=null),Br.forEach(ly),$r.forEach(ly)}function Ic(e,n){e.blockedOn===n&&(e.blockedOn=null,Qf||(Qf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,S2)))}var Oc=null;function cy(e){Oc!==e&&(Oc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Oc===e&&(Oc=null);for(var n=0;n<e.length;n+=3){var i=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Xf(l||i)===null)continue;break}var h=Fi(i);h!==null&&(e.splice(n,3),n-=3,Ju(h,{pending:!0,data:f,method:i.method,action:l},l,f))}}))}function Co(e){function n(M){return Ic(M,e)}$a!==null&&Ic($a,e),za!==null&&Ic(za,e),Ha!==null&&Ic(Ha,e),Br.forEach(n),$r.forEach(n);for(var i=0;i<Pa.length;i++){var l=Pa[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Pa.length&&(i=Pa[0],i.blockedOn===null);)ry(i),i.blockedOn===null&&Pa.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var f=i[l],h=i[l+1],S=f[mt]||null;if(typeof h=="function")S||cy(i);else if(S){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,S=h[mt]||null)w=S.formAction;else if(Xf(f)!==null)continue}else w=S.action;typeof w=="function"?i[l+1]=w:(i.splice(l,3),l-=3),cy(i)}}}function dy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(S){return f=S})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function em(e){this._internalRoot=e}Lc.prototype.render=em.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,l=Ln();ty(i,l,e,n,null,null)},Lc.prototype.unmount=em.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;ty(e.current,2,null,e,null,null),gc(),n[kt]=null}};function Lc(e){this._internalRoot=e}Lc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Qe();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Pa.length&&n!==0&&n<Pa[i].priority;i++);Pa.splice(i,0,e),i===0&&ry(e)}};var uy=s.version;if(uy!=="19.2.4")throw Error(r(527,uy,"19.2.4"));R.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var j2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bc.isDisabled&&Bc.supportsFiber)try{tn=Bc.inject(j2),Ct=Bc}catch{}}return Pr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var i=!1,l="",f=yv,h=bv,S=_v;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError)),n=Q0(e,1,!1,null,null,i,l,null,f,h,S,dy),e[kt]=n.current,Of(e),new em(n)},Pr.hydrateRoot=function(e,n,i){if(!c(e))throw Error(r(299));var l=!1,f="",h=yv,S=bv,w=_v,M=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(S=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(M=i.formState)),n=Q0(e,1,!0,n,i??null,l,f,M,h,S,w,dy),n.context=ey(null),i=n.current,l=Ln(),l=Te(l),f=Na(l),f.callback=null,wa(i,f,l),i=l,n.current.lanes=i,ee(n,i),As(n),e[kt]=n.current,Of(e),new Lc(n)},Pr.version="19.2.4",Pr}var by;function ej(){if(by)return tm.exports;by=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),tm.exports=Q2(),tm.exports}var tj=ej();const nj="modulepreload",sj=function(t){return"/"+t},_y={},aj=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=(m==null?void 0:m.nonce)||(m==null?void 0:m.getAttribute("nonce"));c=u(o.map(g=>{if(g=sj(g),g in _y)return;_y[g]=!0;const v=g.endsWith(".css"),_=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${_}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":nj,v||(b.as="script"),b.crossOrigin="",b.href=g,p&&b.setAttribute("nonce",p),document.head.appendChild(b),v)return new Promise((x,k)=>{b.addEventListener("load",x),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=u,window.dispatchEvent(m),!m.defaultPrevented)throw u}return c.then(u=>{for(const m of u||[])m.status==="rejected"&&d(m.reason);return s().catch(d)})},ij=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),Dd=I2({baseUrl:"/",fetch:ij}),$e=Cd(O2,Dd),mn=Cd(L2,Dd),Hc=Cd(B2,Dd),Pc=Cd($2,Dd),oj="_bar_1xhb4_1",rj="_input_1xhb4_32",lj="_select_1xhb4_67",cj="_btnPrimary_1xhb4_103",dj="_btnGhost_1xhb4_173",uj="_badge_1xhb4_195",fj="_disconnectHint_1xhb4_205",zn={bar:oj,input:rj,select:lj,btnPrimary:cj,btnGhost:dj,badge:uj,disconnectHint:fj};function mj(t,s){if(!t)return!1;const o=s.find(r=>r.id===t);return o!==void 0&&(o.status==="disconnected"||o.status==="error")}function pj({environmentId:t,onReconnect:s}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:zn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),a.jsx("button",{type:"button",onClick:()=>s(t),className:zn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Rd({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:m,onSpawn:p,onStartTask:g,onProvisionEnvironment:v,onShowToast:_}){const[b,x]=y.useState(""),[k,j]=y.useState(""),N=mj(o,u),T=C=>{if(C.preventDefault(),!!b.trim())if(t==="send"){if(!s||N)return;m(s,b),x("")}else if(t==="spawn"){if(!o)return;p(o,b,k),_==null||_("Session started","success"),x(""),j("")}else{if(!r)return;g(r,void 0,o,b),x("")}};return t==="spawn"?a.jsxs("form",{onSubmit:T,className:zn.bar,children:[a.jsx("span",{className:zn.badge,children:"new chat"}),a.jsx("input",{type:"text",value:b,onChange:C=>x(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:zn.input,"aria-label":"Enter prompt"}),c&&a.jsxs("select",{value:k,onChange:C=>j(C.target.value),className:zn.select,"aria-label":"Select persona",children:[a.jsx("option",{value:"",children:"(Default)"}),d.map(C=>a.jsx("option",{value:C.id,children:C.name},C.id))]}),a.jsx("button",{type:"submit",disabled:!b.trim()||!o,className:zn.btnPrimary,children:"Go"})]}):t==="start"?a.jsxs("form",{onSubmit:T,className:zn.bar,children:[a.jsx("input",{type:"text",value:b,onChange:C=>x(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:zn.input,"aria-label":"Type a message"}),a.jsx("button",{type:"submit",disabled:!b.trim(),className:zn.btnPrimary,children:"Send"})]}):a.jsxs("form",{onSubmit:T,className:zn.bar,children:[N&&o&&a.jsx(pj,{environmentId:o,onReconnect:v}),a.jsx("input",{type:"text",value:b,onChange:C=>x(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:zn.input,"aria-label":"Type a message"}),a.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:a.jsx("button",{type:"submit",disabled:!b.trim()||N,className:zn.btnPrimary,children:"Send"})})]})}const xy=220,ky=70,hj=40,gj=60,vj="hierarchy",yj="dependency";function bj(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new fy.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:hj,ranksep:gj});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const m=r.get(u.parentTaskId)||[];m.push(u),r.set(u.parentTaskId,m)}for(const u of t)s.setNode(u.id,{width:xy,height:ky});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const m=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},m),c.push({id:m,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:vj},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const m of u.dependsOn)if(o.has(m)){const p=`dependency-${m}-${u.id}`;s.setEdge(m,u.id,{},p),c.push({id:p,source:m,target:u.id,type:"smoothstep",data:{edgeType:yj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return fy.layout(s),{nodes:t.map(u=>{const m=s.node(u.id),p=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:m.x-xy/2,y:m.y-ky/2},data:{task:u,childCount:p.length,doneChildCount:p.filter(g=>g.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
27
- * @license lucide-react v0.474.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const _j=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M_=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
32
- * @license lucide-react v0.474.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */var xj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
- * @license lucide-react v0.474.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const kj=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...m},p)=>y.createElement("svg",{ref:p,...xj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:M_("lucide",c),...m},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
42
- * @license lucide-react v0.474.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const He=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(kj,{ref:d,iconNode:s,className:M_(`lucide-${_j(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
47
- * @license lucide-react v0.474.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const Sj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Sy=He("ArrowDown",Sj);/**
52
- * @license lucide-react v0.474.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const jj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],jy=He("ArrowUp",jj);/**
57
- * @license lucide-react v0.474.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const Tj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],Nj=He("Ban",Tj);/**
62
- * @license lucide-react v0.474.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const wj=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Cj=He("Brain",wj);/**
67
- * @license lucide-react v0.474.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const Ej=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Aj=He("CalendarClock",Ej);/**
72
- * @license lucide-react v0.474.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const Dj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Li=He("Check",Dj);/**
77
- * @license lucide-react v0.474.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const Rj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],I_=He("ChevronDown",Rj);/**
82
- * @license lucide-react v0.474.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const Mj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pa=He("ChevronRight",Mj);/**
87
- * @license lucide-react v0.474.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const Ij=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ja=He("Circle",Ij);/**
92
- * @license lucide-react v0.474.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const Oj=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],Lj=He("ClipboardList",Oj);/**
97
- * @license lucide-react v0.474.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const Bj=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],O_=He("Clipboard",Bj);/**
102
- * @license lucide-react v0.474.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const $j=[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]],zj=He("Cog",$j);/**
107
- * @license lucide-react v0.474.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const Hj=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Pj=He("Copy",Hj);/**
112
- * @license lucide-react v0.474.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const Uj=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Vj=He("CornerDownRight",Uj);/**
117
- * @license lucide-react v0.474.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const qj=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],Gj=He("FilePen",qj);/**
122
- * @license lucide-react v0.474.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const Fj=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Zj=He("FileText",Fj);/**
127
- * @license lucide-react v0.474.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const Kj=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],Yj=He("Forward",Kj);/**
132
- * @license lucide-react v0.474.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const Jj=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Wj=He("Github",Jj);/**
137
- * @license lucide-react v0.474.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const Xj=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],Qj=He("House",Xj);/**
142
- * @license lucide-react v0.474.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const eT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Tp=He("Info",eT);/**
147
- * @license lucide-react v0.474.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const tT=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],nT=He("Key",tT);/**
152
- * @license lucide-react v0.474.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const sT=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],aT=He("Keyboard",sT);/**
157
- * @license lucide-react v0.474.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const iT=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],oT=He("ListChecks",iT);/**
162
- * @license lucide-react v0.474.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const rT=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],lT=He("List",rT);/**
167
- * @license lucide-react v0.474.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const cT=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],dT=He("Loader",cT);/**
172
- * @license lucide-react v0.474.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const uT=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],fT=He("Menu",uT);/**
177
- * @license lucide-react v0.474.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const mT=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],L_=He("MessageSquare",mT);/**
182
- * @license lucide-react v0.474.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const pT=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],hT=He("Monitor",pT);/**
187
- * @license lucide-react v0.474.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const gT=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],vT=He("Palette",gT);/**
192
- * @license lucide-react v0.474.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const yT=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],bT=He("Pause",yT);/**
197
- * @license lucide-react v0.474.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const _T=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],xT=He("Pencil",_T);/**
202
- * @license lucide-react v0.474.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const kT=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ST=He("Puzzle",kT);/**
207
- * @license lucide-react v0.474.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const jT=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],TT=He("Radio",jT);/**
212
- * @license lucide-react v0.474.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const NT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],wT=He("RefreshCw",NT);/**
217
- * @license lucide-react v0.474.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const CT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],fd=He("Search",CT);/**
222
- * @license lucide-react v0.474.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const ET=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],AT=He("Settings",ET);/**
227
- * @license lucide-react v0.474.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const DT=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],RT=He("SquareCheckBig",DT);/**
232
- * @license lucide-react v0.474.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const MT=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],IT=He("Star",MT);/**
237
- * @license lucide-react v0.474.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const OT=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Np=He("TriangleAlert",OT);/**
242
- * @license lucide-react v0.474.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const LT=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],BT=He("User",LT);/**
247
- * @license lucide-react v0.474.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const $T=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$s=He("X",$T),wp=8,it=12,qt=14,Dt=16,Ym={not_started:{color:"var(--text-tertiary)",icon:a.jsx(Ja,{size:it}),label:"Not Started"},working:{color:"var(--accent-green)",icon:a.jsx(Ja,{size:it,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:a.jsx(bT,{size:it}),label:"Paused"},complete:{color:"var(--accent-green)",icon:a.jsx(Li,{size:it}),label:"Complete"},failed:{color:"var(--accent-red)",icon:a.jsx($s,{size:it}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:a.jsx(Nj,{size:it}),label:"Blocked"}};function Wa(t){return t==="blocked"?Ym.blocked:Ym[gl(t)]}const zT={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function HT(t){return zT[gl(t)]??"statusPending"}const PT=["working","paused","failed","not_started","blocked","complete"],Ty=["not_started","working","paused","complete","failed"],UT={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function gl(t){return t in Ym&&t!=="blocked"?t:UT[t]??"not_started"}const VT={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"},qT="_dagContainer_js4w6_1",GT="_taskNode_js4w6_26",FT="_taskNodeBorder_js4w6_54",ZT="_taskNodeContent_js4w6_60",KT="_taskNodeHeader_js4w6_70",YT="_taskNodeIcon_js4w6_77",JT="_taskNodeTitle_js4w6_82",WT="_taskNodeBadges_js4w6_90",XT="_childBadge_js4w6_95",QT="_depBadge_js4w6_107",eN="_handle_js4w6_119",tN="_emptyCta_js4w6_126",nN="_ctaDescription_js4w6_137",sN="_ctaButton_js4w6_144",Sn={dagContainer:qT,taskNode:GT,taskNodeBorder:FT,taskNodeContent:ZT,taskNodeHeader:KT,taskNodeIcon:YT,taskNodeTitle:JT,taskNodeBadges:WT,childBadge:XT,depBadge:QT,handle:eN,emptyCta:tN,ctaDescription:nN,ctaButton:sN};function aN({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Wa(s.status);return a.jsxs("div",{className:Sn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[a.jsx(my,{type:"target",position:py.Top,className:Sn.handle}),a.jsx("div",{className:Sn.taskNodeBorder,style:{backgroundColor:d.color}}),a.jsxs("div",{className:Sn.taskNodeContent,children:[a.jsxs("div",{className:Sn.taskNodeHeader,children:[a.jsx("span",{className:Sn.taskNodeIcon,style:{color:d.color},children:d.icon}),a.jsx("span",{className:Sn.taskNodeTitle,children:s.title})]}),a.jsxs("div",{className:Sn.taskNodeBadges,children:[o>0&&a.jsxs("span",{className:Sn.childBadge,children:[r,"/",o]}),c&&a.jsx("span",{className:Sn.depBadge,children:"dep"})]})]}),a.jsx(my,{type:"source",position:py.Bottom,className:Sn.handle})]})}/**
252
- * react-router v7.13.2
253
- *
254
- * Copyright (c) Remix Software Inc.
255
- *
256
- * This source code is licensed under the MIT license found in the
257
- * LICENSE.md file in the root directory of this source tree.
258
- *
259
- * @license MIT
260
- */var Ny="popstate";function wy(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function iN(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:m,hash:p}=d||r.location;return Jm("",{pathname:u,search:m,hash:p},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:rl(c)}return rN(s,o,null,t)}function Nt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function cs(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function oN(){return Math.random().toString(36).substring(2,10)}function Cy(t,s){return{usr:t.state,key:t.key,idx:s,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Jm(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?qo(s):s,state:o,key:s&&s.key||r||oN(),unstable_mask:c}}function rl({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function qo(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function rN(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,m="POP",p=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function _(){m="POP";let N=v(),T=N==null?null:N-g;g=N,p&&p({action:m,location:j.location,delta:T})}function b(N,T){m="PUSH";let C=wy(N)?N:Jm(j.location,N,T);g=v()+1;let A=Cy(C,g),L=j.createHref(C.unstable_mask||C);try{u.pushState(A,"",L)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(L)}d&&p&&p({action:m,location:j.location,delta:1})}function x(N,T){m="REPLACE";let C=wy(N)?N:Jm(j.location,N,T);g=v();let A=Cy(C,g),L=j.createHref(C.unstable_mask||C);u.replaceState(A,"",L),d&&p&&p({action:m,location:j.location,delta:0})}function k(N){return lN(N)}let j={get action(){return m},get location(){return t(c,u)},listen(N){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(Ny,_),p=N,()=>{c.removeEventListener(Ny,_),p=null}},createHref(N){return s(c,N)},createURL:k,encodeLocation(N){let T=k(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:x,go(N){return u.go(N)}};return j}function lN(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),Nt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:rl(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function B_(t,s,o="/"){return cN(t,s,o,!1)}function cN(t,s,o,r){let c=typeof s=="string"?qo(s):s,d=ua(c.pathname||"/",o);if(d==null)return null;let u=$_(t);dN(u);let m=null;for(let p=0;m==null&&p<u.length;++p){let g=H_(d);m=bN(u[p],g,r)}return m}function $_(t,s=[],o=[],r="",c=!1){let d=(u,m,p=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:m,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&p)return;Nt(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let _=Os([r,v.relativePath]),b=o.concat(v);u.children&&u.children.length>0&&(Nt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),$_(u.children,s,b,_,p)),!(u.path==null&&!u.index)&&s.push({path:_,score:vN(_,u.index),routesMeta:b})};return t.forEach((u,m)=>{var p;if(u.path===""||!((p=u.path)!=null&&p.includes("?")))d(u,m);else for(let g of z_(u.path))d(u,m,!0,g)}),s}function z_(t){let s=t.split("/");if(s.length===0)return[];let[o,...r]=s,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=z_(r.join("/")),m=[];return m.push(...u.map(p=>p===""?d:[d,p].join("/"))),c&&m.push(...u),m.map(p=>t.startsWith("/")&&p===""?"/":p)}function dN(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:yN(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var uN=/^:[\w-]+$/,fN=3,mN=2,pN=1,hN=10,gN=-2,Ey=t=>t==="*";function vN(t,s){let o=t.split("/"),r=o.length;return o.some(Ey)&&(r+=gN),s&&(r+=mN),o.filter(c=>!Ey(c)).reduce((c,d)=>c+(uN.test(d)?fN:d===""?pN:hN),r)}function yN(t,s){return t.length===s.length&&t.slice(0,-1).every((r,c)=>r===s[c])?t[t.length-1]-s[s.length-1]:0}function bN(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let m=0;m<r.length;++m){let p=r[m],g=m===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",_=ll({path:p.relativePath,caseSensitive:p.caseSensitive,end:g},v),b=p.route;if(!_&&g&&o&&!r[r.length-1].route.index&&(_=ll({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},v)),!_)return null;Object.assign(c,_.params),u.push({params:c,pathname:Os([d,_.pathname]),pathnameBase:jN(Os([d,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(d=Os([d,_.pathnameBase]))}return u}function ll(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=_N(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),m=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:_},b)=>{if(v==="*"){let k=m[b]||"";u=d.slice(0,d.length-k.length).replace(/(.)\/+$/,"$1")}const x=m[b];return _&&!x?g[v]=void 0:g[v]=(x||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function _N(t,s=!1,o=!0){cs(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,m,p,g,v)=>{if(r.push({paramName:m,isOptional:p!=null}),p){let _=v.charAt(g+u.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function H_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return cs(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function ua(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var xN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function kN(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?qo(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=Ay(o.substring(1),"/"):d=Ay(o,s)):d=s,{pathname:d,search:TN(r),hash:NN(c)}}function Ay(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function am(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function SN(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function Cp(t){let s=SN(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function Md(t,s,o,r=!1){let c;typeof t=="string"?c=qo(t):(c={...t},Nt(!c.pathname||!c.pathname.includes("?"),am("?","pathname","search",c)),Nt(!c.pathname||!c.pathname.includes("#"),am("#","pathname","hash",c)),Nt(!c.search||!c.search.includes("#"),am("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,m;if(u==null)m=o;else{let _=s.length-1;if(!r&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),_-=1;c.pathname=b.join("/")}m=_>=0?s[_]:"/"}let p=kN(c,m),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!p.pathname.endsWith("/")&&(g||v)&&(p.pathname+="/"),p}var Os=t=>t.join("/").replace(/\/\/+/g,"/"),jN=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),TN=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,NN=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,wN=class{constructor(t,s,o,r=!1){this.status=t,this.statusText=s||"",this.internal=r,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function CN(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function EN(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var P_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function U_(t,s){let o=t;if(typeof o!="string"||!xN.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(P_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),m=ua(u.pathname,s);u.origin===d.origin&&m!=null?o=m+u.search+u.hash:c=!0}catch{cs(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var V_=["POST","PUT","PATCH","DELETE"];new Set(V_);var AN=["GET",...V_];new Set(AN);var Go=y.createContext(null);Go.displayName="DataRouter";var Id=y.createContext(null);Id.displayName="DataRouterState";var DN=y.createContext(!1),q_=y.createContext({isTransitioning:!1});q_.displayName="ViewTransition";var RN=y.createContext(new Map);RN.displayName="Fetchers";var MN=y.createContext(null);MN.displayName="Await";var Vn=y.createContext(null);Vn.displayName="Navigation";var vl=y.createContext(null);vl.displayName="Location";var ds=y.createContext({outlet:null,matches:[],isDataRoute:!1});ds.displayName="Route";var Ep=y.createContext(null);Ep.displayName="RouteError";var G_="REACT_ROUTER_ERROR",IN="REDIRECT",ON="ROUTE_ERROR_RESPONSE";function LN(t){if(t.startsWith(`${G_}:${IN}:{`))try{let s=JSON.parse(t.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function BN(t){if(t.startsWith(`${G_}:${ON}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new wN(s.status,s.statusText,s.data)}catch{}}function $N(t,{relative:s}={}){Nt(Bi(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Vn),{hash:c,pathname:d,search:u}=yl(t,{relative:s}),m=d;return o!=="/"&&(m=d==="/"?o:Os([o,d])),r.createHref({pathname:m,search:u,hash:c})}function Bi(){return y.useContext(vl)!=null}function Jt(){return Nt(Bi(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(vl).location}function It(t){Nt(Bi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Jt();return y.useMemo(()=>ll(t,H_(s)),[s,t])}var F_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Z_(t){y.useContext(Vn).static||y.useLayoutEffect(t)}function Od(){let{isDataRoute:t}=y.useContext(ds);return t?QN():zN()}function zN(){Nt(Bi(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Go),{basename:s,navigator:o}=y.useContext(Vn),{matches:r}=y.useContext(ds),{pathname:c}=Jt(),d=JSON.stringify(Cp(r)),u=y.useRef(!1);return Z_(()=>{u.current=!0}),y.useCallback((p,g={})=>{if(cs(u.current,F_),!u.current)return;if(typeof p=="number"){o.go(p);return}let v=Md(p,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Os([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var HN=y.createContext(null);function PN(t){let s=y.useContext(ds).outlet;return y.useMemo(()=>s&&y.createElement(HN.Provider,{value:t},s),[s,t])}function qn(){let{matches:t}=y.useContext(ds),s=t[t.length-1];return s?s.params:{}}function yl(t,{relative:s}={}){let{matches:o}=y.useContext(ds),{pathname:r}=Jt(),c=JSON.stringify(Cp(o));return y.useMemo(()=>Md(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function UN(t,s){return K_(t,s)}function K_(t,s,o){var N;Nt(Bi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Vn),{matches:c}=y.useContext(ds),d=c[c.length-1],u=d?d.params:{},m=d?d.pathname:"/",p=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";J_(m,!g||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${T}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
261
-
262
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Jt(),_;if(s){let T=typeof s=="string"?qo(s):s;Nt(p==="/"||((N=T.pathname)==null?void 0:N.startsWith(p)),`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 "${p}" but pathname "${T.pathname}" was given in the \`location\` prop.`),_=T}else _=v;let b=_.pathname||"/",x=b;if(p!=="/"){let T=p.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(T.length).join("/")}let k=B_(t,{pathname:x});cs(g||k!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),cs(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=ZN(k&&k.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:Os([p,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?p:Os([p,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,o);return s&&j?y.createElement(vl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,..._},navigationType:"POP"}},j):j}function VN(){let t=XN(),s=CN(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),o=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),o?y.createElement("pre",{style:c},o):null,u)}var qN=y.createElement(VN,null),Y_=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=BN(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(ds.Provider,{value:this.props.routeContext},y.createElement(Ep.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(GN,{error:t},s):s}};Y_.contextType=DN;var im=new WeakMap;function GN({children:t,error:s}){let{basename:o}=y.useContext(Vn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=LN(s.digest);if(r){let c=im.get(s);if(c)throw c;let d=U_(r.location,o);if(P_&&!im.get(s))if(d.isExternal||r.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:r.replace}));throw im.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function FN({routeContext:t,match:s,children:o}){let r=y.useContext(Go);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(ds.Provider,{value:t},o)}function ZN(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(_=>_.route.id&&(d==null?void 0:d[_.route.id])!==void 0);Nt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,m=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let _=c[v];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(m=v),_.route.id){let{loaderData:b,errors:x}=r,k=_.route.loader&&!b.hasOwnProperty(_.route.id)&&(!x||x[_.route.id]===void 0);if(_.route.lazy||k){o.isStatic&&(u=!0),m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let p=o==null?void 0:o.onError,g=r&&p?(v,_)=>{var b,x;p(v,{location:r.location,params:((x=(b=r.matches)==null?void 0:b[0])==null?void 0:x.params)??{},unstable_pattern:EN(r.matches),errorInfo:_})}:void 0;return c.reduceRight((v,_,b)=>{let x,k=!1,j=null,N=null;r&&(x=d&&_.route.id?d[_.route.id]:void 0,j=_.route.errorElement||qN,u&&(m<0&&b===0?(J_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):m===b&&(k=!0,N=_.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,b+1)),C=()=>{let A;return x?A=j:k?A=N:_.route.Component?A=y.createElement(_.route.Component,null):_.route.element?A=_.route.element:A=v,y.createElement(FN,{match:_,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:A})};return r&&(_.route.ErrorBoundary||_.route.errorElement||b===0)?y.createElement(Y_,{location:r.location,revalidation:r.revalidation,component:j,error:x,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function Ap(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function KN(t){let s=y.useContext(Go);return Nt(s,Ap(t)),s}function YN(t){let s=y.useContext(Id);return Nt(s,Ap(t)),s}function JN(t){let s=y.useContext(ds);return Nt(s,Ap(t)),s}function Dp(t){let s=JN(t),o=s.matches[s.matches.length-1];return Nt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function WN(){return Dp("useRouteId")}function XN(){var r;let t=y.useContext(Ep),s=YN("useRouteError"),o=Dp("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function QN(){let{router:t}=KN("useNavigate"),s=Dp("useNavigate"),o=y.useRef(!1);return Z_(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{cs(o.current,F_),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var Dy={};function J_(t,s,o){!s&&!Dy[t]&&(Dy[t]=!0,cs(!1,o))}y.memo(ew);function ew({routes:t,future:s,state:o,isStatic:r,onError:c}){return K_(t,void 0,{state:o,isStatic:r,onError:c})}function rs({to:t,replace:s,state:o,relative:r}){Nt(Bi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Vn);cs(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(ds),{pathname:u}=Jt(),m=Od(),p=Md(t,Cp(d),u,r==="path"),g=JSON.stringify(p);return y.useEffect(()=>{m(JSON.parse(g),{replace:s,state:o,relative:r})},[m,g,r,s,o]),null}function ha(t){return PN(t.context)}function Ne(t){Nt(!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 tw({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){Nt(!Bi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=t.replace(/^\/*/,"/"),p=y.useMemo(()=>({basename:m,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[m,c,d,u]);typeof o=="string"&&(o=qo(o));let{pathname:g="/",search:v="",hash:_="",state:b=null,key:x="default",unstable_mask:k}=o,j=y.useMemo(()=>{let N=ua(g,m);return N==null?null:{location:{pathname:N,search:v,hash:_,state:b,key:x,unstable_mask:k},navigationType:r}},[m,g,v,_,b,x,r,k]);return cs(j!=null,`<Router basename="${m}"> is not able to match the URL "${g}${v}${_}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:y.createElement(Vn.Provider,{value:p},y.createElement(vl.Provider,{children:s,value:j}))}function nw({children:t,location:s}){return UN(Wm(t),s)}function Wm(t,s=[]){let o=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){o.push.apply(o,Wm(r.props.children,d));return}Nt(r.type===Ne,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Nt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Wm(r.props.children,d)),o.push(u)}),o}var sd="get",ad="application/x-www-form-urlencoded";function Ld(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function sw(t){return Ld(t)&&t.tagName.toLowerCase()==="button"}function aw(t){return Ld(t)&&t.tagName.toLowerCase()==="form"}function iw(t){return Ld(t)&&t.tagName.toLowerCase()==="input"}function ow(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function rw(t,s){return t.button===0&&(!s||s==="_self")&&!ow(t)}function Xm(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,o)=>{let r=t[o];return s.concat(Array.isArray(r)?r.map(c=>[o,c]):[[o,r]])},[]))}function lw(t,s){let o=Xm(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Uc=null;function cw(){if(Uc===null)try{new FormData(document.createElement("form"),0),Uc=!1}catch{Uc=!0}return Uc}var dw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function om(t){return t!=null&&!dw.has(t)?(cs(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ad}"`),null):t}function uw(t,s){let o,r,c,d,u;if(aw(t)){let m=t.getAttribute("action");r=m?ua(m,s):null,o=t.getAttribute("method")||sd,c=om(t.getAttribute("enctype"))||ad,d=new FormData(t)}else if(sw(t)||iw(t)&&(t.type==="submit"||t.type==="image")){let m=t.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=t.getAttribute("formaction")||m.getAttribute("action");if(r=p?ua(p,s):null,o=t.getAttribute("formmethod")||m.getAttribute("method")||sd,c=om(t.getAttribute("formenctype"))||om(m.getAttribute("enctype"))||ad,d=new FormData(m,t),!cw()){let{name:g,type:v,value:_}=t;if(v==="image"){let b=g?`${g}.`:"";d.append(`${b}x`,"0"),d.append(`${b}y`,"0")}else g&&d.append(g,_)}}else{if(Ld(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=sd,r=null,c=ad,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:o.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rp(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function fw(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ua(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function mw(t,s){if(t.id in s)return s[t.id];try{let o=await import(t.module);return s[t.id]=o,o}catch(o){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pw(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function hw(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await mw(d,o);return u.links?u.links():[]}return[]}));return bw(r.flat(1).filter(pw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ry(t,s,o,r,c,d){let u=(p,g)=>o[g]?p.route.id!==o[g].route.id:!0,m=(p,g)=>{var v;return o[g].pathname!==p.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==p.params["*"]};return d==="assets"?s.filter((p,g)=>u(p,g)||m(p,g)):d==="data"?s.filter((p,g)=>{var _;let v=r.routes[p.route.id];if(!v||!v.hasLoader)return!1;if(u(p,g)||m(p,g))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((_=o[0])==null?void 0:_.params)||{},nextUrl:new URL(t,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function gw(t,s,{includeHydrateFallback:o}={}){return vw(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function vw(t){return[...new Set(t)]}function yw(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function bw(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(yw(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function W_(){let t=y.useContext(Go);return Rp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function _w(){let t=y.useContext(Id);return Rp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Mp=y.createContext(void 0);Mp.displayName="FrameworkContext";function X_(){let t=y.useContext(Mp);return Rp(t,"You must render this element inside a <HydratedRouter> element"),t}function xw(t,s){let o=y.useContext(Mp),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:g,onMouseLeave:v,onTouchStart:_}=s,b=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return b.current&&N.observe(b.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let x=()=>{c(!0)},k=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,b,{}]:[d,b,{onFocus:Ur(m,x),onBlur:Ur(p,k),onMouseEnter:Ur(g,x),onMouseLeave:Ur(v,k),onTouchStart:Ur(_,x)}]:[!1,b,{}]}function Ur(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function kw({page:t,...s}){let{router:o}=W_(),r=y.useMemo(()=>B_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(jw,{page:t,matches:r,...s}):null}function Sw(t){let{manifest:s,routeModules:o}=X_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return hw(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function jw({page:t,matches:s,...o}){let r=Jt(),{future:c,manifest:d,routeModules:u}=X_(),{basename:m}=W_(),{loaderData:p,matches:g}=_w(),v=y.useMemo(()=>Ry(t,s,g,d,r,"data"),[t,s,g,d,r]),_=y.useMemo(()=>Ry(t,s,g,d,r,"assets"),[t,s,g,d,r]),b=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,N=!1;if(s.forEach(C=>{var L;let A=d.routes[C.route.id];!A||!A.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in p&&((L=u[C.route.id])!=null&&L.shouldRevalidate)||A.hasClientLoader?N=!0:j.add(C.route.id))}),j.size===0)return[];let T=fw(t,m,c.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&T.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[m,c.unstable_trailingSlashAwareDataRequests,p,r,d,v,s,t,u]),x=y.useMemo(()=>gw(_,d),[_,d]),k=Sw(_);return y.createElement(y.Fragment,null,b.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),x.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),k.map(({key:j,link:N})=>y.createElement("link",{key:j,nonce:o.nonce,...N,crossOrigin:N.crossOrigin??o.crossOrigin})))}function Tw(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var Nw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Nw&&(window.__reactRouterVersion="7.13.2")}catch{}function ww({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=iN({window:r,v5Compat:!0}));let d=c.current,[u,m]=y.useState({action:d.action,location:d.location}),p=y.useCallback(g=>{o===!1?m(g):y.startTransition(()=>m(g))},[o]);return y.useLayoutEffect(()=>d.listen(p),[d,p]),y.createElement(tw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var Q_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bl=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:m,state:p,target:g,to:v,preventScrollReset:_,viewTransition:b,unstable_defaultShouldRevalidate:x,...k},j){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Vn),A=typeof v=="string"&&Q_.test(v),L=U_(v,N);v=L.to;let E=$N(v,{relative:c}),O=Jt(),z=null;if(m){let le=Md(m,[],O.unstable_mask?O.unstable_mask.pathname:"/",!0);N!=="/"&&(le.pathname=le.pathname==="/"?N:Os([N,le.pathname])),z=T.createHref(le)}let[D,H,Y]=xw(r,k),U=Dw(v,{replace:u,unstable_mask:m,state:p,target:g,preventScrollReset:_,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:x,unstable_useTransitions:C});function X(le){s&&s(le),le.defaultPrevented||U(le)}let ge=!(L.isExternal||d),W=y.createElement("a",{...k,...Y,href:(ge?z:void 0)||L.absoluteURL||E,onClick:ge?X:s,ref:Tw(j,H),target:g,"data-discover":!A&&o==="render"?"true":void 0});return D&&!A?y.createElement(y.Fragment,null,W,y.createElement(kw,{page:E})):W});bl.displayName="Link";var Cw=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:m,children:p,...g},v){let _=yl(u,{relative:g.relative}),b=Jt(),x=y.useContext(Id),{navigator:k,basename:j}=y.useContext(Vn),N=x!=null&&Lw(_)&&m===!0,T=k.encodeLocation?k.encodeLocation(_).pathname:_.pathname,C=b.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(C=C.toLowerCase(),A=A?A.toLowerCase():null,T=T.toLowerCase()),A&&j&&(A=ua(A,j)||A);const L=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let E=C===T||!c&&C.startsWith(T)&&C.charAt(L)==="/",O=A!=null&&(A===T||!c&&A.startsWith(T)&&A.charAt(T.length)==="/"),z={isActive:E,isPending:O,isTransitioning:N},D=E?s:void 0,H;typeof r=="function"?H=r(z):H=[r,E?"active":null,O?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(z):d;return y.createElement(bl,{...g,"aria-current":D,className:H,ref:v,style:Y,to:u,viewTransition:m},typeof p=="function"?p(z):p)});Cw.displayName="NavLink";var Ew=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=sd,action:m,onSubmit:p,relative:g,preventScrollReset:v,viewTransition:_,unstable_defaultShouldRevalidate:b,...x},k)=>{let{unstable_useTransitions:j}=y.useContext(Vn),N=Iw(),T=Ow(m,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",A=typeof m=="string"&&Q_.test(m),L=E=>{if(p&&p(E),E.defaultPrevented)return;E.preventDefault();let O=E.nativeEvent.submitter,z=(O==null?void 0:O.getAttribute("formmethod"))||u,D=()=>N(O||E.currentTarget,{fetcherKey:s,method:z,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:_,unstable_defaultShouldRevalidate:b});j&&o!==!1?y.startTransition(()=>D()):D()};return y.createElement("form",{ref:k,method:C,action:T,onSubmit:r?p:L,...x,"data-discover":!A&&t==="render"?"true":void 0})});Ew.displayName="Form";function Aw(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ex(t){let s=y.useContext(Go);return Nt(s,Aw(t)),s}function Dw(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:m,unstable_defaultShouldRevalidate:p,unstable_useTransitions:g}={}){let v=Od(),_=Jt(),b=yl(t,{relative:u});return y.useCallback(x=>{if(rw(x,s)){x.preventDefault();let k=o!==void 0?o:rl(_)===rl(b),j=()=>v(t,{replace:k,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:m,unstable_defaultShouldRevalidate:p});g?y.startTransition(()=>j()):j()}},[_,v,b,o,r,c,s,t,d,u,m,p,g])}function Ip(t){cs(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(Xm(t)),o=y.useRef(!1),r=Jt(),c=y.useMemo(()=>lw(r.search,o.current?null:s.current),[r.search]),d=Od(),u=y.useCallback((m,p)=>{const g=Xm(typeof m=="function"?m(new URLSearchParams(c)):m);o.current=!0,d("?"+g,p)},[d,c]);return[c,u]}var Rw=0,Mw=()=>`__${String(++Rw)}__`;function Iw(){let{router:t}=ex("useSubmit"),{basename:s}=y.useContext(Vn),o=WN(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:m,method:p,encType:g,formData:v,body:_}=uw(d,s);if(u.navigate===!1){let b=u.fetcherKey||Mw();await r(b,o,u.action||m,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:_,formMethod:u.method||p,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||m,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:_,formMethod:u.method||p,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function Ow(t,{relative:s}={}){let{basename:o}=y.useContext(Vn),r=y.useContext(ds);Nt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...yl(t||".",{relative:s})},u=Jt();if(t==null){d.search=u.search;let m=new URLSearchParams(d.search),p=m.getAll("index");if(p.some(v=>v==="")){m.delete("index"),p.filter(_=>_).forEach(_=>m.append("index",_));let v=m.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Os([o,d.pathname])),rl(d)}function Lw(t,{relative:s}={}){let o=y.useContext(q_);Nt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ex("useViewTransitionState"),c=yl(t,{relative:s});if(!o.isTransitioning)return!1;let d=ua(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ua(o.nextLocation.pathname,r)||o.nextLocation.pathname;return ll(c.pathname,u)!=null||ll(c.pathname,d)!=null}function dt(){const t=Od();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Bd(t){return`/sessions/${encodeURIComponent(t)}`}function Ri(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function Pn(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function $i(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function tx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const $o="/environments",Bw="/environments/new";function Mi(t){return`/environments/${encodeURIComponent(t)}`}function $w(t){return`/environments/${encodeURIComponent(t)}/edit`}const Ai="/settings",zw="/settings/credentials",rm="/settings/personas",Hw="/settings/personas/new";function nx(t){return`/settings/personas/${encodeURIComponent(t)}`}const lm="/settings/schedules",Pw="/settings/schedules/new";function sx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const Uw="/settings/shortcuts",Vw="/pair",cl="/chat";function qw(t){return`/chat/${encodeURIComponent(t)}`}const Ii="/",Gw="/tasks",ax="/workspaces/new",ix="/knowledge",$d="/findings";function Fw(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:$d}function Qm(t,s,o){const r=encodeURIComponent(t);return s&&o?`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const Zw=VT,Kw={task:aN};function Yw({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=dt(),d=y.useMemo(()=>o.filter(_=>_.workspaceId===t),[o,t]),{nodes:u,edges:m}=bj(d),p=y.useMemo(()=>{const _=getComputedStyle(document.documentElement),b={};for(const[x,k]of Object.entries(Zw))b[x]=_.getPropertyValue(k).trim()||"#6b7a8d";return b},[r]),g=y.useCallback((_,b)=>{c(Pn(b.id,void 0,t,s))},[c,t,s]),v=y.useCallback(_=>{const b=_.data;return p[b.task.status]||p.pending},[p]);return d.length===0?a.jsxs("div",{className:Sn.emptyCta,children:[a.jsx("button",{className:Sn.ctaButton,onClick:()=>c($i(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:Sn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):a.jsx("div",{className:Sn.dagContainer,children:a.jsxs(C2,{nodes:u,edges:m,nodeTypes:Kw,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(E2,{variant:A2.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(D2,{showInteractive:!1}),a.jsx(R2,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const Jw="_breadcrumbs_17or2_1",Ww="_list_17or2_11",Xw="_item_17or2_21",Qw="_separator_17or2_28",eC="_link_17or2_34",tC="_current_17or2_57",Eo={breadcrumbs:Jw,list:Ww,item:Xw,separator:Qw,link:eC,current:tC};function Ss({segments:t}){return a.jsx("nav",{className:Eo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:a.jsx("ol",{className:Eo.list,children:t.map((s,o)=>{const r=o===t.length-1;return a.jsxs("li",{className:Eo.item,children:[o>0&&a.jsx("span",{className:Eo.separator,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),s.url&&!r?a.jsx(bl,{className:Eo.link,to:s.url,title:s.label,children:s.label}):a.jsx("span",{className:Eo.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const nC="_btn_dwk2o_1",sC="_sm_dwk2o_22",aC="_md_dwk2o_28",iC="_lg_dwk2o_34",oC="_primary_dwk2o_40",rC="_danger_dwk2o_55",lC="_outline_dwk2o_70",cC="_ghost_dwk2o_80",cm={btn:nC,sm:sC,md:aC,lg:iC,primary:oC,danger:rC,outline:lC,ghost:cC},on=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const m=[cm.btn,cm[s],cm[o],r].filter(Boolean).join(" ");return a.jsx("button",{ref:u,className:m,...d,children:c})}),dC="_copyButton_1bqk0_1",uC={copyButton:dC},fC=2e3;function mC({text:t,className:s,"data-testid":o}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},fC)}catch{}},[t]);return a.jsx("button",{type:"button",className:`${uC.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?a.jsx(Li,{size:qt,"aria-hidden":"true"}):a.jsx(O_,{size:qt,"aria-hidden":"true"})})}const pC="_banner_bxqlh_1",hC="_label_bxqlh_15",gC="_text_bxqlh_25",vC="_link_bxqlh_29",Vc={banner:pC,label:hC,text:gC,link:vC};function yC(){return a.jsxs("div",{className:Vc.banner,"data-testid":"demo-banner",children:[a.jsx("span",{className:Vc.label,children:"DEMO"}),a.jsxs("span",{className:Vc.text,children:["This is an interactive demo with mock data."," ",a.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Vc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const bC="_container_og0yp_1",_C="_chevronButton_og0yp_6",xC="_mainButton_og0yp_6",kC="_sm_og0yp_34",SC="_md_og0yp_34",jC="_lg_og0yp_34",TC="_primary_og0yp_57",NC="_danger_og0yp_70",wC="_outline_og0yp_83",CC="_ghost_og0yp_92",EC="_dropdown_og0yp_100",AC="_option_og0yp_113",DC="_optionLabel_og0yp_130",RC="_optionDesc_og0yp_135",aa={container:bC,chevronButton:_C,mainButton:xC,sm:kC,md:SC,lg:jC,primary:TC,danger:NC,outline:wC,ghost:CC,dropdown:EC,option:AC,optionLabel:DC,optionDesc:RC};function ox({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,m]=y.useState(!1),p=y.useRef(null);y.useEffect(()=>{if(!u)return;function b(x){p.current&&x.target instanceof Node&&!p.current.contains(x.target)&&m(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[u]),y.useEffect(()=>{if(!u)return;function b(x){x.key==="Escape"&&m(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[u]);const g=aa[r]||"",v=aa[c]||"",_=()=>{u&&m(!1),s()};return a.jsxs("div",{ref:p,className:aa.container,"data-testid":d,children:[a.jsx("button",{type:"button",className:`${aa.mainButton} ${g} ${v}`,onClick:_,"data-testid":d?`${d}-main`:void 0,children:t}),a.jsx("button",{type:"button",className:`${aa.chevronButton} ${g} ${v}`,onClick:()=>m(b=>!b),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:a.jsx(I_,{size:qt,"aria-hidden":"true"})}),u&&a.jsx("div",{className:aa.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((b,x)=>a.jsxs("button",{type:"button",className:aa.option,onClick:()=>{b.onClick(),m(!1)},children:[a.jsx("span",{className:aa.optionLabel,children:b.label}),b.description&&a.jsx("span",{className:aa.optionDesc,children:b.description})]},x))})]})}function ep(){ep=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var m=new RegExp(c,d);return s.set(m,u||s.get(c)),md(m,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(m,p){var g=u[p];if(typeof g=="number")m[p]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;m[p]=c[g[v]]}return m},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&md(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(p,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var m=this;return t[Symbol.replace].call(this,c,function(){var p=arguments;return typeof p[p.length-1]!="object"&&(p=[].slice.call(p)).push(r(p,m)),d.apply(this,p)})}return t[Symbol.replace].call(this,c,d)},ep.apply(this,arguments)}function md(t,s){return md=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},md(t,s)}function My(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function dm(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return My(c,d);var u=Object.prototype.toString.call(c).slice(8,-1);return u==="Object"&&c.constructor&&(u=c.constructor.name),u==="Map"||u==="Set"?Array.from(c):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?My(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
263
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var MC=(function(t){return function(s){return s===void 0&&(s={}),(function(r,c){if(c&&!r.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(r){Z2(r,"element",o)};function o(r,c,d){var u,m;if(d&&d.tagName==="pre"&&r.tagName==="code"){var p=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(m=r.properties)==null?void 0:m.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,_=(function(E){for(var O,z=dm(E.properties.className);!(O=z()).done;){var D=O.value;if(D.slice(0,9)==="language-")return D.slice(9).toLowerCase()}return null})(r);if(!_&&s.defaultLanguage&&r.properties.className.push("language-"+(_=s.defaultLanguage)),r.properties.className.push("code-highlight"),_)try{var b,x;x=(b=_)!=null&&b.includes("diff-")?_.split("-")[1]:_,g=t.highlight(zc(r),x),d.properties.className=(d.properties.className||[]).concat("language-"+x)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(O){return O.reduce(function(z,D){if(D.type==="text"){var H=D.value,Y=(H.match(/\n/g)||"").length;if(Y===0)D.position={start:{line:v,column:1},end:{line:v,column:1}},z.push(D);else for(var U,X=H.split(`
264
- `),ge=dm(X.entries());!(U=ge()).done;){var W=U.value,le=W[0],B=W[1];z.push({type:"text",value:le===X.length-1?B:B+`
265
- `,position:{start:{line:v+le,column:1},end:{line:v+le,column:1}}})}return v+=Y,z}if(Object.prototype.hasOwnProperty.call(D,"children")){var R=v;return D.children=E(D.children),z.push(D),D.position={start:{line:R,column:1},end:{line:v,column:1}},z}return z.push(D),z},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var k,j=(function(E){var O=/{([\d,-]+)}/,z=E.split(",").map(function(Y){return Y.trim()}).join();if(O.test(z)){var D=O.exec(z)[1],H=Y2(D);return function(Y){return H.includes(Y+1)}}return function(){return!1}})(p),N=(function(E){var O=ep(/showLineNumbers=(\d+)/i,{lines:1});if(O.test(E)){var z=O.exec(E);return Number(z.groups.lines)}return 1})(p),T=(function(E){for(var O=new Array(E),z=0;z<E;z++)O[z]={type:"element",tagName:"span",properties:{className:[]},children:[]};return O})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],A=function(){var E,O,z=k.value,D=z[0],H=z[1];H.properties.className=["code-line"];var Y=J2(g,function(U){return U.position.start.line<=D+1&&U.position.end.line>=D+1});H.children=Y.children,(p.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(_))&&!C.some(function(U){return p.toLowerCase().includes(U)})&&(H.properties.line=[(D+N).toString()],H.properties.className.push("line-number")),j(D)&&H.properties.className.push("highlight-line"),(_==="diff"||(E=_)!=null&&E.includes("diff-"))&&zc(H).substring(0,1)==="-"?H.properties.className.push("deleted"):(_==="diff"||(O=_)!=null&&O.includes("diff-"))&&zc(H).substring(0,1)==="+"&&H.properties.className.push("inserted")},L=dm(T.entries());!(k=L()).done;)A();T.length>0&&zc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(K2);function zo(t){if(t>=1e6)return`${(t/1e6).toFixed(1)}M`;if(t>=1e3){const s=Number((t/1e3).toFixed(1));return s>=1e3?`${(t/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(t)}function Is(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const Iy=new Set(["grackle"]);function Fo(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Iy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Iy.has(o))return t.slice(s+1)}return t}const IC={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",powershell:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata",finding_post:"finding",finding_list:"finding",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",ipc_share_stream:"ipc",ipc_list_streams:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function OC(t){const s=Fo(t);return IC[s.toLowerCase()]??"generic"}const LC="_card_qkm9i_2",BC="_cardBlue_qkm9i_20",$C="_cardOrange_qkm9i_24",zC="_cardGreen_qkm9i_28",HC="_cardPurple_qkm9i_32",PC="_cardNeutral_qkm9i_36",UC="_cardRed_qkm9i_40",VC="_cardTeal_qkm9i_44",qC="_header_qkm9i_48",GC="_icon_qkm9i_55",FC="_toolName_qkm9i_64",ZC="_fileName_qkm9i_71",KC="_badge_qkm9i_80",YC="_spacer_qkm9i_87",JC="_bodyToggle_qkm9i_91",WC="_chevron_qkm9i_109",XC="_chevronExpanded_qkm9i_115",QC="_pre_qkm9i_119",eE="_diffAdd_qkm9i_143",tE="_diffRemove_qkm9i_155",nE="_diffContext_qkm9i_167",sE="_diffHeader_qkm9i_176",aE="_diffLine_qkm9i_182",iE="_exitOk_qkm9i_188",oE="_exitError_qkm9i_194",rE="_exitPending_qkm9i_200",lE="_inProgress_qkm9i_228",cE="_metadata_qkm9i_232",dE="_metadataPrefix_qkm9i_239",I={card:LC,cardBlue:BC,cardOrange:$C,cardGreen:zC,cardPurple:HC,cardNeutral:PC,cardRed:UC,cardTeal:VC,header:qC,icon:GC,toolName:FC,fileName:ZC,badge:KC,spacer:YC,bodyToggle:JC,chevron:WC,chevronExpanded:XC,pre:QC,diffAdd:eE,diffRemove:tE,diffContext:nE,diffHeader:sE,diffLine:aE,exitOk:iE,exitError:oE,exitPending:rE,inProgress:lE,metadata:cE,metadataPrefix:dE};function uE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function fE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const um=5;function Oy({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),m=uE(s),p=fE(m),g=o===void 0,v=r?I.cardRed:c?I.cardGreen:I.cardBlue,_=c?"var(--accent-green)":"var(--accent-blue)",b=c?a.jsx(Gj,{size:qt}):a.jsx(Zj,{size:qt}),x=c?"tool-card-file-write":"tool-card-file-read",k=(o==null?void 0:o.split(`
266
- `))??[],j=k.length>um,N=d?k:k.slice(0,um);return a.jsxs("div",{className:`${I.card} ${v} ${g?I.inProgress:""}`,"data-testid":x,children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,children:b}),a.jsx("span",{className:I.toolName,style:{color:_},children:t}),p&&a.jsx("span",{className:I.fileName,title:m,children:p}),!g&&k.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,children:[k.length," lines"]})]})]}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&k.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>a.jsxs("span",{className:I.diffLine,children:[a.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),j&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),d?"collapse":`${k.length-um} more lines`]})]})]})}function mE(t){const s=t.split(`
267
- `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function pE(t,s){const o=t.split(`
268
- `),r=s.split(`
269
- `),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function hE(t){let s=0,o=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&o++;return{added:s,removed:o}}function gE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function vE(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,o=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(o!==void 0&&r!==void 0)return{oldStr:o,newStr:r}}function yE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function bE(t,s){if(s){let r=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(r=c.detailedContent)}catch{}if(r.includes("@@")||r.startsWith("diff ")){const c=mE(r);if(c.length>0)return c}}const o=vE(t);if(o)return pE(o.oldStr,o.newStr)}const fm=5;function _E({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),m=gE(s),p=yE(m),g=o===void 0,v=bE(s,c),_=v?hE(v):null,b=((v==null?void 0:v.length)??0)>fm,x=d?v:v==null?void 0:v.slice(0,fm);return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${g?I.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,children:a.jsx(xT,{size:qt})}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),p&&a.jsx("span",{className:I.fileName,title:m,children:p}),_&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-diff-stats",children:[a.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",_.added]})," ",a.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",_.removed]})]})]})]}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&x&&x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-diff",children:x.map((k,j)=>{let N=I.diffContext;return k.type==="add"&&(N=I.diffAdd),k.type==="remove"&&(N=I.diffRemove),k.type==="header"&&(N=I.diffHeader),a.jsx("span",{className:`${I.diffLine} ${N}`,children:k.content},j)})}),b&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),d?"collapse":`${((v==null?void 0:v.length)??0)-fm} more lines`]})]}),!r&&!v&&!g&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:o})]})}const xE=/^\[exit (\d+)\]\s*/;function kE(t){const s=xE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function SE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function jE(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const o=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return o?o[1]:t}const mm=3;function TE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=SE(s),m=jE(u),p=o===void 0,g=o?kE(o):null,v=(g==null?void 0:g.output.split(`
270
- `))??[],_=v.length>mm,b=c?v:v.slice(0,mm),x=g==null?void 0:g.exitCode,k=r||x!==void 0&&x!==0;return a.jsxs("div",{className:`${I.card} ${k?I.cardRed:I.cardNeutral}`,"data-testid":"tool-card-shell",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),a.jsx("span",{className:I.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==m?u:void 0,"data-testid":"tool-card-command",children:m}),x!==void 0&&a.jsxs("span",{className:x===0?I.exitOk:I.exitError,"data-testid":"tool-card-exit-code",children:[x===0?a.jsx(Li,{size:it,"aria-hidden":"true"}):a.jsx($s,{size:it,"aria-hidden":"true"})," ","exit ",x]}),p&&a.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:a.jsx(dT,{size:it,"aria-hidden":"true"})})]}),!p&&g&&g.output.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:b.join(`
271
- `)}),_&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),c?"collapse":`${v.length-mm} more lines`]})]})]})}function NE(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,o=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:o,path:r}}const pm=5;function wE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:m}=NE(s),p=o===void 0,g=(o==null?void 0:o.split(`
272
- `).filter(b=>b.length>0))??[],v=g.length>pm,_=c?g:g.slice(0,pm);return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${p?I.inProgress:""}`,"data-testid":"tool-card-search",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,children:a.jsx(fd,{size:qt})}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&a.jsxs("span",{className:I.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),m&&a.jsxs("span",{className:I.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",m]}),!p&&!r&&g.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!p&&_.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:_.join(`
273
- `)}),v&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),c?"collapse":`${g.length-pm} more matches`]})]})]})}const CE="_progressBar_14f5c_1",EE="_progressFill_14f5c_9",AE="_activeTask_14f5c_16",DE="_activeIcon_14f5c_27",RE="_todoPulse_14f5c_1",ME="_activeText_14f5c_34",IE="_checklist_14f5c_48",OE="_item_14f5c_55",LE="_itemIcon_14f5c_65",BE="_itemText_14f5c_73",$E="_pending_14f5c_78",zE="_in_progress_14f5c_85",HE="_completed_14f5c_97",PE="_emptyMessage_14f5c_108",gs={progressBar:CE,progressFill:EE,activeTask:AE,activeIcon:DE,todoPulse:RE,activeText:ME,checklist:IE,item:OE,itemIcon:LE,itemText:BE,pending:$E,in_progress:zE,completed:HE,emptyMessage:PE},UE=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function VE(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(o=>typeof o=="object"&&o!==null&&typeof o.content=="string"&&typeof o.status=="string").map(o=>({content:o.content,activeForm:typeof o.activeForm=="string"?o.activeForm:void 0,status:Ly(o.status)})):Array.isArray(s.plan)?s.plan.filter(o=>typeof o=="object"&&o!==null&&typeof o.step=="string"&&typeof o.status=="string").map(o=>({content:o.step,status:Ly(o.status)})):typeof s.content=="string"?qE(s.content):[]}function Ly(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function qE(t){const s=t.split(`
274
- `),o=[];for(const r of s){const c=UE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let m="pending";d==="x"||d==="X"?m="completed":(d==="~"||d==="/"||d==="!")&&(m="in_progress"),o.push({content:u,status:m})}}return o}function GE(t){switch(t){case"completed":return a.jsx(Li,{size:it});case"in_progress":return a.jsx(Ja,{size:it,fill:"currentColor"});default:return a.jsx(Ja,{size:it})}}function FE({args:t}){const s=VE(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return a.jsxs("div",{className:`${I.card} ${I.cardBlue}`,"data-testid":"tool-card-todo",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,children:a.jsx(oT,{size:qt})}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&a.jsx("div",{className:gs.progressBar,"data-testid":"tool-card-todo-bar",children:a.jsx("div",{className:gs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&a.jsxs("div",{className:gs.activeTask,"data-testid":"tool-card-todo-active",children:[a.jsx("span",{className:gs.activeIcon,children:a.jsx(Ja,{size:it,fill:"currentColor"})}),a.jsx("span",{className:gs.activeText,children:r.activeForm||r.content})]}),!c&&a.jsx("div",{className:gs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>a.jsxs("div",{className:`${gs.item} ${gs[d.status]}`,"data-testid":"tool-card-todo-item",children:[a.jsx("span",{className:gs.itemIcon,children:GE(d.status)}),a.jsx("span",{className:gs.itemText,children:d.content})]},u))}),c&&a.jsx("div",{className:gs.emptyMessage,children:"All items completed and cleared."})]})}function ZE(t,s){if(s==null||typeof s!="object")return"";const o=s;if(typeof o.intent=="string")return o.intent;for(const r of Object.values(o))if(typeof r=="string")return r;return t}function KE({tool:t,args:s}){const o=ZE(t,s);return a.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[a.jsx("span",{className:I.metadataPrefix,children:a.jsx(Vj,{size:it})}),o]})}function YE(t){if(t==null||typeof t!="object")return{};const s=t;return{title:typeof s.title=="string"?s.title:void 0,category:typeof s.category=="string"?s.category:void 0,tags:Array.isArray(s.tags)?s.tags:void 0}}function JE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const hm=5,gm=5;function WE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Fo(t),m=YE(s),p=o===void 0,{single:g,list:v}=JE(o),_=(g==null?void 0:g.title)??m.title,b=v?void 0:(g==null?void 0:g.category)??m.category,x=v?void 0:(g==null?void 0:g.tags)??m.tags;return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${p?I.inProgress:""}`,"data-testid":"tool-card-finding",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"💡"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),_&&a.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',_,'"']}),b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsx("span",{className:I.badge,"data-testid":"tool-card-finding-category",children:b})]}),v&&!b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),x&&x.length>0&&a.jsx("div",{className:I.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:x.map((k,j)=>a.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",k]},j))}),p&&!_&&s!==null&&s!==void 0&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&(g==null?void 0:g.content)&&a.jsx(a.Fragment,{children:(()=>{const k=g.content.split(`
275
- `),j=k.length>gm,N=c?g.content:k.slice(0,gm).join(`
276
- `);return a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),j&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${k.length-gm} more lines`]})]})})()}),!r&&v&&v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,hm)).map((k,j)=>`${k.category?`[${k.category}] `:""}${k.title??k.id??`Finding ${j+1}`}`).join(`
277
- `)}),v.length>hm&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-hm} more findings`]})]})]})}function XE(t){if(t==null||typeof t!="object")return{};const s=t;return{taskId:typeof s.taskId=="string"?s.taskId:void 0,title:typeof s.title=="string"?s.title:void 0,status:typeof s.status=="string"?s.status:void 0}}function QE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function By(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function eA(t){switch(t){case"complete":case"completed":return"var(--accent-green, #4ade80)";case"working":case"in_progress":return"var(--accent-blue, #60a5fa)";case"failed":return"var(--accent-red, #f87171)";case"paused":return"var(--text-tertiary, #888)";default:return"var(--text-secondary, #aaa)"}}const vm=5;function tA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Fo(t),m=XE(s),p=o===void 0,{single:g,list:v,sessionId:_}=QE(o),b=(g==null?void 0:g.title)??m.title,x=(g==null?void 0:g.status)??m.status;return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${p?I.inProgress:""}`,"data-testid":"tool-card-task",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📋"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),b&&a.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',b,'"']}),!b&&m.taskId&&a.jsx("span",{className:I.fileName,"data-testid":"tool-card-task-id",children:m.taskId}),x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,style:{color:eA(x)},"data-testid":"tool-card-task-status",children:[By(x)," ",x]})]}),v&&!x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),p&&!b&&!m.taskId&&s!==null&&s!==void 0&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&_&&a.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",_]}),!r&&g&&!v&&!_&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
278
- `)}),!r&&v&&v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,vm)).map(k=>{const j=By(k.status),N=k.title??k.id??"untitled";return`${j} ${N}`}).join(`
279
- `)}),v.length>vm&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-vm} more tasks`]})]})]})}function nA(t){if(t==null||typeof t!="object")return{};const s=t;return{status:typeof s.status=="string"?s.status:void 0,summary:typeof s.summary=="string"?s.summary:void 0}}function sA(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s,r=typeof o.workpad=="object"&&o.workpad!==null?o.workpad:o;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function aA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Fo(t),m=nA(s),p=o===void 0,g=sA(o),v=g.status??m.status,_=g.summary??m.summary;return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardGreen} ${p?I.inProgress:""}`,"data-testid":"tool-card-workpad",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📓"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsx("span",{className:I.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),_&&a.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:_}),p&&!_&&s!==null&&s!==void 0&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!p&&o&&!_&&!v&&!g.extra&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function iA(t){if(t==null||typeof t!="object")return{};const s=t;return{query:typeof s.query=="string"?s.query:void 0,id:typeof s.id=="string"?s.id:void 0}}function oA(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;if(Array.isArray(o.results))return{results:o.results.filter(r=>r!==null&&typeof r=="object")};if(typeof o.node=="object"&&o.node!==null){const r=Array.isArray(o.edges)?o.edges.length:0;return{node:o.node,edgeCount:r}}if(typeof o.id=="string")return{node:o}}catch{}return{}}const ym=5;function rA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Fo(t),m=iA(s),p=o===void 0,g=oA(o);return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${p?I.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🧠"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),m.query&&a.jsxs("span",{className:I.fileName,"data-testid":"tool-card-knowledge-query",children:['"',m.query,'"']}),m.id&&!m.query&&a.jsx("span",{className:I.fileName,"data-testid":"tool-card-knowledge-id",children:m.id}),g.results&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),p&&s!==null&&s!==void 0&&!m.query&&!m.id&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,ym)).map(v=>{var x,k,j;const _=((x=v.node)==null?void 0:x.title)??((k=v.node)==null?void 0:k.label)??((j=v.node)==null?void 0:j.id)??"node",b=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${_}${b}`}).join(`
280
- `)}),g.results.length>ym&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-ym} more results`]})]}),!r&&g.node&&!g.results&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
281
- `)})]})}function lA(t){if(t==null||typeof t!="object")return{};const s=t;return{fd:typeof s.fd=="number"?s.fd:void 0,pipe:typeof s.pipe=="string"?s.pipe:void 0,prompt:typeof s.prompt=="string"?s.prompt:void 0,name:typeof s.name=="string"?s.name:void 0,message:typeof s.message=="string"?s.message:void 0}}function cA(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;return{sessionId:typeof o.sessionId=="string"?o.sessionId:void 0,fd:typeof o.fd=="number"?o.fd:void 0,fds:Array.isArray(o.fds)?o.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof o.success=="boolean"?o.success:void 0,output:typeof o.output=="string"?o.output:void 0}}catch{}return{}}function dA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=Fo(t),m=lA(s),p=o===void 0,g=cA(o);let v="";m.pipe?v=`[${m.pipe}]`:m.fd!==void 0?v=`fd:${m.fd}`:m.name&&(v=`"${m.name}"`);const _=m.prompt?m.prompt.length>60?`${m.prompt.slice(0,60)}...`:m.prompt:void 0;return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${p?I.inProgress:""}`,"data-testid":"tool-card-ipc",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔀"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&a.jsx("span",{className:I.fileName,"data-testid":"tool-card-ipc-info",children:v}),_&&a.jsx("span",{className:I.fileName,title:m.prompt,"data-testid":"tool-card-ipc-prompt",children:_}),g.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsx("span",{className:I.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),p&&!_&&!v&&s!==null&&s!==void 0&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&a.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(b=>{const x=[`fd:${b.fd??"?"}`,b.permission??"",b.deliveryMode??""];return b.streamName&&x.push(b.streamName),b.owned&&x.push("(owned)"),x.filter(Boolean).join(" ")}).join(`
282
- `)}),g.fds.length>5&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function uA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const bm=8;function fA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=uA(t),u=s===void 0,m=(s==null?void 0:s.split(`
283
- `))??[],p=m.length>bm,g=r?s:m.slice(0,bm).join(`
284
- `);return a.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardNeutral} ${u?I.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔧"}),a.jsx("span",{className:I.toolName,children:"ToolSearch"}),d&&a.jsxs("span",{className:I.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:I.spacer}),a.jsxs("span",{className:I.badge,"data-testid":"tool-card-tool-search-count",children:[m.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-tool-search-result",children:g}),p&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${r?I.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${m.length-bm} more lines`]})]})]})}function mA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function pA(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const o=JSON.stringify(t);return o.length>120?`${o.slice(0,120)}…`:o}catch{return""}}const _m=5;function hA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=mA(t),m=pA(s),p=o===void 0,g=(o==null?void 0:o.split(`
285
- `))??[],v=g.length>_m,_=c?o:g.slice(0,_m).join(`
286
- `);let b="";if(s!=null)try{b=JSON.stringify(s,null,2)}catch{b=String(s)}return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${p?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,children:a.jsx(zj,{size:qt,"aria-hidden":"true"})}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),m&&a.jsx("span",{className:I.fileName,children:m})]}),p&&b&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:b}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!p&&o&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:_}),v&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),c?"collapse":`${g.length-_m} more lines`]})]})]})}const gA="_badgePill_o7eqc_1",vA="_modelBadge_o7eqc_14",yA="_backgroundBadge_o7eqc_26",bA="_backgroundDot_o7eqc_36",_A="_backgroundDotPulsing_o7eqc_41",xA="_description_o7eqc_55",kA="_statusLine_o7eqc_62",SA="_statusCompleted_o7eqc_72",jA="_statusRunning_o7eqc_77",TA="_statusError_o7eqc_83",NA="_promptToggle_o7eqc_88",vs={badgePill:gA,modelBadge:vA,backgroundBadge:yA,backgroundDot:bA,backgroundDotPulsing:_A,description:xA,statusLine:kA,statusCompleted:SA,statusRunning:jA,statusError:TA,promptToggle:NA};function wA(t,s){if(s==null||typeof s!="object")return{};const o=s;return t.toLowerCase()==="read_agent"?{agentId:typeof o.agent_id=="string"?o.agent_id:void 0,isPoll:!0}:typeof o.agent_type=="string"||typeof o.name=="string"?{agentType:typeof o.agent_type=="string"?o.agent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.mode==="background",agentName:typeof o.name=="string"?o.name:void 0}:{agentType:typeof o.subagent_type=="string"?o.subagent_type:void 0,description:typeof o.description=="string"?o.description:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,isBackground:o.run_in_background===!0,model:typeof o.model=="string"?o.model:void 0,isResume:typeof o.resume=="string"&&o.resume.length>0}}const CA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function EA(t){const s=CA.exec(t);if(!s)return;const o=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:o?o.trim():void 0}}const xm=5;function AA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,m]=y.useState(!1),p=wA(t,s),g=o===void 0,v=p.isPoll&&o?EA(o):void 0,_=(v==null?void 0:v.content)??o,b=(_==null?void 0:_.split(`
287
- `))??[],x=b.length>xm,k=c?_:b.slice(0,xm).join(`
288
- `),j=p.isPoll?"Subagent":"Agent";return a.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardTeal} ${g?I.inProgress:""}`,"data-testid":"tool-card-agent",children:[a.jsxs("div",{className:I.header,children:[a.jsx("span",{className:I.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),a.jsx("span",{className:I.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),p.agentType&&a.jsx("span",{className:vs.badgePill,"data-testid":"tool-card-agent-type",children:p.agentType}),p.model&&a.jsx("span",{className:vs.modelBadge,"data-testid":"tool-card-agent-model",children:p.model}),p.isBackground&&a.jsxs("span",{className:vs.backgroundBadge,"data-testid":"tool-card-agent-background",children:[a.jsx("span",{className:g?vs.backgroundDotPulsing:vs.backgroundDot,children:"●"}),"BG"]}),p.agentName&&a.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-name",children:p.agentName}),p.agentId&&a.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:p.agentId}),a.jsx("span",{className:I.spacer}),g&&!p.isBackground&&a.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),p.description&&a.jsx("div",{className:vs.description,"data-testid":"tool-card-agent-description",children:p.isResume?`Resuming: ${p.description}`:p.description}),v&&a.jsxs("div",{className:vs.statusLine,"data-testid":"tool-card-agent-status",children:[a.jsx("span",{className:v.status==="completed"?vs.statusCompleted:v.status==="running"?vs.statusRunning:vs.statusError,children:v.status}),v.metadata&&a.jsx("span",{children:v.metadata})]}),p.prompt&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:vs.promptToggle,onClick:()=>{m(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[a.jsx("span",{className:`${I.chevron} ${u?I.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-prompt",children:p.prompt})]}),r&&o&&a.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&_&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:k}),x&&a.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${b.length-xm} more lines`]})]})]})}function km(t){switch(OC(t.tool)){case"file-read":return a.jsx(Oy,{...t});case"file-edit":return a.jsx(_E,{...t});case"file-write":return a.jsx(Oy,{...t,writeVariant:!0});case"shell":return a.jsx(TE,{...t});case"search":return a.jsx(wE,{...t});case"todo":return a.jsx(FE,{...t});case"metadata":return a.jsx(KE,{...t});case"finding":return a.jsx(WE,{...t});case"task":return a.jsx(tA,{...t});case"workpad":return a.jsx(aA,{...t});case"knowledge":return a.jsx(rA,{...t});case"ipc":return a.jsx(dA,{...t});case"tool-search":return a.jsx(fA,{...t});case"agent":return a.jsx(AA,{...t});default:return a.jsx(hA,{...t})}}const DA="_systemContextEvent_hmqlm_1",RA="_systemContextHeader_hmqlm_7",MA="_systemContextBadge_hmqlm_28",IA="_systemContextToggle_hmqlm_37",OA="_systemContextPre_hmqlm_43",LA="_systemContextEllipsis_hmqlm_54",BA="_systemEvent_hmqlm_58",$A="_systemTimestamp_hmqlm_65",zA="_textEvent_hmqlm_69",HA="_codeBlockWrapper_hmqlm_156",PA="_codeBlockCopyButton_hmqlm_159",UA="_errorEvent_hmqlm_163",VA="_statusEvent_hmqlm_171",qA="_userInputEvent_hmqlm_180",GA="_userInputContent_hmqlm_186",FA="_signalEvent_hmqlm_203",ZA="_signalBadge_hmqlm_214",KA="_signalContent_hmqlm_223",YA="_usageEvent_hmqlm_228",JA="_usageBadge_hmqlm_235",WA="_defaultEvent_hmqlm_244",Vt={systemContextEvent:DA,systemContextHeader:RA,systemContextBadge:MA,systemContextToggle:IA,systemContextPre:OA,systemContextEllipsis:LA,systemEvent:BA,systemTimestamp:$A,textEvent:zA,codeBlockWrapper:HA,codeBlockCopyButton:PA,errorEvent:UA,statusEvent:VA,userInputEvent:qA,userInputContent:GA,signalEvent:FA,signalBadge:ZA,signalContent:KA,usageEvent:YA,usageBadge:JA,defaultEvent:WA},$y=3;function XA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
289
- `),c=r.length>$y,d=s?t:r.slice(0,$y).join(`
290
- `);return a.jsxs("div",{className:Vt.systemContextEvent,"data-testid":"system-context-event",children:[a.jsxs("button",{type:"button",className:Vt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[a.jsx("span",{className:Vt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&a.jsx("span",{className:Vt.systemContextToggle,"aria-hidden":"true",children:s?a.jsx(I_,{size:it}):a.jsx(pa,{size:it})})]}),a.jsxs("pre",{className:Vt.systemContextPre,children:[d,!s&&c&&a.jsx("span",{className:Vt.systemContextEllipsis,children:"…"})]})]})}function QA({time:t,content:s}){return a.jsxs("div",{className:Vt.systemEvent,children:[a.jsxs("span",{className:Vt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function tp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(tp).join(""):t!=null&&typeof t=="object"&&"props"in t?tp(t.props.children):""}function eD({children:t,node:s,...o}){const r=tp(t);return a.jsxs("div",{className:Vt.codeBlockWrapper,children:[a.jsx("pre",{...o,children:t}),a.jsx(mC,{text:r,"data-testid":"copy-code-block",className:Vt.codeBlockCopyButton})]})}const tD={pre:eD};function nD({content:t}){return a.jsx("div",{className:Vt.textEvent,children:a.jsx(Ed,{remarkPlugins:[Ad],rehypePlugins:[MC],components:tD,children:t})})}function sD({content:t}){return a.jsxs("div",{className:Vt.errorEvent,children:["Error: ",t]})}function aD({content:t}){return a.jsxs("div",{className:Vt.statusEvent,children:["--- ",t," ---"]})}function iD({content:t}){return a.jsx("div",{className:Vt.userInputEvent,children:a.jsx("span",{className:Vt.userInputContent,children:t})})}function oD({content:t}){return a.jsxs("div",{className:Vt.signalEvent,"data-testid":"signal-event",children:[a.jsx("span",{className:Vt.signalBadge,children:"SIGNAL"}),a.jsx("span",{className:Vt.signalContent,children:t})]})}function rD({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=zo(r+c),u=Is(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return a.jsx("div",{className:Vt.usageEvent,"data-testid":"usage-event",children:a.jsx("span",{className:Vt.usageBadge,children:s})})}function lD({content:t}){return a.jsx("div",{className:Vt.defaultEvent,children:t})}function cD({event:t,toolUseCtx:s,settled:o}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return a.jsx(XA,{content:t.content})}catch{}return a.jsx(QA,{time:r,content:t.content})}case"text":case"output":return a.jsx(nD,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return a.jsx(km,{tool:c,args:d,result:o?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?a.jsx(km,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):a.jsx(km,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return a.jsx(sD,{content:t.content});case"status":return a.jsx(aD,{content:t.content});case"user_input":return a.jsx(iD,{content:t.content});case"signal":return a.jsx(oD,{content:t.content});case"usage":return a.jsx(rD,{content:t.content});default:return a.jsx(lD,{content:t.content})}}const Op=y.createContext({});function Lp(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const zd=y.createContext(null),Bp=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class dD extends y.Component{getSnapshotBeforeUpdate(s){const o=this.props.childRef.current;if(o&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=o.offsetHeight||0,r.width=o.offsetWidth||0,r.top=o.offsetTop,r.left=o.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function uD({children:t,isPresent:s}){const o=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(Bp);return y.useInsertionEffect(()=>{const{width:u,height:m,top:p,left:g}=c.current;if(s||!r.current||!u||!m)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
291
- [data-motion-pop-id="${o}"] {
292
- position: absolute !important;
293
- width: ${u}px !important;
294
- height: ${m}px !important;
295
- top: ${p}px !important;
296
- left: ${g}px !important;
297
- }
298
- `),()=>{document.head.removeChild(v)}},[s]),a.jsx(dD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const fD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const m=Lp(mD),p=y.useId(),g=y.useCallback(_=>{m.set(_,!0);for(const b of m.values())if(!b)return;r&&r()},[m,r]),v=y.useMemo(()=>({id:p,initial:s,isPresent:o,custom:c,onExitComplete:g,register:_=>(m.set(_,!1),()=>m.delete(_))}),d?[Math.random(),g]:[o,g]);return y.useMemo(()=>{m.forEach((_,b)=>m.set(b,!1))},[o]),y.useEffect(()=>{!o&&!m.size&&r&&r()},[o]),u==="popLayout"&&(t=a.jsx(uD,{isPresent:o,children:t})),a.jsx(zd.Provider,{value:v,children:t})};function mD(){return new Map}function rx(t=!0){const s=y.useContext(zd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const qc=t=>t.key||"";function zy(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const $p=typeof window<"u",lx=$p?y.useLayoutEffect:y.useEffect,ls=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[m,p]=rx(u),g=y.useMemo(()=>zy(t),[t]),v=u&&!m?[]:g.map(qc),_=y.useRef(!0),b=y.useRef(g),x=Lp(()=>new Map),[k,j]=y.useState(g),[N,T]=y.useState(g);lx(()=>{_.current=!1,b.current=g;for(let L=0;L<N.length;L++){const E=qc(N[L]);v.includes(E)?x.delete(E):x.get(E)!==!0&&x.set(E,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==k){let L=[...g];for(let E=0;E<N.length;E++){const O=N[E],z=qc(O);v.includes(z)||(L.splice(E,0,O),C.push(O))}d==="wait"&&C.length&&(L=C),T(zy(L)),j(g);return}const{forceRender:A}=y.useContext(Op);return a.jsx(a.Fragment,{children:N.map(L=>{const E=qc(L),O=u&&!m?!1:g===N||v.includes(E),z=()=>{if(x.has(E))x.set(E,!0);else return;let D=!0;x.forEach(H=>{H||(D=!1)}),D&&(A==null||A(),T(b.current),u&&(p==null||p()),r&&r())};return a.jsx(fD,{isPresent:O,initial:!_.current||o?void 0:!1,custom:O?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:O?void 0:z,children:L},E)})})},Hn=t=>t;let cx=Hn;const pD={useManualTiming:!1};function hD(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function m(g){d.has(g)&&(p.schedule(g),t()),g(u)}const p={schedule:(g,v=!1,_=!1)=>{const x=_&&r?s:o;return v&&d.add(g),x.has(g)||x.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(m),s.clear(),r=!1,c&&(c=!1,p.process(g))}};return p}const Gc=["read","resolveKeyframes","update","preRender","render","postRender"],gD=40;function dx(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Gc.reduce((T,C)=>(T[C]=hD(d),T),{}),{read:m,resolveKeyframes:p,update:g,preRender:v,render:_,postRender:b}=u,x=()=>{const T=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,gD),1),c.timestamp=T,c.isProcessing=!0,m.process(c),p.process(c),g.process(c),v.process(c),_.process(c),b.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(x))},k=()=>{o=!0,r=!0,c.isProcessing||t(x)};return{schedule:Gc.reduce((T,C)=>{const A=u[C];return T[C]=(L,E=!1,O=!1)=>(o||k(),A.schedule(L,E,O)),T},{}),cancel:T=>{for(let C=0;C<Gc.length;C++)u[Gc[C]].cancel(T)},state:c,steps:u}}const{schedule:wt,cancel:Xa,state:fn,steps:Sm}=dx(typeof requestAnimationFrame<"u"?requestAnimationFrame:Hn,!0),ux=y.createContext({strict:!1}),Hy={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"]},Ho={};for(const t in Hy)Ho[t]={isEnabled:s=>Hy[t].some(o=>!!s[o])};function vD(t){for(const s in t)Ho[s]={...Ho[s],...t[s]}}const yD=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 pd(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||yD.has(t)}let fx=t=>!pd(t);function bD(t){t&&(fx=s=>s.startsWith("on")?!pd(s):t(s))}try{bD(require("@emotion/is-prop-valid").default)}catch{}function _D(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(fx(c)||o===!0&&pd(c)||!s&&!pd(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function xD(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Hd=y.createContext({});function dl(t){return typeof t=="string"||Array.isArray(t)}function Pd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const zp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Hp=["initial",...zp];function Ud(t){return Pd(t.animate)||Hp.some(s=>dl(t[s]))}function mx(t){return!!(Ud(t)||t.variants)}function kD(t,s){if(Ud(t)){const{initial:o,animate:r}=t;return{initial:o===!1||dl(o)?o:void 0,animate:dl(r)?r:void 0}}return t.inherit!==!1?s:{}}function SD(t){const{initial:s,animate:o}=kD(t,y.useContext(Hd));return y.useMemo(()=>({initial:s,animate:o}),[Py(s),Py(o)])}function Py(t){return Array.isArray(t)?t.join(" "):t}const jD=Symbol.for("motionComponentSymbol");function Mo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function TD(t,s,o){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):Mo(o)&&(o.current=r))},[s])}const Pp=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ND="framerAppearId",px="data-"+Pp(ND),{schedule:Up}=dx(queueMicrotask,!1),hx=y.createContext({});function wD(t,s,o,r,c){var d,u;const{visualElement:m}=y.useContext(Hd),p=y.useContext(ux),g=y.useContext(zd),v=y.useContext(Bp).reducedMotion,_=y.useRef(null);r=r||p.renderer,!_.current&&r&&(_.current=r(t,{visualState:s,parent:m,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const b=_.current,x=y.useContext(hx);b&&!b.projection&&c&&(b.type==="html"||b.type==="svg")&&CD(_.current,o,c,x);const k=y.useRef(!1);y.useInsertionEffect(()=>{b&&k.current&&b.update(o,g)});const j=o[px],N=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return lx(()=>{b&&(k.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),Up.render(b.render),N.current&&b.animationState&&b.animationState.animateChanges())}),y.useEffect(()=>{b&&(!N.current&&b.animationState&&b.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,j)}),N.current=!1))}),b}function CD(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:m,layoutScroll:p,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:gx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||m&&Mo(m),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:p,layoutRoot:g})}function gx(t){if(t)return t.options.allowProjection!==!1?t.projection:gx(t.parent)}function ED({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&vD(t);function m(g,v){let _;const b={...y.useContext(Bp),...g,layoutId:AD(g)},{isStatic:x}=b,k=SD(g),j=r(g,x);if(!x&&$p){DD();const N=RD(b);_=N.MeasureLayout,k.visualElement=wD(c,j,b,s,N.ProjectionNode)}return a.jsxs(Hd.Provider,{value:k,children:[_&&k.visualElement?a.jsx(_,{visualElement:k.visualElement,...b}):null,o(c,g,TD(j,k.visualElement,v),j,x,k.visualElement)]})}m.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const p=y.forwardRef(m);return p[jD]=c,p}function AD({layoutId:t}){const s=y.useContext(Op).id;return s&&t!==void 0?s+"-"+t:t}function DD(t,s){y.useContext(ux).strict}function RD(t){const{drag:s,layout:o}=Ho;if(!s&&!o)return{};const r={...s,...o};return{MeasureLayout:s!=null&&s.isEnabled(t)||o!=null&&o.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const MD=["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 Vp(t){return typeof t!="string"||t.includes("-")?!1:!!(MD.indexOf(t)>-1||/[A-Z]/u.test(t))}function Uy(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function qp(t,s,o,r){if(typeof s=="function"){const[c,d]=Uy(r);s=s(o!==void 0?o:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=Uy(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const np=t=>Array.isArray(t),ID=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),OD=t=>np(t)?t[t.length-1]||0:t,vn=t=>!!(t&&t.getVelocity);function id(t){const s=vn(t)?t.get():t;return ID(s)?s.toValue():s}function LD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:BD(r,c,d,t),renderState:s()};return o&&(u.onMount=m=>o({props:r,current:m,...u}),u.onUpdate=m=>o(m)),u}const vx=t=>(s,o)=>{const r=y.useContext(Hd),c=y.useContext(zd),d=()=>LD(t,s,r,c);return o?d():Lp(d)};function BD(t,s,o,r){const c={},d=r(t,{});for(const b in d)c[b]=id(d[b]);let{initial:u,animate:m}=t;const p=Ud(t),g=mx(t);s&&g&&!p&&t.inherit!==!1&&(u===void 0&&(u=s.initial),m===void 0&&(m=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const _=v?m:u;if(_&&typeof _!="boolean"&&!Pd(_)){const b=Array.isArray(_)?_:[_];for(let x=0;x<b.length;x++){const k=qp(t,b[x]);if(k){const{transitionEnd:j,transition:N,...T}=k;for(const C in T){let A=T[C];if(Array.isArray(A)){const L=v?A.length-1:0;A=A[L]}A!==null&&(c[C]=A)}for(const C in j)c[C]=j[C]}}}return c}const Zo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],zi=new Set(Zo),yx=t=>s=>typeof s=="string"&&s.startsWith(t),bx=yx("--"),$D=yx("var(--"),Gp=t=>$D(t)?zD.test(t.split("/*")[0].trim()):!1,zD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,_x=(t,s)=>s&&typeof t=="number"?s.transform(t):t,fa=(t,s,o)=>o>s?s:o<t?t:o,Ko={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ul={...Ko,transform:t=>fa(0,1,t)},Fc={...Ko,default:1},_l=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ya=_l("deg"),Ls=_l("%"),De=_l("px"),HD=_l("vh"),PD=_l("vw"),Vy={...Ls,parse:t=>Ls.parse(t)/100,transform:t=>Ls.transform(t*100)},UD={borderWidth:De,borderTopWidth:De,borderRightWidth:De,borderBottomWidth:De,borderLeftWidth:De,borderRadius:De,radius:De,borderTopLeftRadius:De,borderTopRightRadius:De,borderBottomRightRadius:De,borderBottomLeftRadius:De,width:De,maxWidth:De,height:De,maxHeight:De,top:De,right:De,bottom:De,left:De,padding:De,paddingTop:De,paddingRight:De,paddingBottom:De,paddingLeft:De,margin:De,marginTop:De,marginRight:De,marginBottom:De,marginLeft:De,backgroundPositionX:De,backgroundPositionY:De},VD={rotate:Ya,rotateX:Ya,rotateY:Ya,rotateZ:Ya,scale:Fc,scaleX:Fc,scaleY:Fc,scaleZ:Fc,skew:Ya,skewX:Ya,skewY:Ya,distance:De,translateX:De,translateY:De,translateZ:De,x:De,y:De,z:De,perspective:De,transformPerspective:De,opacity:ul,originX:Vy,originY:Vy,originZ:De},qy={...Ko,transform:Math.round},Fp={...UD,...VD,zIndex:qy,size:De,fillOpacity:ul,strokeOpacity:ul,numOctaves:qy},qD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},GD=Zo.length;function FD(t,s,o){let r="",c=!0;for(let d=0;d<GD;d++){const u=Zo[d],m=t[u];if(m===void 0)continue;let p=!0;if(typeof m=="number"?p=m===(u.startsWith("scale")?1:0):p=parseFloat(m)===0,!p||o){const g=_x(m,Fp[u]);if(!p){c=!1;const v=qD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Zp(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,m=!1;for(const p in s){const g=s[p];if(zi.has(p)){u=!0;continue}else if(bx(p)){c[p]=g;continue}else{const v=_x(g,Fp[p]);p.startsWith("origin")?(m=!0,d[p]=v):r[p]=v}}if(s.transform||(u||o?r.transform=FD(s,t.transform,o):r.transform&&(r.transform="none")),m){const{originX:p="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${p} ${g} ${v}`}}const ZD={offset:"stroke-dashoffset",array:"stroke-dasharray"},KD={offset:"strokeDashoffset",array:"strokeDasharray"};function YD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?ZD:KD;t[d.offset]=De.transform(-r);const u=De.transform(s),m=De.transform(o);t[d.array]=`${u} ${m}`}function Gy(t,s,o){return typeof t=="string"?t:De.transform(s+o*t)}function JD(t,s,o){const r=Gy(s,t.x,t.width),c=Gy(o,t.y,t.height);return`${r} ${c}`}function Kp(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:m=1,pathOffset:p=0,...g},v,_){if(Zp(t,g,_),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:b,style:x,dimensions:k}=t;b.transform&&(k&&(x.transform=b.transform),delete b.transform),k&&(c!==void 0||d!==void 0||x.transform)&&(x.transformOrigin=JD(k,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(b.x=s),o!==void 0&&(b.y=o),r!==void 0&&(b.scale=r),u!==void 0&&YD(b,u,m,p,!1)}const Yp=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),xx=()=>({...Yp(),attrs:{}}),Jp=t=>typeof t=="string"&&t.toLowerCase()==="svg";function kx(t,{style:s,vars:o},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in o)t.style.setProperty(d,o[d])}const Sx=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 jx(t,s,o,r){kx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Sx.has(c)?c:Pp(c),s.attrs[c])}const hd={};function WD(t){Object.assign(hd,t)}function Tx(t,{layout:s,layoutId:o}){return zi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!hd[t]||t==="opacity")}function Wp(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(vn(c[u])||s.style&&vn(s.style[u])||Tx(u,t)||((r=o==null?void 0:o.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function Nx(t,s,o){const r=Wp(t,s,o);for(const c in t)if(vn(t[c])||vn(s[c])){const d=Zo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function XD(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const Fy=["x","y","width","height","cx","cy","r"],QD={useVisualState:vx({scrapeMotionValuesFromProps:Nx,createRenderState:xx,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const m in c)if(zi.has(m)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let m=0;m<Fy.length;m++){const p=Fy[m];t[p]!==s[p]&&(u=!0)}u&&wt.read(()=>{XD(o,r),wt.render(()=>{Kp(r,c,Jp(o.tagName),t.transformTemplate),jx(o,r)})})}})},e4={useVisualState:vx({scrapeMotionValuesFromProps:Wp,createRenderState:Yp})};function wx(t,s,o){for(const r in s)!vn(s[r])&&!Tx(r,o)&&(t[r]=s[r])}function t4({transformTemplate:t},s){return y.useMemo(()=>{const o=Yp();return Zp(o,s,t),Object.assign({},o.vars,o.style)},[s])}function n4(t,s){const o=t.style||{},r={};return wx(r,o,t),Object.assign(r,t4(t,s)),r}function s4(t,s){const o={},r=n4(t,s);return t.drag&&t.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=r,o}function a4(t,s,o,r){const c=y.useMemo(()=>{const d=xx();return Kp(d,s,Jp(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};wx(d,t.style,t),c.style={...d,...c.style}}return c}function i4(t=!1){return(o,r,c,{latestValues:d},u)=>{const p=(Vp(o)?a4:s4)(r,d,u,o),g=_D(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...p,ref:c}:{},{children:_}=r,b=y.useMemo(()=>vn(_)?_.get():_,[_]);return y.createElement(o,{...v,children:b})}}function o4(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Vp(r)?QD:e4,preloadedFeatures:t,useRender:i4(c),createVisualElement:s,Component:r};return ED(u)}}function Cx(t,s){if(!Array.isArray(s))return!1;const o=s.length;if(o!==t.length)return!1;for(let r=0;r<o;r++)if(s[r]!==t[r])return!1;return!0}function Vd(t,s,o){const r=t.getProps();return qp(r,s,o!==void 0?o:r.custom,t)}function Xp(t,s){return t?t[s]||t.default||t:void 0}const Ex=new Set(["width","height","top","left","right","bottom",...Zo]);let od;function r4(){od=void 0}const Bs={now:()=>(od===void 0&&Bs.set(fn.isProcessing||pD.useManualTiming?fn.timestamp:performance.now()),od),set:t=>{od=t,queueMicrotask(r4)}};function Qp(t,s){t.indexOf(s)===-1&&t.push(s)}function eh(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class th{constructor(){this.subscriptions=[]}add(s){return Qp(this.subscriptions,s),()=>eh(this.subscriptions,s)}notify(s,o,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,o,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,o,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Ax(t,s){return s?t*(1e3/s):0}const Zy=30,l4=t=>!isNaN(parseFloat(t));class c4{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Bs.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Bs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=l4(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,o){this.events[s]||(this.events[s]=new th);const r=this.events[s].add(o);return s==="change"?()=>{r(),wt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Bs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Zy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Zy);return Ax(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(s){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=s(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function fl(t,s){return new c4(t,s)}function d4(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,fl(o))}function u4(t,s){const o=Vd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const m=OD(d[u]);d4(t,u,m)}}function f4(t){return!!(vn(t)&&t.add)}function sp(t,s){const o=t.getValue("willChange");if(f4(o))return o.add(s)}function Dx(t){return t.props[px]}function nh(t){let s;return()=>(s===void 0&&(s=t()),s)}const m4=nh(()=>window.ScrollTimeline!==void 0);class p4{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,o){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=o}attachTimeline(s,o){const r=this.animations.map(c=>{if(m4()&&c.attachTimeline)return c.attachTimeline(s);if(typeof o=="function")return o(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let o=0;o<this.animations.length;o++)s=Math.max(s,this.animations[o].duration);return s}runAll(s){this.animations.forEach(o=>o[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class h4 extends p4{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ra=t=>t*1e3,la=t=>t/1e3;function sh(t){return typeof t=="function"}function Ky(t,s){t.timeline=s,t.onfinish=null}const ah=t=>Array.isArray(t)&&typeof t[0]=="number",g4={linearEasing:void 0};function v4(t,s){const o=nh(t);return()=>{var r;return(r=g4[s])!==null&&r!==void 0?r:o()}}const gd=v4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Po=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},Rx=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Po(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function Mx(t){return!!(typeof t=="function"&&gd()||!t||typeof t=="string"&&(t in ap||gd())||ah(t)||Array.isArray(t)&&t.every(Mx))}const Yr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,ap={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yr([0,.65,.55,1]),circOut:Yr([.55,0,1,.45]),backIn:Yr([.31,.01,.66,-.59]),backOut:Yr([.33,1.53,.69,.99])};function Ix(t,s){if(t)return typeof t=="function"&&gd()?Rx(t,s):ah(t)?Yr(t):Array.isArray(t)?t.map(o=>Ix(o,s)||ap.easeOut):ap[t]}const Ox=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,y4=1e-7,b4=12;function _4(t,s,o,r,c){let d,u,m=0;do u=s+(o-s)/2,d=Ox(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>y4&&++m<b4);return u}function xl(t,s,o,r){if(t===s&&o===r)return Hn;const c=d=>_4(d,0,1,t,o);return d=>d===0||d===1?d:Ox(c(d),s,r)}const Lx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,Bx=t=>s=>1-t(1-s),$x=xl(.33,1.53,.69,.99),ih=Bx($x),zx=Lx(ih),Hx=t=>(t*=2)<1?.5*ih(t):.5*(2-Math.pow(2,-10*(t-1))),oh=t=>1-Math.sin(Math.acos(t)),Px=Bx(oh),Ux=Lx(oh),Vx=t=>/^0[^.\s]+$/u.test(t);function x4(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Vx(t):!0}const el=t=>Math.round(t*1e5)/1e5,rh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function k4(t){return t==null}const S4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lh=(t,s)=>o=>!!(typeof o=="string"&&S4.test(o)&&o.startsWith(t)||s&&!k4(o)&&Object.prototype.hasOwnProperty.call(o,s)),qx=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,m]=r.match(rh);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:m!==void 0?parseFloat(m):1}},j4=t=>fa(0,255,t),jm={...Ko,transform:t=>Math.round(j4(t))},Ei={test:lh("rgb","red"),parse:qx("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+jm.transform(t)+", "+jm.transform(s)+", "+jm.transform(o)+", "+el(ul.transform(r))+")"};function T4(t){let s="",o="",r="",c="";return t.length>5?(s=t.substring(1,3),o=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),o=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,o+=o,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(o,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const ip={test:lh("#"),parse:T4,transform:Ei.transform},Io={test:lh("hsl","hue"),parse:qx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ls.transform(el(s))+", "+Ls.transform(el(o))+", "+el(ul.transform(r))+")"},gn={test:t=>Ei.test(t)||ip.test(t)||Io.test(t),parse:t=>Ei.test(t)?Ei.parse(t):Io.test(t)?Io.parse(t):ip.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ei.transform(t):Io.transform(t)},N4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function w4(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(rh))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(N4))===null||o===void 0?void 0:o.length)||0)>0}const Gx="number",Fx="color",C4="var",E4="var(",Yy="${}",A4=/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 ml(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const m=s.replace(A4,p=>(gn.test(p)?(r.color.push(d),c.push(Fx),o.push(gn.parse(p))):p.startsWith(E4)?(r.var.push(d),c.push(C4),o.push(p)):(r.number.push(d),c.push(Gx),o.push(parseFloat(p))),++d,Yy)).split(Yy);return{values:o,split:m,indexes:r,types:c}}function Zx(t){return ml(t).values}function Kx(t){const{split:s,types:o}=ml(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const m=o[u];m===Gx?d+=el(c[u]):m===Fx?d+=gn.transform(c[u]):d+=c[u]}return d}}const D4=t=>typeof t=="number"?0:t;function R4(t){const s=Zx(t);return Kx(t)(s.map(D4))}const Qa={test:w4,parse:Zx,createTransformer:Kx,getAnimatableNone:R4},M4=new Set(["brightness","contrast","saturate","opacity"]);function I4(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(rh)||[];if(!r)return t;const c=o.replace(r,"");let d=M4.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const O4=/\b([a-z-]*)\(.*?\)/gu,op={...Qa,getAnimatableNone:t=>{const s=t.match(O4);return s?s.map(I4).join(" "):t}},L4={...Fp,color:gn,backgroundColor:gn,outlineColor:gn,fill:gn,stroke:gn,borderColor:gn,borderTopColor:gn,borderRightColor:gn,borderBottomColor:gn,borderLeftColor:gn,filter:op,WebkitFilter:op},ch=t=>L4[t];function Yx(t,s){let o=ch(t);return o!==op&&(o=Qa),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const B4=new Set(["auto","none","0"]);function $4(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!B4.has(d)&&ml(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=Yx(o,c)}const Jy=t=>t===Ko||t===De,Wy=(t,s)=>parseFloat(t.split(", ")[s]),Xy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Wy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Wy(d[1],t):0}},z4=new Set(["x","y","z"]),H4=Zo.filter(t=>!z4.has(t));function P4(t){const s=[];return H4.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Uo={width:({x:t},{paddingLeft:s="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),height:({y:t},{paddingTop:s="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:Xy(4,13),y:Xy(5,14)};Uo.translateX=Uo.x;Uo.translateY=Uo.y;const Di=new Set;let rp=!1,lp=!1;function Jx(){if(lp){const t=Array.from(Di).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=P4(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var m;(m=r.getValue(d))===null||m===void 0||m.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}lp=!1,rp=!1,Di.forEach(t=>t.complete()),Di.clear()}function Wx(){Di.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(lp=!0)})}function U4(){Wx(),Jx()}class dh{constructor(s,o,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=o,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Di.add(this),rp||(rp=!0,wt.read(Wx),wt.resolveKeyframes(Jx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),m=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const p=r.readValue(o,m);p!=null&&(s[0]=p)}s[0]===void 0&&(s[0]=m),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Di.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Di.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Xx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),V4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function q4(t){const s=V4.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function Qx(t,s,o=1){const[r,c]=q4(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return Xx(u)?parseFloat(u):u}return Gp(c)?Qx(c,s,o+1):c}const e1=t=>s=>s.test(t),G4={test:t=>t==="auto",parse:t=>t},t1=[Ko,De,Ls,Ya,PD,HD,G4],Qy=t=>t1.find(e1(t));class n1 extends dh{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let p=0;p<s.length;p++){let g=s[p];if(typeof g=="string"&&(g=g.trim(),Gp(g))){const v=Qx(g,o.current);v!==void 0&&(s[p]=v),p===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Ex.has(r)||s.length!==2)return;const[c,d]=s,u=Qy(c),m=Qy(d);if(u!==m)if(Jy(u)&&Jy(m))for(let p=0;p<s.length;p++){const g=s[p];typeof g=="string"&&(s[p]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)x4(s[c])&&r.push(c);r.length&&$4(s,r,o)}measureInitialState(){const{element:s,unresolvedKeyframes:o,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Uo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,m=c[u];c[u]=Uo[r](o.measureViewportBox(),window.getComputedStyle(o.current)),m!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=m),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([p,g])=>{o.getValue(p).set(g)}),this.resolveNoneKeyframes()}}const eb=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Qa.test(t)||t==="0")&&!t.startsWith("url("));function F4(t){const s=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==s)return!0}function Z4(t,s,o,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=eb(c,s),m=eb(d,s);return!u||!m?!1:F4(t)||(o==="spring"||sh(o))&&r}const K4=t=>t!==null;function qd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(K4),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const Y4=40;class s1{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...m}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Bs.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...m},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>Y4?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&U4(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Bs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:m,onUpdate:p,isGenerator:g}=this.options;if(!g&&!Z4(s,r,c,d))if(u)this.options.duration=0;else{p&&p(qd(s,this.options,o)),m&&m(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const cp=2e4;function a1(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<cp;)s+=o,r=t.next(s);return s>=cp?1/0:s}const Ot=(t,s,o)=>t+(s-t)*o;function Tm(t,s,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(s-t)*6*o:o<1/2?s:o<2/3?t+(s-t)*(2/3-o)*6:t}function J4({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const m=o<.5?o*(1+s):o+s-o*s,p=2*o-m;c=Tm(p,m,t+1/3),d=Tm(p,m,t),u=Tm(p,m,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function vd(t,s){return o=>o>0?s:t}const Nm=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},W4=[ip,Ei,Io],X4=t=>W4.find(s=>s.test(t));function tb(t){const s=X4(t);if(!s)return!1;let o=s.parse(t);return s===Io&&(o=J4(o)),o}const nb=(t,s)=>{const o=tb(t),r=tb(s);if(!o||!r)return vd(t,s);const c={...o};return d=>(c.red=Nm(o.red,r.red,d),c.green=Nm(o.green,r.green,d),c.blue=Nm(o.blue,r.blue,d),c.alpha=Ot(o.alpha,r.alpha,d),Ei.transform(c))},Q4=(t,s)=>o=>s(t(o)),kl=(...t)=>t.reduce(Q4),dp=new Set(["none","hidden"]);function eR(t,s){return dp.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function tR(t,s){return o=>Ot(t,s,o)}function uh(t){return typeof t=="number"?tR:typeof t=="string"?Gp(t)?vd:gn.test(t)?nb:aR:Array.isArray(t)?i1:typeof t=="object"?gn.test(t)?nb:nR:vd}function i1(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>uh(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function nR(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=uh(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function sR(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],m=t.indexes[u][c[u]],p=(o=t.values[m])!==null&&o!==void 0?o:0;r[d]=p,c[u]++}return r}const aR=(t,s)=>{const o=Qa.createTransformer(s),r=ml(t),c=ml(s);return r.indexes.var.length===c.indexes.var.length&&r.indexes.color.length===c.indexes.color.length&&r.indexes.number.length>=c.indexes.number.length?dp.has(t)&&!c.values.length||dp.has(s)&&!r.values.length?eR(t,s):kl(i1(sR(r,c),c.values),o):vd(t,s)};function o1(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Ot(t,s,o):uh(t)(t,s)}const iR=5;function r1(t,s,o){const r=Math.max(s-iR,0);return Ax(o-t(r),s-r)}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},wm=.001;function oR({duration:t=$t.duration,bounce:s=$t.bounce,velocity:o=$t.velocity,mass:r=$t.mass}){let c,d,u=1-s;u=fa($t.minDamping,$t.maxDamping,u),t=fa($t.minDuration,$t.maxDuration,la(t)),u<1?(c=g=>{const v=g*u,_=v*t,b=v-o,x=up(g,u),k=Math.exp(-_);return wm-b/x*k},d=g=>{const _=g*u*t,b=_*o+o,x=Math.pow(u,2)*Math.pow(g,2)*t,k=Math.exp(-_),j=up(Math.pow(g,2),u);return(-c(g)+wm>0?-1:1)*((b-x)*k)/j}):(c=g=>{const v=Math.exp(-g*t),_=(g-o)*t+1;return-wm+v*_},d=g=>{const v=Math.exp(-g*t),_=(o-g)*(t*t);return v*_});const m=5/t,p=lR(c,d,m);if(t=ra(t),isNaN(p))return{stiffness:$t.stiffness,damping:$t.damping,duration:t};{const g=Math.pow(p,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const rR=12;function lR(t,s,o){let r=o;for(let c=1;c<rR;c++)r=r-t(r)/s(r);return r}function up(t,s){return t*Math.sqrt(1-s*s)}const cR=["duration","bounce"],dR=["stiffness","damping","mass"];function sb(t,s){return s.some(o=>t[o]!==void 0)}function uR(t){let s={velocity:$t.velocity,stiffness:$t.stiffness,damping:$t.damping,mass:$t.mass,isResolvedFromDuration:!1,...t};if(!sb(t,dR)&&sb(t,cR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*fa(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:$t.mass,stiffness:c,damping:d}}else{const o=oR(t);s={...s,...o,mass:$t.mass},s.isResolvedFromDuration=!0}return s}function l1(t=$t.visualDuration,s=$t.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],m={done:!1,value:d},{stiffness:p,damping:g,mass:v,duration:_,velocity:b,isResolvedFromDuration:x}=uR({...o,velocity:-la(o.velocity||0)}),k=b||0,j=g/(2*Math.sqrt(p*v)),N=u-d,T=la(Math.sqrt(p/v)),C=Math.abs(N)<5;r||(r=C?$t.restSpeed.granular:$t.restSpeed.default),c||(c=C?$t.restDelta.granular:$t.restDelta.default);let A;if(j<1){const E=up(T,j);A=O=>{const z=Math.exp(-j*T*O);return u-z*((k+j*T*N)/E*Math.sin(E*O)+N*Math.cos(E*O))}}else if(j===1)A=E=>u-Math.exp(-T*E)*(N+(k+T*N)*E);else{const E=T*Math.sqrt(j*j-1);A=O=>{const z=Math.exp(-j*T*O),D=Math.min(E*O,300);return u-z*((k+j*T*N)*Math.sinh(D)+E*N*Math.cosh(D))/E}}const L={calculatedDuration:x&&_||null,next:E=>{const O=A(E);if(x)m.done=E>=_;else{let z=0;j<1&&(z=E===0?ra(k):r1(A,E,O));const D=Math.abs(z)<=r,H=Math.abs(u-O)<=c;m.done=D&&H}return m.value=m.done?u:O,m},toString:()=>{const E=Math.min(a1(L),cp),O=Rx(z=>L.next(E*z).value,E,30);return E+"ms "+O}};return L}function ab({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:m,max:p,restDelta:g=.5,restSpeed:v}){const _=t[0],b={done:!1,value:_},x=D=>m!==void 0&&D<m||p!==void 0&&D>p,k=D=>m===void 0?p:p===void 0||Math.abs(m-D)<Math.abs(p-D)?m:p;let j=o*s;const N=_+j,T=u===void 0?N:u(N);T!==N&&(j=T-_);const C=D=>-j*Math.exp(-D/r),A=D=>T+C(D),L=D=>{const H=C(D),Y=A(D);b.done=Math.abs(H)<=g,b.value=b.done?T:Y};let E,O;const z=D=>{x(b.value)&&(E=D,O=l1({keyframes:[b.value,k(b.value)],velocity:r1(A,D,b.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return z(0),{calculatedDuration:null,next:D=>{let H=!1;return!O&&E===void 0&&(H=!0,L(D),z(D)),E!==void 0&&D>=E?O.next(D-E):(!H&&L(D),b)}}}const fR=xl(.42,0,1,1),mR=xl(0,0,.58,1),c1=xl(.42,0,.58,1),pR=t=>Array.isArray(t)&&typeof t[0]!="number",hR={linear:Hn,easeIn:fR,easeInOut:c1,easeOut:mR,circIn:oh,circInOut:Ux,circOut:Px,backIn:ih,backInOut:zx,backOut:$x,anticipate:Hx},ib=t=>{if(ah(t)){cx(t.length===4);const[s,o,r,c]=t;return xl(s,o,r,c)}else if(typeof t=="string")return hR[t];return t};function gR(t,s,o){const r=[],c=o||o1,d=t.length-1;for(let u=0;u<d;u++){let m=c(t[u],t[u+1]);if(s){const p=Array.isArray(s)?s[u]||Hn:s;m=kl(p,m)}r.push(m)}return r}function vR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(cx(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const m=gR(s,r,c),p=m.length,g=v=>{if(u&&v<t[0])return s[0];let _=0;if(p>1)for(;_<t.length-2&&!(v<t[_+1]);_++);const b=Po(t[_],t[_+1],v);return m[_](b)};return o?v=>g(fa(t[0],t[d-1],v)):g}function yR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Po(0,s,r);t.push(Ot(o,1,c))}}function bR(t){const s=[0];return yR(s,t.length-1),s}function _R(t,s){return t.map(o=>o*s)}function xR(t,s){return t.map(()=>s||c1).splice(0,t.length-1)}function yd({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=pR(r)?r.map(ib):ib(r),d={done:!1,value:s[0]},u=_R(o&&o.length===s.length?o:bR(s),t),m=vR(u,s,{ease:Array.isArray(c)?c:xR(s,c)});return{calculatedDuration:t,next:p=>(d.value=m(p),d.done=p>=t,d)}}const kR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>wt.update(s,!0),stop:()=>Xa(s),now:()=>fn.isProcessing?fn.timestamp:Bs.now()}},SR={decay:ab,inertia:ab,tween:yd,keyframes:yd,spring:l1},jR=t=>t/100;class fh extends s1{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:p}=this.options;p&&p()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||dh,m=(p,g)=>this.onKeyframesResolved(p,g);this.resolver=new u(d,m,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,m=sh(o)?o:SR[o]||yd;let p,g;m!==yd&&typeof s[0]!="number"&&(p=kl(jR,o1(s[0],s[1])),s=[0,100]);const v=m({...this.options,keyframes:s});d==="mirror"&&(g=m({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=a1(v));const{calculatedDuration:_}=v,b=_+c,x=b*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:p,calculatedDuration:_,resolvedDuration:b,totalDuration:x}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:D}=this.options;return{done:!0,value:D[D.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:m,keyframes:p,calculatedDuration:g,totalDuration:v,resolvedDuration:_}=r;if(this.startTime===null)return d.next(0);const{delay:b,repeat:x,repeatType:k,repeatDelay:j,onUpdate:N}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-b*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let A=this.currentTime,L=d;if(x){const D=Math.min(this.currentTime,v)/_;let H=Math.floor(D),Y=D%1;!Y&&D>=1&&(Y=1),Y===1&&H--,H=Math.min(H,x+1),!!(H%2)&&(k==="reverse"?(Y=1-Y,j&&(Y-=j/_)):k==="mirror"&&(L=u)),A=fa(0,1,Y)*_}const E=C?{done:!1,value:p[0]}:L.next(A);m&&(E.value=m(E.value));let{done:O}=E;!C&&g!==null&&(O=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const z=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return z&&c!==void 0&&(E.value=qd(p,this.options,c)),N&&N(E.value),z&&this.finish(),E}get duration(){const{resolved:s}=this;return s?la(s.calculatedDuration):0}get time(){return la(this.currentTime)}set time(s){s=ra(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=la(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=kR,onPlay:o,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),o&&o();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const TR=new Set(["opacity","clipPath","filter","transform"]);function NR(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:m="easeInOut",times:p}={}){const g={[s]:o};p&&(g.offset=p);const v=Ix(m,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const wR=nh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),bd=10,CR=2e4;function ER(t){return sh(t.type)||t.type==="spring"||!Mx(t.ease)}function AR(t,s){const o=new fh({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const c=[];let d=0;for(;!r.done&&d<CR;)r=o.sample(d),c.push(r.value),d+=bd;return{times:void 0,keyframes:c,duration:d-bd,ease:"linear"}}const d1={anticipate:Hx,backInOut:zx,circInOut:Ux};function DR(t){return t in d1}class ob extends s1{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new n1(d,(u,m)=>this.onKeyframesResolved(u,m),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:m,name:p,startTime:g}=this.options;if(!m.owner||!m.owner.current)return!1;if(typeof d=="string"&&gd()&&DR(d)&&(d=d1[d]),ER(this.options)){const{onComplete:_,onUpdate:b,motionValue:x,element:k,...j}=this.options,N=AR(s,j);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=NR(m.owner.current,p,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Ky(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:_}=this.options;m.set(qd(s,this.options,o)),_&&_(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return la(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return la(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ra(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return Hn;const{animation:r}=o;Ky(r,s)}return Hn}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:m}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:_,element:b,...x}=this.options,k=new fh({...x,keyframes:r,duration:c,type:d,ease:u,times:m,isGenerator:!0}),j=ra(this.time);g.setWithVelocity(k.sample(j-bd).value,k.sample(j).value,bd)}const{onStop:p}=this.options;p&&p(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:m}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:p,transformTemplate:g}=o.owner.getProps();return wR()&&r&&TR.has(r)&&!p&&!g&&!c&&d!=="mirror"&&u!==0&&m!=="inertia"}}const RR={type:"spring",stiffness:500,damping:25,restSpeed:10},MR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),IR={type:"keyframes",duration:.8},OR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},LR=(t,{keyframes:s})=>s.length>2?IR:zi.has(t)?t.startsWith("scale")?MR(s[1]):RR:OR;function BR({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:m,from:p,elapsed:g,...v}){return!!Object.keys(v).length}const mh=(t,s,o,r={},c,d)=>u=>{const m=Xp(r,t)||{},p=m.delay||r.delay||0;let{elapsed:g=0}=r;g=g-ra(p);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...m,delay:-g,onUpdate:b=>{s.set(b),m.onUpdate&&m.onUpdate(b)},onComplete:()=>{u(),m.onComplete&&m.onComplete()},name:t,motionValue:s,element:d?void 0:c};BR(m)||(v={...v,...LR(t,v)}),v.duration&&(v.duration=ra(v.duration)),v.repeatDelay&&(v.repeatDelay=ra(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let _=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(_=!0)),_&&!d&&s.get()!==void 0){const b=qd(v.keyframes,m);if(b!==void 0)return wt.update(()=>{v.onUpdate(b),v.onComplete()}),new h4([])}return!d&&ob.supports(v)?new ob(v):new fh(v)};function $R({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function u1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:m,...p}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const _ in p){const b=t.getValue(_,(d=t.latestValues[_])!==null&&d!==void 0?d:null),x=p[_];if(x===void 0||v&&$R(v,_))continue;const k={delay:o,...Xp(u||{},_)};let j=!1;if(window.MotionHandoffAnimation){const T=Dx(t);if(T){const C=window.MotionHandoffAnimation(T,_,wt);C!==null&&(k.startTime=C,j=!0)}}sp(t,_),b.start(mh(_,b,x,t.shouldReduceMotion&&Ex.has(_)?{type:!1}:k,t,j));const N=b.animation;N&&g.push(N)}return m&&Promise.all(g).then(()=>{wt.update(()=>{m&&u4(t,m)})}),g}function fp(t,s,o={}){var r;const c=Vd(t,s,o.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const u=c?()=>Promise.all(u1(t,c,o)):()=>Promise.resolve(),m=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:_,staggerDirection:b}=d;return zR(t,s,v+g,_,b,o)}:()=>Promise.resolve(),{when:p}=d;if(p){const[g,v]=p==="beforeChildren"?[u,m]:[m,u];return g().then(()=>v())}else return Promise.all([u(),m(o.delay)])}function zR(t,s,o=0,r=0,c=1,d){const u=[],m=(t.variantChildren.size-1)*r,p=c===1?(g=0)=>g*r:(g=0)=>m-g*r;return Array.from(t.variantChildren).sort(HR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(fp(g,s,{...d,delay:o+p(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function HR(t,s){return t.sortNodePosition(s)}function PR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>fp(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=fp(t,s,o);else{const c=typeof s=="function"?Vd(t,s,o.custom):s;r=Promise.all(u1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const UR=Hp.length;function f1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?f1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<UR;o++){const r=Hp[o],c=t.props[r];(dl(c)||c===!1)&&(s[r]=c)}return s}const VR=[...zp].reverse(),qR=zp.length;function GR(t){return s=>Promise.all(s.map(({animation:o,options:r})=>PR(t,o,r)))}function FR(t){let s=GR(t),o=rb(),r=!0;const c=p=>(g,v)=>{var _;const b=Vd(t,v,p==="exit"?(_=t.presenceContext)===null||_===void 0?void 0:_.custom:void 0);if(b){const{transition:x,transitionEnd:k,...j}=b;g={...g,...j,...k}}return g};function d(p){s=p(t)}function u(p){const{props:g}=t,v=f1(t.parent)||{},_=[],b=new Set;let x={},k=1/0;for(let N=0;N<qR;N++){const T=VR[N],C=o[T],A=g[T]!==void 0?g[T]:v[T],L=dl(A),E=T===p?C.isActive:null;E===!1&&(k=N);let O=A===v[T]&&A!==g[T]&&L;if(O&&r&&t.manuallyAnimateOnMount&&(O=!1),C.protectedKeys={...x},!C.isActive&&E===null||!A&&!C.prevProp||Pd(A)||typeof A=="boolean")continue;const z=ZR(C.prevProp,A);let D=z||T===p&&C.isActive&&!O&&L||N>k&&L,H=!1;const Y=Array.isArray(A)?A:[A];let U=Y.reduce(c(T),{});E===!1&&(U={});const{prevResolvedValues:X={}}=C,ge={...X,...U},W=R=>{D=!0,b.has(R)&&(H=!0,b.delete(R)),C.needsAnimating[R]=!0;const se=t.getValue(R);se&&(se.liveStyle=!1)};for(const R in ge){const se=U[R],oe=X[R];if(x.hasOwnProperty(R))continue;let q=!1;np(se)&&np(oe)?q=!Cx(se,oe):q=se!==oe,q?se!=null?W(R):b.add(R):se!==void 0&&b.has(R)?W(R):C.protectedKeys[R]=!0}C.prevProp=A,C.prevResolvedValues=U,C.isActive&&(x={...x,...U}),r&&t.blockInitialAnimation&&(D=!1),D&&(!(O&&z)||H)&&_.push(...Y.map(R=>({animation:R,options:{type:T}})))}if(b.size){const N={};b.forEach(T=>{const C=t.getBaseTarget(T),A=t.getValue(T);A&&(A.liveStyle=!0),N[T]=C??null}),_.push({animation:N})}let j=!!_.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(_):Promise.resolve()}function m(p,g){var v;if(o[p].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(b=>{var x;return(x=b.animationState)===null||x===void 0?void 0:x.setActive(p,g)}),o[p].isActive=g;const _=u(p);for(const b in o)o[b].protectedKeys={};return _}return{animateChanges:u,setActive:m,setAnimateFunction:d,getState:()=>o,reset:()=>{o=rb(),r=!0}}}function ZR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!Cx(s,t):!1}function ji(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rb(){return{animate:ji(!0),whileInView:ji(),whileHover:ji(),whileTap:ji(),whileDrag:ji(),whileFocus:ji(),exit:ji()}}class ei{constructor(s){this.isMounted=!1,this.node=s}update(){}}class KR extends ei{constructor(s){super(s),s.animationState||(s.animationState=FR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Pd(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let YR=0;class JR extends ei{constructor(){super(...arguments),this.id=YR++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);o&&!s&&c.then(()=>o(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const WR={animation:{Feature:KR},exit:{Feature:JR}},xs={x:!1,y:!1};function m1(){return xs.x||xs.y}function XR(t){return t==="x"||t==="y"?xs[t]?null:(xs[t]=!0,()=>{xs[t]=!1}):xs.x||xs.y?null:(xs.x=xs.y=!0,()=>{xs.x=xs.y=!1})}const ph=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function pl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function Sl(t){return{point:{x:t.pageX,y:t.pageY}}}const QR=t=>s=>ph(s)&&t(s,Sl(s));function tl(t,s,o,r){return pl(t,s,QR(o),r)}const lb=(t,s)=>Math.abs(t-s);function eM(t,s){const o=lb(t.x,s.x),r=lb(t.y,s.y);return Math.sqrt(o**2+r**2)}class p1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=Em(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,x=eM(_.offset,{x:0,y:0})>=3;if(!b&&!x)return;const{point:k}=_,{timestamp:j}=fn;this.history.push({...k,timestamp:j});const{onStart:N,onMove:T}=this.handlers;b||(N&&N(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,_)},this.handlePointerMove=(_,b)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=Cm(b,this.transformPagePoint),wt.update(this.updatePoint,!0)},this.handlePointerUp=(_,b)=>{this.end();const{onEnd:x,onSessionEnd:k,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Em(_.type==="pointercancel"?this.lastMoveEventInfo:Cm(b,this.transformPagePoint),this.history);this.startEvent&&x&&x(_,N),k&&k(_,N)},!ph(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=Sl(s),m=Cm(u,this.transformPagePoint),{point:p}=m,{timestamp:g}=fn;this.history=[{...p,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,Em(m,this.history)),this.removeListeners=kl(tl(this.contextWindow,"pointermove",this.handlePointerMove),tl(this.contextWindow,"pointerup",this.handlePointerUp),tl(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Xa(this.updatePoint)}}function Cm(t,s){return s?{point:s(t.point)}:t}function cb(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Em({point:t},s){return{point:t,delta:cb(t,h1(s)),offset:cb(t,tM(s)),velocity:nM(s,.1)}}function tM(t){return t[0]}function h1(t){return t[t.length-1]}function nM(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=h1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>ra(s)));)o--;if(!r)return{x:0,y:0};const d=la(c.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const u={x:(c.x-r.x)/d,y:(c.y-r.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const g1=1e-4,sM=1-g1,aM=1+g1,v1=.01,iM=0-v1,oM=0+v1;function Un(t){return t.max-t.min}function rM(t,s,o){return Math.abs(t-s)<=o}function db(t,s,o,r=.5){t.origin=r,t.originPoint=Ot(s.min,s.max,t.origin),t.scale=Un(o)/Un(s),t.translate=Ot(o.min,o.max,t.origin)-t.originPoint,(t.scale>=sM&&t.scale<=aM||isNaN(t.scale))&&(t.scale=1),(t.translate>=iM&&t.translate<=oM||isNaN(t.translate))&&(t.translate=0)}function nl(t,s,o,r){db(t.x,s.x,o.x,r?r.originX:void 0),db(t.y,s.y,o.y,r?r.originY:void 0)}function ub(t,s,o){t.min=o.min+s.min,t.max=t.min+Un(s)}function lM(t,s,o){ub(t.x,s.x,o.x),ub(t.y,s.y,o.y)}function fb(t,s,o){t.min=s.min-o.min,t.max=t.min+Un(s)}function sl(t,s,o){fb(t.x,s.x,o.x),fb(t.y,s.y,o.y)}function cM(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Ot(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Ot(o,t,r.max):Math.min(t,o)),t}function mb(t,s,o){return{min:s!==void 0?t.min+s:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function dM(t,{top:s,left:o,bottom:r,right:c}){return{x:mb(t.x,o,c),y:mb(t.y,s,r)}}function pb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function uM(t,s){return{x:pb(t.x,s.x),y:pb(t.y,s.y)}}function fM(t,s){let o=.5;const r=Un(t),c=Un(s);return c>r?o=Po(s.min,s.max-r,t.min):r>c&&(o=Po(t.min,t.max-c,s.min)),fa(0,1,o)}function mM(t,s){const o={};return s.min!==void 0&&(o.min=s.min-t.min),s.max!==void 0&&(o.max=s.max-t.min),o}const mp=.35;function pM(t=mp){return t===!1?t=0:t===!0&&(t=mp),{x:hb(t,"left","right"),y:hb(t,"top","bottom")}}function hb(t,s,o){return{min:gb(t,s),max:gb(t,o)}}function gb(t,s){return typeof t=="number"?t:t[s]||0}const vb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Oo=()=>({x:vb(),y:vb()}),yb=()=>({min:0,max:0}),Pt=()=>({x:yb(),y:yb()});function os(t){return[t("x"),t("y")]}function y1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function hM({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function gM(t,s){if(!s)return t;const o=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:r.y,right:r.x}}function Am(t){return t===void 0||t===1}function pp({scale:t,scaleX:s,scaleY:o}){return!Am(t)||!Am(s)||!Am(o)}function wi(t){return pp(t)||b1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function b1(t){return bb(t.x)||bb(t.y)}function bb(t){return t&&t!=="0%"}function _d(t,s,o){const r=t-o,c=s*r;return o+c}function _b(t,s,o,r,c){return c!==void 0&&(t=_d(t,c,r)),_d(t,o,r)+s}function hp(t,s=0,o=1,r,c){t.min=_b(t.min,s,o,r,c),t.max=_b(t.max,s,o,r,c)}function _1(t,{x:s,y:o}){hp(t.x,s.translate,s.scale,s.originPoint),hp(t.y,o.translate,o.scale,o.originPoint)}const xb=.999999999999,kb=1.0000000000001;function vM(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let m=0;m<c;m++){d=o[m],u=d.projectionDelta;const{visualElement:p}=d.options;p&&p.props.style&&p.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Bo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,_1(t,u)),r&&wi(d.latestValues)&&Bo(t,d.latestValues))}s.x<kb&&s.x>xb&&(s.x=1),s.y<kb&&s.y>xb&&(s.y=1)}function Lo(t,s){t.min=t.min+s,t.max=t.max+s}function Sb(t,s,o,r,c=.5){const d=Ot(t.min,t.max,c);hp(t,s,o,d,r)}function Bo(t,s){Sb(t.x,s.x,s.scaleX,s.scale,s.originX),Sb(t.y,s.y,s.scaleY,s.scale,s.originY)}function x1(t,s){return y1(gM(t.getBoundingClientRect(),s))}function yM(t,s,o){const r=x1(t,o),{scroll:c}=s;return c&&(Lo(r.x,c.offset.x),Lo(r.y,c.offset.y)),r}const k1=({current:t})=>t?t.ownerDocument.defaultView:null,bM=new WeakMap;class _M{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=Pt(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:_}=this.getProps();_?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(Sl(v).point)},d=(v,_)=>{const{drag:b,dragPropagation:x,onDragStart:k}=this.getProps();if(b&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XR(b),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),os(N=>{let T=this.getAxisMotionValue(N).get()||0;if(Ls.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[N];A&&(T=Un(A)*(parseFloat(T)/100))}}this.originPoint[N]=T}),k&&wt.postRender(()=>k(v,_)),sp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,_)=>{const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:k,onDrag:j}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:N}=_;if(x&&this.currentDirection===null){this.currentDirection=xM(N),this.currentDirection!==null&&k&&k(this.currentDirection);return}this.updateAxis("x",_.point,N),this.updateAxis("y",_.point,N),this.visualElement.render(),j&&j(v,_)},m=(v,_)=>this.stop(v,_),p=()=>os(v=>{var _;return this.getAnimationState(v)==="paused"&&((_=this.getAxisMotionValue(v).animation)===null||_===void 0?void 0:_.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new p1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:m,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:k1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&wt.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!Zc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=cM(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&Mo(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=dM(c.layoutBox,o):this.constraints=!1,this.elastic=pM(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&os(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=mM(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Mo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=yM(r,c.root,this.visualElement.getTransformPagePoint());let u=uM(c.layout.layoutBox,d);if(o){const m=o(hM(u));this.hasMutatedConstraints=!!m,m&&(u=y1(m))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:m}=this.getProps(),p=this.constraints||{},g=os(v=>{if(!Zc(v,o,this.currentDirection))return;let _=p&&p[v]||{};u&&(_={min:0,max:0});const b=c?200:1e6,x=c?40:1e7,k={type:"inertia",velocity:r?s[v]:0,bounceStiffness:b,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...d,..._};return this.startAxisValueAnimation(v,k)});return Promise.all(g).then(m)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return sp(this.visualElement,s),r.start(mh(s,r,0,o,this.visualElement,!1))}stopAnimation(){os(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){os(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){os(o=>{const{drag:r}=this.getProps();if(!Zc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:m}=c.layout.layoutBox[o];d.set(s[o]-Ot(u,m,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Mo(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};os(u=>{const m=this.getAxisMotionValue(u);if(m&&this.constraints!==!1){const p=m.get();c[u]=fM({min:p,max:p},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),os(u=>{if(!Zc(u,s,null))return;const m=this.getAxisMotionValue(u),{min:p,max:g}=this.constraints[u];m.set(Ot(p,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;bM.set(this.visualElement,this);const s=this.visualElement.current,o=tl(s,"pointerdown",p=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(p)}),r=()=>{const{dragConstraints:p}=this.getProps();Mo(p)&&p.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),wt.read(r);const u=pl(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:p,hasLayoutChanged:g})=>{this.isDragging&&g&&(os(v=>{const _=this.getAxisMotionValue(v);_&&(this.originPoint[v]+=p[v].translate,_.set(_.get()+p[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),m&&m()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=mp,dragMomentum:m=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:m}}}function Zc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function xM(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class kM extends ei{constructor(s){super(s),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new _M(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const jb=t=>(s,o)=>{t&&wt.postRender(()=>t(s,o))};class SM extends ei{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(s){this.session=new p1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:k1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:jb(s),onStart:jb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&wt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=tl(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 rd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Tb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Vr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(De.test(t))t=parseFloat(t);else return t;const o=Tb(t,s.target.x),r=Tb(t,s.target.y);return`${o}% ${r}%`}},jM={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Qa.parse(t);if(c.length>5)return r;const d=Qa.createTransformer(t),u=typeof c[0]!="number"?1:0,m=o.x.scale*s.x,p=o.y.scale*s.y;c[0+u]/=m,c[1+u]/=p;const g=Ot(m,p,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class TM extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;WD(NM),d&&(o.group&&o.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),rd.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||wt.postRender(()=>{const m=u.getStack();(!m||!m.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Up.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function S1(t){const[s,o]=rx(),r=y.useContext(Op);return a.jsx(TM,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(hx),isPresent:s,safeToRemove:o})}const NM={borderRadius:{...Vr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Vr,borderTopRightRadius:Vr,borderBottomLeftRadius:Vr,borderBottomRightRadius:Vr,boxShadow:jM};function wM(t,s,o){const r=vn(t)?t:fl(t);return r.start(mh("",r,s,o)),r.animation}function CM(t){return t instanceof SVGElement&&t.tagName!=="svg"}const EM=(t,s)=>t.depth-s.depth;class AM{constructor(){this.children=[],this.isDirty=!1}add(s){Qp(this.children,s),this.isDirty=!0}remove(s){eh(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(EM),this.isDirty=!1,this.children.forEach(s)}}function DM(t,s){const o=Bs.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Xa(r),t(d-s))};return wt.read(r,!0),()=>Xa(r)}const j1=["TopLeft","TopRight","BottomLeft","BottomRight"],RM=j1.length,Nb=t=>typeof t=="string"?parseFloat(t):t,wb=t=>typeof t=="number"||De.test(t);function MM(t,s,o,r,c,d){c?(t.opacity=Ot(0,o.opacity!==void 0?o.opacity:1,IM(r)),t.opacityExit=Ot(s.opacity!==void 0?s.opacity:1,0,OM(r))):d&&(t.opacity=Ot(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<RM;u++){const m=`border${j1[u]}Radius`;let p=Cb(s,m),g=Cb(o,m);if(p===void 0&&g===void 0)continue;p||(p=0),g||(g=0),p===0||g===0||wb(p)===wb(g)?(t[m]=Math.max(Ot(Nb(p),Nb(g),r),0),(Ls.test(g)||Ls.test(p))&&(t[m]+="%")):t[m]=g}(s.rotate||o.rotate)&&(t.rotate=Ot(s.rotate||0,o.rotate||0,r))}function Cb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const IM=T1(0,.5,Px),OM=T1(.5,.95,Hn);function T1(t,s,o){return r=>r<t?0:r>s?1:o(Po(t,s,r))}function Eb(t,s){t.min=s.min,t.max=s.max}function ns(t,s){Eb(t.x,s.x),Eb(t.y,s.y)}function Ab(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Db(t,s,o,r,c){return t-=s,t=_d(t,1/o,r),c!==void 0&&(t=_d(t,1/c,r)),t}function LM(t,s=0,o=1,r=.5,c,d=t,u=t){if(Ls.test(s)&&(s=parseFloat(s),s=Ot(u.min,u.max,s/100)-u.min),typeof s!="number")return;let m=Ot(d.min,d.max,r);t===d&&(m-=s),t.min=Db(t.min,s,o,m,c),t.max=Db(t.max,s,o,m,c)}function Rb(t,s,[o,r,c],d,u){LM(t,s[o],s[r],s[c],s.scale,d,u)}const BM=["x","scaleX","originX"],$M=["y","scaleY","originY"];function Mb(t,s,o,r){Rb(t.x,s,BM,o?o.x:void 0,r?r.x:void 0),Rb(t.y,s,$M,o?o.y:void 0,r?r.y:void 0)}function Ib(t){return t.translate===0&&t.scale===1}function N1(t){return Ib(t.x)&&Ib(t.y)}function Ob(t,s){return t.min===s.min&&t.max===s.max}function zM(t,s){return Ob(t.x,s.x)&&Ob(t.y,s.y)}function Lb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function w1(t,s){return Lb(t.x,s.x)&&Lb(t.y,s.y)}function Bb(t){return Un(t.x)/Un(t.y)}function $b(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class HM{constructor(){this.members=[]}add(s){Qp(this.members,s),s.scheduleRender()}remove(s){if(eh(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(s){const o=this.members.findIndex(c=>s===c);if(o===0)return!1;let r;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,o){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,o&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:o,resumingFrom:r}=s;o.onExitComplete&&o.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function PM(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:_,rotateY:b,skewX:x,skewY:k}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),_&&(r+=`rotateX(${_}deg) `),b&&(r+=`rotateY(${b}deg) `),x&&(r+=`skewX(${x}deg) `),k&&(r+=`skewY(${k}deg) `)}const m=t.x.scale*s.x,p=t.y.scale*s.y;return(m!==1||p!==1)&&(r+=`scale(${m}, ${p})`),r||"none"}const Ci={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Jr=typeof window<"u"&&window.MotionDebug!==void 0,Dm=["","X","Y","Z"],UM={visibility:"hidden"},zb=1e3;let VM=0;function Rm(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function C1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Dx(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",wt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&C1(r)}function E1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},m=s==null?void 0:s()){this.id=VM++,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,Jr&&(Ci.totalNodes=Ci.resolvedTargetDeltas=Ci.recalculatedProjection=0),this.nodes.forEach(FM),this.nodes.forEach(WM),this.nodes.forEach(XM),this.nodes.forEach(ZM),Jr&&window.MotionDebug.record(Ci)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,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 p=0;p<this.path.length;p++)this.path[p].shouldResetTransform=!0;this.root===this&&(this.nodes=new AM)}addEventListener(u,m){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new th),this.eventHandlers.get(u).add(m)}notifyListeners(u,...m){const p=this.eventHandlers.get(u);p&&p.notify(...m)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,m=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=CM(u),this.instance=u;const{layoutId:p,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),m&&(g||p)&&(this.isLayoutDirty=!0),t){let _;const b=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,_&&_(),_=DM(b,250),rd.hasAnimatedSinceResize&&(rd.hasAnimatedSinceResize=!1,this.nodes.forEach(Pb))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&v&&(p||g)&&this.addEventListener("didUpdate",({delta:_,hasLayoutChanged:b,hasRelativeTargetChanged:x,layout:k})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||s3,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!w1(this.targetLayout,k)||x,A=!b&&x;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||b&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(_,A);const L={...Xp(j,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(L.delay=0,L.type=!1),this.startAnimation(L)}else b||Pb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=k})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Xa(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(QM),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&C1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const _=this.path[v];_.shouldResetTransform=!0,_.updateScroll("snapshot"),_.options.layoutRoot&&_.willUpdate(!1)}const{layoutId:m,layout:p}=this.options;if(m===void 0&&!p)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Hb);return}this.isUpdating||this.nodes.forEach(YM),this.isUpdating=!1,this.nodes.forEach(JM),this.nodes.forEach(qM),this.nodes.forEach(GM),this.clearAllSnapshots();const m=Bs.now();fn.delta=fa(0,1e3/60,m-fn.timestamp),fn.timestamp=m,fn.isProcessing=!0,Sm.update.process(fn),Sm.preRender.process(fn),Sm.render.process(fn),fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Up.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(KM),this.sharedNodes.forEach(e3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wt.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 p=0;p<this.path.length;p++)this.path[p].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Pt(),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,u?u.layoutBox:void 0)}updateScroll(u="measure"){let m=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(m=!1),m){const p=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:p,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:p}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,m=this.projectionDelta&&!N1(this.projectionDelta),p=this.getTransformTemplate(),g=p?p(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(m||wi(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const m=this.measurePageBox();let p=this.removeElementScroll(m);return u&&(p=this.removeTransform(p)),a3(p),{animationId:this.root.animationId,measuredBox:m,layoutBox:p,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:m}=this.options;if(!m)return Pt();const p=m.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(i3))){const{scroll:v}=this.root;v&&(Lo(p.x,v.offset.x),Lo(p.y,v.offset.y))}return p}removeElementScroll(u){var m;const p=Pt();if(ns(p,u),!((m=this.scroll)===null||m===void 0)&&m.wasRoot)return p;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:_,options:b}=v;v!==this.root&&_&&b.layoutScroll&&(_.wasRoot&&ns(p,u),Lo(p.x,_.offset.x),Lo(p.y,_.offset.y))}return p}applyTransform(u,m=!1){const p=Pt();ns(p,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!m&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Bo(p,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),wi(v.latestValues)&&Bo(p,v.latestValues)}return wi(this.latestValues)&&Bo(p,this.latestValues),p}removeTransform(u){const m=Pt();ns(m,u);for(let p=0;p<this.path.length;p++){const g=this.path[p];if(!g.instance||!wi(g.latestValues))continue;pp(g.latestValues)&&g.updateSnapshot();const v=Pt(),_=g.measurePageBox();ns(v,_),Mb(m,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return wi(this.latestValues)&&Mb(m,this.latestValues),m}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==fn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var m;const p=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=p.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=p.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=p.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==p;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((m=this.parent)===null||m===void 0)&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:_,layoutId:b}=this.options;if(!(!this.layout||!(_||b))){if(this.resolvedRelativeTargetAt=fn.timestamp,!this.targetDelta&&!this.relativeTarget){const x=this.getClosestProjectingParent();x&&x.layout&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Pt(),this.relativeTargetOrigin=Pt(),sl(this.relativeTargetOrigin,this.layout.layoutBox,x.layout.layoutBox),ns(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Pt(),this.targetWithTransforms=Pt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),lM(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ns(this.target,this.layout.layoutBox),_1(this.target,this.targetDelta)):ns(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const x=this.getClosestProjectingParent();x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Pt(),this.relativeTargetOrigin=Pt(),sl(this.relativeTargetOrigin,this.target,x.target),ns(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Jr&&Ci.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||pp(this.parent.latestValues)||b1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const m=this.getLead(),p=!!this.resumingFrom||this!==m;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),p&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===fn.timestamp&&(g=!1),g)return;const{layout:v,layoutId:_}=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||_))return;ns(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,x=this.treeScale.y;vM(this.layoutCorrected,this.treeScale,this.path,p),m.layout&&!m.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(m.target=m.layout.layoutBox,m.targetWithTransforms=Pt());const{target:k}=m;if(!k){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ab(this.prevProjectionDelta.x,this.projectionDelta.x),Ab(this.prevProjectionDelta.y,this.projectionDelta.y)),nl(this.projectionDelta,this.layoutCorrected,k,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==x||!$b(this.projectionDelta.x,this.prevProjectionDelta.x)||!$b(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",k)),Jr&&Ci.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var m;if((m=this.options.visualElement)===null||m===void 0||m.scheduleRender(),u){const p=this.getStack();p&&p.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Oo(),this.projectionDelta=Oo(),this.projectionDeltaWithTransform=Oo()}setAnimationOrigin(u,m=!1){const p=this.snapshot,g=p?p.latestValues:{},v={...this.latestValues},_=Oo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!m;const b=Pt(),x=p?p.source:void 0,k=this.layout?this.layout.source:void 0,j=x!==k,N=this.getStack(),T=!N||N.members.length<=1,C=!!(j&&!T&&this.options.crossfade===!0&&!this.path.some(n3));this.animationProgress=0;let A;this.mixTargetDelta=L=>{const E=L/1e3;Ub(_.x,u.x,E),Ub(_.y,u.y,E),this.setTargetDelta(_),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sl(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),t3(this.relativeTarget,this.relativeTargetOrigin,b,E),A&&zM(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Pt()),ns(A,this.relativeTarget)),j&&(this.animationValues=v,MM(v,g,this.latestValues,E,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Xa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wt.update(()=>{rd.hasAnimatedSinceResize=!0,this.currentAnimation=wM(0,zb,{...u,onUpdate:m=>{this.mixTargetDelta(m),u.onUpdate&&u.onUpdate(m)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(zb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:m,target:p,layout:g,latestValues:v}=u;if(!(!m||!p||!g)){if(this!==u&&this.layout&&g&&A1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){p=this.target||Pt();const _=Un(this.layout.layoutBox.x);p.x.min=u.target.x.min,p.x.max=p.x.min+_;const b=Un(this.layout.layoutBox.y);p.y.min=u.target.y.min,p.y.max=p.y.min+b}ns(m,p),Bo(m,v),nl(this.projectionDeltaWithTransform,this.layoutCorrected,m,v)}}registerSharedNode(u,m){this.sharedNodes.has(u)||this.sharedNodes.set(u,new HM),this.sharedNodes.get(u).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 u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:m}=this.options;return m?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:m}=this.options;return m?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:m,preserveFollowOpacity:p}={}){const g=this.getStack();g&&g.promote(this,p),u&&(this.projectionDelta=void 0,this.needsReset=!0),m&&this.setOptions({transition:m})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let m=!1;const{latestValues:p}=u;if((p.z||p.rotate||p.rotateX||p.rotateY||p.rotateZ||p.skewX||p.skewY)&&(m=!0),!m)return;const g={};p.z&&Rm("z",u,g,this.animationValues);for(let v=0;v<Dm.length;v++)Rm(`rotate${Dm[v]}`,u,g,this.animationValues),Rm(`skew${Dm[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var m,p;if(!this.instance||this.isSVG)return;if(!this.isVisible)return UM;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=id(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const _=this.getLead();if(!this.projectionDelta||!this.layout||!_.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=id(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!wi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const b=_.animationValues||_.latestValues;this.applyTransformsToTarget(),g.transform=PM(this.projectionDeltaWithTransform,this.treeScale,b),v&&(g.transform=v(b,g.transform));const{x,y:k}=this.projectionDelta;g.transformOrigin=`${x.origin*100}% ${k.origin*100}% 0`,_.animationValues?g.opacity=_===this?(p=(m=b.opacity)!==null&&m!==void 0?m:this.latestValues.opacity)!==null&&p!==void 0?p:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:g.opacity=_===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const j in hd){if(b[j]===void 0)continue;const{correct:N,applyTo:T}=hd[j],C=g.transform==="none"?b[j]:N(b[j],_);if(T){const A=T.length;for(let L=0;L<A;L++)g[T[L]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=_===this?id(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var m;return(m=u.currentAnimation)===null||m===void 0?void 0:m.stop()}),this.root.nodes.forEach(Hb),this.root.sharedNodes.clear()}}}function qM(t){t.updateLayout()}function GM(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?os(_=>{const b=u?o.measuredBox[_]:o.layoutBox[_],x=Un(b);b.min=r[_].min,b.max=b.min+x}):A1(d,o.layoutBox,r)&&os(_=>{const b=u?o.measuredBox[_]:o.layoutBox[_],x=Un(r[_]);b.max=b.min+x,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[_].max=t.relativeTarget[_].min+x)});const m=Oo();nl(m,r,o.layoutBox);const p=Oo();u?nl(p,t.applyTransform(c,!0),o.measuredBox):nl(p,r,o.layoutBox);const g=!N1(m);let v=!1;if(!t.resumeFrom){const _=t.getClosestProjectingParent();if(_&&!_.resumeFrom){const{snapshot:b,layout:x}=_;if(b&&x){const k=Pt();sl(k,o.layoutBox,b.layoutBox);const j=Pt();sl(j,r,x.layoutBox),w1(k,j)||(v=!0),_.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=k,t.relativeParent=_)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:p,layoutDelta:m,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function FM(t){Jr&&Ci.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ZM(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function KM(t){t.clearSnapshot()}function Hb(t){t.clearMeasurements()}function YM(t){t.isLayoutDirty=!1}function JM(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Pb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function WM(t){t.resolveTargetDelta()}function XM(t){t.calcProjection()}function QM(t){t.resetSkewAndRotation()}function e3(t){t.removeLeadSnapshot()}function Ub(t,s,o){t.translate=Ot(s.translate,0,o),t.scale=Ot(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Vb(t,s,o,r){t.min=Ot(s.min,o.min,r),t.max=Ot(s.max,o.max,r)}function t3(t,s,o,r){Vb(t.x,s.x,o.x,r),Vb(t.y,s.y,o.y,r)}function n3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const s3={duration:.45,ease:[.4,0,.1,1]},qb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Gb=qb("applewebkit/")&&!qb("chrome/")?Math.round:Hn;function Fb(t){t.min=Gb(t.min),t.max=Gb(t.max)}function a3(t){Fb(t.x),Fb(t.y)}function A1(t,s,o){return t==="position"||t==="preserve-aspect"&&!rM(Bb(s),Bb(o),.2)}function i3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const o3=E1({attachResizeListener:(t,s)=>pl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Mm={current:void 0},D1=E1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Mm.current){const t=new o3({});t.mount(window),t.setOptions({layoutScroll:!0}),Mm.current=t}return Mm.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),r3={pan:{Feature:SM},drag:{Feature:kM,ProjectionNode:D1,MeasureLayout:S1}};function l3(t,s,o){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function R1(t,s){const o=l3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Zb(t){return s=>{s.pointerType==="touch"||m1()||t(s)}}function c3(t,s,o={}){const[r,c,d]=R1(t,o),u=Zb(m=>{const{target:p}=m,g=s(m);if(typeof g!="function"||!p)return;const v=Zb(_=>{g(_),p.removeEventListener("pointerleave",v)});p.addEventListener("pointerleave",v,c)});return r.forEach(m=>{m.addEventListener("pointerenter",u,c)}),d}function Kb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&wt.postRender(()=>d(s,Sl(s)))}class d3 extends ei{mount(){const{current:s}=this.node;s&&(this.unmount=c3(s,o=>(Kb(this.node,o,"Start"),r=>Kb(this.node,r,"End"))))}unmount(){}}class u3 extends ei{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=kl(pl(this.node.current,"focus",()=>this.onFocus()),pl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const M1=(t,s)=>s?t===s?!0:M1(t,s.parentElement):!1,f3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function m3(t){return f3.has(t.tagName)||t.tabIndex!==-1}const Wr=new WeakSet;function Yb(t){return s=>{s.key==="Enter"&&t(s)}}function Im(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const p3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Yb(()=>{if(Wr.has(o))return;Im(o,"down");const c=Yb(()=>{Im(o,"up")}),d=()=>Im(o,"cancel");o.addEventListener("keyup",c,s),o.addEventListener("blur",d,s)});o.addEventListener("keydown",r,s),o.addEventListener("blur",()=>o.removeEventListener("keydown",r),s)};function Jb(t){return ph(t)&&!m1()}function h3(t,s,o={}){const[r,c,d]=R1(t,o),u=m=>{const p=m.currentTarget;if(!Jb(m)||Wr.has(p))return;Wr.add(p);const g=s(m),v=(x,k)=>{window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",b),!(!Jb(x)||!Wr.has(p))&&(Wr.delete(p),typeof g=="function"&&g(x,{success:k}))},_=x=>{v(x,o.useGlobalTarget||M1(p,x.target))},b=x=>{v(x,!1)};window.addEventListener("pointerup",_,c),window.addEventListener("pointercancel",b,c)};return r.forEach(m=>{!m3(m)&&m.getAttribute("tabindex")===null&&(m.tabIndex=0),(o.useGlobalTarget?window:m).addEventListener("pointerdown",u,c),m.addEventListener("focus",g=>p3(g,c),c)}),d}function Wb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&wt.postRender(()=>d(s,Sl(s)))}class g3 extends ei{mount(){const{current:s}=this.node;s&&(this.unmount=h3(s,o=>(Wb(this.node,o,"Start"),(r,{success:c})=>Wb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const gp=new WeakMap,Om=new WeakMap,v3=t=>{const s=gp.get(t.target);s&&s(t)},y3=t=>{t.forEach(v3)};function b3({root:t,...s}){const o=t||document;Om.has(o)||Om.set(o,{});const r=Om.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(y3,{root:t,...s})),r[c]}function _3(t,s,o){const r=b3(s);return gp.set(t,o),r.observe(t),()=>{gp.delete(t),r.unobserve(t)}}const x3={some:0,all:1};class k3 extends ei{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:x3[c]},m=p=>{const{isIntersecting:g}=p;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:_}=this.node.getProps(),b=g?v:_;b&&b(p)};return _3(this.node.current,u,m)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(S3(s,o))&&this.startObserver()}unmount(){}}function S3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const j3={inView:{Feature:k3},tap:{Feature:g3},focus:{Feature:u3},hover:{Feature:d3}},T3={layout:{ProjectionNode:D1,MeasureLayout:S1}},xd={current:null},hh={current:!1};function I1(){if(hh.current=!0,!!$p)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>xd.current=t.matches;t.addListener(s),s()}else xd.current=!1}const N3=[...t1,gn,Qa],w3=t=>N3.find(e1(t)),Xb=new WeakMap;function C3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(vn(c))t.addValue(r,c);else if(vn(d))t.addValue(r,fl(c,{owner:t}));else if(d!==c)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(c):u.hasAnimated||u.set(c)}else{const u=t.getStaticValue(r);t.addValue(r,fl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Qb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class E3{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=dh,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 x=Bs.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,wt.render(this.render,!1,!0))};const{latestValues:p,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=p,this.baseTarget={...p},this.initialValues=o.initial?{...p}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=m,this.blockInitialAnimation=!!d,this.isControllingVariants=Ud(o),this.isVariantNode=mx(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:_,...b}=this.scrapeMotionValuesFromProps(o,{},this);for(const x in b){const k=b[x];p[x]!==void 0&&vn(k)&&k.set(p[x],!1)}}mount(s){this.current=s,Xb.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,r)=>this.bindToMotionValue(r,o)),hh.current||I1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:xd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Xb.delete(this.current),this.projection&&this.projection.unmount(),Xa(this.notifyUpdate),Xa(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=zi.has(s),c=o.on("change",m=>{this.latestValues[s]=m,this.props.onUpdate&&wt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Ho){const o=Ho[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Pt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Qb.length;r++){const c=Qb[r];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d="on"+c,u=s[d];u&&(this.propEventSubscriptions[c]=this.on(c,u))}this.prevMotionValues=C3(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(s),()=>o.variantChildren.delete(s)}addValue(s,o){const r=this.values.get(s);o!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,o),this.values.set(s,o),this.latestValues[s]=o.get())}removeValue(s){this.values.delete(s);const o=this.valueSubscriptions.get(s);o&&(o(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,o){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&o!==void 0&&(r=fl(o===null?void 0:o,{owner:this}),this.addValue(s,r)),r}readValue(s,o){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(Xx(c)||Vx(c))?c=parseFloat(c):!w3(c)&&Qa.test(o)&&(c=Yx(s,o)),this.setBaseTarget(s,vn(c)?c.get():c)),vn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=qp(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!vn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new th),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class O1 extends E3{constructor(){super(...arguments),this.KeyframeResolver=n1}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;vn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function A3(t){return window.getComputedStyle(t)}class D3 extends O1{constructor(){super(...arguments),this.type="html",this.renderInstance=kx}readValueFromInstance(s,o){if(zi.has(o)){const r=ch(o);return r&&r.default||0}else{const r=A3(s),c=(bx(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return x1(s,o)}build(s,o,r){Zp(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Wp(s,o,r)}}class R3 extends O1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Pt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(zi.has(o)){const r=ch(o);return r&&r.default||0}return o=Sx.has(o)?o:Pp(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return Nx(s,o,r)}build(s,o,r){Kp(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){jx(s,o,r,c)}mount(s){this.isSVGTag=Jp(s.tagName),super.mount(s)}}const M3=(t,s)=>Vp(t)?new R3(s):new D3(s,{allowProjection:t!==y.Fragment}),I3=o4({...WR,...j3,...r3,...T3},M3),Rt=xD(I3);function O3(){!hh.current&&I1();const[t]=y.useState(xd.current);return t}const L3="_overlay_cmicx_1",B3="_dialog_cmicx_11",$3="_title_cmicx_30",z3="_description_cmicx_38",H3="_actions_cmicx_45",P3="_cancelButton_cmicx_52",U3="_confirmButton_cmicx_79",Ti={overlay:L3,dialog:B3,title:$3,description:z3,actions:H3,cancelButton:P3,confirmButton:U3};function ks({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),m=y.useId();return a.jsx(ls,{children:t&&a.jsx(Rt.div,{className:Ti.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:p=>{p.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?m:void 0,children:a.jsxs(Rt.div,{className:Ti.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:p=>p.stopPropagation(),children:[a.jsx("h3",{id:u,className:Ti.title,children:s}),o&&a.jsx("p",{id:m,className:Ti.description,children:o}),a.jsxs("div",{className:Ti.actions,children:[a.jsx("button",{type:"button",className:Ti.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),a.jsx("button",{type:"button",className:Ti.confirmButton,onClick:c,children:r})]})]})})})}const V3="_skeleton_1gqp4_9",q3="_circular_1gqp4_17",G3="_textContainer_1gqp4_26",F3="_card_1gqp4_31",kd={skeleton:V3,circular:q3,textContainer:G3,card:F3};function we({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[kd.skeleton,r==="circular"?kd.circular:"",c??""].filter(Boolean).join(" ");return a.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function vp({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return a.jsx("div",{className:`${kd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>a.jsx(we,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function Sd({lines:t=2,className:s}){return a.jsxs("div",{className:`${kd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[a.jsx(we,{width:"40%",height:"1.25rem"}),a.jsx(vp,{lines:t})]})}const Z3="_spinner_1uyt1_1",K3="_spin_1uyt1_1",Y3="_sm_1uyt1_14",J3="_md_1uyt1_20",W3="_lg_1uyt1_26",X3="_xl_1uyt1_32",e_={spinner:Z3,spin:K3,sm:Y3,md:J3,lg:W3,xl:X3};function L1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return a.jsx("span",{className:`${e_.spinner} ${e_[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}const Q3="_splash_1bn1g_1",e6="_logo_1bn1g_11",t_={splash:Q3,logo:e6};function B1(){return a.jsxs("div",{className:t_.splash,"data-testid":"splash-screen",children:[a.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:t_.logo}),a.jsx(L1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const t6="_wrapper_4e5yt_1",n6="_wrapperBlock_4e5yt_6",s6="_tooltip_4e5yt_11",a6="_visible_4e5yt_31",i6="_top_4e5yt_41",o6="_bottom_4e5yt_48",r6="_left_4e5yt_55",l6="_right_4e5yt_62",qr={wrapper:t6,wrapperBlock:n6,tooltip:s6,visible:a6,top:i6,bottom:o6,left:r6,right:l6},c6=300,Kc=6;function Oi({text:t,placement:s="top",delayMs:o=c6,inline:r=!0,children:c,className:d,"data-testid":u}){const[m,p]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),_=y.useRef(null),b=y.useRef(null),x=y.useRef(void 0),k=y.useId(),j=typeof document<"u",N=y.useCallback(()=>{if(!_.current||!b.current)return;const H=_.current.getBoundingClientRect(),Y=b.current.getBoundingClientRect();let U=0,X=0;switch(s){case"top":U=H.top-Y.height-Kc,X=H.left+H.width/2-Y.width/2;break;case"bottom":U=H.bottom+Kc,X=H.left+H.width/2-Y.width/2;break;case"left":U=H.top+H.height/2-Y.height/2,X=H.left-Y.width-Kc;break;case"right":U=H.top+H.height/2-Y.height/2,X=H.right+Kc;break}v({top:U,left:X})},[s]),T=y.useCallback(H=>{x.current!==void 0&&clearTimeout(x.current),x.current=setTimeout(()=>{N(),p(!0),x.current=void 0},H)},[N]),C=y.useCallback(()=>{T(o)},[o,T]),A=y.useCallback(()=>{T(0)},[T]),L=y.useCallback(()=>{x.current!==void 0&&(clearTimeout(x.current),x.current=void 0),p(!1)},[]);y.useEffect(()=>{if(!m)return;const H=Y=>{Y.key==="Escape"&&L()};return document.addEventListener("keydown",H),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",H),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[m,L,N]),y.useEffect(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const E=r?"span":"div",O=[r?qr.wrapper:qr.wrapperBlock,d].filter(Boolean).join(" ");let z=c;if(y.isValidElement(c)){const H=c,Y=H.props["aria-describedby"],U=m?Y?`${Y} ${k}`:k:Y;z=y.cloneElement(H,{"aria-describedby":U})}const D=a.jsx("div",{ref:b,id:k,role:"tooltip",className:`${qr.tooltip} ${qr[s]} ${m?qr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return a.jsxs(E,{ref:_,className:O,onMouseEnter:C,onMouseLeave:L,onFocus:A,onBlur:L,children:[z,j?M2.createPortal(D,document.body):null]})}const d6="_attemptSelector_ggigl_1",u6="_attemptLabel_ggigl_17",f6="_attemptButton_ggigl_21",m6="_attemptActive_ggigl_38",p6="_attemptStatus_ggigl_44",Gr={attemptSelector:d6,attemptLabel:u6,attemptButton:f6,attemptActive:m6,attemptStatus:p6};function h6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return a.jsxs("div",{className:Gr.attemptSelector,"data-testid":"attempt-selector",children:[a.jsx("span",{className:Gr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return a.jsxs("button",{className:`${Gr.attemptButton} ${d?Gr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&a.jsx("span",{className:Gr.attemptStatus,children:u})]},r.id)})]})}const g6="_row_ldkru_1",v6="_hoverActions_ldkru_5",y6="_hoverButton_ldkru_31",b6="_selectingRow_ldkru_72",_6="_selected_ldkru_83",x6="_checkboxArea_ldkru_90",k6="_checkbox_ldkru_90",S6="_contentArea_ldkru_106",ys={row:g6,hoverActions:v6,hoverButton:y6,selectingRow:b6,selected:_6,checkboxArea:x6,checkbox:k6,contentArea:S6};function j6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:m,children:p}){const[g,v]=y.useState(!1),_=y.useRef(void 0);y.useEffect(()=>()=>{_.current!==void 0&&clearTimeout(_.current)},[]);const b=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),m==null||m(),_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,m]),x=y.useCallback(k=>{!o||k.target.closest("a, button, input, textarea, select, [role=button]")||(k.preventDefault(),u(k.shiftKey))},[o,u]);return s?o?a.jsxs("div",{className:`${ys.row} ${ys.selectingRow} ${r?ys.selected:""}`,onClick:x,"data-testid":"event-selectable-row",children:[a.jsx("div",{className:ys.checkboxArea,children:a.jsx("input",{type:"checkbox",checked:r,onChange:k=>{u(k.nativeEvent.shiftKey)},onClick:k=>{k.stopPropagation()},className:ys.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),a.jsx("div",{className:ys.contentArea,children:p})]}):a.jsxs("div",{className:ys.row,"data-testid":"event-hover-row",children:[a.jsxs("div",{className:ys.hoverActions,"data-testid":"event-hover-actions",children:[a.jsx("button",{type:"button",className:ys.hoverButton,onClick:()=>{b().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?a.jsx(Li,{size:it,"aria-hidden":"true"}):a.jsx(O_,{size:it,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:ys.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:a.jsx(RT,{size:it,"aria-hidden":"true"})})]}),p]}):a.jsx("div",{className:ys.row,children:p})}const T6="_bar_lagql_1",N6="_left_lagql_21",w6="_right_lagql_27",C6="_count_lagql_33",E6="_toggleButton_lagql_40",A6="_copyButton_lagql_68",D6="_forwardButton_lagql_108",R6="_cancelButton_lagql_148",Va={bar:T6,left:N6,right:w6,count:C6,toggleButton:E6,copyButton:A6,forwardButton:D6,cancelButton:R6};function M6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:m}){const p=t>0&&t>=s;return a.jsxs(Rt.div,{className:Va.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[a.jsxs("div",{className:Va.left,children:[a.jsxs("span",{className:Va.count,"data-testid":"floating-bar-count",children:[t," selected"]}),a.jsx("button",{type:"button",className:Va.toggleButton,onClick:p?r:o,"data-testid":"floating-bar-select-all",children:p?"Deselect all":"Select all"})]}),a.jsxs("div",{className:Va.right,children:[a.jsxs("button",{type:"button",className:Va.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[a.jsx(Pj,{size:it,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&a.jsx(Oi,{text:u?"No active sessions to forward to":"Forward to another session",children:a.jsxs("button",{type:"button",className:Va.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[a.jsx(Yj,{size:it,"aria-hidden":"true"}),"Forward"]})}),a.jsx("button",{type:"button",className:Va.cancelButton,onClick:m,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:a.jsx($s,{size:it,"aria-hidden":"true"})})]})]})}const I6="_overlay_1hra6_1",O6="_dialog_1hra6_11",L6="_header_1hra6_27",B6="_title_1hra6_35",$6="_closeButton_1hra6_42",z6="_filterRow_1hra6_78",H6="_searchIcon_1hra6_86",P6="_filterInput_1hra6_91",U6="_list_1hra6_108",V6="_emptyItem_1hra6_116",q6="_sessionRow_1hra6_123",G6="_sessionMain_1hra6_158",F6="_envName_1hra6_165",Z6="_personaName_1hra6_175",K6="_statusBadge_1hra6_189",Y6="_status_running_1hra6_198",J6="_status_idle_1hra6_202",W6="_status_other_1hra6_206",X6="_sessionPrompt_1hra6_211",Q6="_noSessions_1hra6_220",Xt={overlay:I6,dialog:O6,header:L6,title:B6,closeButton:$6,filterRow:z6,searchIcon:H6,filterInput:P6,list:U6,emptyItem:V6,sessionRow:q6,sessionMain:G6,envName:F6,personaName:Z6,statusBadge:K6,status_running:Y6,status_idle:J6,status_other:W6,sessionPrompt:X6,noSessions:Q6};function e5(t){return t==="running"?"running":t==="idle"?"idle":t}function t5({isOpen:t,sessions:s,environments:o,personas:r,onSelect:c,onCancel:d}){const[u,m]=y.useState(""),p=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{var j;t&&s.length<=4&&((j=g.current)==null||j.focus())},[t,s.length]);const v=new Map(o.map(j=>[j.id,j.displayName])),_=new Map((r??[]).map(j=>[j.id,j.name])),b=s.map(j=>({session:j,environmentName:v.get(j.environmentId)??j.environmentId})),x=s.length>4,k=u.trim()?b.filter(({session:j,environmentName:N})=>N.toLowerCase().includes(u.toLowerCase())||j.prompt.toLowerCase().includes(u.toLowerCase())):b;return a.jsx(ls,{children:t&&a.jsx(Rt.div,{className:Xt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:a.jsxs(Rt.div,{ref:p,className:Xt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[a.jsxs("div",{className:Xt.header,children:[a.jsx("h3",{className:Xt.title,children:"Forward to session"}),a.jsx("button",{ref:g,type:"button",className:Xt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:a.jsx($s,{size:it,"aria-hidden":"true"})})]}),x&&a.jsxs("div",{className:Xt.filterRow,children:[a.jsx(fd,{size:it,className:Xt.searchIcon,"aria-hidden":"true"}),a.jsx("input",{type:"text",className:Xt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{m(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?a.jsxs("div",{className:Xt.noSessions,"data-testid":"session-picker-no-sessions",children:[a.jsx(fd,{size:qt,"aria-hidden":"true"}),a.jsx("p",{children:"No active sessions to forward to."})]}):a.jsx("ul",{className:Xt.list,"data-testid":"session-picker-list",children:k.length===0?a.jsx("li",{className:Xt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):k.map(({session:j,environmentName:N})=>{const T=j.personaId?_.get(j.personaId)??void 0:void 0;return a.jsx("li",{children:a.jsxs("button",{type:"button",className:Xt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[a.jsxs("div",{className:Xt.sessionMain,children:[a.jsx("span",{className:Xt.envName,children:N}),T!==void 0&&a.jsx("span",{className:Xt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:T}),a.jsx("span",{className:`${Xt.statusBadge} ${Xt[`status_${j.status}`]??Xt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:e5(j.status)})]}),a.jsx("div",{className:Xt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const $1=50;function n5(t,s,o,r,c=$1){return r?t<c:s-t-o<c}function s5(t,s){const o=s-t;return o>0?o:0}function a5({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),m=y.useRef(!1),p=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let _=!0;const b=()=>{p.current||(p.current=requestAnimationFrame(()=>{p.current=0;const x=n5(v.scrollTop,v.scrollHeight,v.clientHeight,o,$1);x!==_&&(_=x,d(x))}))};return v.addEventListener("scroll",b,{passive:!0}),()=>{v.removeEventListener("scroll",b),p.current&&(cancelAnimationFrame(p.current),p.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||m.current||(m.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const _=s5(u.current,v.scrollHeight);_>0&&(v.scrollTop+=_)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const _=o?0:v.scrollHeight;v.scrollTo({top:_,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const i5=new Set(["text","output","user_input","tool_use","tool_result","error"]);function hl(t){return i5.has(t.eventType)}function o5(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
299
- ${c}`}catch{return t.content}default:return t.content}}function n_(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;return typeof s.command=="string"?`\`${s.command}\``:typeof s.file_path=="string"||typeof s.filePath=="string"?`\`${s.file_path??s.filePath}\``:typeof s.path=="string"?`\`${s.path}\``:typeof s.query=="string"?`\`${s.query}\``:typeof s.pattern=="string"?`\`${s.pattern}\``:""}function z1(t){var o;const s=[];for(const r of t){if(!hl(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
300
- ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
301
- ${r.content}`);break}case"tool_result":{let d=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=n_(r.toolUseCtx.args),m=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${m} (${c}):
302
- ${d}`)}else s.push(`**Tool output** (${c}):
303
- ${d}`);break}case"tool_use":{let d="tool",u;try{const g=JSON.parse(r.content);d=g.tool??"tool",u=g.args}catch{}const m=n_(u),p=m?`**Tool: ${d}** ${m}`:`**Tool: ${d}**`;u!==void 0?s.push(`${p} (${c}):
304
- \`\`\`json
305
- ${JSON.stringify(u,void 0,2)}
306
- \`\`\``):s.push(`${p} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
307
- ${r.content}`);break}}}return s.join(`
308
-
309
- `)}function r5(t,s){const o=l5(t),r=z1(s);return`--- Forwarded from ${o} ---
310
-
311
- ${r}
312
-
313
- --- End forwarded ---`}function l5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function c5({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),m=y.useMemo(()=>c.size,[c]),p=y.useCallback(k=>{r(!0),k!==void 0?(d(new Set([k])),u.current=k):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((k,j)=>{if(j&&u.current!==void 0){const N=Math.min(u.current,k),T=Math.max(u.current,k);d(C=>{const A=new Set(C);for(let L=N;L<=T;L++)L<t.length&&hl(t[L])&&A.add(L);return A})}else d(N=>{const T=new Set(N);return T.has(k)?T.delete(k):T.add(k),T.size===0?(r(!1),u.current=void 0):u.current=k,T})},[t]),_=y.useCallback(()=>{const k=new Set;for(let j=0;j<t.length;j++)hl(t[j])&&k.add(j);d(k)},[t]),b=y.useCallback(()=>{d(new Set)},[]),x=y.useCallback(async()=>{const j=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(j.length===0)return!1;const N=s(j);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:m,enterSelectionMode:p,cancelSelection:g,toggleEvent:v,selectAll:_,deselectAll:b,copySelected:x}}const d5="_wrapper_1cdza_1",u5="_scrollContainer_1cdza_9",f5="_selectingPadding_1cdza_16",m5="_toolbar_1cdza_20",p5="_directionToggle_1cdza_27",h5="_scrollToAnchor_1cdza_65",g5="_scrollToAnchorBottom_1cdza_89",v5="_scrollToAnchorTop_1cdza_93",y5="_eventOverflowWarning_1cdza_97",oa={wrapper:d5,scrollContainer:u5,selectingPadding:f5,toolbar:m5,directionToggle:p5,scrollToAnchor:h5,scrollToAnchorBottom:g5,scrollToAnchorTop:v5,eventOverflowWarning:y5},b5=10*1024,_5=new Set(["running","idle"]);function x5(t){const s=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"text":case"output":return`Select message from assistant at ${s}`;case"user_input":return`Select message from user at ${s}`;case"tool_result":case"tool_use":return`Select tool event at ${s}`;case"error":return`Select error at ${s}`;default:return`Select event at ${s}`}}const H1="grackle-stream-direction";function k5(){try{return localStorage.getItem(H1)==="reversed"}catch{return!1}}function S5({eventsDropped:t}){return t<=0?a.jsx(a.Fragment,{}):a.jsxs("div",{className:oa.eventOverflowWarning,role:"alert",children:[a.jsx(Np,{size:qt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function al({events:t,eventsDropped:s,emptyState:o,onShowToast:r,sessions:c,currentSessionId:d,environments:u,personas:m,onForward:p}){const g=y.useRef(null),[v,_]=y.useState(k5),b=O3(),[x,k]=y.useState(!1),[j,N]=y.useState(!1),[T,C]=y.useState(void 0),A=c5({events:t,formatForClipboard:z1}),L=y.useMemo(()=>t.filter(hl).length,[t]),E=y.useMemo(()=>c?c.filter(q=>_5.has(q.status)&&q.id!==d):[],[c,d]),O=y.useMemo(()=>v?[...t].reverse():t,[t,v]),{isAtAnchor:z,scrollToAnchor:D}=a5({scrollRef:g,contentLength:t.length,isReversed:v,paused:A.isSelecting}),H=()=>{const q=!v;_(q);try{localStorage.setItem(H1,q?"reversed":"default")}catch{}};y.useEffect(()=>{if(!A.isSelecting)return;const q=me=>{me.key==="Escape"&&!x&&!j&&A.cancelSelection()};return window.addEventListener("keydown",q),()=>{window.removeEventListener("keydown",q)}},[A.isSelecting,A.cancelSelection,x,j]);const Y=y.useCallback(async()=>{await A.copySelected()&&(r==null||r(`Copied ${A.selectedCount} message${A.selectedCount===1?"":"s"} to clipboard`,"success"))},[A,r]),U=y.useCallback(()=>[...A.selectedIndices].sort((me,de)=>me-de).filter(me=>me<t.length).map(me=>t[me]),[A.selectedIndices,t]),X=y.useCallback(q=>{if(!q)return"this session";const me=c==null?void 0:c.find(xe=>xe.id===q);if(!me)return q.slice(0,8);const de=u==null?void 0:u.find(xe=>xe.id===me.environmentId);return(de==null?void 0:de.displayName)??me.environmentId.slice(0,8)},[c,u]),ge=y.useCallback(async(q,me)=>{if(!p)return;const de=X(q);try{await p(q,me);const xe=A.selectedCount;r==null||r(`Forwarded ${xe} message${xe===1?"":"s"} to ${de}`,"success"),A.cancelSelection()}catch{r==null||r("Failed to forward messages","error")}},[p,X,r,A]),W=y.useCallback(q=>{k(!1);const me=U(),de=X(d),xe=r5(de,me);if(new TextEncoder().encode(xe).length>b5){C({sessionId:q,text:xe}),N(!0);return}ge(q,xe).catch(()=>{})},[U,X,d,ge]),le=y.useCallback(()=>{N(!1),T&&(ge(T.sessionId,T.text).catch(()=>{}),C(void 0))},[T,ge]),B=y.useCallback(()=>{N(!1),C(void 0)},[]),R=b?0:.2,se=v?-8:8,oe=T?Math.round(new TextEncoder().encode(T.text).length/1024):0;return a.jsxs("div",{className:oa.wrapper,children:[a.jsx("div",{className:oa.toolbar,children:a.jsx(Oi,{text:v?"Showing newest first":"Showing oldest first",children:a.jsx("button",{className:oa.directionToggle,onClick:H,"aria-label":v?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:v?a.jsx(Sy,{size:qt,"aria-hidden":"true"}):a.jsx(jy,{size:qt,"aria-hidden":"true"})})})}),a.jsxs("div",{ref:g,className:`${oa.scrollContainer} ${A.isSelecting?oa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,a.jsx(S5,{eventsDropped:s}),a.jsx(ls,{initial:!1,children:O.map((q,me)=>{const de=v?t.length-1-me:me;return a.jsx(Rt.div,{initial:{opacity:0,y:se},animate:{opacity:1,y:0},transition:{duration:R,ease:"easeOut"},children:a.jsx(j6,{copyText:o5(q),isContentBearing:hl(q),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(de),checkboxLabel:x5(q),onSelect:()=>{A.enterSelectionMode(de)},onToggle:xe=>{A.toggleEvent(de,xe)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:a.jsx(cD,{event:q,toolUseCtx:q.toolUseCtx,settled:q.settled})})},`${q.sessionId}-${q.timestamp}-${de}`)})})]}),a.jsx(ls,{children:A.isSelecting&&a.jsx(M6,{selectedCount:A.selectedCount,totalSelectable:L,onSelectAll:A.selectAll,onDeselectAll:A.deselectAll,onCopy:()=>{Y().catch(()=>{})},onForward:p!==void 0?()=>{k(!0)}:void 0,forwardDisabled:E.length===0,onCancel:A.cancelSelection})}),a.jsx(t5,{isOpen:x,sessions:E,environments:u??[],personas:m,onSelect:W,onCancel:()=>{k(!1)}}),a.jsx(ks,{isOpen:j,title:"Send large message?",description:`This will forward a large message (${oe} KB). Continue?`,confirmLabel:"Send",onConfirm:le,onCancel:B}),a.jsx(ls,{children:!z&&a.jsxs(Rt.button,{className:`${oa.scrollToAnchor} ${v?oa.scrollToAnchorTop:oa.scrollToAnchorBottom}`,onClick:D,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:[v?a.jsx(jy,{size:qt,"aria-hidden":"true"}):a.jsx(Sy,{size:qt,"aria-hidden":"true"})," New events"]})})]})}function gh(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:m=!0,trimOnSave:p=!0}=t,[g,v]=y.useState(""),[_,b]=y.useState(""),x=y.useRef(!1),k=d===c,j=y.useCallback(z=>{v(z),b("")},[]),N=y.useCallback(()=>{b("")},[]),T=y.useCallback(()=>{x.current=!1,u==null||u(null),v(""),b("")},[u]),C=y.useCallback(()=>{const z=p?g.trim():g;if(r){const H=r(g);if(H){b(H);return}}const D=p?s.trim():s;if(z===D){T();return}o(z),T()},[g,s,p,r,o,T]),A=y.useCallback(()=>{x.current=!0,u==null||u(c),v(s),b("")},[c,s,u]),L=y.useCallback(z=>{if(x.current){x.current=!1;return}z.relatedTarget instanceof HTMLElement&&z.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(z=>{z.key==="Escape"?T():z.key==="Enter"&&m&&C()},[T,m,C]),O=(()=>{if(!k)return!1;const z=p?s.trim():s;return(p?g.trim():g)!==z})();return y.useEffect(()=>{!k&&(g!==""||_!=="")&&(v(""),b(""))},[k,g,_]),{isEditing:k,draft:g,error:_,isDirty:O,startEdit:A,cancelEdit:T,save:C,setDraft:j,clearError:N,handleBlur:L,handleKeyDown:E,ignoreInitialBlurRef:x}}const j5="_editFieldWrapper_yuzty_1",T5="_editInput_yuzty_10",N5="_editTextarea_yuzty_42",w5="_editSelect_yuzty_78",C5="_editError_yuzty_111",E5="_editInputInvalid_yuzty_118",A5="_editHint_yuzty_123",D5="_unsavedDot_yuzty_132",R5="_metaValueClickable_yuzty_140",M5="_editButton_yuzty_159",I5="_metaPlaceholder_yuzty_175",O5="_worktreeToggle_yuzty_180",at={editFieldWrapper:j5,editInput:T5,editTextarea:N5,editSelect:w5,editError:C5,editInputInvalid:E5,editHint:A5,unsavedDot:D5,metaValueClickable:R5,editButton:M5,metaPlaceholder:I5,worktreeToggle:O5};function Ut(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:m,onChange:p,renderDisplay:g,placeholder:v,maxLength:_,ariaLabel:b,"data-testid":x}=t,k=y.useRef(null),j=gh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:m,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const T=window.setTimeout(()=>{var C;(C=k.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[j.isEditing]),c==="create"){const T=A=>{p==null||p(A.target.value)},C=r==null?void 0:r(s);return a.jsxs("div",{className:at.editFieldWrapper,children:[a.jsx("input",{className:`${at.editInput} ${C?at.editInputInvalid:""}`,value:s,onChange:T,maxLength:_,placeholder:v,"aria-label":b,"data-testid":x?`${x}-input`:void 0}),C&&a.jsx("span",{className:at.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return a.jsxs("div",{className:at.editFieldWrapper,children:[a.jsx("input",{ref:k,className:`${at.editInput} ${j.error?at.editInputInvalid:""}`,value:j.draft,onChange:T=>j.setDraft(T.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:_,placeholder:v,"aria-label":b,"data-testid":x?`${x}-input`:void 0}),j.isDirty&&a.jsx("span",{className:at.unsavedDot,title:"Unsaved changes"}),j.error&&a.jsx("span",{className:at.editError,"data-testid":"edit-error",children:j.error}),a.jsx("span",{className:at.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return a.jsxs("span",{role:"button",tabIndex:0,className:at.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":b,"data-testid":x?`${x}-button`:void 0,children:[N!==void 0?N:s?a.jsx("span",{children:s}):a.jsx("span",{className:at.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:at.editButton,"aria-hidden":"true",children:"✏️"})]})}function yp(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:m,onChange:p,renderDisplay:g,placeholder:v,ariaLabel:_,"data-testid":b}=t,x=y.useRef(null),k=gh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:m,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(k.isEditing){const N=window.setTimeout(()=>{var T;(T=x.current)==null||T.focus()},0);return()=>window.clearTimeout(N)}},[k.isEditing]),c==="create"){const N=C=>{p==null||p(C.target.value)},T=r==null?void 0:r(s);return a.jsxs("div",{className:at.editFieldWrapper,children:[a.jsx("textarea",{className:`${at.editTextarea} ${T?at.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":_,"data-testid":b?`${b}-input`:void 0}),T&&a.jsx("span",{className:at.editError,"data-testid":"edit-error",children:T})]})}if(k.isEditing)return a.jsxs("div",{className:at.editFieldWrapper,children:[a.jsx("textarea",{ref:x,className:`${at.editTextarea} ${k.error?at.editInputInvalid:""}`,value:k.draft,onChange:N=>k.setDraft(N.target.value),onBlur:k.handleBlur,onKeyDown:k.handleKeyDown,title:_,"aria-label":_,"data-testid":b?`${b}-input`:void 0}),k.isDirty&&a.jsx("span",{className:at.unsavedDot,title:"Unsaved changes"}),k.error&&a.jsx("span",{className:at.editError,"data-testid":"edit-error",children:k.error}),a.jsx("span",{className:at.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return a.jsxs("span",{role:"button",tabIndex:0,className:at.metaValueClickable,onClick:()=>k.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),k.startEdit())},title:"Click to edit","aria-label":_,"data-testid":b?`${b}-button`:void 0,children:[j!==void 0?j:s?a.jsx("span",{children:s}):a.jsx("span",{className:at.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:at.editButton,"aria-hidden":"true",children:"✏️"})]})}function jd(t){var A;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:m,onChange:p,renderDisplay:g,placeholder:v,ariaLabel:_,"data-testid":b}=t,x=y.useRef(null),k=gh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:m,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(k.isEditing){const L=window.setTimeout(()=>{var E;(E=x.current)==null||E.focus()},0);return()=>window.clearTimeout(L)}},[k.isEditing]);const j=y.useCallback(L=>{const E=L.target.value;k.ignoreInitialBlurRef.current=!1,E!==s&&o(E),k.cancelEdit()},[s,o,k]),N=y.useCallback(L=>{if(k.ignoreInitialBlurRef.current){k.ignoreInitialBlurRef.current=!1;return}L.relatedTarget instanceof HTMLElement&&L.relatedTarget.dataset.editAction===d||k.cancelEdit()},[d,k]);if(r==="create")return a.jsx("select",{className:at.editSelect,value:s,onChange:L=>p==null?void 0:p(L.target.value),"aria-label":_,"data-testid":b?`${b}-select`:void 0,children:c.map(L=>a.jsx("option",{value:L.value,children:L.label},L.value))});if(k.isEditing)return a.jsx("select",{ref:x,className:at.editSelect,value:k.draft,onChange:j,onBlur:N,title:_,"aria-label":_,"data-testid":b?`${b}-select`:void 0,children:c.map(L=>a.jsx("option",{value:L.value,children:L.label},L.value))});const T=g==null?void 0:g(s),C=(A=c.find(L=>L.value===s))==null?void 0:A.label;return a.jsxs("button",{type:"button",className:at.metaValueClickable,onClick:()=>k.startEdit(),title:"Click to change","aria-label":_,"data-testid":b?`${b}-button`:void 0,children:[T!==void 0?T:C?a.jsx("span",{children:C}):a.jsx("span",{className:at.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:at.editButton,"aria-hidden":"true",children:"✏️"})]})}function L5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return a.jsxs("label",{className:at.worktreeToggle,"data-testid":d,children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),a.jsx("span",{children:r})]})}const B5="_nav_1snmp_1",$5="_searchForm_1snmp_8",z5="_searchInput_1snmp_15",H5="_searchButton_1snmp_33",P5="_clearButton_1snmp_68",U5="_workspaceSelect_1snmp_85",V5="_listHeader_1snmp_99",q5="_nodeList_1snmp_108",G5="_nodeItem_1snmp_116",F5="_indicator_1snmp_129",Z5="_label_1snmp_136",K5="_badge_1snmp_145",ss={nav:B5,searchForm:$5,searchInput:z5,searchButton:H5,clearButton:P5,workspaceSelect:U5,listHeader:V5,nodeList:q5,nodeItem:G5,indicator:F5,label:Z5,badge:K5};function Y5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:m}){const[p,g]=y.useState(""),v=y.useCallback(k=>{k.preventDefault(),p.trim()&&c(p.trim())},[p,c]),_=y.useCallback(()=>{g(""),d()},[d]),b=y.useCallback(k=>{u(k)},[u]),x=y.useCallback(k=>{g(""),m(k)},[m]);return a.jsxs("div",{className:ss.nav,"data-testid":"knowledge-nav",children:[a.jsxs("form",{className:ss.searchForm,onSubmit:v,children:[a.jsx("input",{className:ss.searchInput,type:"text",placeholder:"Search...",value:p,onChange:k=>{g(k.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),a.jsx("button",{type:"submit",className:ss.searchButton,disabled:o,children:"Go"})]}),r&&a.jsx("button",{type:"button",className:ss.clearButton,onClick:_,children:"Clear search"}),a.jsxs("select",{className:ss.workspaceSelect,onChange:k=>{x(k.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[a.jsx("option",{value:"",children:"All workspaces"}),s.map(k=>a.jsx("option",{value:k.id,children:k.name},k.id))]}),a.jsxs("div",{className:ss.listHeader,children:["Nodes (",t.length,")"]}),a.jsx("ul",{className:ss.nodeList,children:t.map(k=>a.jsxs("li",{className:ss.nodeItem,onClick:()=>{b(k.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),b(k.id))},role:"button",tabIndex:0,children:[a.jsx("span",{className:ss.indicator,style:{backgroundColor:k.kind==="reference"?"#4A9EFF":k.category==="decision"?"#22C55E":k.category==="concept"?"#A855F7":k.category==="snippet"?"#6B7280":"#EAB308"}}),a.jsx("span",{className:ss.label,children:k.label}),a.jsx("span",{className:ss.badge,children:k.kind==="reference"?k.sourceType:k.category})]},k.id))})]})}const J5="_container_bwu10_1",W5="_hamburger_bwu10_33",X5="_brand_bwu10_49",Q5="_brandLogo_bwu10_68",eI="_info_bwu10_75",tI="_connectionLabel_bwu10_90",nI="_connectionDot_bwu10_103",sI="_connected_bwu10_106",aI="_disconnected_bwu10_110",iI="_connecting_bwu10_113",Ms={container:J5,hamburger:W5,brand:X5,brandLogo:Q5,info:eI,connectionLabel:tI,connectionDot:nI,connected:sI,disconnected:aI,connecting:iI},oI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},rI={connected:Ms.connected,connecting:Ms.connecting,disconnected:Ms.disconnected};function lI({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=dt(),u=s.length,m=s.filter(v=>v.status==="connected").length,p=o.filter(v=>["running","idle"].includes(v.status)).length,g=oI[t];return a.jsxs("div",{className:Ms.container,children:[r&&a.jsx("button",{type:"button",className:Ms.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:a.jsx(fT,{size:Dt,"aria-hidden":"true"})}),a.jsx(Oi,{text:"Home",placement:"bottom",children:a.jsxs("button",{type:"button",className:Ms.brand,onClick:()=>d(Ii),"data-testid":"statusbar-brand",children:[a.jsx("img",{src:"/icon-192x192.png",alt:"",className:Ms.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),a.jsxs("div",{className:Ms.info,children:[a.jsxs("span",{"aria-label":g,children:[a.jsx("span",{className:`${Ms.connectionDot} ${rI[t]}`,"aria-hidden":"true",children:a.jsx(Ja,{size:wp,fill:"currentColor"})})," ",a.jsx("span",{className:Ms.connectionLabel,"aria-hidden":"true",children:g})]}),a.jsxs("span",{children:[m,"/",u," env",u!==1?"s":""]}),a.jsxs("span",{children:[p," active"]})]})]})}const cI="_nav_gx5h3_1",dI="_tab_gx5h3_35",uI="_tabIcon_gx5h3_68",fI="_tabLabel_gx5h3_79",mI="_tabActive_gx5h3_84",pI="_tabEnd_gx5h3_90",Ao={nav:cI,tab:dI,tabIcon:uI,tabLabel:fI,tabActive:mI,tabEnd:pI},ld=[{view:"dashboard",label:"Dashboard",icon:a.jsx(Qj,{size:Dt}),route:Ii,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:a.jsx(L_,{size:Dt}),route:cl,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:a.jsx(Lj,{size:Dt}),route:Gw,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:a.jsx(hT,{size:Dt}),route:$o,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:a.jsx(Cj,{size:Dt}),route:ix,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:a.jsx(fd,{size:Dt}),route:$d,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:a.jsx(AT,{size:Dt}),route:zw,testId:"sidebar-tab-settings",align:"end"}];function hI(t){return t===Ii||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(ix)?"knowledge":t.startsWith($d)?"findings":t.startsWith(Ai)?"settings":"tasks"}function gI({tabs:t=ld}){var g;const s=Jt(),o=dt(),r=y.useRef(null),c=hI(s.pathname),d=y.useMemo(()=>[...t.filter(v=>v.align!=="end"),...t.filter(v=>v.align==="end")],[t]),u=(g=d.find(v=>v.align==="end"))==null?void 0:g.view,m=y.useCallback(v=>{o(v.route)},[o]),p=y.useCallback(v=>{var j,N;const _=(j=r.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!_)return;const b=Array.from(_).findIndex(T=>T===document.activeElement),x=b>=0?b:d.findIndex(T=>T.view===c);let k=x;if(v.key==="ArrowRight"||v.key==="j"||v.key==="J")v.preventDefault(),k=(x+1)%d.length;else if(v.key==="ArrowLeft"||v.key==="k"||v.key==="K")v.preventDefault(),k=(x-1+d.length)%d.length;else if(v.key==="Home")v.preventDefault(),k=0;else if(v.key==="End")v.preventDefault(),k=d.length-1;else return;o(d[k].route),(N=_[k])==null||N.focus()},[c,o,d]);return a.jsx("nav",{className:Ao.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:p,"data-testid":"sidebar-nav",children:d.map(v=>{const _=v.view===c,b=v.view===u;return a.jsx(Oi,{text:v.label,placement:"bottom",className:b?Ao.tabEnd:void 0,children:a.jsxs("button",{role:"tab",type:"button","aria-selected":_,tabIndex:_?0:-1,className:`${Ao.tab} ${_?Ao.tabActive:""}`,onClick:()=>m(v),"data-testid":v.testId,"aria-label":v.label,children:[a.jsx("span",{className:Ao.tabIcon,"aria-hidden":"true",children:v.icon}),a.jsx("span",{className:Ao.tabLabel,children:v.label})]})},v.view)})})}const vI="_container_pi6ii_1",yI="_content_pi6ii_66",s_={container:vI,content:yI},bI=320,P1=220,U1=600,V1="grackle-sidebar-width";function _I(){try{const t=localStorage.getItem(V1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=P1&&s<=U1)return s}}catch{}return bI}function xI(t){try{localStorage.setItem(V1,String(t))}catch{}}function kI({content:t}){const[s]=y.useState(_I),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const m=u.borderBoxSize[0];if(m){const p=Math.round(m.inlineSize);p>=P1&&p<=U1&&xI(p)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return a.jsx("div",{className:s_.container,ref:o,"data-testid":"sidebar",style:{width:s},children:a.jsx("div",{className:s_.content,children:t})})}const SI="_bar_tnfsh_1",jI="_btnPrimary_tnfsh_32",TI="_statusText_tnfsh_85",NI="_statusCompleted_tnfsh_90",wI="_statusFailed_tnfsh_94",CI="_statusBlocked_tnfsh_98",EI="_hintText_tnfsh_103",At={bar:SI,btnPrimary:jI,statusText:TI,statusCompleted:NI,statusFailed:wI,statusBlocked:CI,hintText:EI};function AI({sessions:t,tasks:s,environments:o}){const r=dt(),c=Jt(),d=It("/sessions/:sessionId"),u=It("/tasks/:taskId"),m=It("/tasks/:taskId/stream"),p=It("/tasks/:taskId/findings"),g=It("/tasks/:taskId/edit"),v=It("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),_=It("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=It("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),x=It("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),k=It("/sessions/new"),j=It("/environments/:environmentId/workspaces/:workspaceId"),N=It("/tasks/new"),T=It("/chat"),C=It("/"),A=It("/settings/*"),L=d==null?void 0:d.params.sessionId,E=(u==null?void 0:u.params.taskId)??(m==null?void 0:m.params.taskId)??(p==null?void 0:p.params.taskId)??(v==null?void 0:v.params.taskId)??(_==null?void 0:_.params.taskId)??(b==null?void 0:b.params.taskId)??(x==null?void 0:x.params.taskId),O=v??_??b??x,z=(O==null?void 0:O.params.environmentId)??(j==null?void 0:j.params.environmentId),D=c.pathname.startsWith("/environments")&&!j&&!O,H=!!T,Y=!!k,U=!!j&&!v&&!_&&!b&&!x,X=!!N;if(!!C&&!Y&&!U&&!X||!!A||(!!g||!!x)||X||D||Y)return a.jsx(a.Fragment,{});if(H)return o.find(R=>R.adapterType==="local"&&R.status==="connected")?a.jsx(a.Fragment,{}):a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Add a local environment to start chatting"})});if(U)return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Select a task or click + to create one"})});if(E){const B=s.find(oe=>oe.id===E);if(!B)return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Loading..."})});const R=new Map(s.map(oe=>[oe.id,oe])),se=B.dependsOn.some(oe=>{const q=R.get(oe);return q!==void 0&&q.status!=="complete"});if(B.status==="not_started"){const oe=se?B.dependsOn.map(q=>R.get(q)).filter(q=>q&&q.status!=="complete").map(q=>q.title):[];return a.jsx("div",{className:At.bar,children:se?a.jsxs("span",{className:At.statusBlocked,children:["Blocked by: ",oe.join(", ")]}):a.jsx("span",{className:At.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const oe=B.latestSessionId||void 0,q=oe?t.find(de=>de.id===oe):void 0;return q&&q.status!=="stopped"?a.jsx(a.Fragment,{}):a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return a.jsxs("div",{className:At.bar,children:[a.jsx("span",{className:`${At.statusText} ${At.statusCompleted}`,children:"Task completed"}),a.jsx("button",{onClick:()=>r($i(B.workspaceId,void 0,z)),className:At.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:`${At.statusText} ${At.statusFailed}`,children:"Task failed"})})}if(L){const B=t.find(oe=>oe.id===L),R=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!R)return a.jsx(a.Fragment,{});if(R)return a.jsxs("div",{className:At.bar,children:[a.jsxs("span",{className:`${At.statusText} ${At.hintText}`,children:["Session ",B.endReason||B.status]}),a.jsx("button",{onClick:()=>r(tx(B.environmentId)),className:At.btnPrimary,children:"+ New Chat"})]})}return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Loading..."})})}const DI="_nav_14i94_1",RI="_tab_14i94_24",MI="_tabActive_14i94_62",II="_tabLabel_14i94_75",OI="_statusDot_14i94_81",LI="_pulse_14i94_87",BI="_addButton_14i94_99",$I="_empty_14i94_132",qa={nav:DI,tab:RI,tabActive:MI,tabLabel:II,statusDot:OI,pulse:LI,addButton:BI,empty:$I},zI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function HI({environments:t}){const s=dt(),o=y.useRef(null),r=It("/environments/:environmentId"),c=It("/environments/:environmentId/edit"),d=It("/environments/:environmentId/workspaces/:workspaceId"),u=It("/environments/:environmentId/workspaces/:workspaceId/*"),m=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),p=m==="new"?void 0:m,g=y.useCallback(b=>{s(Mi(b))},[s]),v=y.useCallback(b=>{var T;const x=(T=o.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!x||x.length===0)return;const k=Array.from(x).findIndex(C=>C===document.activeElement),j=k>=0?k:t.findIndex(C=>C.id===p);let N=j;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(j+1)%x.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(j-1+x.length)%x.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=x.length-1;else return;N<t.length&&s(Mi(t[N].id)),x[N].focus()},[p,t,s]),_=p??(t.length>0?t[0].id:void 0);return a.jsxs("div",{className:qa.nav,"data-testid":"environment-nav",children:[a.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(b=>{const x=b.id===p,k=b.id===_,j=zI[b.status]||"var(--text-tertiary)",N=b.status==="connected";return a.jsxs("button",{role:"tab",type:"button","aria-selected":x,tabIndex:k?0:-1,className:`${qa.tab} ${x?qa.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"env-nav-item",children:[a.jsx("span",{className:`${qa.statusDot} ${N?qa.pulse:""}`,style:{color:j},"aria-hidden":"true",children:a.jsx(Ja,{size:wp,fill:"currentColor"})}),a.jsx("span",{className:qa.tabLabel,title:b.displayName||b.id,children:b.displayName||b.id})]},b.id)})}),a.jsx("button",{type:"button",className:qa.addButton,onClick:()=>s(Bw),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&a.jsx("div",{className:qa.empty,children:"No environments yet."})]})}function Vo(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),m=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(m===1)return"yesterday";if(m<7)return`${m} days ago`;const p=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return p?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function q1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),m=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(m<7)return`in ${m} day${m===1?"":"s"}`;const p=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return p?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const a_={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 Td(t){return a_[t]||a_.general}const PI="_nav_dlm8m_1",UI="_categoryPills_dlm8m_24",VI="_categoryPill_dlm8m_24",qI="_tab_dlm8m_42",GI="_tabActive_dlm8m_80",FI="_tabContent_dlm8m_93",ZI="_tabLabel_dlm8m_100",KI="_tabMeta_dlm8m_106",YI="_categoryDot_dlm8m_111",JI="_empty_dlm8m_118",Ds={nav:PI,categoryPills:UI,categoryPill:VI,tab:qI,tabActive:GI,tabContent:FI,tabLabel:ZI,tabMeta:KI,categoryDot:YI,empty:JI};function WI({findings:t,workspaceId:s,environmentId:o}){const r=dt(),c=y.useRef(null),d=It("/findings/:findingId"),u=It("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),m=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),p=y.useMemo(()=>{const b=new Set(t.map(x=>x.category).filter(Boolean));return Array.from(b).sort()},[t]),g=y.useCallback(b=>{r(Qm(b,s,o))},[r,s,o]),v=y.useCallback(b=>{var T;const x=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!x||x.length===0)return;const k=Array.from(x).findIndex(C=>C===document.activeElement),j=k>=0?k:t.findIndex(C=>C.id===m);let N=j;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(j+1)%x.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(j-1+x.length)%x.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=x.length-1;else return;N<t.length&&r(Qm(t[N].id,s,o)),x[N].focus()},[m,t,r,s,o]),_=m??(t.length>0?t[0].id:void 0);return a.jsxs("div",{className:Ds.nav,"data-testid":"findings-nav",children:[p.length>1&&a.jsx("div",{className:Ds.categoryPills,"data-testid":"findings-nav-categories",children:p.map(b=>a.jsx("span",{className:Ds.categoryPill,style:{color:Td(b).text},children:b},b))}),a.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(b=>{const x=b.id===m,k=b.id===_;return a.jsxs("button",{role:"tab",type:"button","aria-selected":x,tabIndex:k?0:-1,className:`${Ds.tab} ${x?Ds.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"finding-nav-item",children:[a.jsx("span",{className:Ds.categoryDot,style:{color:Td(b.category).text},"aria-hidden":"true",children:a.jsx(Ja,{size:wp,fill:"currentColor"})}),a.jsxs("span",{className:Ds.tabContent,children:[a.jsx("span",{className:Ds.tabLabel,title:b.title,children:b.title}),a.jsx("span",{className:Ds.tabMeta,title:b.createdAt,children:Vo(b.createdAt)})]})]},b.id)})}),t.length===0&&a.jsx("div",{className:Ds.empty,children:"No findings yet. Agents will post discoveries here."})]})}function XI(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),o=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=o[o.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):o.push([d,u])}return o}function G1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return a.jsx(a.Fragment,{children:t});const r=XI(s),c=[];let d=0;for(const[u,m]of r)u>d&&c.push(a.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(a.jsx("mark",{className:o,children:t.slice(u,m+1)},`m${u}`)),d=m+1;return d<t.length&&c.push(a.jsx("span",{children:t.slice(d)},`p${d}`)),a.jsx(a.Fragment,{children:c})}function QI(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),o=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):o.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return o.sort((r,c)=>r.sortOrder-c.sortOrder)}function eO(t,s){const o=new Map;for(const d of t){const m=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,p=o.get(m);p?p.push(d):o.set(m,[d])}const r=[],c=new Set;for(const d of PT){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((p,g)=>p.sortOrder-g.sortOrder);const m=Wa(d);r.push({status:d,label:m.label,style:m,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((p,g)=>p.sortOrder-g.sortOrder);const m=Wa(d);r.push({status:d,label:m.label,style:m,tasks:u})}return r}const tO="_container_z4i38_1",nO="_header_z4i38_5",sO="_headerActions_z4i38_17",aO="_searchInput_z4i38_23",iO="_searchHighlight_z4i38_56",oO="_groupToggle_z4i38_62",rO="_groupToggleActive_z4i38_89",lO="_addButton_z4i38_93",cO="_taskRow_z4i38_120",dO="_selected_z4i38_140",uO="_expandArrow_z4i38_150",fO="_expanded_z4i38_157",mO="_leafSpacer_z4i38_161",pO="_taskStatusIcon_z4i38_166",hO="_taskTitle_z4i38_170",gO="_workspaceBadge_z4i38_177",vO="_childCountBadge_z4i38_195",yO="_dependencyBadge_z4i38_208",bO="_blockedBadge_z4i38_220",_O="_addChildButton_z4i38_225",xO="_emptyState_z4i38_268",kO="_statusGroupHeader_z4i38_275",SO="_statusGroupIcon_z4i38_294",jO="_statusGroupLabel_z4i38_298",TO="_statusGroupCount_z4i38_303",We={container:tO,header:nO,headerActions:sO,searchInput:aO,searchHighlight:iO,groupToggle:oO,groupToggleActive:rO,addButton:lO,taskRow:cO,selected:dO,expandArrow:uO,expanded:fO,leafSpacer:mO,taskStatusIcon:pO,taskTitle:hO,workspaceBadge:gO,childCountBadge:vO,dependencyBadge:yO,blockedBadge:bO,addChildButton:_O,emptyState:xO,statusGroupHeader:kO,statusGroupIcon:SO,statusGroupLabel:jO,statusGroupCount:TO},NO=[{name:"title",weight:2},{name:"description",weight:1}],F1=16,wO=16,Z1="grackle-task-group-by-status";function i_(){try{return localStorage.getItem(Z1)==="true"}catch{return!1}}function CO(t){try{localStorage.setItem(Z1,String(t))}catch{}}function EO({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return a.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[a.jsxs("div",{className:We.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o())},children:[a.jsx("span",{className:`${We.expandArrow} ${s?We.expanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:it})}),a.jsx("span",{className:We.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),a.jsx("span",{className:We.statusGroupLabel,children:t.label}),a.jsx("span",{className:We.statusGroupCount,children:t.tasks.length})]}),a.jsx(ls,{children:s&&a.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(m=>{const p=Wa(m.status),g=r===m.id,v=m.parentTaskId||!m.workspaceId?void 0:u.get(m.workspaceId);return a.jsxs("div",{onClick:()=>c(Pn(m.id)),role:"button",tabIndex:0,"aria-label":m.title,onKeyDown:_=>{_.currentTarget===_.target&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c(Pn(m.id)))},className:`${We.taskRow} ${g?We.selected:""}`,style:{"--task-indent":`${F1}px`},"data-task-id":m.id,children:[a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:p.color},"aria-hidden":"true","data-testid":`task-status-${gl(m.status)}`,children:p.icon}),a.jsx("span",{className:We.taskTitle,title:m.title,children:a.jsx(G1,{text:m.title,indices:d.get(m.id),highlightClass:We.searchHighlight})}),v&&a.jsx("span",{className:We.workspaceBadge,title:v,children:v})]},m.id)})})})]})}function K1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:m,workspaceNames:p}){const g=Wa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),_=o.has(t.id),b=t.children.length>0,x=c===t.id,k=F1+s*wO,N=s===0&&!t.parentTaskId&&t.workspaceId?p.get(t.workspaceId):void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>d(Pn(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(Pn(t.id)))},className:`${We.taskRow} ${x?We.selected:""}`,style:{"--task-indent":`${k}px`},"data-task-id":t.id,children:[b&&a.jsx("span",{className:`${We.expandArrow} ${_?We.expanded:""}`,role:"button",tabIndex:0,"aria-label":_?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:a.jsx(pa,{size:it,"aria-hidden":"true"})}),!b&&a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${gl(t.status)}`,children:g.icon}),a.jsx("span",{className:We.taskTitle,title:t.title,children:a.jsx(G1,{text:t.title,indices:m.get(t.id),highlightClass:We.searchHighlight})}),N&&a.jsx("span",{className:We.workspaceBadge,title:N,children:N}),b&&a.jsxs("span",{className:We.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&a.jsx("span",{className:`${We.dependencyBadge} ${v?We.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<H2&&a.jsx(Oi,{text:"Add child task",children:a.jsx("button",{onClick:T=>{T.stopPropagation(),d($i(t.workspaceId,t.id))},"aria-label":"Add child task",className:We.addChildButton,children:"+"})})]}),a.jsx(ls,{children:b&&_&&a.jsx(Rt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(T=>a.jsx(K1,{node:T,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:m,workspaceNames:p},T.id))})})]})}function AO({workspaces:t,tasks:s}){const o=dt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[m,p]=y.useState(i_),[g,v]=y.useState(i_),[_,b]=y.useState(new Map),x=It("/tasks/:taskId/*"),k=(x==null?void 0:x.params.taskId)!=="new"?x==null?void 0:x.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(W=>[W.id,W.status])),[s]),N=y.useMemo(()=>new Map(t.map(W=>[W.id,W.name])),[t]),T=()=>{const W=!m;CO(W),p(W),W&&(v(!0),b(new Map))},C=W=>{b(le=>{const B=new Map(le),R=B.has(W)?B.get(W):g;return B.set(W,!R),B})},A=W=>_.has(W)?_.get(W):g,L=W=>{c(le=>{const B=new Set(le);return B.has(W)?(B.delete(W),u(R=>new Set(R).add(W))):(B.add(W),u(R=>{const se=new Set(R);return se.delete(W),se})),B})};y.useEffect(()=>{const W=new Set(s.filter(le=>le.parentTaskId).map(le=>le.parentTaskId));W.size>0&&c(le=>{const B=new Set(le);for(const R of W)d.has(R)||B.add(R);return B})},[s,d]);const[E,O]=y.useState(""),{directMatchTaskIds:z,treeMatchTaskIds:D,titleHighlights:H}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const W=z2(s,E,NO),le=new Set(W.map(oe=>oe.item.id)),B=new Map;for(const oe of W){const q=oe.matches.find(me=>me.key==="title");q&&B.set(oe.item.id,q.indices)}const R=new Set(le),se=new Map(s.map(oe=>[oe.id,oe]));for(const oe of[...le]){let q=se.get(oe);for(;q!=null&&q.parentTaskId;)R.add(q.parentTaskId),q=se.get(q.parentTaskId)}return{directMatchTaskIds:le,treeMatchTaskIds:R,titleHighlights:B}},[E,s]),Y=z!==null,U=Y?m?z:D:null,X=U?s.filter(W=>U.has(W.id)):s,ge=m?[]:QI(X);return a.jsxs("div",{className:We.container,children:[a.jsxs("div",{className:We.header,children:[a.jsx("span",{children:"Tasks"}),a.jsxs("div",{className:We.headerActions,children:[a.jsx(Oi,{text:m?"Switch to tree view":"Group tasks by status",children:a.jsx("button",{className:`${We.groupToggle} ${m?We.groupToggleActive:""}`,onClick:T,"aria-label":m?"Switch to tree view":"Group tasks by status","aria-pressed":m,"data-testid":"task-group-by-status-toggle",children:a.jsx(lT,{size:qt})})}),a.jsx(Oi,{text:"New task",children:a.jsx("button",{className:We.addButton,onClick:()=>o($i()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&a.jsx("input",{type:"text",value:E,onChange:W=>O(W.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:We.searchInput,"data-testid":"sidebar-search"}),m?eO(X,j).map(W=>a.jsx(EO,{group:W,isExpanded:A(W.status),onToggle:()=>C(W.status),selectedTaskId:k,navigate:o,titleHighlights:H,workspaceNames:N},W.status)):ge.map(W=>a.jsx(K1,{node:W,depth:0,expandedTasks:r,toggleTask:L,selectedTaskId:k,navigate:o,taskStatusById:j,titleHighlights:H,workspaceNames:N},W.id)),X.length===0&&!Y&&a.jsx("div",{className:We.emptyState,children:"No tasks yet. Click + to create one."}),X.length===0&&Y&&a.jsx("div",{className:We.emptyState,children:"No matching tasks"})]})}const DO="_toast_ed2dk_1",RO="_success_ed2dk_18",MO="_icon_ed2dk_22",IO="_error_ed2dk_25",OO="_warning_ed2dk_32",LO="_info_ed2dk_38",BO="_message_ed2dk_53",$O="_close_ed2dk_60",Fr={toast:DO,success:RO,icon:MO,error:IO,warning:OO,info:LO,message:BO,close:$O},zO={success:a.jsx(Li,{size:Dt}),error:a.jsx($s,{size:Dt}),warning:a.jsx(Np,{size:Dt}),info:a.jsx(Tp,{size:Dt})};function HO({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),a.jsxs(Rt.div,{className:`${Fr.toast} ${Fr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[a.jsx("span",{className:Fr.icon,"aria-hidden":"true",children:zO[t.variant]}),a.jsx("span",{className:Fr.message,children:t.message}),a.jsx("button",{type:"button",className:Fr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:a.jsx($s,{size:qt,"aria-hidden":"true"})})]})}const PO="_container_qqse2_1",UO={container:PO};function VO({toasts:t,onDismiss:s}){return a.jsx("div",{className:UO.container,"data-testid":"toast-container",children:a.jsx(ls,{children:t.map(o=>a.jsx(HO,{toast:o,onDismiss:s},o.id))})})}const qO="_callout_e5awm_1",GO="_success_e5awm_11",FO="_icon_e5awm_15",ZO="_error_e5awm_18",KO="_warning_e5awm_25",YO="_info_e5awm_32",JO="_content_e5awm_48",WO="_close_e5awm_53",Zr={callout:qO,success:GO,icon:FO,error:ZO,warning:KO,info:YO,content:JO,close:WO},XO={success:a.jsx(Li,{size:Dt}),error:a.jsx($s,{size:Dt}),warning:a.jsx(Np,{size:Dt}),info:a.jsx(Tp,{size:Dt})};function QO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return a.jsx(a.Fragment,{children:!c&&a.jsxs("div",{className:[Zr.callout,Zr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[a.jsx("span",{className:Zr.icon,"aria-hidden":"true",children:XO[t]}),a.jsx("span",{className:Zr.content,children:s}),o&&a.jsx("button",{type:"button",className:Zr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:a.jsx($s,{size:qt,"aria-hidden":"true"})})]})})}function eL({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return a.jsx(a.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return a.jsx("div",{"data-testid":"update-banner",children:a.jsxs(QO,{variant:"info",dismissible:!0,children:[a.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",a.jsx("code",{children:c})]})})}const tL="_container_de44x_1",nL="_emptyState_de44x_8",sL="_card_de44x_14",aL="_cardClickable_de44x_34",iL="_cardHeader_de44x_42",oL="_categoryBadge_de44x_54",rL="_findingTitle_de44x_62",lL="_findingDate_de44x_68",cL="_findingContent_de44x_80",dL="_tags_de44x_86",uL="_tag_de44x_86",bs={container:tL,emptyState:nL,card:sL,cardClickable:aL,cardHeader:iL,categoryBadge:oL,findingTitle:rL,findingDate:lL,findingContent:cL,tags:dL,tag:uL};function Y1({findings:t,onFindingClick:s}){return t.length===0?a.jsx("div",{className:bs.emptyState,children:"No findings yet. Agents will post discoveries here."}):a.jsx("div",{className:bs.container,children:t.map((o,r)=>{const c=Td(o.category),d=s?Rt.button:Rt.div;return a.jsxs(d,{type:s?"button":void 0,className:`${bs.card} ${s?bs.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(o.id)}:void 0,children:[a.jsxs("div",{className:bs.cardHeader,children:[a.jsx("span",{className:bs.categoryBadge,style:{background:c.bg,color:c.text},children:o.category}),a.jsx("span",{className:bs.findingTitle,children:o.title}),a.jsx("span",{className:bs.findingDate,title:o.createdAt,children:Vo(o.createdAt)})]}),a.jsx("div",{className:bs.findingContent,children:o.content.length>300?o.content.slice(0,300)+"...":o.content}),o.tags.length>0&&a.jsx("div",{className:bs.tags,children:o.tags.map(u=>a.jsx("span",{className:bs.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},o.id)})})}const fL="_container_m1fsr_1",mL="_heading_m1fsr_7",pL="_section_m1fsr_14",hL="_sectionTitle_m1fsr_26",gL="_sectionDescription_m1fsr_35",vL="_emptyState_m1fsr_41",yL="_tokenList_m1fsr_48",bL="_tokenRow_m1fsr_55",_L="_tokenBadge_m1fsr_68",xL="_tokenName_m1fsr_83",kL="_tokenTarget_m1fsr_90",SL="_deleteButton_m1fsr_99",jL="_addForm_m1fsr_113",TL="_formRow_m1fsr_119",NL="_input_m1fsr_125",wL="_select_m1fsr_155",CL="_addButton_m1fsr_187",EL="_emptyStateInfo_m1fsr_221",AL="_themeOptions_m1fsr_229",DL="_themeOption_m1fsr_229",RL="_themeOptionSelected_m1fsr_254",ML="_themeOptionHeader_m1fsr_259",IL="_themeOptionLabel_m1fsr_266",OL="_themeOptionDesc_m1fsr_273",LL="_variantToggle_m1fsr_279",BL="_variantButton_m1fsr_286",$L="_variantActive_m1fsr_305",zL="_themeSwatches_m1fsr_311",HL="_themeSwatch_m1fsr_311",PL="_systemToggle_m1fsr_325",UL="_systemToggleHint_m1fsr_341",VL="_themeActive_m1fsr_348",qL="_aboutGrid_m1fsr_354",GL="_aboutItem_m1fsr_360",FL="_aboutLabel_m1fsr_373",ZL="_aboutValue_m1fsr_379",KL="_aboutDot_m1fsr_387",YL="_aboutDotConnected_m1fsr_394",JL="_aboutDotDisconnected_m1fsr_398",WL="_aboutDotConnecting_m1fsr_402",fe={container:fL,heading:mL,section:pL,sectionTitle:hL,sectionDescription:gL,emptyState:vL,tokenList:yL,tokenRow:bL,tokenBadge:_L,tokenName:xL,tokenTarget:kL,deleteButton:SL,addForm:jL,formRow:TL,input:NL,select:wL,addButton:CL,emptyStateInfo:EL,themeOptions:AL,themeOption:DL,themeOptionSelected:RL,themeOptionHeader:ML,themeOptionLabel:IL,themeOptionDesc:OL,variantToggle:LL,variantButton:BL,variantActive:$L,themeSwatches:zL,themeSwatch:HL,systemToggle:PL,systemToggleHint:UL,themeActive:VL,aboutGrid:qL,aboutItem:GL,aboutLabel:FL,aboutValue:ZL,aboutDot:KL,aboutDotConnected:YL,aboutDotDisconnected:JL,aboutDotConnecting:WL},XL=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function QL({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,m]=y.useState(""),[p,g]=y.useState("env_var"),[v,_]=y.useState(""),[b,x]=y.useState(null),k=T=>{if(T.preventDefault(),!c||!u)return;const C=p==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,p,C,p==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),m(""),_("")},j=T=>{x(T)},N=()=>{b&&(o(b),r==null||r("Token deleted","info")),x(null)};return a.jsxs(a.Fragment,{children:[a.jsx(ks,{isOpen:b!==null,title:"Delete Token?",description:b?`"${b}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>x(null)}),a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),a.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):a.jsx("div",{className:fe.tokenList,children:t.map(T=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenBadge,children:T.tokenType}),a.jsx("span",{className:fe.tokenName,children:T.name}),a.jsx("span",{className:fe.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),a.jsx("button",{className:fe.deleteButton,onClick:()=>j(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:a.jsx($s,{size:qt,"aria-hidden":"true"})})]},T.name))}),a.jsxs("form",{className:fe.addForm,onSubmit:k,children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:T=>m(T.target.value)})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsx("select",{className:fe.select,value:p,onChange:T=>g(T.target.value),children:XL.map(T=>a.jsx("option",{value:T.value,children:T.label},T.value))}),a.jsx("input",{className:fe.input,type:"text",placeholder:p==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>_(T.target.value)}),a.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Gd=[{id:"grackle",label:"Grackle",description:"The default Grackle theme — iridescent purple on clean dark.",swatches:["#0e1218","#8b5cf6","#60a5fa","#e5e7eb","#34d399"],variantLightId:"grackle-light",variantDarkId:"grackle-dark"},{id:"grackle-light",label:"Grackle Light",description:"Light Grackle variant.",hidden:!0},{id:"grackle-dark",label:"Grackle Dark",description:"Dark Grackle variant.",hidden:!0},{id:"glass",label:"Glassmorphism",description:"Dark frosted-glass aesthetic with backdrop blur effects.",swatches:["#0a0c14","#4ecca3","#70a1ff","#e2e8f0","#a855f7"]},{id:"matrix",label:"Matrix",description:"Phosphor-green CRT terminal with scanlines and glow.",swatches:["#050505","#00ff41","#00bfff","#33ff77","#ffb000"]},{id:"brutalist",label:"Neubrutalism",description:"Thick borders, raw colors, bold type — ugly on purpose.",swatches:["#f5f0e8","#ff5757","#5ce1e6","#1a1a1a","#ffde59"],variantLightId:"brutalist-light",variantDarkId:"brutalist-dark"},{id:"brutalist-light",label:"Neubrutalism Light",description:"Light neubrutalism variant.",hidden:!0},{id:"brutalist-dark",label:"Neubrutalism Dark",description:"Dark neubrutalism variant.",hidden:!0},{id:"monokai",label:"Monokai",description:"Classic warm editor palette — pink, green, and purple.",swatches:["#272822","#f92672","#a6e22e","#f8f8f2","#ae81ff"],variantLightId:"monokai-light",variantDarkId:"monokai-dark"},{id:"monokai-dark",label:"Monokai Dark",description:"Dark Monokai variant.",hidden:!0},{id:"monokai-light",label:"Monokai Light",description:"Light Monokai variant.",hidden:!0},{id:"ubuntu",label:"Ubuntu",description:"Aubergine terminal with the GNOME Tango palette.",swatches:["#300a24","#8ae234","#ef2929","#eeeeec","#fce94f"]},{id:"sandstone",label:"Sandstone",description:"Warm terracotta accent on dark brown, in the style of Claude Code.",swatches:["#1a1815","#C15F3C","#6b8afd","#e8e6e3","#a78bfa"]},{id:"verdigris",label:"Verdigris",description:"Teal accent on charcoal, in the style of ChatGPT.",swatches:["#141414","#00a67e","#3b82f6","#ececec","#ab68ff"]},{id:"primer",label:"Primer",description:"Blue accent on ink-dark grey, in the style of GitHub.",swatches:["#0d1117","#58a6ff","#3fb950","#c9d1d9","#bc8cff"]}],J1=new Set(Gd.map(t=>t.id)),o_="grackle";function bp(t){return Gd.find(s=>s.id===t)}function eB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),a.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),a.jsx("div",{className:fe.themeOptions,children:Gd.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),m=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,p=u&&s===d.variantLightId;return a.jsxs("button",{type:"button",className:`${fe.themeOption} ${m?fe.themeOptionSelected:""}`,"aria-pressed":m,onClick:()=>o(d.id),children:[a.jsxs("span",{className:fe.themeOptionHeader,children:[a.jsxs("span",{children:[a.jsx("span",{className:fe.themeOptionLabel,children:d.label}),a.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&a.jsxs("span",{className:fe.variantToggle,children:[a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${m&&p?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":m&&p,children:"☼"}),a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${m&&!p?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":m&&!p,children:"☾"})]})]}),d.swatches&&a.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((g,v)=>a.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),a.jsxs("label",{className:fe.systemToggle,children:[a.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),a.jsx("span",{children:"Match system light/dark preference"})]}),a.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),a.jsxs("p",{className:fe.themeActive,children:["Active theme: ",a.jsx("strong",{children:s})]})]})}const tB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},nB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function sB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return a.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"About"}),a.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),a.jsxs("div",{className:fe.aboutGrid,children:[a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Connection"}),a.jsxs("span",{className:fe.aboutValue,children:[a.jsx("span",{className:`${fe.aboutDot} ${nB[t]}`}),tB[t]]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Environments"}),a.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),a.jsx("span",{className:fe.aboutValue,children:d})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Version"}),a.jsx("span",{className:fe.aboutValue,children:"0.110.3"})]})]})]})}const aB="_container_cddyd_1",iB="_header_cddyd_8",oB="_headerTitle_cddyd_35",rB="_badge_cddyd_44",lB="_headerActions_cddyd_54",cB="_body_cddyd_61",dB="_formContent_cddyd_73",uB="_section_cddyd_85",fB="_label_cddyd_91",mB="_titleInput_cddyd_98",pB="_descriptionTextarea_cddyd_131",hB="_parentContext_cddyd_167",gB="_parentLabel_cddyd_175",vB="_parentName_cddyd_182",yB="_personaSelect_cddyd_186",bB="_depList_cddyd_220",_B="_depItem_cddyd_226",xB="_depItemSelected_cddyd_248",kB="_noDeps_cddyd_252",SB="_btnPrimary_cddyd_258",jB="_btnGhost_cddyd_289",st={container:aB,header:iB,headerTitle:oB,badge:rB,headerActions:lB,body:cB,formContent:dB,section:uB,label:fB,titleInput:mB,descriptionTextarea:pB,parentContext:hB,parentLabel:gB,parentName:vB,personaSelect:yB,depList:bB,depItem:_B,depItemSelected:xB,noDeps:kB,btnPrimary:SB,btnGhost:jB};function W1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:m,onCreateTask:p,onUpdateTask:g,onEditDone:v,onShowToast:_}){const b=dt(),x=t==="edit",k=x&&s?d.find(_e=>_e.id===s):void 0,j=x?(k==null?void 0:k.workspaceId)??"":o??"",[N,T]=y.useState(j),C=j||N,A=u.find(_e=>_e.id===C),L=c??(A==null?void 0:A.linkedEnvironmentIds[0]),E=!x&&!o,O=x?(k==null?void 0:k.parentTaskId)??"":r??"",z=O?d.find(_e=>_e.id===O):void 0,[D,H]=y.useState((k==null?void 0:k.title)??""),[Y,U]=y.useState((k==null?void 0:k.description)??""),[X,ge]=y.useState((k==null?void 0:k.dependsOn)??[]),[W,le]=y.useState((k==null?void 0:k.defaultPersonaId)??""),[B,R]=y.useState((k==null?void 0:k.canDecompose)??!1),[se,oe]=y.useState(!1),q=y.useRef(!1);y.useEffect(()=>{x&&k&&!q.current&&(q.current=!0,H(k.title),U(k.description),ge(k.dependsOn),le(k.defaultPersonaId),R(k.canDecompose))},[x,k]);const me=d.filter(_e=>_e.workspaceId===C&&(!x||_e.id!==s)&&_e.id!==O),de=D.trim().length>0&&(!x||k!==void 0)&&C.length>0,xe=_e=>{ge(Ie=>Ie.includes(_e)?Ie.filter(Mt=>Mt!==_e):[...Ie,_e])},Se=()=>{!de||se||x&&k===void 0||(x&&s?(g(s,D.trim(),Y,X,W),_==null||_("Task updated","success"),v?v():b(Pn(s,void 0,C,L),{replace:!0})):(oe(!0),p(C,D.trim(),Y,X.length>0?X:void 0,O||void 0,W,B,()=>{_==null||_("Task created","success"),b(o?Ri(o,L):"/tasks",{replace:!0})},_e=>{_==null||_(_e,"error"),oe(!1)})))},Pe=()=>{if(v){v();return}b(x&&s?Pn(s,void 0,C,L):o?Ri(o,L):"/tasks")},gt=x?"edit task":O?"child task":"new task";return a.jsxs("div",{className:st.container,children:[a.jsxs("div",{className:st.header,children:[a.jsxs("div",{className:st.headerTitle,children:[a.jsx("span",{className:st.badge,children:gt}),z&&a.jsxs("span",{className:st.parentContext,children:[a.jsx("span",{className:st.parentLabel,children:"Child of"}),a.jsx("span",{className:st.parentName,children:z.title})]})]}),a.jsxs("div",{className:st.headerActions,children:[a.jsx("button",{onClick:Se,disabled:!de||se,className:st.btnPrimary,"data-testid":"task-edit-save",children:se?"Creating…":x?"Save Changes":"Create"}),a.jsx("button",{onClick:Pe,className:st.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:st.body,children:a.jsxs("div",{className:st.formContent,children:[E&&a.jsxs("div",{className:st.section,children:[a.jsx("label",{className:st.label,htmlFor:"task-edit-workspace",children:"Workspace"}),a.jsxs("select",{id:"task-edit-workspace",value:N,onChange:_e=>T(_e.target.value),className:st.personaSelect,"data-testid":"task-edit-workspace",children:[a.jsx("option",{value:"",children:"Select a workspace..."}),u.map(_e=>a.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),a.jsxs("div",{className:st.section,children:[a.jsx("label",{className:st.label,htmlFor:"task-edit-title",children:"Title"}),a.jsx("input",{id:"task-edit-title",type:"text",value:D,onChange:_e=>H(_e.target.value),placeholder:"Task title...",autoFocus:!0,className:st.titleInput,"data-testid":"task-edit-title",onKeyDown:_e=>{_e.key==="Enter"&&de&&Se()}})]}),a.jsxs("div",{className:st.section,children:[a.jsx("label",{className:st.label,htmlFor:"task-edit-description",children:"Description"}),a.jsx("textarea",{id:"task-edit-description",value:Y,onChange:_e=>U(_e.target.value),placeholder:"Describe the task... (markdown supported)",className:st.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),a.jsxs("div",{className:st.section,children:[a.jsx("label",{className:st.label,htmlFor:"task-edit-persona",children:"Default Persona"}),a.jsxs("select",{id:"task-edit-persona",value:W,onChange:_e=>le(_e.target.value),className:st.personaSelect,"data-testid":"task-edit-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),m.map(_e=>a.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),!x&&a.jsx("div",{className:st.section,children:a.jsxs("label",{className:st.depItem,"data-testid":"task-edit-can-decompose",children:[a.jsx("input",{type:"checkbox",checked:B,onChange:_e=>R(_e.target.checked)}),"Can spawn subtasks"]})}),a.jsxs("div",{className:st.section,children:[a.jsx("div",{className:st.label,children:"Dependencies"}),me.length===0?a.jsx("div",{className:st.noDeps,children:"No other tasks in this workspace"}):a.jsx("div",{className:st.depList,children:me.map(_e=>{const Ie=X.includes(_e.id);return a.jsxs("label",{className:`${st.depItem} ${Ie?st.depItemSelected:""}`,"data-testid":`dep-option-${_e.id}`,children:[a.jsx("input",{type:"checkbox",checked:Ie,onChange:()=>xe(_e.id)}),_e.title,a.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",_e.status,")"]})]},_e.id)})})]})]})})]})}const TB="_actionButtons_1rjka_1",NB="_btnPrimary_1rjka_8",wB="_btnDanger_1rjka_39",CB="_btnGhost_1rjka_78",Qt={actionButtons:TB,btnPrimary:NB,btnDanger:wB,btnGhost:CB};function EB({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:m,onEdit:p}){if(t.status==="not_started")return o?a.jsxs("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:p,className:Qt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:m,className:Qt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):a.jsxs("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Qt.btnPrimary,children:"Start"}),a.jsx("button",{onClick:p,className:Qt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:m,className:Qt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return a.jsxs("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Qt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:u,disabled:!s,className:Qt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return a.jsxs("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Qt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:c,className:Qt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),a.jsx("button",{onClick:m,className:Qt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return a.jsx("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:a.jsx("button",{onClick:m,className:Qt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return a.jsxs("div",{className:Qt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:r,className:Qt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),a.jsx("button",{onClick:m,className:Qt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const AB="_workpadSection_y8nj9_1",DB="_workpadLabel_y8nj9_9",RB="_workpadStatus_y8nj9_17",MB="_workpadSummary_y8nj9_23",IB="_workpadExtra_y8nj9_29",Ga={workpadSection:AB,workpadLabel:DB,workpadStatus:RB,workpadSummary:MB,workpadExtra:IB};function OB({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return a.jsxs("div",{className:Ga.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Ga.workpadLabel,children:"Workpad"}),a.jsx("div",{className:Ga.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return a.jsxs("div",{className:Ga.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Ga.workpadLabel,children:"Workpad"}),s.status&&a.jsx("div",{className:Ga.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&a.jsx("div",{className:Ga.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&a.jsx("div",{className:Ga.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const LB="_overviewDashboard_r05qm_1",BB="_overviewHero_r05qm_7",$B="_statusBadge_r05qm_14",zB="_statusPending_r05qm_26",HB="_statusAssigned_r05qm_31",PB="_statusInProgress_r05qm_36",UB="_statusReview_r05qm_41",VB="_statusDone_r05qm_46",qB="_statusFailed_r05qm_51",GB="_statusWaitingInput_r05qm_56",FB="_overviewBranchPill_r05qm_61",ZB="_branchLink_r05qm_76",KB="_overviewSection_r05qm_87",YB="_overviewLabel_r05qm_93",JB="_overviewValue_r05qm_100",WB="_overviewMuted_r05qm_105",XB="_overviewMarkdown_r05qm_111",QB="_envRow_r05qm_180",e8="_envDot_r05qm_186",t8="_envDotGreen_r05qm_193",n8="_envDotYellow_r05qm_197",s8="_envDotRed_r05qm_201",a8="_envDotGray_r05qm_205",i8="_depList_r05qm_209",o8="_depItem_r05qm_215",r8="_depBlocked_r05qm_222",l8="_depDone_r05qm_226",c8="_timeline_r05qm_230",d8="_timelineRow_r05qm_236",u8="_timelineKey_r05qm_243",f8="_timelineValue_r05qm_249",m8="_timelineDelta_r05qm_253",p8="_reviewNotes_r05qm_264",be={overviewDashboard:LB,overviewHero:BB,statusBadge:$B,statusPending:zB,statusAssigned:HB,statusInProgress:PB,statusReview:UB,statusDone:VB,statusFailed:qB,statusWaitingInput:GB,overviewBranchPill:FB,branchLink:ZB,overviewSection:KB,overviewLabel:YB,overviewValue:JB,overviewMuted:WB,overviewMarkdown:XB,envRow:QB,envDot:e8,envDotGreen:t8,envDotYellow:n8,envDotRed:s8,envDotGray:a8,depList:i8,depItem:o8,depBlocked:r8,depDone:l8,timeline:c8,timelineRow:d8,timelineKey:u8,timelineValue:f8,timelineDelta:m8,reviewNotes:p8};function Yc(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Lm(t,s){if(!t||!s)return;const o=new Date(s).getTime()-new Date(t).getTime();if(isNaN(o)||o<0)return;const r=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function r_(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?be.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?be.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?be.envDotRed:be.envDotGray}function h8({status:t}){const s=Wa(t),o=HT(t);return a.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function g8({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:m}){const p=c.length>0?c[c.length-1]:void 0,g=(p==null?void 0:p.environmentId)??"",v=g?o.find(k=>k.id===g):void 0,_=r.find(k=>k.id===t.workspaceId),b=o.find(k=>k.id===d),x=t.branch&&(_!=null&&_.repoUrl)?`${_.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return a.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[a.jsxs("div",{className:be.overviewHero,children:[a.jsx(h8,{status:t.status}),t.branch&&a.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:x?a.jsxs("a",{href:x,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):a.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[a.jsx("div",{className:be.overviewLabel,children:"Description"}),a.jsx("div",{className:be.overviewMarkdown,children:a.jsx(Ed,{remarkPlugins:[Ad],children:t.description})})]}),t.workpad&&a.jsx(OB,{workpad:t.workpad}),a.jsxs("div",{className:be.overviewSection,children:[a.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${r_(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:v.displayName})]}):b?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${r_(b.status)}`,title:b.status,"aria-label":`Status: ${b.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:b.displayName}),a.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):a.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[a.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?a.jsx("div",{className:be.overviewMuted,children:"None"}):a.jsx("div",{className:be.depList,children:t.dependsOn.map(k=>{const j=s.get(k),N=(j==null?void 0:j.status)==="complete";return a.jsxs("div",{className:`${be.depItem} ${N?be.depDone:be.depBlocked}`,children:[a.jsx("span",{children:N?"✓":"○"}),a.jsx("span",{children:(j==null?void 0:j.title)??k})]},k)})})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[a.jsx("div",{className:be.overviewLabel,children:"Timeline"}),a.jsxs("div",{className:be.timeline,children:[t.createdAt&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Created"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.createdAt)})]}),t.assignedAt&&(()=>{const k=Lm(t.createdAt,t.assignedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Assigned"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.assignedAt)}),k!==void 0&&a.jsx("span",{className:be.timelineDelta,children:k})]})})(),t.startedAt&&(()=>{const k=Lm(t.assignedAt??t.createdAt,t.startedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Started"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.startedAt)}),k!==void 0&&a.jsx("span",{className:be.timelineDelta,children:k})]})})(),t.completedAt&&(()=>{const k=Lm(t.startedAt,t.completedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Completed"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.completedAt)}),k!==void 0&&a.jsx("span",{className:be.timelineDelta,children:k})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&a.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[a.jsx("div",{className:be.overviewLabel,children:"Usage"}),a.jsxs("div",{className:be.timeline,children:[a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsx("span",{className:be.timelineValue,children:Is(u.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),m&&m.costMillicents>u.costMillicents&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),a.jsx("span",{className:be.timelineValue,children:Is(m.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[m.sessionCount," session",m.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[a.jsx("div",{className:be.overviewLabel,children:"Budget"}),a.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Tokens"}),a.jsxs("span",{className:be.timelineValue,children:[zo(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",zo(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsxs("span",{className:be.timelineValue,children:[Is((u==null?void 0:u.costMillicents)??0)," / ",Is(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[a.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),a.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function v8({plugins:t,loading:s,onSetPluginEnabled:o}){return a.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[a.jsx("h2",{className:fe.heading,children:"Plugins"}),a.jsxs("div",{className:fe.section,children:[a.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&a.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&a.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return a.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&a.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),a.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&a.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),a.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:a.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function y8({githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u}){const[m,p]=y.useState(""),[g,v]=y.useState(""),[_,b]=y.useState(!1),[x,k]=y.useState(!1),[j,N]=y.useState(!1),[T,C]=y.useState(null),A=t.find(D=>D.id===T),L=async D=>{if(D.preventDefault(),!(!m.trim()||!g.trim())){k(!0);try{await o(m.trim(),g.trim(),"",_),u==null||u("GitHub account added","success"),p(""),v(""),b(!1)}catch(H){const Y=H instanceof Error?H.message:"Failed to add account";u==null||u(Y,"error")}finally{k(!1)}}},E=async D=>{try{await r(D,{isDefault:!0}),u==null||u("Default account updated","success")}catch(H){const Y=H instanceof Error?H.message:"Failed to update account";u==null||u(Y,"error")}},O=async()=>{if(T)try{await c(T),u==null||u("GitHub account removed","info")}catch(D){const H=D instanceof Error?D.message:"Failed to remove account";u==null||u(H,"error")}finally{C(null)}},z=async()=>{N(!0);try{const D=await d();D.imported>0?u==null||u(`Imported ${D.imported} account(s): ${D.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(D){const H=D instanceof Error?D.message:"Import failed";u==null||u(H,"error")}finally{N(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(ks,{isOpen:T!==null,title:"Remove GitHub Account?",description:A?`"${A.label}"${A.username?` (@${A.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{O().catch(()=>{})},onCancel:()=>C(null)}),a.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),a.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?a.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):a.jsx("div",{className:fe.tokenList,children:t.map(D=>a.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${D.id}`,children:[D.isDefault&&a.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),a.jsx("span",{className:fe.tokenName,children:D.label}),D.username&&a.jsxs("span",{className:fe.tokenTarget,children:["@",D.username]}),!D.isDefault&&a.jsx("button",{className:fe.deleteButton,onClick:()=>{E(D.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${D.label} as default`,"data-testid":`github-account-set-default-${D.id}`,children:a.jsx(IT,{size:qt,"aria-hidden":"true"})}),a.jsx("button",{className:fe.deleteButton,onClick:()=>C(D.id),title:`Remove ${D.label}`,"aria-label":`Remove ${D.label}`,"data-testid":`github-account-remove-${D.id}`,children:a.jsx($s,{size:qt,"aria-hidden":"true"})})]},D.id))}),a.jsxs("form",{className:fe.addForm,onSubmit:D=>{L(D).catch(()=>{})},children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:m,onChange:D=>p(D.target.value),"data-testid":"github-account-label-input"}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:g,onChange:D=>v(D.target.value),"data-testid":"github-account-token-input"})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:_,onChange:D=>b(D.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),a.jsx("button",{className:fe.addButton,type:"submit",disabled:!m.trim()||!g.trim()||x,"data-testid":"github-account-add-button",children:x?"Adding...":"Add Account"}),a.jsx("button",{className:fe.addButton,type:"button",onClick:()=>{z().catch(()=>{})},disabled:j,"data-testid":"github-account-import-button",children:j?"Importing...":"Import from gh CLI"})]})]})]})]})}const b8="_container_legrg_1",_8="_header_legrg_8",x8="_headerTitle_legrg_35",k8="_badge_legrg_44",S8="_headerActions_legrg_54",j8="_body_legrg_61",T8="_formContent_legrg_73",N8="_section_legrg_85",w8="_label_legrg_91",C8="_nameInput_legrg_98",E8="_fieldInput_legrg_131",A8="_adapterSelect_legrg_164",D8="_readOnlyValue_legrg_198",R8="_codespaceSection_legrg_204",M8="_codespaceActions_legrg_210",I8="_creatingHint_legrg_216",O8="_errorHint_legrg_222",L8="_btnPrimary_legrg_235",B8="_btnGhost_legrg_266",ie={container:b8,header:_8,headerTitle:x8,badge:k8,headerActions:S8,body:j8,formContent:T8,section:N8,label:w8,nameInput:C8,fieldInput:E8,adapterSelect:A8,readOnlyValue:D8,codespaceSection:R8,codespaceActions:M8,creatingHint:I8,errorHint:O8,btnPrimary:L8,btnGhost:B8},cd=1,dd=65535;function Bm(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=cd&&s<=dd}function $m(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function $8({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:m,onCreateCodespace:p}){const[g,v]=y.useState("pick"),[_,b]=y.useState(""),[x,k]=y.useState("");return g==="create"?a.jsxs("div",{className:ie.codespaceSection,children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Repository"}),a.jsx("input",{type:"text",value:_,onChange:j=>b(j.target.value),placeholder:"owner/repo",className:ie.fieldInput,"data-testid":"env-codespace-repo"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Machine Type"}),a.jsx("input",{type:"text",value:x,onChange:j=>k(j.target.value),placeholder:"Machine type (optional)...",className:ie.fieldInput,"data-testid":"env-codespace-machine"})]}),a.jsxs("div",{className:ie.codespaceActions,children:[a.jsx("button",{onClick:()=>{_.trim()&&(p(_.trim(),x.trim()||void 0),v("pick"),b(""),k(""))},disabled:!_.trim(),className:ie.btnPrimary,children:"Create"}),a.jsx("button",{onClick:()=>{v("pick"),b(""),k("")},className:ie.btnGhost,children:"Cancel"})]})]}):a.jsx("div",{className:ie.codespaceSection,children:a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Codespace"}),!u&&a.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:m,className:ie.adapterSelect,"data-testid":"env-codespace-select",children:[a.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>a.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),a.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),m&&a.jsx("span",{className:ie.creatingHint,children:"Creating codespace..."}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:ie.errorHint,children:u}),a.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:ie.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&a.jsx("span",{className:ie.errorHint,children:d})]})})}function X1({mode:t,environmentId:s,environments:o,githubAccounts:r,onAddEnvironment:c,onUpdateEnvironment:d,onListCodespaces:u,codespaces:m,codespaceError:p,codespaceListError:g,codespaceCreating:v,onCreateCodespace:_,onListDockerContainers:b,dockerContainers:x,dockerContainersError:k,onShowToast:j}){const N=dt(),T=t==="edit",C=T&&s?o.find(re=>re.id===s):void 0,[A,L]=y.useState(""),[E,O]=y.useState("local"),[z,D]=y.useState(""),[H,Y]=y.useState(""),[U,X]=y.useState(""),[ge,W]=y.useState(""),[le,B]=y.useState(""),[R,se]=y.useState(""),[oe,q]=y.useState(""),[me,de]=y.useState(""),[xe,Se]=y.useState("create"),[Pe,gt]=y.useState(""),[_e,Ie]=y.useState(null),Mt=y.useCallback(()=>{const re={};if(E==="local"){if(z.trim()&&(re.host=z.trim()),H.trim()){const ve=Number(H);Number.isInteger(ve)&&(re.port=ve)}}else if(E==="ssh"){if(re.host=z.trim(),U.trim()&&(re.user=U.trim()),H.trim()){const ve=Number(H);Number.isInteger(ve)&&(re.sshPort=ve)}ge.trim()&&(re.identityFile=ge.trim())}else E==="docker"?xe==="attach"?Pe.trim()&&(re.attach=Pe.trim()):(le.trim()&&(re.image=le.trim()),R.trim()&&(re.repo=R.trim())):E==="codespace"&&(re.codespaceName=oe.trim());return re},[E,z,H,U,ge,le,R,oe,xe,Pe]),hn=()=>!(!A.trim()||E==="ssh"&&!z.trim()||E==="codespace"&&!oe.trim()||E==="docker"&&xe==="attach"&&!Pe.trim()||(E==="local"||E==="ssh")&&!Bm(H)),ce=()=>{hn()&&(c(A.trim(),E,Mt(),me||void 0),j==null||j("Environment added successfully","success"),N($o,{replace:!0}))},Ue=()=>{N(s?Mi(s):$o)},ut=y.useCallback((re,ve)=>{if(!C||!s)return;const ft=$m(C.adapterConfig),Me=ve.trim();Me?ft[re]=Me:delete ft[re],d(s,{adapterConfig:ft})},[C,s,d]),te=y.useCallback((re,ve)=>{if(!C||!s)return;const ft=$m(C.adapterConfig);if(ve.trim()){const Me=Number(ve);Number.isInteger(Me)&&Me>=cd&&Me<=dd&&(ft[re]=Me)}else delete ft[re];d(s,{adapterConfig:ft})},[C,s,d]);if(T){if(!C)return a.jsxs("div",{className:ie.container,children:[a.jsxs("div",{className:ie.header,children:[a.jsx("div",{className:ie.headerTitle,children:a.jsx("span",{className:ie.badge,children:"edit environment"})}),a.jsx("div",{className:ie.headerActions,children:a.jsx("button",{onClick:Ue,className:ie.btnGhost,children:"Back"})})]}),a.jsx("div",{className:ie.body,children:a.jsx("div",{className:ie.formContent,children:a.jsx("span",{className:ie.readOnlyValue,children:"Environment not found"})})})]});const re=$m(C.adapterConfig);return a.jsxs("div",{className:ie.container,"data-testid":"env-edit-panel",children:[a.jsxs("div",{className:ie.header,children:[a.jsx("div",{className:ie.headerTitle,children:a.jsx("span",{className:ie.badge,children:"edit environment"})}),a.jsx("div",{className:ie.headerActions,children:a.jsx("button",{onClick:Ue,className:ie.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),a.jsx("div",{className:ie.body,children:a.jsxs("div",{className:ie.formContent,children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Name"}),a.jsx(Ut,{value:C.displayName,onSave:ve=>{s&&d(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:_e,onActivate:Ie,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Adapter Type"}),a.jsx("span",{className:ie.readOnlyValue,"data-testid":"env-edit-adapter-type",children:C.adapterType})]}),(C.adapterType==="codespace"||C.adapterType==="docker")&&(r.length>0||!!C.githubAccountId)&&a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"GitHub Account"}),a.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:ie.adapterSelect,"data-testid":"env-edit-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>a.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Host"}),a.jsx(Ut,{value:String(re.host??""),onSave:ve=>ut("host",ve),mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Ie,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Port"}),a.jsx(Ut,{value:String(re.port??""),onSave:ve=>te("port",ve),validate:ve=>Bm(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:_e,onActivate:Ie,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),C.adapterType==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Host"}),a.jsx(Ut,{value:String(re.host??""),onSave:ve=>ut("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Ie,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"User"}),a.jsx(Ut,{value:String(re.user??""),onSave:ve=>ut("user",ve),mode:"edit",fieldId:"user",activeFieldId:_e,onActivate:Ie,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"SSH Port"}),a.jsx(Ut,{value:String(re.sshPort??""),onSave:ve=>te("sshPort",ve),validate:ve=>Bm(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:_e,onActivate:Ie,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Identity File"}),a.jsx(Ut,{value:String(re.identityFile??""),onSave:ve=>ut("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:_e,onActivate:Ie,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),C.adapterType==="docker"&&re.attach!==void 0&&a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Attach (container)"}),a.jsx(Ut,{value:String(re.attach??""),onSave:ve=>ut("attach",ve),validate:ve=>ve.trim()===""?"Container name is required":void 0,mode:"edit",fieldId:"attach",activeFieldId:_e,onActivate:Ie,placeholder:"container name or ID",ariaLabel:"Attach container","data-testid":"env-edit-attach"})]}),C.adapterType==="docker"&&re.attach===void 0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Image"}),a.jsx(Ut,{value:String(re.image??""),onSave:ve=>ut("image",ve),mode:"edit",fieldId:"image",activeFieldId:_e,onActivate:Ie,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Repo"}),a.jsx(Ut,{value:String(re.repo??""),onSave:ve=>ut("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:_e,onActivate:Ie,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),C.adapterType==="codespace"&&a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Codespace Name"}),a.jsx(Ut,{value:String(re.codespaceName??""),onSave:ve=>ut("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:_e,onActivate:Ie,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return a.jsxs("div",{className:ie.container,"data-testid":"env-create-panel",children:[a.jsxs("div",{className:ie.header,children:[a.jsx("div",{className:ie.headerTitle,children:a.jsx("span",{className:ie.badge,children:"new environment"})}),a.jsxs("div",{className:ie.headerActions,children:[a.jsx("button",{onClick:ce,disabled:!hn(),className:ie.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),a.jsx("button",{onClick:Ue,className:ie.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:ie.body,children:a.jsxs("div",{className:ie.formContent,children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-name",children:"Name"}),a.jsx("input",{id:"env-create-name",type:"text",value:A,onChange:re=>L(re.target.value),placeholder:"Environment name...",autoFocus:!0,className:ie.nameInput,"data-testid":"env-create-name",onKeyDown:re=>{re.key==="Enter"&&hn()&&ce()}})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),a.jsxs("select",{id:"env-create-adapter",value:E,onChange:re=>{O(re.target.value),re.target.value==="codespace"&&u(me||void 0)},className:ie.adapterSelect,"data-testid":"env-create-adapter",children:[a.jsx("option",{value:"local",children:"local"}),a.jsx("option",{value:"ssh",children:"ssh"}),a.jsx("option",{value:"docker",children:"docker"}),a.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),a.jsxs("select",{id:"env-create-github-account",value:me,onChange:re=>{de(re.target.value),E==="codespace"&&u(re.target.value||void 0)},className:ie.adapterSelect,"data-testid":"env-create-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(re=>a.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:z,onChange:re=>D(re.target.value),placeholder:"Host (optional)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:cd,max:dd,value:H,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:z,onChange:re=>D(re.target.value),placeholder:"Host (required)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-user",children:"User"}),a.jsx("input",{id:"env-create-user",type:"text",value:U,onChange:re=>X(re.target.value),placeholder:"User (optional)...",className:ie.fieldInput,"data-testid":"env-create-user"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"SSH Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:cd,max:dd,value:H,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-identity",children:"Identity File"}),a.jsx("input",{id:"env-create-identity",type:"text",value:ge,onChange:re=>W(re.target.value),placeholder:"Identity file (optional)...",className:ie.fieldInput,"data-testid":"env-create-identity"})]})]}),E==="docker"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-docker-mode",children:"Source"}),a.jsxs("select",{id:"env-docker-mode",value:xe,onChange:re=>{const ve=re.target.value;Se(ve),ve==="attach"&&b()},className:ie.adapterSelect,"data-testid":"env-docker-mode",children:[a.jsx("option",{value:"create",children:"Create new container"}),a.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),xe==="create"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-image",children:"Image"}),a.jsx("input",{id:"env-create-image",type:"text",value:le,onChange:re=>B(re.target.value),placeholder:"Image (optional)...",className:ie.fieldInput,"data-testid":"env-create-image"})]}),a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,htmlFor:"env-create-repo",children:"Repo"}),a.jsx("input",{id:"env-create-repo",type:"text",value:R,onChange:re=>se(re.target.value),placeholder:"Repo (optional)...",className:ie.fieldInput,"data-testid":"env-create-repo"})]})]}):a.jsxs("div",{className:ie.section,children:[a.jsx("label",{className:ie.label,children:"Container"}),!k&&x.length>0&&a.jsxs("select",{value:Pe,onChange:re=>{gt(re.target.value),re.target.value&&!A.trim()&&L(re.target.value)},className:ie.adapterSelect,"data-testid":"env-docker-container-select",children:[a.jsx("option",{value:"",children:"Select a container..."}),x.map(re=>a.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(k||x.length===0)&&a.jsxs(a.Fragment,{children:[k?a.jsx("span",{className:ie.errorHint,children:k}):a.jsx("span",{className:ie.creatingHint,children:"No running containers found."}),a.jsx("input",{type:"text",value:Pe,onChange:re=>{gt(re.target.value),re.target.value&&!A.trim()&&L(re.target.value)},placeholder:"Enter container name/ID...",className:ie.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&a.jsx($8,{codespaceName:oe,onCodespaceNameChange:q,envName:A,onEnvNameChange:L,codespaces:m,codespaceError:p,codespaceListError:g,codespaceCreating:v,onCreateCodespace:_})]})})]})}const z8="_group_1iprv_1",H8="_groupTitle_1iprv_8",P8="_shortcutList_1iprv_17",U8="_shortcutRow_1iprv_23",V8="_keys_1iprv_36",q8="_kbd_1iprv_43",G8="_description_1iprv_60",Ni={group:z8,groupTitle:H8,shortcutList:P8,shortcutRow:U8,keys:V8,kbd:q8,description:G8},F8=[{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 Z8(){return a.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),a.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),F8.map(t=>a.jsxs("div",{className:Ni.group,children:[a.jsx("h4",{className:Ni.groupTitle,children:t.title}),a.jsx("div",{className:Ni.shortcutList,children:t.shortcuts.map(s=>a.jsxs("div",{className:Ni.shortcutRow,children:[a.jsx("span",{className:Ni.keys,children:s.keys.map(o=>a.jsx("kbd",{className:Ni.kbd,children:o},o))}),a.jsx("span",{className:Ni.description,children:s.description})]},s.description))})]},t.title))]})}const K8=[{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 Y8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),a.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),a.jsx("div",{className:fe.tokenList,children:K8.map(r=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenName,children:r.label}),a.jsx("span",{className:fe.tokenTarget,children:r.description}),a.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>a.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const J8="_container_10efq_1",W8="_header_10efq_7",X8="_list_10efq_105",Q8="_card_10efq_111",e7="_cardHeader_10efq_125",t7="_cardTitle_10efq_135",n7="_defaultBadge_10efq_141",s7="_cardActions_10efq_155",a7="_description_10efq_160",i7="_meta_10efq_166",o7="_empty_10efq_212",r7="_typeBadge_10efq_362",as={container:J8,header:W8,list:X8,card:Q8,cardHeader:e7,cardTitle:t7,defaultBadge:n7,cardActions:s7,description:a7,meta:i7,empty:o7,typeBadge:r7};function l7({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,m]=y.useState(null),p=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),m(null)};return a.jsxs("div",{className:as.container,children:[a.jsxs("div",{className:as.header,children:[a.jsx("h2",{children:"Personas"}),a.jsx(on,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?a.jsx("p",{className:as.empty,children:"No personas yet. Create one to get started."}):a.jsx("div",{className:as.list,children:t.map(v=>{const _=s===v.id,b=v.type==="script";return a.jsxs("div",{className:as.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(v.id))},children:[a.jsxs("div",{className:as.cardHeader,children:[a.jsxs("span",{className:as.cardTitle,children:[a.jsx("strong",{children:v.name}),a.jsx("span",{className:as.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:b?"Script":"Agent"}),_&&a.jsx("span",{className:as.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),a.jsxs("div",{className:as.cardActions,onClick:x=>x.stopPropagation(),children:[!_&&a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>m(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&a.jsx("p",{className:as.description,children:v.description}),a.jsxs("div",{className:as.meta,children:[v.runtime&&a.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&a.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&a.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),a.jsx(ks,{isOpen:u!==null,title:"Delete Persona?",description:`"${(p==null?void 0:p.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>m(null)})]})}const c7="_container_uy08i_1",d7="_header_uy08i_7",u7="_count_uy08i_13",f7="_presets_uy08i_18",m7="_presetButton_uy08i_24",p7="_filterInput_uy08i_41",h7="_groups_uy08i_53",g7="_group_uy08i_53",v7="_groupHeader_uy08i_68",y7="_groupName_uy08i_77",b7="_groupCount_uy08i_81",_7="_toolList_uy08i_87",x7="_toolItem_uy08i_95",k7="_toolName_uy08i_103",_n={container:c7,header:d7,count:u7,presets:f7,presetButton:m7,filterInput:p7,groups:h7,group:g7,groupHeader:v7,groupName:y7,groupCount:b7,toolList:_7,toolItem:x7,toolName:k7},S7=(()=>{const t=new Map;for(const s of A_){const o=s==="get_version_status"?"version":s.split("_")[0];t.has(o)||t.set(o,[]),t.get(o).push(s)}return[...t.entries()].sort(([s],[o])=>s.localeCompare(o)).map(([s,o])=>({group:s,tools:o.sort()}))})(),j7=[{name:"default",label:"Default",tools:E_},{name:"worker",label:"Worker",tools:P2},{name:"orchestrator",label:"Orchestrator",tools:U2},{name:"admin",label:"Admin",tools:V2}];function l_({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const _=new Set(d);_.has(v)?_.delete(v):_.add(v),s([..._].sort())},[d,s,o]),m=y.useCallback((v,_)=>{if(o)return;const b=new Set(d);for(const x of v)_?b.delete(x):b.add(x);s([...b].sort())},[d,s,o]),p=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return a.jsxs("div",{className:_n.container,"data-testid":"mcp-tool-selector",children:[a.jsx("div",{className:_n.header,children:a.jsx("span",{className:_n.count,children:t.length===0?`Using default (${E_.length} tools)`:`${t.length} of ${A_.size} tools selected`})}),a.jsxs("div",{className:_n.presets,"data-testid":"mcp-tool-presets",children:[j7.map(v=>a.jsx("button",{type:"button",className:_n.presetButton,disabled:o,onClick:()=>p(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),a.jsx("button",{type:"button",className:_n.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),a.jsx("input",{type:"text",className:_n.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),a.jsx("div",{className:_n.groups,children:S7.map(({group:v,tools:_})=>{const b=g?_.filter(k=>k.toLowerCase().includes(g)):_;if(b.length===0)return null;const x=b.every(k=>d.has(k));return a.jsxs("div",{className:_n.group,"data-testid":`tool-group-${v}`,children:[a.jsxs("label",{className:_n.groupHeader,children:[a.jsx("input",{type:"checkbox",checked:x,onChange:()=>m(b,x),disabled:o,"data-testid":`group-toggle-${v}`}),a.jsx("span",{className:_n.groupName,children:v}),a.jsxs("span",{className:_n.groupCount,children:["(",b.filter(k=>d.has(k)).length,"/",b.length,")"]})]}),a.jsx("div",{className:_n.toolList,children:b.map(k=>a.jsxs("label",{className:_n.toolItem,children:[a.jsx("input",{type:"checkbox",checked:d.has(k),onChange:()=>u(k),disabled:o,"data-testid":`tool-${k}`}),a.jsx("span",{className:_n.toolName,children:k})]},k))})]},v)})})]})}const T7="_container_1gfuq_1",N7="_header_1gfuq_7",w7="_list_1gfuq_19",C7="_card_1gfuq_25",E7="_cardHeader_1gfuq_40",A7="_cardTitle_1gfuq_46",D7="_statusBadge_1gfuq_56",R7="_enabled_1gfuq_68",M7="_disabled_1gfuq_71",I7="_cardActions_1gfuq_75",O7="_cardMeta_1gfuq_80",L7="_empty_1gfuq_98",is={container:T7,header:N7,list:w7,card:C7,cardHeader:E7,cardTitle:A7,statusBadge:D7,enabled:R7,disabled:M7,cardActions:I7,cardMeta:O7,empty:L7};function B7({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,m]=y.useState(null),p=u?t.find(b=>b.id===u):void 0,g=async b=>{await o(b),m(null)},v=y.useMemo(()=>{const b=new Map;for(const x of s)b.set(x.id,x.name);return b},[s]),_=b=>v.get(b)??b;return a.jsxs("div",{className:is.container,children:[a.jsxs("div",{className:is.header,children:[a.jsx("h2",{children:"Schedules"}),a.jsx(on,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?a.jsx("p",{className:is.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):a.jsx("div",{className:is.list,children:t.map(b=>a.jsxs("div",{className:is.card,"data-testid":`schedule-card-${b.id}`,onClick:()=>d(b.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(b.id))},children:[a.jsxs("div",{className:is.cardHeader,children:[a.jsxs("span",{className:is.cardTitle,children:[a.jsx("strong",{children:b.title}),a.jsx("span",{className:`${is.statusBadge} ${b.enabled?is.enabled:is.disabled}`,"data-testid":`schedule-status-badge-${b.id}`,children:b.enabled?"Enabled":"Disabled"})]}),a.jsxs("div",{className:is.cardActions,onClick:x=>x.stopPropagation(),children:[a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(b.id,{enabled:!b.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${b.id}`,title:b.enabled?"Disable schedule":"Enable schedule",children:b.enabled?"Disable":"Enable"}),a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>d(b.id),"data-testid":`schedule-edit-${b.id}`,children:"Edit"}),a.jsx(on,{variant:"ghost",size:"sm",onClick:()=>m(b.id),"data-testid":`schedule-delete-${b.id}`,children:"Delete"})]})]}),a.jsxs("div",{className:is.cardMeta,children:[a.jsx("span",{"data-testid":`schedule-expression-${b.id}`,children:b.scheduleExpression}),b.personaId&&a.jsxs("span",{"data-testid":`schedule-persona-${b.id}`,children:["Persona: ",_(b.personaId)]}),a.jsxs("span",{"data-testid":`schedule-last-run-${b.id}`,children:["Last run: ",b.lastRunAt?Vo(b.lastRunAt):"Never"]}),b.enabled&&b.nextRunAt?a.jsxs("span",{"data-testid":`schedule-next-run-${b.id}`,children:["Next run: ",q1(b.nextRunAt)]}):null,b.runCount>0&&a.jsxs("span",{"data-testid":`schedule-run-count-${b.id}`,children:["Runs: ",b.runCount]})]})]},b.id))}),a.jsx(ks,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(p==null?void 0:p.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>m(null)})]})}const $7="_nav_1bhou_1",z7="_tab_1bhou_24",H7="_tabIcon_1bhou_62",P7="_tabActive_1bhou_68",Jc={nav:$7,tab:z7,tabIcon:H7,tabActive:P7},ia=[{path:"credentials",label:"Credentials",icon:a.jsx(nT,{size:Dt})},{path:"github-accounts",label:"GitHub Accounts",icon:a.jsx(Wj,{size:Dt})},{path:"personas",label:"Personas",icon:a.jsx(BT,{size:Dt})},{path:"schedules",label:"Schedules",icon:a.jsx(Aj,{size:Dt})},{path:"appearance",label:"Appearance",icon:a.jsx(vT,{size:Dt})},{path:"shortcuts",label:"Shortcuts",icon:a.jsx(aT,{size:Dt})},{path:"plugins",label:"Plugins",icon:a.jsx(ST,{size:Dt})},{path:"about",label:"About",icon:a.jsx(Tp,{size:Dt})}];function U7(){var u;const t=Jt(),s=dt(),o=y.useRef(null),r=((u=ia.find(m=>{const p=`${Ai}/${m.path}`;return t.pathname===p||t.pathname.startsWith(`${p}/`)}))==null?void 0:u.path)??ia[0].path,c=y.useCallback(m=>{s(`${Ai}/${m}`)},[s]),d=y.useCallback(m=>{var x,k;const p=(x=o.current)==null?void 0:x.querySelectorAll('[role="tab"]');if(!p)return;const g=Array.from(p).findIndex(j=>j===document.activeElement),v=g>=0?g:ia.findIndex(j=>j.path===r);let _=v;if(m.key==="ArrowDown"||m.key==="j"||m.key==="J")m.preventDefault(),_=(v+1)%ia.length;else if(m.key==="ArrowUp"||m.key==="k"||m.key==="K")m.preventDefault(),_=(v-1+ia.length)%ia.length;else if(m.key==="Home")m.preventDefault(),_=0;else if(m.key==="End")m.preventDefault(),_=ia.length-1;else return;const b=ia[_].path;s(`${Ai}/${b}`),(k=p[_])==null||k.focus()},[r,s]);return a.jsx("nav",{className:Jc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:ia.map(m=>{const p=m.path===r;return a.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Jc.tab} ${p?Jc.tabActive:""}`,onClick:()=>c(m.path),children:[a.jsx("span",{className:Jc.tabIcon,"aria-hidden":"true",children:m.icon}),m.label]},m.path)})})}const V7="_container_1dqrb_1",q7="_header_1dqrb_5",G7="_refreshButton_1dqrb_17",F7="_streamRow_1dqrb_32",Z7="_selected_1dqrb_49",K7="_systemRow_1dqrb_53 _streamRow_1dqrb_32",Y7="_streamIcon_1dqrb_60",J7="_streamName_1dqrb_65",W7="_subscriberBadge_1dqrb_74",X7="_emptyState_1dqrb_88",Q7="_loading_1dqrb_95",xn={container:V7,header:q7,refreshButton:G7,streamRow:F7,selected:Z7,systemRow:K7,streamIcon:Y7,streamName:J7,subscriberBadge:W7,emptyState:X7,loading:Q7},c_=14;function e$({streams:t,loading:s,streamsLoadError:o=!1,streamsLoadedOnce:r=!0,onRefresh:c}){const d=dt(),u=Jt(),m=It("/chat/:streamId"),p=m==null?void 0:m.params.streamId,g=!p&&u.pathname===cl,v=[...t].sort((x,k)=>x.name.localeCompare(k.name)),_=y.useCallback(()=>{d(cl)},[d]),b=y.useCallback(x=>{d(qw(x))},[d]);return a.jsxs("div",{className:xn.container,"data-testid":"stream-list",children:[a.jsxs("div",{className:xn.header,children:[a.jsx("span",{children:"Streams"}),c&&a.jsx("button",{className:xn.refreshButton,onClick:c,"aria-label":"Refresh streams","data-testid":"stream-list-refresh",children:a.jsx(wT,{size:12})})]}),a.jsxs("button",{type:"button",className:`${xn.systemRow}${g?` ${xn.selected}`:""}`,onClick:_,"data-testid":"stream-list-system-row","aria-current":g?"page":void 0,children:[a.jsx(L_,{size:c_,className:xn.streamIcon}),a.jsx("span",{className:xn.streamName,children:"System"})]}),s&&v.length===0&&a.jsx("div",{className:xn.loading,children:"Loading..."}),!s&&o&&a.jsx("div",{className:xn.emptyState,"data-testid":"stream-list-error",children:"Unable to load streams"}),!s&&!o&&r&&v.length===0&&a.jsx("div",{className:xn.emptyState,children:"No streams"}),v.map(x=>{const k=p===x.id;return a.jsxs("button",{type:"button",className:`${xn.streamRow}${k?` ${xn.selected}`:""}`,onClick:()=>b(x.id),"data-testid":`stream-list-row-${x.id}`,"aria-current":k?"page":void 0,children:[a.jsx(TT,{size:c_,className:xn.streamIcon}),a.jsx("span",{className:xn.streamName,children:x.name}),x.subscriberCount>0&&a.jsx("span",{className:xn.subscriberBadge,children:x.subscriberCount})]},x.id)})]})}const t$="_panel_1au81_1",n$="_header_1au81_24",s$="_title_1au81_33",a$="_closeButton_1au81_43",i$="_body_1au81_57",o$="_section_1au81_63",r$="_sectionLabel_1au81_67",l$="_metaRow_1au81_76",c$="_metaKey_1au81_84",d$="_metaValue_1au81_90",u$="_subscriberCard_1au81_99",f$="_subscriberHeader_1au81_107",m$="_sessionLink_1au81_114",p$="_badges_1au81_132",h$="_badgeRw_1au81_150 _badge_1au81_132",g$="_badgeR_1au81_150 _badge_1au81_132",v$="_badgeW_1au81_162 _badge_1au81_132",y$="_badgeAsync_1au81_168 _badge_1au81_132",b$="_badgeSync_1au81_174 _badge_1au81_132",_$="_badgeDetach_1au81_178 _badge_1au81_132",x$="_spawnTag_1au81_184 _badge_1au81_132",k$="_fdNumber_1au81_189",S$="_emptySubscribers_1au81_195",lt={panel:t$,header:n$,title:s$,closeButton:a$,body:i$,section:o$,sectionLabel:r$,metaRow:l$,metaKey:c$,metaValue:d$,subscriberCard:u$,subscriberHeader:f$,sessionLink:m$,badges:p$,badgeRw:h$,badgeR:g$,badgeW:v$,badgeAsync:y$,badgeSync:b$,badgeDetach:_$,spawnTag:x$,fdNumber:k$,emptySubscribers:S$};function j$({permission:t}){const s=t==="rw"?lt.badgeRw:t==="r"?lt.badgeR:lt.badgeW;return a.jsx("span",{className:s,children:t})}function T$({mode:t}){const s=t==="async"?lt.badgeAsync:t==="detach"?lt.badgeDetach:lt.badgeSync;return a.jsx("span",{className:s,children:t})}function N$({stream:t,onClose:s}){const o=dt();return y.useEffect(()=>{const r=c=>{c.key==="Escape"&&s()};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[s]),a.jsxs("div",{className:lt.panel,"data-testid":"stream-detail-panel",children:[a.jsxs("div",{className:lt.header,children:[a.jsx("h3",{className:lt.title,children:t.name}),a.jsx("button",{className:lt.closeButton,onClick:s,"aria-label":"Close stream details",children:"×"})]}),a.jsxs("div",{className:lt.body,children:[a.jsxs("div",{className:lt.section,children:[a.jsx("div",{className:lt.sectionLabel,children:"Overview"}),a.jsxs("div",{className:lt.metaRow,children:[a.jsx("span",{className:lt.metaKey,children:"Stream ID"}),a.jsx("span",{className:lt.metaValue,children:t.id})]}),a.jsxs("div",{className:lt.metaRow,children:[a.jsx("span",{className:lt.metaKey,children:"Subscribers"}),a.jsx("span",{className:lt.metaValue,children:t.subscriberCount})]}),a.jsxs("div",{className:lt.metaRow,children:[a.jsx("span",{className:lt.metaKey,children:"Buffered"}),a.jsxs("span",{className:lt.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),a.jsxs("div",{className:lt.section,children:[a.jsx("div",{className:lt.sectionLabel,children:"Subscribers"}),t.subscribers.length===0?a.jsx("div",{className:lt.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(r=>a.jsxs("div",{className:lt.subscriberCard,"data-testid":`subscriber-card-${r.subscriptionId}`,children:[a.jsxs("div",{className:lt.subscriberHeader,children:[a.jsxs("span",{className:lt.fdNumber,children:["fd ",r.fd]}),a.jsxs("button",{className:lt.sessionLink,onClick:()=>{o(Bd(r.sessionId))},title:r.sessionId,children:[r.sessionId.slice(0,12),"…"]})]}),a.jsxs("div",{className:lt.badges,children:[a.jsx(j$,{permission:r.permission}),a.jsx(T$,{mode:r.deliveryMode}),r.createdBySpawn&&a.jsx("span",{className:lt.spawnTag,children:"spawn"})]})]},r.subscriptionId))]})]})]})}function w$({tasks:t,taskStatusById:s,sessionStatusByTaskId:o}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(Ty.map(d=>[d,[]]));for(const d of t){const u=gl(d.status),m=d.dependsOn.length>0&&d.dependsOn.some(k=>s.get(k)!=="complete"),p=r.get(d.id)??[],g=p.length,v=p.filter(k=>k.status==="complete").length;let _;if(u==="paused"&&o){const k=o.get(d.id);k==="idle"?_="Needs input":k==="completed"&&(_="Ready to complete")}const b={task:d,isBlocked:m,childCount:g,doneChildCount:v,pausedSubBadge:_},x=c.get(u);x?x.push(b):c.get("not_started").push(b)}for(const d of c.values())d.sort((u,m)=>u.task.sortOrder-m.task.sortOrder);return Ty.map(d=>{const u=Wa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const C$="_boardContainer_1c4y1_1",E$="_column_1c4y1_17",A$="_columnHeader_1c4y1_34",D$="_columnIcon_1c4y1_47",R$="_columnLabel_1c4y1_52",M$="_columnCount_1c4y1_57",I$="_cardList_1c4y1_67",O$="_emptyPlaceholder_1c4y1_76",L$="_card_1c4y1_67",B$="_cardHeader_1c4y1_107",$$="_cardStatusIcon_1c4y1_113",z$="_cardTitle_1c4y1_119",H$="_cardBadges_1c4y1_127",P$="_badge_1c4y1_134",U$="_blockedBadge_1c4y1_146",V$="_childBadge_1c4y1_151",q$="_depBadge_1c4y1_155",G$="_parentBadge_1c4y1_159",F$="_pausedSubBadge_1c4y1_166",Z$="_personaBadge_1c4y1_170",K$="_envBadge_1c4y1_174",Y$="_emptyCta_1c4y1_178",J$="_ctaButton_1c4y1_188",W$="_ctaDescription_1c4y1_204",ct={boardContainer:C$,column:E$,columnHeader:A$,columnIcon:D$,columnLabel:R$,columnCount:M$,cardList:I$,emptyPlaceholder:O$,card:L$,cardHeader:B$,cardStatusIcon:$$,cardTitle:z$,cardBadges:H$,badge:P$,blockedBadge:U$,childBadge:V$,depBadge:q$,parentBadge:G$,pausedSubBadge:F$,personaBadge:Z$,envBadge:K$,emptyCta:Y$,ctaButton:J$,ctaDescription:W$};function X$({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=dt(),m=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),p=y.useMemo(()=>new Map(o.map(b=>[b.id,b.status])),[o]),g=y.useMemo(()=>new Map(m.map(b=>[b.id,b])),[m]),v=y.useMemo(()=>{const b=new Map(r.map(C=>[C.id,C])),x=new Map(c.map(C=>[C.id,C])),k=new Map(d.map(C=>[C.id,C])),j=new Map,N=new Map,T=new Map;for(const C of m)if(C.latestSessionId){const A=b.get(C.latestSessionId);if(A){if(j.set(C.id,A.endReason||A.status),A.personaId){const L=x.get(A.personaId);L&&N.set(C.id,L.name)}if(A.environmentId){const L=k.get(A.environmentId);L&&T.set(C.id,L.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:N,environmentNameByTaskId:T}},[m,r,c,d]),_=y.useMemo(()=>w$({tasks:m,taskStatusById:p,sessionStatusByTaskId:v.sessionStatusByTaskId}),[m,p,v]);return m.length===0?a.jsxs("div",{className:ct.emptyCta,"data-testid":"board-empty-cta",children:[a.jsx("button",{className:ct.ctaButton,onClick:()=>u($i(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:ct.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):a.jsx("div",{className:ct.boardContainer,"data-testid":"board-container",children:_.map(b=>a.jsxs("section",{className:ct.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[a.jsxs("div",{className:ct.columnHeader,children:[a.jsx("span",{className:ct.columnIcon,style:{color:b.style.color},children:b.style.icon}),a.jsx("span",{className:ct.columnLabel,children:b.label}),a.jsx("span",{className:ct.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),a.jsx("div",{className:ct.cardList,children:b.tasks.length===0?a.jsx("div",{className:ct.emptyPlaceholder,children:"No tasks"}):a.jsx(ls,{mode:"popLayout",children:b.tasks.map(x=>a.jsx(Rt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:a.jsx(Q$,{boardTask:x,tasksById:g,personaName:v.personaNameByTaskId.get(x.task.id),envName:v.environmentNameByTaskId.get(x.task.id),onClick:()=>u(Pn(x.task.id,void 0,t,s))})},x.task.id))})})]},b.status))})}function Q$({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:m,doneChildCount:p,pausedSubBadge:g}=t,v=Wa(d.status),_=d.parentTaskId?s.get(d.parentTaskId):void 0;return a.jsxs("div",{className:ct.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c())},children:[a.jsxs("div",{className:ct.cardHeader,children:[a.jsx("span",{className:ct.cardStatusIcon,style:{color:v.color},children:v.icon}),a.jsx("span",{className:ct.cardTitle,children:d.title})]}),a.jsxs("div",{className:ct.cardBadges,children:[_&&a.jsx("span",{className:`${ct.badge} ${ct.parentBadge}`,title:_.title,children:_.title}),m>0&&a.jsxs("span",{className:`${ct.badge} ${ct.childBadge}`,children:[p,"/",m]}),u&&a.jsx("span",{className:`${ct.badge} ${ct.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&a.jsx("span",{className:`${ct.badge} ${ct.depBadge}`,children:"dep"}),g&&a.jsx("span",{className:`${ct.badge} ${ct.pausedSubBadge}`,children:g}),o&&a.jsx("span",{className:`${ct.badge} ${ct.personaBadge}`,children:o}),r&&a.jsx("span",{className:`${ct.badge} ${ct.envBadge}`,children:r})]})]})}const ez="_formContent_ymnez_1",tz="_section_ymnez_13",nz="_label_ymnez_19",sz="_titleInput_ymnez_26",az="_descriptionTextarea_ymnez_58",iz="_selectField_ymnez_94",oz="_checkboxRow_ymnez_128",rz="_checkboxLabel_ymnez_141",lz="_fieldError_ymnez_146",Tt={formContent:ez,section:tz,label:nz,titleInput:sz,descriptionTextarea:az,selectField:iz,checkboxRow:oz,checkboxLabel:rz,fieldError:lz};function cz(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.linkedEnvironmentIds[0])??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const dz=100;function uz({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const m=(p,g)=>{s({...t,[p]:g})};return a.jsxs("div",{className:Tt.formContent,children:[a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-name",children:"Name"}),a.jsx("input",{id:"ws-name",className:Tt.titleInput,type:"text",value:t.name,onChange:p=>m("name",p.target.value),placeholder:"Workspace name",maxLength:dz,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-description",children:"Description"}),a.jsx("textarea",{id:"ws-description",className:Tt.descriptionTextarea,value:t.description,onChange:p=>m("description",p.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-repo",children:"Repository URL"}),a.jsx("input",{id:"ws-repo",className:Tt.titleInput,type:"text",value:t.repoUrl,onChange:p=>m("repoUrl",p.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-environment",children:"Environment"}),a.jsxs("select",{id:"ws-environment",className:Tt.selectField,value:t.environmentId,onChange:p=>m("environmentId",p.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[a.jsx("option",{value:"",children:"Select environment…"}),o.map(p=>a.jsx("option",{value:p.id,children:p.displayName||p.id},p.id))]}),(c==null?void 0:c.environmentId)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-persona",children:"Default Persona"}),a.jsxs("select",{id:"ws-persona",className:Tt.selectField,value:t.defaultPersonaId,onChange:p=>m("defaultPersonaId",p.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),r.map(p=>a.jsx("option",{value:p.id,children:p.name},p.id))]})]}),a.jsx("div",{className:Tt.section,children:a.jsxs("label",{className:Tt.checkboxRow,children:[a.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:p=>m("useWorktrees",p.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),a.jsx("span",{className:Tt.checkboxLabel,children:"Enable worktree isolation"})]})}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-workdir",children:"Working Directory"}),a.jsx("input",{id:"ws-workdir",className:Tt.titleInput,type:"text",value:t.workingDirectory,onChange:p=>m("workingDirectory",p.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const Q1=y.createContext(void 0),fz=4e3;function mz({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(m=>m.filter(p=>p.id!==u))},[]),d=y.useCallback((u,m="info",p=fz)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:m,duration:p}])},[]);return a.jsx(Q1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(Q1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const _p="grackle-theme",ek="grackle-prefer-system",tk="(prefers-color-scheme: dark)";let Xr=[],ud;function zm(){ud=void 0;for(const t of Xr)t()}function xp(){return typeof window>"u"?!1:window.matchMedia(tk).matches}function il(){if(typeof localStorage>"u")return o_;try{const t=localStorage.getItem(_p);if(t!==null&&J1.has(t))return t}catch{}return o_}function Nd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(ek)==="true"}catch{return!1}}function kp(t){return Gd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function nk(t,s){const o=bp(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?xp()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=kp(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return xp()?r.variantDarkId:r.variantLightId}return t}function Ro(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=nk(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Ro(il(),Nd());function pz(){return ud===void 0&&(ud={themeId:il(),systemDark:xp(),preferSystem:Nd()}),ud}function hz(t){return Xr=[...Xr,t],()=>{Xr=Xr.filter(s=>s!==t)}}function gz(){const t=y.useSyncExternalStore(hz,pz),{themeId:s,preferSystem:o}=t,r=nk(s,o),c=y.useCallback(u=>{if(J1.has(u)){try{localStorage.setItem(_p,u)}catch{}Ro(u,Nd(),!0),zm()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(ek,u?"true":"false")}catch{}if(u){const m=il(),p=bp(m);if(p!=null&&p.hidden){const g=kp(m);if(g)try{localStorage.setItem(_p,g.id)}catch{}}}Ro(il(),u,!0),zm()},[]);return y.useEffect(()=>{Ro(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(tk),m=()=>{const p=il(),g=Nd();if(g){const v=bp(p);if(v!=null&&v.variantDarkId&&v.variantLightId&&Ro(p,g),v!=null&&v.hidden){const _=kp(p);_!=null&&_.variantDarkId&&_.variantLightId&&Ro(p,g)}}zm()};return u.addEventListener("change",m),()=>{u.removeEventListener("change",m)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const sk=y.createContext(void 0);function vz({children:t}){const s=gz();return a.jsx(sk.Provider,{value:s,children:t})}function ak(){const t=y.useContext(sk);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const ik=y.createContext(void 0),ok=y.createContext(void 0);function yz({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return a.jsx(ok.Provider,{value:r,children:a.jsx(ik.Provider,{value:s,children:t})})}function bz(){return y.useContext(ik)}function _z(){const t=y.useContext(ok);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const vh=y.createContext(void 0);function ot(){const t=y.useContext(vh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function rk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function lk(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function xz(t){return rk(t)&&typeof t.sessionId=="string"&&typeof t.eventType=="string"&&typeof t.timestamp=="string"&&typeof t.content=="string"&&(t.raw===void 0||typeof t.raw=="string")}const kz=new Set(["off","subscription","api_key"]),Wc=new Set(["off","on"]);function Sz(t){return rk(t)&&kz.has(t.claude)&&Wc.has(t.github)&&Wc.has(t.copilot)&&Wc.has(t.codex)&&Wc.has(t.goose)}function ck(t){switch(t){case"waiting_input":return"idle";case"completed":return"stopped";case"killed":return"stopped";case"failed":return"stopped";case"interrupted":return"stopped";case"terminated":return"stopped";default:return t}}function dk(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const Do=5e3;function jz(t,s){const o=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);o.unshift(d),r=d.parentTaskId||void 0}return o}const ma={label:"Home",url:Ii};function Tz(t){return t?[ma,{label:"Settings",url:Ai},{label:t,url:void 0}]:[ma,{label:"Settings",url:void 0}]}const yh={label:"Environments",url:$o};function Nz(){return[ma,{label:"Environments",url:void 0}]}function wz(){return[ma,{label:"New Chat",url:void 0}]}function Cz(t){return[ma,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function Ez(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[ma,yh,{label:(d==null?void 0:d.displayName)??"Environment",url:Mi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function Az(t,s,o,r,c){const d=jz(t,c),u=c.get(t),m=u==null?void 0:u.workspaceId,p=m?o.find(x=>x.id===m):void 0,g=s??(p==null?void 0:p.linkedEnvironmentIds[0]),v=g?r.find(x=>x.id===g):void 0,_=[ma];v&&g&&(_.push(yh),_.push({label:v.displayName,url:Mi(g)})),p&&g&&_.push({label:p.name,url:Ri(p.id,g)});for(let x=0;x<d.length-1;x++)_.push({label:d[x].title,url:Pn(d[x].id,void 0,m,g)});const b=d[d.length-1];return _.push({label:(b==null?void 0:b.title)??t,url:void 0}),_}const Dz={label:"Findings",url:$d};function Rz(){return[ma,{label:"Findings",url:void 0}]}function uk(t,s,o,r,c){const d=[ma];if(s&&o){const u=r.find(p=>p.id===s),m=c.find(p=>p.id===o);d.push(yh),m&&d.push({label:m.displayName,url:Mi(o)}),u&&d.push({label:u.name,url:Ri(s,o)}),d.push({label:"Findings",url:Fw(s,o)})}else d.push(Dz);return d.push({label:t,url:void 0}),d}function bh(t){const s=[];for(const o of t){const r=s[s.length-1];o.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+o.content}:s.push(o)}return s}function Xc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function Mz(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function _h(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const _=s.get(v),b=_?Xc(_):void 0;if(b)try{const x=JSON.parse(v.content);o.set(b,{tool:x.tool,args:x.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,_)=>{if(v.eventType!=="tool_result")return v;const b=s.get(v),x=b?Mz(b):void 0;if(!x)return v;const k=o.get(x);if(!k)return v;r.add(x),c.add(_);let j;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(j=T.detailedContent)}catch{}return{...v,toolUseCtx:{...k,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const _=s.get(d[v]),b=_?Xc(_):void 0;b&&r.has(b)||u.push(v)}const m=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||m.push(v);let p=0;for(const v of u){for(;p<m.length&&m[p]<v;)p++;if(p>=m.length)break;const _=m[p];if(_!==v+1)continue;const b=d[v],x=d[_];let k;try{const j=JSON.parse(b.content);k={tool:j.tool,args:j.args}}catch{}if(k){let j;const N=x.content.trim();if(N.startsWith("{"))try{const A=JSON.parse(N);typeof A.detailedContent=="string"&&(j=A.detailedContent)}catch{}d[_]={...x,toolUseCtx:{...k,detailedResult:j}},c.add(_);const T=s.get(b),C=T?Xc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(b,{...T??{},__seqId:`__seq_${v}`})),p++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const _=s.get(v);if(!_)return!0;const b=Xc(_);if(b&&r.has(b))return!1;const x=_.__seqId;return!(x&&r.has(x))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let _=!1;for(let b=v+1;b<g.length;b++)if(g[b].eventType!=="tool_use"){_=!0;break}_&&(g[v]={...g[v],settled:!0})}return g}function Iz(t,s,o){const r=t.filter(p=>p.status==="running"||p.status==="idle"||p.status==="waiting").length,c=fk(s),d=s.filter(p=>Sp(p,c)).length,u=s.filter(p=>p.status==="paused"||p.status==="failed"||Sp(p,c)).length,m=o.filter(p=>p.status==="disconnected"||p.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:m}}function fk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function Sp(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function Oz(t,s){var u;const o=new Map;for(const m of s)o.set(m.id,m);const r=fk(t),c=[];for(const m of t){const p=m.workspaceId?((u=o.get(m.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";m.status==="failed"?c.push({task:m,reason:"failed",workspaceName:p}):Sp(m,r)?c.push({task:m,reason:"blocked",workspaceName:p}):m.status==="paused"&&c.push({task:m,reason:"paused",workspaceName:p})}const d={failed:0,blocked:1,paused:2};return c.sort((m,p)=>(d[m.reason]??3)-(d[p.reason]??3)),c}function Lz(t,s){const o=new Map;for(const r of s)o.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=o.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function Bz(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const Rs=[{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
314
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
315
- const header = req.headers.authorization;
316
- if (!header?.startsWith("Bearer ")) {
317
- res.status(401).json({ error: "Missing token" });
318
- return;
319
- }
320
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
321
- req.user = decoded;
322
- next();
323
- }
324
- \`\`\``,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
325
- CREATE TABLE audit_log (
326
- id BIGSERIAL PRIMARY KEY,
327
- user_id UUID REFERENCES users(id),
328
- action TEXT NOT NULL,
329
- entity_type TEXT NOT NULL,
330
- entity_id TEXT NOT NULL,
331
- old_value JSONB,
332
- new_value JSONB,
333
- ip_address INET,
334
- created_at TIMESTAMPTZ DEFAULT now()
335
- );
336
- \`\`\``,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}],Fa=[{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"}],$z=new Map(Rs.map(t=>[t.id,t]));function Hm(t){const s=$z.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const d_={"kn-auth-flow":{node:Hm("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:Hm("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:Hm("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"}]}},zz=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1,githubAccountId:""},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""}],Hz=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],Pz=[{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.
337
- Project: acme/alpha — Node.js + Express REST API
338
- 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";
339
- import type { Request, Response, NextFunction } from "express";
340
-
341
- export function requireAuth(req: Request, res: Response, next: NextFunction): void {
342
- if (!req.session?.userId) {
343
- res.status(401).json({ error: "Not authenticated" });
344
- return;
345
- }
346
- next();
347
- }`,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) {
348
- src/routes/login.ts:18: req.session.userId = user.id;
349
- src/routes/login.ts:19: req.session.role = user.role;
350
- src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_millicents:21e3})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
351
- import bcrypt from "bcrypt";
352
- import { db } from "../db.js";
353
-
354
- const router = Router();
355
-
356
- router.post("/login", async (req, res) => {
357
- const { email, password } = req.body;
358
- const user = await db.users.findByEmail(email);
359
- if (!user || !await bcrypt.compare(password, user.passwordHash)) {
360
- return res.status(401).json({ error: "Invalid credentials" });
361
- }
362
- req.session.userId = user.id;
363
- req.session.role = user.role;
364
- res.json({ ok: true });
365
- });
366
-
367
- 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.
368
- Project: acme/alpha — Node.js + Express REST API
369
- Task: Implement auth middleware using JWT tokens
370
-
371
- 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
372
- src/routes/login.ts
373
- 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
374
-
375
- 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";
376
- import type { Request, Response, NextFunction } from "express";
377
-
378
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
379
-
380
- export interface JwtPayload {
381
- userId: string;
382
- role: string;
383
- iat: number;
384
- exp: number;
385
- }
386
-
387
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
388
- const header = req.headers.authorization;
389
- if (!header?.startsWith("Bearer ")) {
390
- res.status(401).json({ error: "Missing or malformed token" });
391
- return;
392
- }
393
- try {
394
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
395
- req.user = decoded;
396
- next();
397
- } catch (err) {
398
- if (err instanceof jwt.TokenExpiredError) {
399
- res.status(401).json({ error: "Token expired" });
400
- } else {
401
- res.status(403).json({ error: "Invalid token" });
402
- }
403
- }
404
- }
405
- `}}),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.
406
-
407
- The new login flow will:
408
- 1. Validate credentials (unchanged)
409
- 2. Generate a JWT with \`userId\` and \`role\` claims
410
- 3. Return the token in the response body
411
- 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";
412
- import bcrypt from "bcrypt";
413
- import jwt from "jsonwebtoken";
414
- import crypto from "node:crypto";
415
- import { db } from "../db.js";
416
-
417
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
418
- const ACCESS_TOKEN_EXPIRY = "24h";
419
- const REFRESH_TOKEN_BYTES = 48;
420
-
421
- const router = Router();
422
-
423
- router.post("/login", async (req, res) => {
424
- const { email, password } = req.body;
425
- const user = await db.users.findByEmail(email);
426
- if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
427
- return res.status(401).json({ error: "Invalid credentials" });
428
- }
429
-
430
- const accessToken = jwt.sign(
431
- { userId: user.id, role: user.role },
432
- JWT_SECRET,
433
- { expiresIn: ACCESS_TOKEN_EXPIRY },
434
- );
435
-
436
- const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
437
- await db.refreshTokens.create({ userId: user.id, token: refreshToken });
438
-
439
- res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
440
- });
441
-
442
- export default router;
443
- `}}),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
444
- PASS src/routes/__tests__/protected.test.ts
445
- FAIL src/middleware/__tests__/auth.test.ts
446
- x should reject missing session (12ms)
447
- x should allow valid session (8ms)
448
-
449
- 2 failed, 12 passed, 14 total
450
-
451
- 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.
452
-
453
- 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";
454
- import jwt from "jsonwebtoken";
455
- import { verifyToken } from "../auth.js";
456
- import { createMockReqRes } from "../../test-utils/mock-express.js";
457
-
458
- const SECRET = "test-secret";
459
- process.env.JWT_SECRET = SECRET;
460
-
461
- describe("verifyToken", () => {
462
- it("should reject requests without Authorization header", () => {
463
- const { req, res, next } = createMockReqRes();
464
- verifyToken(req, res, next);
465
- expect(res.status).toHaveBeenCalledWith(401);
466
- });
467
-
468
- it("should reject expired tokens", () => {
469
- const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
470
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
471
- verifyToken(req, res, next);
472
- expect(res.status).toHaveBeenCalledWith(401);
473
- });
474
-
475
- it("should accept valid tokens and attach user to request", () => {
476
- const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
477
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
478
- verifyToken(req, res, next);
479
- expect(next).toHaveBeenCalled();
480
- expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
481
- });
482
- });
483
- `}}),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
484
- PASS src/routes/__tests__/protected.test.ts
485
- PASS src/middleware/__tests__/auth.test.ts
486
-
487
- Test Suites: 3 passed, 3 total
488
- Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_millicents:22e3})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
489
-
490
- ### Changes made
491
-
492
- | File | Action |
493
- |------|--------|
494
- | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
495
- | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
496
- | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
497
- | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
498
-
499
- ### Key decisions
500
- - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
501
- - **Refresh tokens**: 48-byte random hex, stored in DB
502
- - **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.
503
- Project: acme/alpha — Node.js + Express REST API
504
- 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";
505
- import bcrypt from "bcrypt";
506
- import { db } from "../db.js";
507
- import { validateEmail, validatePassword } from "../utils/validators.js";
508
-
509
- const SALT_ROUNDS = 12;
510
- const router = Router();
511
-
512
- router.post("/register", async (req, res) => {
513
- const { name, email, password } = req.body;
514
-
515
- if (!name || !email || !password) {
516
- return res.status(400).json({ error: "Missing required fields" });
517
- }
518
- if (!validateEmail(email)) {
519
- return res.status(400).json({ error: "Invalid email format" });
520
- }
521
- if (!validatePassword(password)) {
522
- return res.status(400).json({ error: "Password too weak" });
523
- }
524
-
525
- const existing = await db.users.findByEmail(email);
526
- if (existing) {
527
- return res.status(409).json({ error: "Email already registered" });
528
- }
529
-
530
- const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
531
- const user = await db.users.create({ name, email, passwordHash });
532
- res.status(201).json({ id: user.id, name: user.name, email: user.email });
533
- });
534
-
535
- 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:
536
-
537
- 1. **Happy path** - valid registration
538
- 2. **Missing fields** - each required field missing
539
- 3. **Invalid email** - malformed email format
540
- 4. **Weak password** - password validation failure
541
- 5. **Duplicate email** - conflict with existing user
542
- 6. **SQL injection** - malicious email input
543
- 7. **XSS payload** - HTML in the name field
544
- 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
545
- POST /api/register
546
- ✓ should register a valid user (28ms)
547
- ✓ should reject missing name (4ms)
548
- ✓ should reject missing email (3ms)
549
- ✓ should reject missing password (3ms)
550
- ✓ should reject invalid email format (5ms)
551
- ✓ should reject weak password (4ms)
552
- ✓ should reject duplicate email (12ms)
553
- ✓ should sanitize HTML in name field (6ms)
554
-
555
- Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_millicents:18e3})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
556
- Project: acme/alpha — Node.js + Express + PostgreSQL
557
- 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 (
558
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
559
- name TEXT NOT NULL,
560
- email TEXT UNIQUE NOT NULL,
561
- password_hash TEXT NOT NULL,
562
- role TEXT DEFAULT 'user',
563
- created_at TIMESTAMPTZ DEFAULT now(),
564
- updated_at TIMESTAMPTZ DEFAULT now()
565
- );
566
-
567
- CREATE TABLE sessions (
568
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
569
- user_id UUID REFERENCES users(id),
570
- expires_at TIMESTAMPTZ NOT NULL,
571
- created_at TIMESTAMPTZ DEFAULT now()
572
- );`,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
573
- -- Add audit logging and user activity tracking
574
-
575
- BEGIN;
576
-
577
- -- 1. Add last_login_at to users
578
- ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
579
-
580
- -- 2. Index for session cleanup queries
581
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
582
-
583
- -- 3. Audit log table
584
- CREATE TABLE audit_log (
585
- id BIGSERIAL PRIMARY KEY,
586
- user_id UUID REFERENCES users(id),
587
- action TEXT NOT NULL,
588
- entity_type TEXT NOT NULL,
589
- entity_id TEXT NOT NULL,
590
- old_value JSONB,
591
- new_value JSONB,
592
- ip_address INET,
593
- created_at TIMESTAMPTZ DEFAULT now()
594
- );
595
-
596
- CREATE INDEX idx_audit_log_user ON audit_log (user_id);
597
- CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
598
- CREATE INDEX idx_audit_log_created ON audit_log (created_at);
599
-
600
- COMMIT;
601
- `}}),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
602
- - ALTER TABLE users ADD COLUMN last_login_at
603
- - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
604
- - CREATE TABLE audit_log
605
- - 3 indexes on audit_log
606
-
607
- WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
608
- Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_millicents:31e3})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
609
- Project: acme/data-pipeline — ETL pipelines for analytics
610
- 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
611
- src/middleware/error-handler.ts
612
- src/middleware/logger.ts
613
- 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:
614
-
615
- - Uses an **in-memory token bucket** per client IP
616
- - Supports configurable rate (requests/second) and burst size
617
- - Returns \`429 Too Many Requests\` with \`Retry-After\` header
618
- - Has a Redis adapter option for multi-instance deployments
619
-
620
- 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.
621
- Project: acme/alpha — Node.js + Express + PostgreSQL
622
- 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";
623
-
624
- const pool = new pg.Pool({
625
- connectionString: process.env.DATABASE_URL,
626
- max: 20,
627
- idleTimeoutMillis: 30000,
628
- });
629
-
630
- 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:
631
-
632
- 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
633
- 2. **Configurable limits** per tenant (max connections, idle timeout)
634
- 3. **Health checks** with automatic pool eviction for unhealthy connections
635
- 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";
636
- src/routes/users.ts:2:import { pool } from "../db/pool.js";
637
- src/routes/register.ts:3:import { pool } from "../db/pool.js";
638
- src/routes/admin.ts:4:import { pool } from "../db/pool.js";
639
- src/services/billing.ts:2:import { pool } from "../db/pool.js";
640
- 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:
641
- 1. Create a new \`PoolManager\` abstraction
642
- 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
643
- 3. Add middleware to extract tenant ID from the request
644
-
645
- This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],Uz=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",linkedEnvironmentIds:["env-local-01","env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",linkedEnvironmentIds:["env-local-01"],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],Vz=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],Qc=[{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"}],qz=[{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:""}],Gz=[{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));
646
- for (const f of files) {
647
- const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
648
- if (eslintResult.exitCode !== 0) {
649
- env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
650
- }
651
- const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
652
- if (prettierResult.exitCode !== 0) {
653
- env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
654
- }
655
- }
656
- env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],Fz={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Le(t){return new Date(Date.now()+t).toISOString()}const u_=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Le(1600),content:`src/routes/users.ts
657
- src/routes/auth.ts
658
- src/routes/billing.ts
659
- src/routes/admin.ts
660
- src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Le(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
661
-
662
- \`\`\`typescript
663
- const router = Router();
664
- router.use(authenticate);
665
- router.use(validateBody);
666
-
667
- router.get("/", listUsers);
668
- router.post("/", createUser);
669
- router.get("/:id", getUser);
670
- router.put("/:id", updateUser);
671
- router.delete("/:id", deleteUser);
672
- \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Le(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Le(4e3),content:` PASS src/routes/__tests__/users.test.ts
673
- PASS src/routes/__tests__/auth.test.ts
674
- PASS src/routes/__tests__/billing.test.ts
675
-
676
- Test Suites: 3 passed, 3 total
677
- Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Le(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Le(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Le(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`CREATE TABLE users (
678
- id UUID PRIMARY KEY,
679
- name TEXT NOT NULL,
680
- email TEXT UNIQUE NOT NULL,
681
- created_at TIMESTAMPTZ DEFAULT now()
682
- );
683
-
684
- CREATE TABLE sessions (
685
- id UUID PRIMARY KEY,
686
- user_id UUID REFERENCES users(id),
687
- expires_at TIMESTAMPTZ NOT NULL
688
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(2600),content:`I found the tables to modify:
689
- - **users**: add column \`last_login_at\`
690
- - **sessions**: add index on \`expires_at\`
691
- - **audit_log**: new table
692
-
693
- This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
694
-
695
- Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Le(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Le(1700),content:`Applying 002_add_last_login.sql... done
696
- Applying 003_sessions_index.sql... done
697
- Applying 004_audit_log.sql... done
698
-
699
- 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Le(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Le(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`import { StripeClient } from "./stripe-client.js";
700
- import type { Invoice, LineItem } from "../types/billing.js";
701
-
702
- export class BillingService {
703
- constructor(private stripe: StripeClient) {}
704
-
705
- async calculateMonthlyTotal(userId: string): Promise<number> {
706
- const invoices = await this.stripe.listInvoices(userId);
707
- return invoices.reduce((sum, inv) => sum + inv.total, 0);
708
- }
709
- }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Le(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Le(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Le(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Le(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Le(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`import jwt from "jsonwebtoken";
710
- import type { Request, Response, NextFunction } from "express";
711
-
712
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
713
-
714
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
715
- const header = req.headers.authorization;
716
- if (!header?.startsWith("Bearer ")) {
717
- res.status(401).json({ error: "Missing token" });
718
- return;
719
- }
720
- try {
721
- const decoded = jwt.verify(header.slice(7), JWT_SECRET);
722
- if (decoded.exp > Date.now() / 1000) {
723
- res.status(403).json({ error: "Token expired" });
724
- return;
725
- }
726
- req.user = decoded;
727
- next();
728
- } catch {
729
- res.status(403).json({ error: "Invalid token" });
730
- }
731
- }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Le(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Le(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Le(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Le(5800),content:`[exit 0] > jest --grep auth
732
-
733
- PASS src/auth.test.ts
734
- ✓ validates JWT token (12ms)
735
- ✓ rejects expired token (3ms)
736
- ✓ handles missing header (1ms)
737
-
738
- Tests: 3 passed, 3 total
739
- Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Le(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Le(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
740
- src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Le(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Le(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Le(8800),content:"completed"}}]}],Bn={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1},f_=400;function Zz({children:t}){const[s,o]=y.useState(zz),[r,c]=y.useState(Hz),[d,u]=y.useState(Pz),[m,p]=y.useState(void 0),[g,v]=y.useState(Uz),[_,b]=y.useState(""),[x,k]=y.useState(Vz),[j,N]=y.useState(Qc),[T,C]=y.useState(void 0),A=!1,[L,E]=y.useState(qz),[O,z]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[D,H]=y.useState(Gz),[Y,U]=y.useState([]),[X]=y.useState(Fz),[ge,W]=y.useState(""),[le,B]=y.useState(Rs),[R,se]=y.useState(Fa),[oe,q]=y.useState(void 0),[me,de]=y.useState(void 0),[xe,Se]=y.useState(""),Pe=y.useRef(void 0),gt=y.useRef(0),_e=y.useRef(0),Ie=y.useRef(new Set),Mt=y.useRef(new Map),hn=y.useRef(x);hn.current=x;const ce=y.useRef(new Map),Ue=y.useRef(new Map),ut=y.useCallback(P=>(gt.current+=1,`mock-${P}-${String(gt.current).padStart(3,"0")}`),[]),te=y.useCallback(()=>{const P=u_[_e.current%u_.length];return _e.current+=1,P},[]),re=y.useCallback((P,ee,ue)=>{const pe=setTimeout(()=>{var ye;Ie.current.delete(pe),ue&&((ye=Mt.current.get(ue))==null||ye.delete(pe)),P()},ee);Ie.current.add(pe),ue&&(Mt.current.has(ue)||Mt.current.set(ue,new Set),Mt.current.get(ue).add(pe))},[]),ve=y.useCallback(P=>{const ee=Mt.current.get(P);ee&&(ee.forEach(ue=>{clearTimeout(ue),Ie.current.delete(ue)}),Mt.current.delete(P))},[]),ft=y.useCallback((P,ee,ue)=>{c(pe=>pe.map(ye=>ye.id===P?{...ye,status:ee,...ue!==void 0?{endReason:ue}:{}}:ye))},[]),Me=y.useCallback(P=>{u(ee=>[...ee,P])},[]),rn=y.useCallback((P,ee,ue)=>{ee.forEach((pe,ye)=>{re(()=>{const Ze={sessionId:P,...pe.event,timestamp:new Date().toISOString()};if(Me(Ze),pe.event.eventType==="status"){const Te=ck(pe.event.content),Oe=dk(pe.event.content);ft(P,Te,Oe)}ye===ee.length-1&&ue&&ue()},pe.delayMs,P)})},[re,Me,ft]),ga=y.useCallback(async(P,ee,ue,pe)=>{console.log("[MockGrackle] spawn",{environmentId:P,prompt:ee,runtime:pe});const ye=ut("sess"),Ze={id:ye,environmentId:P,runtime:pe||"claude-code",status:"running",prompt:ee,startedAt:new Date().toISOString()};c(Oe=>[...Oe,Ze]),p(ye);const Te=te();if(console.log(`[MockGrackle] Playing scenario: ${Te.label}`),Te.pauseForInput){const Oe=Te.pauseAfterStep??Te.steps.length-1,Qe=Te.steps.slice(0,Oe+1),_t=Qe.length>0?Qe[Qe.length-1].delayMs:0;rn(ye,Qe),re(()=>{ft(ye,"idle"),Me({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},_t+f_,ye),Te.resumeSteps&&ce.current.set(ye,Te.resumeSteps)}else rn(ye,Te.steps)},[ut,te,rn,re,ft,Me]),fs=y.useCallback(async P=>{console.log("[MockGrackle] kill",P),ve(P),ce.current.delete(P),ft(P,"stopped","killed"),Me({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),k(ee=>ee.map(ue=>ue.latestSessionId===P&&ue.status==="working"?{...ue,status:"not_started"}:ue))},[ve,ft,Me]),ti=y.useCallback(async P=>{console.log("[MockGrackle] stopGraceful",P),ve(P),ce.current.delete(P),ft(P,"stopped","terminated"),Me({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),k(ee=>ee.map(ue=>ue.latestSessionId===P&&ue.status==="working"?{...ue,status:"not_started"}:ue))},[ve,ft,Me]),va=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),en=y.useCallback(async P=>{console.log("[MockGrackle] loadSessionEvents",P)},[]),Hi=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ya=y.useCallback(async(P,ee,ue,pe,ye,Ze,Te,Oe,Qe)=>{console.log("[MockGrackle] createWorkspace",{name:P,description:ee});const _t={id:ut("proj"),name:P,description:ee||"",repoUrl:ue||"",linkedEnvironmentIds:pe?[pe]:[],status:"active",workingDirectory:Te||"",useWorktrees:Ze??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(qe=>[...qe,_t]),Oe&&Oe()},[ut]),ni=y.useCallback(async P=>{console.log("[MockGrackle] archiveWorkspace",P),v(ee=>ee.map(ue=>ue.id===P?{...ue,status:"archived"}:ue))},[]),js=y.useCallback(async P=>{console.log("[MockGrackle] loadTasks",P)},[]),Pi=y.useCallback(async(P,ee,ue,pe,ye,Ze,Te,Oe,Qe)=>{console.log("[MockGrackle] createTask",{workspaceId:P,title:ee,parentTaskId:ye}),k(_t=>{const et=_t.filter(zs=>zs.workspaceId===P).reduce((zs,Jo)=>Math.max(zs,Jo.sortOrder),0),mt=ye?_t.find(zs=>zs.id===ye):void 0;if(ye&&!mt)return console.warn("[MockGrackle] Parent task not found:",ye),_t;if(mt&&!mt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),_t;const kt=mt?mt.depth+1:0,Ns={id:ut("task"),workspaceId:P,title:ee,description:ue||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:et+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:kt,childTaskIds:[],canDecompose:Te??!ye,defaultPersonaId:Ze||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[..._t,Ns]}),Oe&&Oe()},[ut]),Gn=y.useCallback(async(P,ee,ue,pe)=>{var _t;console.log("[MockGrackle] startTask",{taskId:P});const ye=hn.current.find(qe=>qe.id===P),Ze=(ye==null?void 0:ye.title)??"",Te=ut("sess"),Oe={id:Te,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Ze||P,startedAt:new Date().toISOString()};c(qe=>[...qe,Oe]),k(qe=>qe.map(et=>et.id===P?{...et,status:"working",latestSessionId:Te,branch:`mock/${P.slice(0,8)}`}:et));const Qe=te();if(console.log(`[MockGrackle] Playing task scenario: ${Qe.label}`),Qe.pauseForInput){const qe=Qe.pauseAfterStep??Qe.steps.length-1,et=Qe.steps.slice(0,qe+1),mt=et.length>0?et[et.length-1].delayMs:0;if(rn(Te,et),re(()=>{ft(Te,"idle"),Me({sessionId:Te,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},mt+f_,Te),Qe.resumeSteps){const kt=[...Qe.resumeSteps];ce.current.set(Te,kt);const Ns=kt.reduce((zs,Jo)=>Math.max(zs,Jo.delayMs),0);Ue.current.set(Te,{taskId:P,delayAfterResume:Ns+200})}}else{const qe=Qe.steps.length>0?Qe.steps[Qe.steps.length-1].delayMs:0;rn(Te,Qe.steps);const et=(_t=Qe.steps[Qe.steps.length-1])==null?void 0:_t.event.content;re(()=>{et==="completed"?k(mt=>mt.map(kt=>kt.id===P&&kt.status==="working"?{...kt,status:"paused"}:kt)):et==="failed"&&k(mt=>mt.map(kt=>kt.id===P&&kt.status==="working"?{...kt,status:"failed"}:kt))},qe+100,Te)}},[ut,te,rn,re,ft,Me]),Ee=y.useCallback(async(P,ee)=>{console.log("[MockGrackle] sendInput",{sessionId:P,text:ee}),Me({sessionId:P,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ee}`}),ft(P,"running"),Me({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const ue=ce.current.get(P);if(ue)ce.current.delete(P),rn(P,ue);else{const ye=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];rn(P,ye)}const pe=Ue.current.get(P);pe&&(Ue.current.delete(P),re(()=>{k(ye=>ye.map(Ze=>Ze.id===pe.taskId&&Ze.status==="working"?{...Ze,status:"paused"}:Ze))},pe.delayAfterResume,P))},[Me,ft,rn,re]),Ve=y.useCallback(async P=>{console.log("[MockGrackle] completeTask",P),k(ee=>ee.map(ue=>ue.id===P?{...ue,status:"complete"}:ue))},[]),tn=y.useCallback(async P=>{console.log("[MockGrackle] resumeTask",P)},[]),Ct=y.useCallback(async(P,ee,ue,pe,ye)=>{console.log("[MockGrackle] updateTask",{taskId:P,title:ee}),k(Ze=>Ze.map(Te=>Te.id===P?{...Te,title:ee.trim()||Te.title,description:ue,dependsOn:pe,...ye!==void 0?{defaultPersonaId:ye}:{}}:Te))},[]),yn=y.useCallback(async P=>{console.log("[MockGrackle] deleteTask",P),k(ee=>ee.filter(ue=>ue.id!==P))},[]),nn=y.useCallback(async P=>{console.log("[MockGrackle] loadFindings",P),N(Qc.filter(ee=>ee.workspaceId===P))},[]),Ui=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),N([...Qc])},[]),Vi=y.useCallback(async P=>{console.log("[MockGrackle] loadFinding",P);const ee=Qc.find(ue=>ue.id===P);C(ee)},[]),qi=y.useCallback(async(P,ee,ue,pe,ye)=>{console.log("[MockGrackle] postFinding",{workspaceId:P,title:ee});const Ze={id:ut("find"),workspaceId:P,taskId:"",sessionId:"",category:pe||"general",title:ee,content:ue,tags:ye||[],createdAt:new Date().toISOString()};N(Te=>[...Te,Ze])},[ut]),si=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),ai=y.useCallback(async(P,ee,ue)=>{console.log("[MockGrackle] addEnvironment",{displayName:P,adapterType:ee,adapterConfig:ue})},[]),ii=y.useCallback(async(P,ee)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:P,...ee}),o(ue=>ue.map(pe=>pe.id!==P?pe:{...pe,...ee.displayName!==void 0?{displayName:ee.displayName}:{},...ee.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ee.adapterConfig)}:{}}))},[]),Ts=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),oi=y.useCallback(async(P,ee,ue,pe,ye)=>{console.log("[MockGrackle] setToken",{name:P,tokenType:ue}),E(Ze=>[...Ze.filter(Oe=>Oe.name!==P),{name:P,tokenType:ue,envVar:pe,filePath:ye,expiresAt:""}])},[]),ba=y.useCallback(async P=>{console.log("[MockGrackle] deleteToken",P),E(ee=>ee.filter(ue=>ue.name!==P))},[]),jl=y.useCallback(async P=>{console.log("[MockGrackle] updateCredentialProviders",P),z(P)},[]);y.useEffect(()=>()=>{Ie.current.forEach(clearTimeout),Ie.current.clear()},[]);const Tl=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:si,addEnvironment:ai,updateEnvironment:ii,provisionEnvironment:async(P,ee)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:Bn},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:m,taskSessions:X,spawn:ga,sendInput:Ee,kill:fs,stopGraceful:ti,loadSessionEvents:en,clearEvents:Hi,loadTaskSessions:async P=>{console.log("[MockGrackle] loadTaskSessions",P)},domainHook:Bn},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:ya,archiveWorkspace:ni,updateWorkspace:async(P,ee)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:P,...ee}),v(ue=>ue.map(pe=>pe.id!==P?pe:{...pe,...ee.name!==void 0?{name:ee.name}:{},...ee.description!==void 0?{description:ee.description}:{},...ee.repoUrl!==void 0?{repoUrl:ee.repoUrl}:{},...ee.environmentId!==void 0?{environmentId:ee.environmentId}:{},...ee.workingDirectory!==void 0?{workingDirectory:ee.workingDirectory}:{},...ee.useWorktrees!==void 0?{useWorktrees:ee.useWorktrees}:{},...ee.defaultPersonaId!==void 0?{defaultPersonaId:ee.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(P,ee)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:P,environmentId:ee}),ee==="error-env"){b("Failed to link environment");return}b(""),v(ue=>ue.map(pe=>pe.id!==P||pe.linkedEnvironmentIds.includes(ee)?pe:{...pe,linkedEnvironmentIds:[...pe.linkedEnvironmentIds,ee]}))},unlinkEnvironment:async(P,ee)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:P,environmentId:ee}),ee==="error-env"){b("Failed to unlink environment");return}b(""),v(ue=>ue.map(pe=>pe.id!==P?pe:{...pe,linkedEnvironmentIds:pe.linkedEnvironmentIds.filter(ye=>ye!==ee)}))},linkOperationError:_,clearLinkOperationError:()=>{b("")},domainHook:Bn},tasks:{tasks:x,tasksLoading:!1,taskStartingId:void 0,loadTasks:js,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Pi,startTask:Gn,stopTask:async P=>{console.log("[MockGrackle] stopTask",{taskId:P}),await Ve(P)},completeTask:Ve,resumeTask:tn,updateTask:Ct,deleteTask:yn,domainHook:Bn},findings:{findings:j,selectedFinding:T,findingLoading:A,findingsLoading:!1,loadFindings:nn,loadAllFindings:Ui,loadFinding:Vi,postFinding:qi,domainHook:Bn},tokens:{tokens:L,tokensLoading:!1,loadTokens:Ts,setToken:oi,deleteToken:ba,domainHook:Bn},credentials:{credentialProviders:O,credentialsLoading:!1,updateCredentialProviders:jl,domainHook:Bn},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:Bn},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:Bn},personas:{personas:D,personasLoading:!1,createPersona:async(P,ee,ue,pe,ye,Ze,Te,Oe,Qe)=>{console.log("[MockGrackle] createPersona",{name:P});const _t={id:`mock-persona-${Date.now()}`,name:P,description:ee,systemPrompt:ue,toolConfig:"{}",runtime:pe??"claude-code",model:ye||"",maxTurns:Ze||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:Te||"agent",script:Oe||"",allowedMcpTools:Qe||[]};return H(qe=>[...qe,_t]),_t},updatePersona:async(P,ee,ue,pe,ye,Ze,Te,Oe,Qe,_t)=>{console.log("[MockGrackle] updatePersona",{personaId:P,name:ee});const qe=D.find(kt=>kt.id===P);if(!qe)throw new Error(`Persona not found: ${P}`);const et=new Date().toISOString(),mt={...qe,...ee!==void 0?{name:ee}:{},...ue!==void 0?{description:ue}:{},...pe!==void 0?{systemPrompt:pe}:{},...ye!==void 0?{runtime:ye}:{},...Ze!==void 0?{model:Ze}:{},...Te!==void 0?{maxTurns:Te}:{},...Oe!==void 0?{type:Oe}:{},...Qe!==void 0?{script:Qe}:{},..._t!==void 0?{allowedMcpTools:_t}:{},updatedAt:et};return H(kt=>kt.map(Ns=>Ns.id===P?mt:Ns)),mt},deletePersona:async P=>{console.log("[MockGrackle] deletePersona",P),H(ee=>ee.filter(ue=>ue.id!==P))},domainHook:Bn},schedules:{schedules:Y,schedulesLoading:!1,createSchedule:async(P,ee,ue,pe,ye)=>{console.log("[MockGrackle] createSchedule",{title:P});const Ze={id:`mock-schedule-${Date.now()}`,title:P,description:ee,scheduleExpression:ue,personaId:pe,workspaceId:ye??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return U(Te=>[...Te,Ze]),Ze},updateSchedule:async(P,ee)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:P,fields:ee});let ue;if(U(pe=>pe.map(ye=>ye.id!==P?ye:(ue={...ye,...ee,updatedAt:new Date().toISOString()},ue))),!ue)throw new Error(`Schedule not found: ${P}`);return ue},deleteSchedule:async P=>{console.log("[MockGrackle] deleteSchedule",P),U(ee=>ee.filter(ue=>ue.id!==P))},domainHook:Bn},streams:{streams:[],streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async()=>{},domainHook:Bn},knowledge:{graphData:{nodes:le,links:R},selectedNode:oe,loading:!1,selectedId:me,searchQuery:xe,search:async P=>{if(console.log("[MockGrackle] knowledge.search",P),!P.trim()){Se(P);return}Se(P);const ee=Pe.current,ue=ee?Rs.filter(Te=>!Te.workspaceId||Te.workspaceId===ee):Rs,pe=P.toLowerCase(),ye=ue.filter(Te=>{var Oe,Qe,_t;return Te.label.toLowerCase().includes(pe)||((Oe=Te.content)==null?void 0:Oe.toLowerCase().includes(pe))||((Qe=Te.tags)==null?void 0:Qe.some(qe=>qe.toLowerCase().includes(pe)))||((_t=Te.category)==null?void 0:_t.toLowerCase().includes(pe))});B(ye);const Ze=new Set(ye.map(Te=>Te.id));se(Fa.filter(Te=>Ze.has(Te.source)&&Ze.has(Te.target))),de(void 0),q(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),Se("");const P=Pe.current,ee=P?Rs.filter(pe=>!pe.workspaceId||pe.workspaceId===P):Rs;B(ee);const ue=new Set(ee.map(pe=>pe.id));se(Fa.filter(pe=>ue.has(pe.source)&&ue.has(pe.target)))},selectNode:async P=>{console.log("[MockGrackle] knowledge.selectNode",P),de(P);const ee=P in d_?d_[P]:void 0;if(ee)q(ee);else{const ue=Rs.find(pe=>pe.id===P);if(ue){const pe=Fa.filter(ye=>ye.source===P||ye.target===P).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));q({node:ue,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),de(void 0),q(void 0)},expandNode:async P=>{console.log("[MockGrackle] knowledge.expandNode",P),B(ee=>{const ue=new Set(ee.map(Oe=>Oe.id)),pe=Fa.filter(Oe=>Oe.source===P||Oe.target===P),ye=new Set;for(const Oe of pe)ue.has(Oe.source)||ye.add(Oe.source),ue.has(Oe.target)||ye.add(Oe.target);if(ye.size===0)return ee;const Ze=Rs.filter(Oe=>ye.has(Oe.id)),Te=new Set([...ue,...ye]);return se(Oe=>{const Qe=new Set(Oe.map(qe=>`${qe.source}|${qe.target}|${qe.type}`)),_t=Fa.filter(qe=>Te.has(qe.source)&&Te.has(qe.target)&&!Qe.has(`${qe.source}|${qe.target}|${qe.type}`));return _t.length>0?[...Oe,..._t]:Oe}),[...ee,...Ze]})},loadRecent:async P=>{if(console.log("[MockGrackle] knowledge.loadRecent",P),Pe.current=P,P){const ee=Rs.filter(pe=>!pe.workspaceId||pe.workspaceId===P);B(ee);const ue=new Set(ee.map(pe=>pe.id));se(Fa.filter(pe=>ue.has(pe.source)&&ue.has(pe.target)))}else B(Rs),se(Fa);Se("")},handleEvent:()=>!1,domainHook:Bn},githubAccounts:{githubAccounts:[],githubAccountsLoading:!1,loadGitHubAccounts:async()=>{console.log("[MockGrackle] loadGitHubAccounts")},addGitHubAccount:async(P,ee,ue,pe)=>{console.log("[MockGrackle] addGitHubAccount",P)},updateGitHubAccount:async(P,ee)=>{console.log("[MockGrackle] updateGitHubAccount",P,ee)},removeGitHubAccount:async P=>{console.log("[MockGrackle] removeGitHubAccount",P)},importGitHubAccounts:async()=>(console.log("[MockGrackle] importGitHubAccounts"),{imported:0,usernames:[]})},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(P,ee)=>{console.log("[MockGrackle] setPluginEnabled",P,ee)}},appDefaultPersonaId:ge,setAppDefaultPersonaId:async P=>{console.log("[MockGrackle] setAppDefaultPersonaId",P),W(P)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(P,ee)=>{console.log(`[MockGrackle] loadUsage(${P}, ${ee})`)},refresh:va}),[s,r,d,m,X,g,_,x,j,T,L,O,D,Y,ge,le,R,oe,me,xe,ga,Ee,fs,ti,en,Hi,ya,ni,js,Pi,Gn,Ve,tn,Ct,yn,nn,Ui,Vi,qi,si,ai,ii,Ts,oi,ba,jl,va]);return a.jsx(vh.Provider,{value:Tl,children:t})}const mk=3e3,Kz=mk;function Yz(t){const[s,o]=y.useState("connecting"),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onConnect);d.current=t.onConnect;const u=y.useRef(t.onDisconnect);return u.current=t.onDisconnect,y.useEffect(()=>{let m=!1,p,g;async function v(){var x,k;if(m)return;Promise.resolve((x=d.current)==null?void 0:x.call(d)).catch(()=>{});let _=!1;const b=()=>{!_&&!m&&(_=!0,o("connected"))};g=setTimeout(b,Kz);try{const j=$e.streamEvents({});for await(const N of j){if(b(),m)break;const T=N.event;if(T.case==="sessionEvent"){const C=T.value;r.current({sessionId:C.sessionId,type:C.type,timestamp:C.timestamp,content:C.content,raw:C.raw})}else if(T.case==="domainEvent"){const C=T.value;c.current({id:C.id,type:C.type,timestamp:C.timestamp,payloadJson:C.payloadJson})}}}catch(j){if(clearTimeout(g),j instanceof da&&j.code===D_.Unauthenticated){window.location.href=Vw;return}}clearTimeout(g),m||(o("connecting"),(k=u.current)==null||k.call(u),p=setTimeout(()=>{v().catch(()=>{})},mk))}return v().catch(()=>{}),()=>{m=!0,clearTimeout(p),clearTimeout(g)}},[]),{connectionStatus:s}}const jp=["core","orchestration","scheduling"],pk=y.createContext({pluginNames:[...jp],loading:!1,error:void 0});function Jz({children:t}){const[s,o]=y.useState([...jp]),[r,c]=y.useState(!0),[d,u]=y.useState(void 0);return y.useEffect(()=>{let m=!1;return fetch("/api/manifest").then(async p=>{if(!p.ok)throw new Error(`Manifest fetch returned ${p.status}`);return p.json()}).then(p=>{m||(o(p.plugins.map(g=>g.name)),c(!1))}).catch(p=>{m||(o([...jp]),u(p instanceof Error?p:new Error(String(p))),c(!1))}),()=>{m=!0}},[]),a.jsx(pk.Provider,{value:{pluginNames:s,loading:r,error:d},children:t})}function xh(){return y.useContext(pk)}const Wz=new Set(["dashboard","chat","environments","settings"]),Xz=new Set(["tasks","findings"]),Qz=new Set(["knowledge"]),hk={core:{navItems:ld.filter(t=>Wz.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:ld.filter(t=>Xz.has(t.view)),domainHookKeys:["tasks","findings","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:ld.filter(t=>Qz.has(t.view)),domainHookKeys:["knowledge"]}};function eH(t){return t.flatMap(s=>{var o;return((o=hk[s])==null?void 0:o.navItems)??[]})}function tH(t){return new Set(t.flatMap(s=>{var o;return((o=hk[s])==null?void 0:o.domainHookKeys)??[]}))}function nH(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function m_(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function sH(t){return{sessionId:t.sessionId,eventType:R_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function aH(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:q2(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function p_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:G2(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function Pm(t){return{id:t.id,workspaceId:t.workspaceId,taskId:t.taskId,sessionId:t.sessionId,category:t.category,title:t.title,content:t.content,tags:[...t.tags],createdAt:t.createdAt}}function iH(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function oH(t){return{claude:F2(t.claude),github:$c(t.github),copilot:$c(t.copilot),codex:$c(t.codex),goose:$c(t.goose)}}function rH(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function lH(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function Um(t){return{id:t.id,name:t.name,description:t.description,systemPrompt:t.systemPrompt,toolConfig:t.toolConfig?JSON.stringify({allowedTools:[...t.toolConfig.allowedTools],disallowedTools:[...t.toolConfig.disallowedTools]}):"{}",runtime:t.runtime,model:t.model,maxTurns:t.maxTurns,mcpServers:JSON.stringify(t.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:t.createdAt,updatedAt:t.updatedAt,type:t.type||"agent",script:t.script,allowedMcpTools:[...t.allowedMcpTools]}}function cH(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Vm(t){return{id:t.id,title:t.title,description:t.description,scheduleExpression:t.scheduleExpression,personaId:t.personaId,workspaceId:t.workspaceId,parentTaskId:t.parentTaskId,enabled:t.enabled,lastRunAt:t.lastRunAt,nextRunAt:t.nextRunAt,runCount:t.runCount,createdAt:t.createdAt,updatedAt:t.updatedAt}}function ed(t,s=0){return{id:t.id,label:t.title||t.label||t.id,kind:t.kind,category:t.category||void 0,sourceType:t.sourceType||void 0,sourceId:t.sourceId||void 0,content:t.content||void 0,tags:t.tags.length>0?[...t.tags]:void 0,workspaceId:t.workspaceId||void 0,createdAt:t.createdAt||void 0,updatedAt:t.updatedAt||void 0,val:s}}function qm(t){return{source:t.fromId,target:t.toId,type:t.type}}function dH(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function uH(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(dH)}}function us(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const h_=5e3;function Kr(t){return t instanceof da?t.message:"Operation failed"}function fH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),[c,d]=y.useState({}),[u,m]=y.useState(""),p=y.useCallback(()=>{m("")},[]),g=y.useCallback(async()=>{try{const C=await r($e.listEnvironments({}));s(C.environments.map(nH))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const A=C.payload.environmentId;return A&&(s(L=>L.filter(E=>E.id!==A)),d(L=>{const E={...L};return delete E[A],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const A=C.payload;if(typeof A.environmentId!="string"||typeof A.stage!="string"||typeof A.message!="string"||typeof A.progress!="number")return lk("environment.provision_progress","invalid payload"),!0;if(d(L=>({...L,[A.environmentId]:{stage:A.stage,message:A.message,progress:A.progress}})),A.stage==="ready"){const L=A.environmentId;setTimeout(()=>{d(E=>{const O={...E};return delete O[L],O})},h_)}return!0}default:return!1}},[g]),_=y.useCallback(C=>{var A;if(C.type==="environments"){const L=Array.isArray((A=C.payload)==null?void 0:A.environments)?C.payload.environments:[];return s(L),!0}return!1},[]),b=y.useCallback(async(C,A,L,E)=>{m("");try{await $e.addEnvironment({displayName:C,adapterType:A,adapterConfig:JSON.stringify(L??{}),githubAccountId:E??""})}catch(O){m(Kr(O))}},[]),x=y.useCallback(async(C,A)=>{m("");try{await $e.updateEnvironment({id:C,displayName:A.displayName,adapterConfig:A.adapterConfig?JSON.stringify(A.adapterConfig):void 0,githubAccountId:A.githubAccountId})}catch(L){m(Kr(L))}},[]),k=y.useCallback(async(C,A)=>{m("");try{const L=$e.provisionEnvironment({id:C,force:A??!1});for await(const E of L)d(O=>({...O,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(O=>{const z={...O};return delete z[C],z})},h_)}catch(L){d(E=>{const O={...E};return delete O[C],O}),m(Kr(L))}},[]),j=y.useCallback(async C=>{m("");try{await $e.stopEnvironment({id:C})}catch(A){m(Kr(A))}},[]),N=y.useCallback(async C=>{m("");try{await $e.removeEnvironment({id:C})}catch(A){m(Kr(A))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:p,loadEnvironments:g,addEnvironment:b,updateEnvironment:x,provisionEnvironment:k,stopEnvironment:j,removeEnvironment:N,handleEvent:v,handleLegacyMessage:_,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const Gm=new Set(["pending","running","idle"]),mH=new Set(["completed","failed","interrupted","hibernating","suspended"]),g_=["pending","running","idle"];function pH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),[c,d]=y.useState([]),[u,m]=y.useState(0),[p,g]=y.useState(void 0),[v,_]=y.useState({}),b=y.useCallback(async()=>{try{const H=(await r($e.listSessions({}))).sessions.map(m_);s(Y=>{const U=new Map(Y.map(X=>[X.id,X]));return H.map(X=>{const ge=U.get(X.id),W=ge==null?void 0:ge.status;return!W||W===X.status?X:mH.has(W)&&Gm.has(X.status)?{...X,status:W,...ge.endReason!==void 0?{endReason:ge.endReason}:{}}:Gm.has(W)&&Gm.has(X.status)&&g_.indexOf(W)>g_.indexOf(X.status)?{...X,status:W}:X})})}catch{}},[r]),x=y.useCallback(D=>{if(D.type!=="session_event")return!1;if(!xz(D.payload))return lk("session_event","payload is not a valid SessionEvent"),!0;const H=D.payload;let Y=0;if(d(U=>{const X=[...U,H];return X.length>Do?(Y=X.length-Do,X.slice(-Do)):X}),Y>0&&m(U=>U+Y),H.eventType==="usage")try{const U=JSON.parse(H.content),X=Number(U.input_tokens)||0,ge=Number(U.output_tokens)||0,W=Number(U.cost_millicents)||0;(X>0||ge>0||W>0)&&s(le=>le.map(B=>B.id===H.sessionId?{...B,inputTokens:(B.inputTokens??0)+X,outputTokens:(B.outputTokens??0)+ge,costMillicents:(B.costMillicents??0)+W}:B))}catch{}if(H.eventType==="status"){const U=ck(H.content),X=dk(H.content);s(ge=>ge.some(le=>le.id===H.sessionId)?ge.map(le=>le.id===H.sessionId?{...le,status:U,...X!==void 0?{endReason:X}:{}}:le):[...ge,{id:H.sessionId,environmentId:"",runtime:"",status:U,prompt:"",startedAt:H.timestamp,...X!==void 0?{endReason:X}:{}}])}return!0},[]),k=y.useCallback(D=>{x({type:"session_event",payload:D})},[x]),j=y.useCallback(D=>{var H,Y,U,X,ge;switch(D.type){case"sessions":{const W=Array.isArray((H=D.payload)==null?void 0:H.sessions)?D.payload.sessions:[];return s(W),!0}case"spawned":{const W=(Y=D.payload)==null?void 0:Y.sessionId;return typeof W=="string"&&W&&g(W),b().catch(()=>{}),!0}case"session_events":{const W=Array.isArray((U=D.payload)==null?void 0:U.events)?D.payload.events:[];return W.length>0&&d(W),!0}case"task_sessions":{const W=(X=D.payload)==null?void 0:X.taskId;if(typeof W=="string"&&W){const le=Array.isArray((ge=D.payload)==null?void 0:ge.sessions)?D.payload.sessions:[];_(B=>({...B,[W]:le}))}return!0}default:return!1}},[b]),N=y.useCallback(async(D,H,Y,U,X)=>{try{const ge=await $e.spawnAgent({environmentId:D,prompt:H,personaId:Y||"",workingDirectory:U||"",workspaceId:X||""});g(ge.id),await b()}catch{}},[b]),T=y.useCallback(async(D,H)=>{await $e.sendInput({sessionId:D,text:H})},[]),C=y.useCallback(async D=>{try{await $e.killAgent({id:D,graceful:!1})}catch{}},[]),A=y.useCallback(async D=>{try{await $e.killAgent({id:D,graceful:!0})}catch{}},[]),L=y.useCallback(async D=>{try{const Y=(await $e.getSessionEvents({id:D})).events.map(sH);if(Y.length>0){let U=0;d(X=>{const ge=new Set;for(const B of X)B.sessionId===D&&ge.add(`${B.timestamp}|${B.eventType}`);const W=Y.filter(B=>!ge.has(`${B.timestamp}|${B.eventType}`)),le=[...X,...W].sort((B,R)=>B.sessionId!==R.sessionId?0:B.timestamp.localeCompare(R.timestamp));return le.length>Do?(U=le.length-Do,le.slice(-Do)):le}),U>0&&m(X=>X+U)}}catch{}},[]),E=y.useCallback(()=>{d([]),m(0)},[]),O=y.useCallback(async D=>{try{const Y=(await $e.getTaskSessions({id:D})).sessions.map(m_);_(U=>({...U,[D]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:p,taskSessions:v,loadSessions:b,spawn:N,sendInput:T,kill:C,stopGraceful:A,loadSessionEvents:L,clearEvents:E,loadTaskSessions:O,handleMessage:x,handleSessionEvent:k,handleLegacyMessage:j,domainHook:{onConnect:()=>b(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function v_(t){return t instanceof da?t.message:"Operation failed"}function hH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),[c,d]=y.useState(!1),[u,m]=y.useState(""),p=y.useCallback(async()=>{try{const C=await r($e.listWorkspaces({}));s(C.workspaces.map(aH))}catch{}},[r]),g=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),p().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return p().catch(()=>{}),!0;default:return!1}},[p]),v=y.useCallback(()=>{d(!1)},[]),_=y.useCallback(async(C,A,L,E,O,z,D,H,Y)=>{d(!0);try{await $e.createWorkspace({name:C,description:A||"",repoUrl:L||"",environmentId:E||"",defaultPersonaId:O||void 0,useWorktrees:z??!0,workingDirectory:D||void 0}),d(!1),H==null||H()}catch(U){d(!1);const X=U instanceof da?U.message:"Failed to create workspace";Y==null||Y(X)}},[]),b=y.useCallback(async C=>{try{await $e.archiveWorkspace({id:C})}catch{}},[]),x=y.useCallback(async(C,A)=>{try{await $e.updateWorkspace({id:C,...A})}catch{}},[]),k=y.useCallback(()=>{m("")},[]),j=y.useCallback(async(C,A)=>{try{m(""),await $e.linkEnvironment({workspaceId:C,environmentId:A}),await p().catch(()=>{})}catch(L){m(v_(L))}},[p]),N=y.useCallback(async(C,A)=>{try{m(""),await $e.unlinkEnvironment({workspaceId:C,environmentId:A}),await p().catch(()=>{})}catch(L){m(v_(L))}},[p]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:p,createWorkspace:_,archiveWorkspace:b,updateWorkspace:x,linkEnvironment:j,unlinkEnvironment:N,linkOperationError:u,clearLinkOperationError:k,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>p(),onDisconnect:v,handleEvent:g}}}function gH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),[c,d]=y.useState(void 0),u=y.useRef({}),m=y.useCallback(async E=>{try{const z=(await mn.listTasks({workspaceId:E})).tasks.map(p_);s(D=>[...D.filter(H=>H.workspaceId!==E),...z])}catch{}},[]),p=y.useCallback(async()=>{try{const O=(await r(mn.listTasks({}))).tasks.map(p_);s(z=>{const D=new Set(O.map(H=>H.id));return[...z.filter(H=>!D.has(H.id)),...O]})}catch{}},[r]),g=y.useCallback((E,O)=>{const z=D=>{clearTimeout(u.current[D]),u.current[D]=setTimeout(()=>{delete u.current[D],m(D).catch(()=>{})},200)};E?z(E):O&&s(D=>{const H=D.find(Y=>Y.id===O);return H!=null&&H.workspaceId?z(H.workspaceId):p().catch(()=>{}),D})},[m,p]),v=y.useCallback(E=>{const O=E.payload;switch(E.type){case"task.created":{const z=typeof O.workspaceId=="string"?O.workspaceId:"";return z&&m(z).catch(()=>{}),!0}case"task.started":{const z=typeof O.taskId=="string"?O.taskId:"",D=typeof O.sessionId=="string"?O.sessionId:"",H=typeof O.workspaceId=="string"?O.workspaceId:"";return d(Y=>z&&Y===z?void 0:Y),D&&z&&s(Y=>Y.map(U=>U.id===z?{...U,latestSessionId:D}:U)),g(H,z),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const z=typeof O.workspaceId=="string"?O.workspaceId:"",D=typeof O.taskId=="string"?O.taskId:"";return d(H=>D&&H===D?void 0:H),g(z,D),!0}default:return!1}},[m,g]),_=y.useCallback(()=>{d(void 0)},[]),b=y.useCallback(E=>{var O,z;if(E.type==="tasks"){const D=Array.isArray((O=E.payload)==null?void 0:O.tasks)?E.payload.tasks:[],H=typeof((z=E.payload)==null?void 0:z.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s(H?Y=>[...Y.filter(U=>U.workspaceId!==H),...D]:Y=>{const U=new Set(D.map(X=>X.id));return[...Y.filter(X=>!U.has(X.id)),...D]}),!0}return!1},[]),x=y.useCallback(async(E,O,z,D,H,Y,U,X,ge)=>{try{await mn.createTask({workspaceId:E,title:O,description:z||"",dependsOn:D||[],parentTaskId:H||"",defaultPersonaId:Y||void 0,canDecompose:U??void 0}),X==null||X()}catch(W){const le=W instanceof da?W.message:"Failed to create task";ge==null||ge(le)}},[]),k=y.useCallback(async(E,O,z,D)=>{d(E);try{await mn.startTask({taskId:E,personaId:O||"",environmentId:z||"",notes:D||""})}catch(H){if(H instanceof da&&H.code===D_.ResourceExhausted)return;throw d(void 0),H}},[]),j=y.useCallback(async E=>{try{await mn.stopTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await mn.completeTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await mn.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,O,z,D,H)=>{try{await mn.updateTask({id:E,title:O,description:z,dependsOn:D,...H!==void 0?{defaultPersonaId:H}:{}})}catch{}},[]),A=y.useCallback(async E=>{try{await mn.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:m,loadAllTasks:p,createTask:x,startTask:k,stopTask:j,completeTask:N,resumeTask:T,updateTask:C,deleteTask:A,handleEvent:v,onDisconnect:_,handleLegacyMessage:b,domainHook:{onConnect:()=>p(),onDisconnect:_,handleEvent:v}}}function vH(){const[t,s]=y.useState([]),[o,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:m}=us(),p=y.useCallback(async k=>{try{const j=await m(mn.queryFindings({workspaceId:k}));s(j.findings.map(Pm))}catch{}},[m]),g=y.useCallback(async()=>{try{const k=await m(mn.queryFindings({workspaceId:""}));s(k.findings.map(Pm))}catch{}},[m]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const j=await mn.getFinding({id:k});r(Pm(j))}catch{r(void 0)}finally{d(!1)}},[]),_=y.useCallback(k=>{if(k.type==="finding.posted"){const j=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return j&&p(j).catch(()=>{}),!0}return!1},[p]),b=y.useCallback(async(k,j,N,T,C)=>{try{await mn.postFinding({workspaceId:k,title:j,content:N,category:T??"general",tags:C??[]})}catch{}},[]);return{findings:t,selectedFinding:o,findingLoading:c,findingsLoading:u,loadFindings:p,loadAllFindings:g,loadFinding:v,postFinding:b,handleEvent:_,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:_}}}function yH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),c=y.useCallback(async()=>{try{const g=await r($e.listTokens({}));s(g.tokens.map(iH))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,_,b,x)=>{try{await $e.setToken({name:g,value:v,type:_,envVar:b,filePath:x})}catch{}},[]),m=y.useCallback(async g=>{try{await $e.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function bH(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=us(),c=y.useCallback(async()=>{try{const p=await r($e.getCredentialProviders({}));s(oH(p))}catch{}},[r]),d=y.useCallback(p=>p.type==="credential.providers_changed"?(Sz(p.payload)&&s(p.payload),!0):!1,[]),u=y.useCallback(async p=>{const g=[{provider:"claude",value:p.claude},{provider:"github",value:p.github},{provider:"copilot",value:p.copilot},{provider:"codex",value:p.codex},{provider:"goose",value:p.goose}];await Promise.allSettled(g.map(({provider:v,value:_})=>$e.setCredentialProvider({provider:v,value:_})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function _H(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,m]=y.useState(!1),p=y.useCallback(async _=>{try{const b=await $e.listCodespaces({githubAccountId:_??""});s(b.codespaces.map(rH)),d(b.error)}catch{}},[]),g=y.useCallback(async(_,b)=>{m(!0),r("");try{await $e.createCodespace({repo:_,machine:b??""}),m(!1),await p()}catch(x){m(!1);const k=x instanceof da?x.message:"Failed to create codespace";r(k)}},[p]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:p,createCodespace:g,domainHook:{onConnect:()=>p(),onDisconnect:()=>{},handleEvent:()=>!1}}}function xH(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await $e.listDockerContainers({});s(u.containers.map(lH)),r(u.error)}catch(u){s([]),r(u instanceof Error?u.message:"Failed to list Docker containers")}},[]);return{dockerContainers:t,dockerContainersError:o,listDockerContainers:c,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1}}}function kH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),c=y.useCallback(async()=>{try{const v=await r(mn.listPersonas({}));s(v.personas.map(Um))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,_,b,x,k,j,N,T,C)=>{const A=await mn.createPersona({name:v,description:_,systemPrompt:b,runtime:x||"",model:k||"",maxTurns:j||0,type:N||"agent",script:T||"",allowedMcpTools:C||[]}),L=Um(A);return s(E=>[...E.filter(O=>O.id!==L.id),L]),L},[]),m=y.useCallback(async(v,_,b,x,k,j,N,T,C,A)=>{const L={id:v};_!==void 0&&(L.name=_),b!==void 0&&(L.description=b),x!==void 0&&(L.systemPrompt=x),k!==void 0&&(L.runtime=k),j!==void 0&&(L.model=j),N!==void 0&&(L.maxTurns=N),T!==void 0&&(L.type=T),C!==void 0&&(L.script=C),A!==void 0&&(L.allowedMcpTools={tools:A});const E=await mn.updatePersona(L),O=Um(E);return s(z=>z.map(D=>D.id===O.id?O:D)),O},[]),p=y.useCallback(async v=>{await mn.deletePersona({id:v}),s(_=>_.filter(b=>b.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:m,deletePersona:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function SH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const _=await r(Hc.listSchedules({}));s(_.schedules.map(Vm))}catch{}},[r]),u=y.useCallback(_=>{switch(_.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),m=y.useCallback(async(_,b,x,k,j,N)=>{const T=await Hc.createSchedule({title:_,description:b,scheduleExpression:x,personaId:k,workspaceId:j||"",parentTaskId:N||""}),C=Vm(T);return s(A=>[...A.filter(L=>L.id!==C.id),C]),C},[]),p=y.useCallback(async(_,b)=>{const x={id:_};b.title!==void 0&&(x.title=b.title),b.description!==void 0&&(x.description=b.description),b.scheduleExpression!==void 0&&(x.scheduleExpression=b.scheduleExpression),b.personaId!==void 0&&(x.personaId=b.personaId),b.enabled!==void 0&&(x.enabled=b.enabled);const k=await Hc.updateSchedule(x),j=Vm(k);return s(N=>N.map(T=>T.id===j.id?j:T)),j},[]),g=y.useCallback(async _=>{await Hc.deleteSchedule({id:_}),s(b=>b.filter(x=>x.id!==_))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:m,updateSchedule:p,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function jH(t){if(t)try{return JSON.parse(t)}catch{return}}function TH(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,m]=y.useState(void 0),[p,g]=y.useState(!1),[v,_]=y.useState(""),b=y.useRef(""),x=y.useCallback(async E=>{const O=E??"";b.current=O,_(""),g(!0);try{const z=await Pc.listRecentKnowledgeNodes({limit:30,workspaceId:O}),D=new Map,H=[];for(const Y of z.nodes)D.set(Y.id,ed(Y));for(const Y of z.edges)H.push(qm(Y));for(const Y of H){const U=D.get(Y.source);U&&(U.val+=1);const X=D.get(Y.target);X&&(X.val+=1)}s(D),r(H)}catch{}finally{g(!1)}},[]),k=y.useCallback(async E=>{if(E.trim()){_(E),m(void 0),d(void 0),g(!0);try{const O=await Pc.searchKnowledge({query:E,limit:20,workspaceId:b.current}),z=new Map,D=[];for(const H of O.results){H.node&&z.set(H.node.id,ed(H.node,H.edges.length));for(const Y of H.edges)D.push(qm(Y))}s(z),r(D)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{x(b.current).catch(()=>{})},[x]),N=y.useCallback(async E=>{m(E);try{const O=await Pc.getKnowledgeNode({id:E});if(!O.node){d(void 0);return}d({node:ed(O.node,O.edges.length),edges:O.edges.map(z=>({fromId:z.fromId,toId:z.toId,type:z.type,metadata:jH(z.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{m(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const O=await Pc.expandKnowledgeNode({id:E,depth:1});s(z=>{const D=new Map(z);for(const H of O.nodes)D.has(H.id)||D.set(H.id,ed(H));return D}),r(z=>{const D=new Set(z.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),H=[];for(const Y of O.edges){const U=qm(Y),X=`${U.source}:${U.target}:${U.type}`;D.has(X)||H.push(U)}return[...z,...H]})}catch{}},[]),A=y.useCallback(E=>!1,[]),L={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:A};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:p,searchQuery:v,search:k,clearSearch:j,selectNode:N,clearSelection:T,expandNode:C,loadRecent:x,handleEvent:A,domainHook:L}}function NH(){const t=y.useRef("default");y.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(r){if(r.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(u=>{t.current=u}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const c=r.payload,d=new Notification(c.title||"Agent needs input",{body:c.message||"An agent is waiting for your input.",tag:c.escalationId,icon:"/icon-192x192.png"});return d.onclick=()=>{window.focus(),c.taskUrl&&(window.location.href=c.taskUrl),d.close()},!0}return{handleEvent:s,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:s}}}function wH(){const[t,s]=y.useState([]),[o,r]=y.useState(!1),[c,d]=y.useState(!1),{loading:u,track:m}=us(),p=y.useRef(0),g=y.useCallback(async()=>{const b=p.current;try{const x=await m($e.listStreams({}));p.current===b&&(s(x.streams.map(uH)),d(!1))}catch{p.current===b&&d(!0)}finally{p.current===b&&r(!0)}},[m]),v=y.useCallback(b=>!1,[]);return{streams:t,streamsLoading:u,streamsLoadedOnce:o,streamsLoadError:c,loadStreams:g,handleEvent:v,domainHook:{onConnect:g,onDisconnect:()=>{p.current+=1,s([]),r(!1),d(!1)},handleEvent:v}}}function CH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),c=y.useCallback(async()=>{try{const p=await r($e.listPlugins({}));s(p.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=y.useCallback(p=>p.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(p,g)=>{try{const v=await $e.setPluginEnabled({name:p,enabled:g});s(_=>_.map(b=>b.name===v.name?{...b,enabled:v.enabled}:b))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function EH(){const[t,s]=y.useState([]),{loading:o,track:r}=us(),c=y.useCallback(async()=>{try{const _=await r($e.listGitHubAccounts({}));s(_.accounts.map(b=>({id:b.id,label:b.label,username:b.username,isDefault:b.isDefault,createdAt:b.createdAt})))}catch{}},[r]),d=y.useCallback(_=>_.type==="github_account.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(_,b,x,k)=>{const j=await $e.addGitHubAccount({label:_,token:b,username:x,isDefault:k});s(N=>[...j.isDefault?N.map(C=>({...C,isDefault:!1})):N,{id:j.id,label:j.label,username:j.username,isDefault:j.isDefault,createdAt:j.createdAt}])},[]),m=y.useCallback(async(_,b)=>{const x=await $e.updateGitHubAccount({id:_,...b});s(k=>k.map(j=>j.id===x.id?{...j,label:x.label,username:x.username,isDefault:x.isDefault}:b.isDefault?{...j,isDefault:!1}:j))},[]),p=y.useCallback(async _=>{await $e.removeGitHubAccount({id:_}),s(b=>b.filter(x=>x.id!==_))},[]),g=y.useCallback(async()=>{const _=await $e.importGitHubAccounts({});return _.imported>0&&await c(),{imported:_.imported,usernames:_.usernames}},[c]);return{githubAccounts:t,githubAccountsLoading:o,loadGitHubAccounts:c,addGitHubAccount:u,updateGitHubAccount:m,removeGitHubAccount:p,importGitHubAccounts:g,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function AH(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=xh(),m=tH(u),p=fH(),g=pH(),v=hH(),_=gH(),b=vH(),x=yH(),k=bH(),j=_H(),N=xH(),T=kH(),C=SH(),A=TH(),L=NH(),E=wH(),O=CH(),z=EH(),D=[...m.has("environments")?[p.domainHook]:[],...m.has("sessions")?[g.domainHook]:[],...m.has("workspaces")?[v.domainHook]:[],...m.has("tasks")?[_.domainHook]:[],...m.has("findings")?[b.domainHook]:[],...m.has("tokens")?[x.domainHook]:[],...m.has("credentials")?[k.domainHook]:[],...m.has("codespaces")?[j.domainHook]:[],...m.has("dockerContainers")?[N.domainHook]:[],...m.has("personas")?[T.domainHook]:[],...m.has("schedules")?[C.domainHook]:[],...m.has("knowledge")?[A.domainHook]:[],...m.has("notifications")?[L.domainHook]:[],...m.has("streams")?[E.domainHook]:[],...m.has("plugins")?[O.domainHook]:[],z.domainHook],{connectionStatus:H}=Yz({onSessionEvent:oe=>{g.handleSessionEvent({sessionId:oe.sessionId,eventType:R_(oe.type),timestamp:oe.timestamp,content:oe.content,raw:oe.raw||void 0})},onDomainEvent:oe=>{try{const q=JSON.parse(oe.payloadJson);le({id:oe.id,type:oe.type,timestamp:oe.timestamp,payload:q})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",oe.payloadJson)}},onConnect:B,onDisconnect:R}),Y="default_persona_id",U="onboarding_completed",X=y.useCallback(async oe=>{const q=await $e.setSetting({key:Y,value:oe});s(q.value)},[]),ge=y.useCallback(async()=>{r(!0);try{await $e.setSetting({key:U,value:"true"})}catch{}},[]),W=y.useCallback(async(oe,q)=>{try{const me=await $e.getUsage({scope:oe,id:q}),de=`${oe}:${q}`;d(xe=>({...xe,[de]:cH(me)}))}catch{}},[]);function le(oe){const q=oe.payload.key,me=oe.payload.value;if(oe.type==="setting.changed"){q===Y&&s(me??""),q===U&&r(me==="true");return}for(const de of D)if(de.handleEvent(oe))break;(oe.type==="environment.removed"||oe.type==="task.started")&&g.loadSessions().catch(()=>{}),(oe.type==="session.started"||oe.type==="session.stopped")&&E.loadStreams().catch(()=>{})}async function B(){for(const oe of D)oe.onConnect().catch(()=>{});try{const oe=await $e.getSetting({key:Y});s(oe.value)}catch{}try{const oe=await $e.getSetting({key:U});r(oe.value==="true")}catch{}}function R(){D.forEach(oe=>oe.onDisconnect())}const se=y.useCallback(()=>{p.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),x.loadTokens().catch(()=>{})},[p.loadEnvironments,g.loadSessions,v.loadWorkspaces,x.loadTokens]);return{connectionStatus:H,environments:{environments:p.environments,environmentsLoading:p.environmentsLoading,provisionStatus:p.provisionStatus,operationError:p.operationError,clearOperationError:p.clearOperationError,loadEnvironments:p.loadEnvironments,addEnvironment:p.addEnvironment,updateEnvironment:p.updateEnvironment,provisionEnvironment:p.provisionEnvironment,stopEnvironment:p.stopEnvironment,removeEnvironment:p.removeEnvironment,domainHook:p.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:_.tasks,tasksLoading:_.tasksLoading,taskStartingId:_.taskStartingId,loadTasks:_.loadTasks,loadAllTasks:_.loadAllTasks,createTask:_.createTask,startTask:_.startTask,stopTask:_.stopTask,completeTask:_.completeTask,resumeTask:_.resumeTask,updateTask:_.updateTask,deleteTask:_.deleteTask,domainHook:_.domainHook},findings:{findings:b.findings,selectedFinding:b.selectedFinding,findingLoading:b.findingLoading,findingsLoading:b.findingsLoading,loadFindings:b.loadFindings,loadAllFindings:b.loadAllFindings,loadFinding:b.loadFinding,postFinding:b.postFinding,domainHook:b.domainHook},tokens:{tokens:x.tokens,tokensLoading:x.tokensLoading,loadTokens:x.loadTokens,setToken:x.setToken,deleteToken:x.deleteToken,domainHook:x.domainHook},credentials:{credentialProviders:k.credentialProviders,credentialsLoading:k.credentialsLoading,updateCredentialProviders:k.updateCredentialProviders,domainHook:k.domainHook},codespaces:{codespaces:j.codespaces,codespaceError:j.codespaceError,codespaceListError:j.codespaceListError,codespaceCreating:j.codespaceCreating,listCodespaces:j.listCodespaces,createCodespace:j.createCodespace,domainHook:j.domainHook},dockerContainers:{dockerContainers:N.dockerContainers,dockerContainersError:N.dockerContainersError,listDockerContainers:N.listDockerContainers,domainHook:N.domainHook},personas:{personas:T.personas,personasLoading:T.personasLoading,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,domainHook:T.domainHook},schedules:{schedules:C.schedules,schedulesLoading:C.schedulesLoading,createSchedule:C.createSchedule,updateSchedule:C.updateSchedule,deleteSchedule:C.deleteSchedule,domainHook:C.domainHook},streams:{streams:E.streams,streamsLoading:E.streamsLoading,streamsLoadedOnce:E.streamsLoadedOnce,streamsLoadError:E.streamsLoadError,loadStreams:E.loadStreams,domainHook:E.domainHook},knowledge:A,plugins:{plugins:O.plugins,pluginsLoading:O.pluginsLoading,loadPlugins:O.loadPlugins,setPluginEnabled:O.setPluginEnabled},githubAccounts:{githubAccounts:z.githubAccounts,githubAccountsLoading:z.githubAccountsLoading,loadGitHubAccounts:z.loadGitHubAccounts,addGitHubAccount:z.addGitHubAccount,updateGitHubAccount:z.updateGitHubAccount,removeGitHubAccount:z.removeGitHubAccount,importGitHubAccounts:z.importGitHubAccounts},appDefaultPersonaId:t,setAppDefaultPersonaId:X,onboardingCompleted:o,completeOnboarding:ge,usageCache:c,loadUsage:W,refresh:se}}function DH({children:t}){const s=AH();return a.jsx(vh.Provider,{value:s,children:t})}function RH(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const m=c.get(u.id);m&&m.status!==u.status&&(u.status==="sleeping"||u.status==="connecting"||(u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&m.status==="connected"&&s("Environment disconnected","warning")))}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function MH(t,s,o){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const IH={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 OH(t){return IH[t]}function LH(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const m=OH(d.status);m&&o.push(m)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function BH(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=LH(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const $H="_dashboard_16pzm_1",zH="_kpiStrip_16pzm_11",HH="_kpiCard_16pzm_23",PH="_kpiValue_16pzm_68",UH="_kpiLabel_16pzm_76",VH="_bodyGrid_16pzm_84",qH="_section_16pzm_96",GH="_sectionHeader_16pzm_109",FH="_sectionIcon_16pzm_118",ZH="_sectionTitle_16pzm_123",KH="_sectionCount_16pzm_131",YH="_sectionBody_16pzm_138",JH="_emptyHint_16pzm_143",WH="_sessionRow_16pzm_150",XH="_sessionPrompt_16pzm_177",QH="_sessionEnv_16pzm_186",e9="_sessionRuntime_16pzm_192",t9="_sessionStatus_16pzm_198",n9="_statusDot_16pzm_207",s9="_attentionRow_16pzm_233",a9="_attentionTitle_16pzm_259",i9="_attentionMeta_16pzm_267",o9="_reasonBadge_16pzm_274",r9="_bottomGrid_16pzm_301",l9="_envRow_16pzm_312",c9="_envName_16pzm_323",d9="_envStatusBadge_16pzm_333",u9="_workspaceRow_16pzm_369",f9="_workspaceTop_16pzm_395",m9="_workspaceName_16pzm_401",p9="_workspaceCounts_16pzm_407",h9="_progressBar_16pzm_415",g9="_progressFill_16pzm_422",he={dashboard:$H,kpiStrip:zH,kpiCard:HH,kpiValue:PH,kpiLabel:UH,bodyGrid:VH,section:qH,sectionHeader:GH,sectionIcon:FH,sectionTitle:ZH,sectionCount:KH,sectionBody:YH,emptyHint:JH,sessionRow:WH,sessionPrompt:XH,sessionEnv:QH,sessionRuntime:e9,sessionStatus:t9,statusDot:n9,attentionRow:s9,attentionTitle:a9,attentionMeta:i9,reasonBadge:o9,bottomGrid:r9,envRow:l9,envName:c9,envStatusBadge:d9,workspaceRow:u9,workspaceTop:f9,workspaceName:m9,workspaceCounts:p9,progressBar:h9,progressFill:g9};function v9(){return a.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[a.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:he.kpiCard,children:[a.jsx(we,{width:"3rem",height:"2rem"}),a.jsx(we,{width:"80%",height:"0.75rem"})]},s))}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(we,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(we,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>a.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[a.jsx(we,{width:"60%",height:"0.875rem"}),a.jsx(we,{width:"4rem",height:"0.75rem"}),a.jsx(we,{width:"3rem",height:"0.75rem"}),a.jsx(we,{width:"3rem",height:"0.75rem"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(we,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(we,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx(we,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"70%",height:"0.875rem"})]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx(we,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(we,{width:"9rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(we,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.envRow,children:[a.jsx(we,{width:"60%",height:"0.875rem"}),a.jsx(we,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(we,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(we,{width:"6rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(we,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx(we,{width:"50%",height:"0.875rem"}),a.jsx(we,{width:"2rem",height:"0.75rem"})]}),a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const y9={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},td={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function b9(t,s,o,r){const c=[`${t} of ${s} tasks completed`];return o>0&&c.push(`${o} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function nd({value:t,label:s,accent:o,index:r,testId:c}){return a.jsxs(Rt.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:y9,initial:"hidden",animate:"visible",custom:r,children:[a.jsx("span",{className:he.kpiValue,children:t}),a.jsx("span",{className:he.kpiLabel,children:s})]})}function _9(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:m,environmentsLoading:p}}=ot(),g=dt(),v=y.useRef(new Set);y.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const _=y.useMemo(()=>Iz(d,o,m),[d,o,m]),b=y.useMemo(()=>Lz(d,m),[d,m]),x=y.useMemo(()=>Oz(o,t),[o,t]),k=y.useMemo(()=>Bz(t,o),[t,o,m]);return d.length===0&&o.length===0&&m.length===0&&t.length===0&&(u||r||p||s)?a.jsx(v9,{}):a.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[a.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[a.jsx(nd,{value:_.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),a.jsx(nd,{value:_.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),a.jsx(nd,{value:_.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),a.jsx(nd,{value:_.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs(Rt.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),a.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),a.jsx("span",{className:he.sectionCount,children:b.length})]}),a.jsx("div",{className:he.sectionBody,children:b.length===0?a.jsx("div",{className:he.emptyHint,children:"No active sessions"}):b.map(({session:N,environmentName:T})=>a.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(Bd(N.id)),"data-testid":"session-row",children:[a.jsx("span",{className:he.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),a.jsx("span",{className:he.sessionEnv,children:T}),a.jsx("span",{className:he.sessionRuntime,children:N.runtime}),a.jsxs("span",{className:he.sessionStatus,children:[a.jsx("span",{className:he.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),a.jsxs(Rt.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),a.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),a.jsx("span",{className:he.sectionCount,children:x.length})]}),a.jsx("div",{className:he.sectionBody,children:x.length===0?a.jsx("div",{className:he.emptyHint,children:"All clear"}):x.map(({task:N,reason:T,workspaceName:C})=>a.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(Pn(N.id)),"data-testid":"attention-row",children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx("span",{className:he.reasonBadge,"data-reason":T,children:T}),N.title]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx("span",{children:C})})]},N.id))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs(Rt.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),a.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),a.jsx("span",{className:he.sectionCount,children:m.length})]}),a.jsx("div",{className:he.sectionBody,children:m.length===0?a.jsx("div",{className:he.emptyHint,children:"No environments configured"}):m.map(N=>a.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[a.jsx("span",{className:he.envName,children:N.displayName}),a.jsx("span",{className:he.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),a.jsxs(Rt.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),a.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),a.jsx("span",{className:he.sectionCount,children:t.length})]}),a.jsx("div",{className:he.sectionBody,children:k.length===0?a.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):k.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:A,failedTasks:L})=>{const E=T>0?Math.round(C/T*100):0;return a.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(Ri(N.id,N.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx("span",{className:he.workspaceName,children:N.name}),a.jsxs("span",{className:he.workspaceCounts,"aria-label":b9(C,T,A,L),children:[C,"/",T,A>0&&a.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",A]}),L>0&&a.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",L]})]})]}),T>0&&a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},N.id)})})]})]})]})}const x9="_panelContainer_1udy7_1",k9="_emptyState_1udy7_8",S9="_workspaceSummary_1udy7_17",j9="_workspaceSummaryTitle_1udy7_28",T9="_workspaceSummarySubtitle_1udy7_32",N9="_header_1udy7_36",w9="_headerInfo_1udy7_71",C9="_headerTitle_1udy7_106",E9="_taskStatusBadge_1udy7_128",A9="_taskBranch_1udy7_137",D9="_taskBlockedBadge_1udy7_143",R9="_tabBar_1udy7_277",M9="_tab_1udy7_277",I9="_active_1udy7_303",O9="_eventScroll_1udy7_308",L9="_tabContent_1udy7_314",B9="_noContext_1udy7_319",$9="_overviewContent_1udy7_325",z9="_overviewDashboard_1udy7_334",H9="_overviewHero_1udy7_340",P9="_overviewSection_1udy7_347",U9="_overviewLabel_1udy7_353",V9="_envRow_1udy7_360",q9="_timeline_1udy7_366",G9="_timelineRow_1udy7_372",F9="_waitingMessage_1udy7_379",Z9="_errorMessage_1udy7_383",K9="_emptyCta_1udy7_387",Y9="_ctaTitle_1udy7_399",J9="_ctaDescription_1udy7_405",W9="_ctaButton_1udy7_412",X9="_workspaceHeader_1udy7_533",Q9="_workspaceName_1udy7_558",eP="_workspaceMeta_1udy7_571",tP="_metaRow_1udy7_579",nP="_metaLabel_1udy7_592",sP="_metaValue_1udy7_607",aP="_archiveButton_1udy7_617",iP="_repoLink_1udy7_647",oP="_metaToggle_1udy7_657",rP="_metaToggleArrow_1udy7_678",lP="_metaToggleArrowOpen_1udy7_683",cP="_progressBarContainer_1udy7_687",dP="_progressBar_1udy7_687",uP="_progressFill_1udy7_703",fP="_progressLabel_1udy7_710",mP="_metaTimestamps_1udy7_717",pP="_metaTimestamp_1udy7_717",hP="_metaPlaceholder_1udy7_739",gP="_linkedEnvList_1udy7_744",vP="_linkedEnvChip_1udy7_750",yP="_chipDismiss_1udy7_762",bP="_linkError_1udy7_777",_P="_linkEnvSelect_1udy7_782",J={panelContainer:x9,emptyState:k9,workspaceSummary:S9,workspaceSummaryTitle:j9,workspaceSummarySubtitle:T9,header:N9,headerInfo:w9,headerTitle:C9,taskStatusBadge:E9,taskBranch:A9,taskBlockedBadge:D9,tabBar:R9,tab:M9,active:I9,eventScroll:O9,tabContent:L9,noContext:B9,overviewContent:$9,overviewDashboard:z9,overviewHero:H9,overviewSection:P9,overviewLabel:U9,envRow:V9,timeline:q9,timelineRow:G9,waitingMessage:F9,errorMessage:Z9,emptyCta:K9,ctaTitle:Y9,ctaDescription:J9,ctaButton:W9,workspaceHeader:X9,workspaceName:Q9,workspaceMeta:eP,metaRow:tP,metaLabel:nP,metaValue:sP,archiveButton:aP,repoLink:iP,metaToggle:oP,metaToggleArrow:rP,metaToggleArrowOpen:lP,progressBarContainer:cP,progressBar:dP,progressFill:uP,progressLabel:fP,metaTimestamps:mP,metaTimestamp:pP,metaPlaceholder:hP,linkedEnvList:gP,linkedEnvChip:vP,chipDismiss:yP,linkError:bP,linkEnvSelect:_P};function xP(){return a.jsx("div",{className:J.emptyState,children:"Select a task or click + to create one"})}function kP(){return a.jsx("div",{className:J.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function SP(){const{workspaces:{workspaces:t},environments:{environments:s}}=ot(),o=dt(),r=s.length>0;return t.length>0?a.jsx(_9,{}):a.jsxs("div",{className:J.emptyCta,"data-testid":"welcome-cta",children:[a.jsx("div",{className:J.ctaTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:J.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),a.jsx("button",{className:J.ctaButton,onClick:()=>o(ax),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&a.jsx("div",{className:J.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const jP="_panelContainer_1rih4_1",TP="_chatHeader_1rih4_9",NP="_chatHeaderInfo_1rih4_38",wP="_chatHeaderActions_1rih4_44",CP="_detailButton_1rih4_50",EP="_emptyState_1rih4_64",AP="_emptyTitle_1rih4_76",DP="_emptyDescription_1rih4_82",RP="_emptyHint_1rih4_88",Yt={panelContainer:jP,chatHeader:TP,chatHeaderInfo:NP,chatHeaderActions:wP,detailButton:CP,emptyState:EP,emptyTitle:AP,emptyDescription:DP,emptyHint:RP};function Fm(){return a.jsx("div",{className:Yt.panelContainer,"aria-hidden":"true",children:a.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(we,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function MP({hasLocalEnvironment:t}){return a.jsxs("div",{className:Yt.emptyState,"data-testid":"chat-empty-state",children:[a.jsx("div",{className:Yt.emptyTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:Yt.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&a.jsx("div",{className:Yt.emptyHint,children:"Go to Settings → Environments to add one."})]})}function IP({streamName:t}){return a.jsxs("div",{className:Yt.emptyState,"data-testid":"stream-no-session-state",children:[a.jsx("div",{className:Yt.emptyTitle,children:t}),a.jsx("div",{className:Yt.emptyDescription,children:"No active sessions on this stream."})]})}function OP(){return a.jsxs("div",{className:Yt.emptyState,"data-testid":"stream-not-found-state",children:[a.jsx("div",{className:Yt.emptyTitle,children:"Stream not found"}),a.jsxs("div",{className:Yt.emptyDescription,children:["This stream no longer exists or hasn't been created yet."," ",a.jsx(bl,{to:cl,children:"Back to System"})]})]})}function LP(){return a.jsxs("div",{className:Yt.emptyState,"data-testid":"stream-unavailable-state",children:[a.jsx("div",{className:Yt.emptyTitle,children:"Stream unavailable"}),a.jsxs("div",{className:Yt.emptyDescription,children:["The stream could not be loaded. It may have been deleted, or there may be a temporary network problem."," ",a.jsx(bl,{to:cl,children:"Back to System"})]})]})}function y_(){const{streamId:t}=qn(),{tasks:{tasks:s,tasksLoading:o,startTask:r},sessions:{sessions:c,sessionsLoading:d,events:u,eventsDropped:m,taskSessions:p,loadTaskSessions:g,loadSessionEvents:v,kill:_,stopGraceful:b,sendInput:x,spawn:k},environments:{environments:j,provisionEnvironment:N},personas:{personas:T},streams:{streams:C,streamsLoading:A,streamsLoadedOnce:L,streamsLoadError:E}}=ot(),{showToast:O}=pn(),[z,D]=y.useState(!1),H=y.useRef(void 0),[Y,U]=y.useState(),X=s.find(Se=>Se.id===Hr),ge=t===void 0&&X!=null&&X.latestSessionId?c.find(Se=>Se.id===X.latestSessionId)??(p[Hr]??[]).find(Se=>Se.id===X.latestSessionId):void 0;y.useEffect(()=>{t===void 0&&g(Hr).catch(()=>{})},[t,g]),y.useEffect(()=>{t===void 0&&(X!=null&&X.latestSessionId)&&g(Hr).catch(()=>{})},[t,X==null?void 0:X.latestSessionId,g]);const W=t!==void 0?C.find(Se=>Se.id===t):void 0,le=y.useMemo(()=>!W||W.subscribers.length===0?void 0:(W.subscribers.find(gt=>gt.permission==="rw")??W.subscribers[0]).sessionId,[W]),B=le!==void 0?c.find(Se=>Se.id===le):void 0,R=t===void 0?ge:B;y.useEffect(()=>{R&&R.id!==H.current&&(H.current=R.id,v(R.id).catch(()=>{}))},[R==null?void 0:R.id,v]),y.useEffect(()=>{H.current=void 0,D(!1)},[t]);const se=y.useMemo(()=>{if(!R)return[];const Se=u.filter(Pe=>Pe.sessionId===R.id);return _h(bh(Se))},[u,R==null?void 0:R.id]),oe=j.find(Se=>Se.adapterType==="local"&&Se.status==="connected"),q=R!==void 0&&R.status!=="stopped"&&R.status!=="suspended",me=(R==null?void 0:R.status)==="idle";y.useEffect(()=>{Y&&R&&me&&(x(R.id,Y).catch(()=>{O("Failed to send message","error")}),U(void 0))},[Y,me,R==null?void 0:R.id,x,O]);const de=y.useCallback((Se,Pe,gt,_e)=>{_e&&U(_e),r(Se,Pe,gt).catch(()=>{})},[r]);if(t===void 0&&!X&&(d||o))return a.jsx(Fm,{});if(t!==void 0&&!W&&(A||!L))return a.jsx(Fm,{});if(t!==void 0&&W&&d&&!R)return a.jsx(Fm,{});if(t!==void 0&&!W)return a.jsx("div",{className:Yt.panelContainer,"data-testid":"chat-page",children:a.jsx(al,{events:[],eventsDropped:0,emptyState:E?a.jsx(LP,{}):a.jsx(OP,{}),onShowToast:O})});const xe=t!==void 0&&W?W.name:void 0;return a.jsxs("div",{className:Yt.panelContainer,"data-testid":"chat-page",children:[q&&a.jsxs("div",{className:Yt.chatHeader,children:[a.jsxs("span",{className:Yt.chatHeaderInfo,children:[xe&&a.jsxs("strong",{children:[xe," — "]}),"Session: ",R.id.slice(0,8)," | ",R.runtime," | ",R.status]}),a.jsxs("div",{className:Yt.chatHeaderActions,children:[W&&a.jsx("button",{className:Yt.detailButton,onClick:()=>D(Se=>!Se),"aria-label":"Stream details","aria-expanded":z,"data-testid":"stream-detail-toggle",children:"Info"}),a.jsx(ox,{label:"Stop",onClick:()=>{b(R.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(R.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{_(R.id).catch(()=>{})}}]})]})]}),t!==void 0&&W&&!R&&!d&&a.jsx(al,{events:[],eventsDropped:0,emptyState:a.jsx(IP,{streamName:W.name}),onShowToast:O}),(t===void 0||R)&&a.jsx(al,{events:se,eventsDropped:m,emptyState:t===void 0?a.jsx(MP,{hasLocalEnvironment:!!oe}):void 0,onShowToast:O}),t===void 0&&oe&&a.jsx(Rd,{mode:q?"send":"start",sessionId:q?R.id:void 0,taskId:Hr,environmentId:q?R.environmentId:oe.id,personas:T,environments:j,onSendInput:(Se,Pe)=>{x(Se,Pe).catch(()=>{O("Failed to send message","error")})},onSpawn:(Se,Pe,gt)=>{k(Se,Pe,gt).catch(()=>{})},onStartTask:de,onProvisionEnvironment:Se=>{N(Se).catch(()=>{})},onShowToast:O}),z&&W&&a.jsx(N$,{stream:W,onClose:()=>D(!1)})]})}function BP(){const t=wz(),[s]=Ip(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:m,provisionEnvironment:p}}=ot(),{showToast:g}=pn();return a.jsxs("div",{className:J.panelContainer,children:[a.jsx(Ss,{segments:t}),a.jsx("div",{className:J.emptyState,children:"Enter a prompt below to start a new session"}),a.jsx(Rd,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:m,onSendInput:(v,_)=>{r(v,_).catch(()=>{g("Failed to send message","error")})},onSpawn:(v,_,b)=>{c(v,_,b).catch(()=>{})},onStartTask:(v,_,b)=>{d(v,_,b).catch(()=>{})},onProvisionEnvironment:v=>{p(v).catch(()=>{})},onShowToast:g})]})}function $P(){return a.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[a.jsxs("div",{className:J.header,children:[a.jsx("span",{children:a.jsx(we,{width:"10rem",height:"0.875rem"})}),a.jsx("span",{className:J.headerInfo,children:a.jsx(we,{width:"16rem",height:"0.875rem"})})]}),a.jsx("div",{className:J.eventScroll,children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(we,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function zP({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return a.jsxs("div",{className:J.header,children:[a.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${zo((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Is(s.costMillicents??0)}`:""]}),a.jsxs("span",{className:J.headerInfo,children:[s&&a.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&a.jsx(ox,{label:"Stop",onClick:r,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:r},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function HP({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return a.jsx("div",{className:s?J.errorMessage:J.waitingMessage,children:o})}function PP(){const{sessionId:t}=qn(),{sessions:{events:s,eventsDropped:o,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:m,sendInput:p,spawn:g},tasks:{startTask:v},personas:{personas:_},environments:{environments:b,provisionEnvironment:x}}=ot(),{showToast:k}=pn(),j=y.useRef(void 0),N=Cz(t),T=r.find(L=>L.id===t)??void 0,C=y.useMemo(()=>{const L=t?s.filter(E=>E.sessionId===t):[];return _h(bh(L))},[s,t]);if(y.useEffect(()=>{t&&t!==j.current&&(j.current=t,m(t).catch(()=>{}))},[t,m]),!T&&c)return a.jsx($P,{});if(!t)return a.jsx("div",{className:J.emptyState,children:"No session selected"});const A=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return a.jsxs("div",{className:J.panelContainer,children:[a.jsx(Ss,{segments:N}),a.jsx(zP,{sessionId:t,session:T,isActive:A,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),a.jsx(al,{events:C,eventsDropped:o,emptyState:a.jsx(HP,{session:T}),onShowToast:k,sessions:r,currentSessionId:t,environments:b,personas:_,onForward:(L,E)=>p(L,E)}),A&&a.jsx(Rd,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:_,environments:b,onSendInput:(L,E)=>{p(L,E).catch(()=>{k("Failed to send message","error")})},onSpawn:(L,E,O)=>{g(L,E,O).catch(()=>{})},onStartTask:(L,E,O)=>{v(L,E,O).catch(()=>{})},onProvisionEnvironment:L=>{x(L).catch(()=>{})},onShowToast:k})]})}function UP(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function ca(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:m=!0}=t;y.useEffect(()=>{if(!m)return;const p=g=>{if(u&&UP(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,c,d,u,m])}function VP(){return a.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:J.workspaceHeader,children:a.jsx("span",{className:J.workspaceName,children:a.jsx(we,{width:"12rem",height:"1.25rem"})})}),a.jsx("div",{className:J.metaToggle,style:{cursor:"default"},children:a.jsx(we,{width:"4rem",height:"0.625rem"})}),a.jsxs("div",{className:J.progressBarContainer,children:[a.jsx("div",{className:J.progressBar,children:a.jsx("div",{className:J.progressFill,style:{width:"0%"}})}),a.jsx(we,{width:"2rem",height:"0.625rem"})]}),a.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("span",{className:`${J.tab} ${J.active}`,children:"Graph"}),a.jsx("span",{className:J.tab,children:"Board"}),a.jsx("span",{className:J.tab,children:"Tasks"})]}),a.jsx("div",{className:J.overviewContent,children:Array.from({length:3},(t,s)=>a.jsx(Sd,{lines:2},s))})]})}function b_(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const r=Date.now()-s.getTime();if(r<0)return"just now";const c=Math.floor(r/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const u=Math.floor(d/24);return u<30?`${u}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const Zm=100;function qP(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function GP(){const{workspaceId:t,environmentId:s}=qn(),o=dt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:m,updateWorkspace:p,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:_,clearLinkOperationError:b},personas:{personas:x},sessions:{sessions:k},usageCache:j,loadUsage:N}=ot(),{resolvedThemeId:T}=ak(),[C,A]=y.useState("tasks"),[L,E]=y.useState(!1),[O,z]=y.useState(null),[D,H]=y.useState(!1),Y=y.useRef(void 0),U=d.find(q=>q.id===t),X=s??(U==null?void 0:U.linkedEnvironmentIds[0])??"",ge=Ez(t,X,d,c);ca({key:"1"},()=>A("graph")),ca({key:"2"},()=>A("board")),ca({key:"3"},()=>A("tasks")),y.useEffect(()=>{const q=Y.current;Y.current=t,!(q===void 0||q===t)&&O!==null&&z(null)},[t,O]);const W=k.reduce((q,me)=>q+(me.costMillicents??0),0);y.useEffect(()=>{t&&N("workspace",t).catch(()=>{})},[t,N,W]);const le=t?j[`workspace:${t}`]:void 0,B=r.filter(q=>q.workspaceId===t),R=B.filter(q=>q.status==="complete").length,se=B.length,oe=se>0?Math.round(R/se*100):0;return!U&&u?a.jsx(VP,{}):a.jsxs("div",{className:J.panelContainer,children:[a.jsx(Ss,{segments:ge}),a.jsxs("div",{className:J.workspaceHeader,children:[a.jsx("span",{className:J.workspaceName,"data-testid":"workspace-name",children:a.jsx(Ut,{value:(U==null?void 0:U.name)||"",onSave:q=>{U&&p(U.id,{name:q}).catch(()=>{})},validate:q=>{const me=q.trim();if(!me)return"Name is required";if(me.length>Zm)return`Max ${Zm} characters`},maxLength:Zm,fieldId:"name",activeFieldId:O,onActivate:z,ariaLabel:"Workspace name",renderDisplay:q=>q||t||void 0,"data-testid":"edit-name"})}),a.jsx("button",{className:J.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),a.jsxs("button",{className:J.metaToggle,onClick:()=>H(!D),"aria-expanded":!D,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[a.jsx("span",{className:`${J.metaToggleArrow} ${D?"":J.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!D&&a.jsxs("div",{className:J.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Description"}),a.jsx("div",{className:J.metaValue,children:a.jsx(yp,{value:(U==null?void 0:U.description)||"",onSave:q=>{U&&p(U.id,{description:q}).catch(()=>{})},fieldId:"description",activeFieldId:O,onActivate:z,renderDisplay:q=>q?a.jsx("span",{className:J.overviewMarkdown,children:a.jsx(Ed,{remarkPlugins:[Ad],children:q})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Repository"}),a.jsx("div",{className:J.metaValue,children:a.jsx(Ut,{value:(U==null?void 0:U.repoUrl)||"",onSave:q=>{U&&p(U.id,{repoUrl:q}).catch(()=>{})},validate:q=>{const me=q.trim();if(me&&!/^https?:\/\/.+/.test(me))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:O,onActivate:z,renderDisplay:q=>{const me=qP(q);return me?a.jsx("a",{className:J.repoLink,href:me,target:"_blank",rel:"noopener noreferrer",onClick:de=>de.stopPropagation(),children:q}):q?a.jsx("span",{children:q}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Environments"}),a.jsx("div",{className:J.metaValue,"data-testid":"linked-environments",children:U?a.jsxs("span",{className:J.linkedEnvList,children:[(()=>{const q=[...new Set(U.linkedEnvironmentIds)];return q.length===0?a.jsx("span",{className:J.metaPlaceholder,children:"None"}):q.map(me=>{const de=c.find(xe=>xe.id===me);return a.jsxs("span",{className:J.linkedEnvChip,"data-testid":`linked-env-${me}`,children:[(de==null?void 0:de.displayName)||me,a.jsx("button",{className:J.chipDismiss,onClick:()=>{v(U.id,me).catch(()=>{})},title:`Unlink ${(de==null?void 0:de.displayName)||me}`,"aria-label":`Unlink ${(de==null?void 0:de.displayName)||me}`,"data-testid":`unlink-env-${me}`,disabled:q.length<=1,children:"x"})]},me)})})(),(()=>{const q=new Set(U.linkedEnvironmentIds),me=c.filter(de=>!q.has(de.id));return me.length===0?null:a.jsxs("select",{className:J.linkEnvSelect,value:"",onChange:de=>{de.target.value&&g(U.id,de.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[a.jsx("option",{value:"",children:"+ Link"}),me.map(de=>a.jsx("option",{value:de.id,children:de.displayName||de.id},de.id))]})})(),_&&a.jsxs("span",{className:J.linkError,"data-testid":"link-operation-error",role:"alert",children:[_,a.jsx("button",{className:J.chipDismiss,onClick:b,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):a.jsx("span",{className:J.metaPlaceholder,children:"None"})})]}),a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Persona"}),a.jsx("div",{className:J.metaValue,children:a.jsx(jd,{value:(U==null?void 0:U.defaultPersonaId)||"",onSave:q=>{U&&p(U.id,{defaultPersonaId:q}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...x.map(q=>({value:q.id,label:q.name}))],fieldId:"defaultPersonaId",activeFieldId:O,onActivate:z,renderDisplay:q=>{const me=x.find(de=>de.id===q);if(me)return a.jsx("span",{children:me.name})},placeholder:(U==null?void 0:U.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Worktrees"}),a.jsx("div",{className:J.metaValue,children:a.jsx(L5,{checked:(U==null?void 0:U.useWorktrees)??!0,onChange:q=>{U&&p(U.id,{useWorktrees:q}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),a.jsxs("div",{className:J.metaRow,children:[a.jsx("span",{className:J.metaLabel,children:"Working Dir"}),a.jsx("div",{className:J.metaValue,children:a.jsx(Ut,{value:(U==null?void 0:U.workingDirectory)||"",onSave:q=>{U&&p(U.id,{workingDirectory:q}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:O,onActivate:z,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),U&&a.jsxs("div",{className:J.metaTimestamps,children:[a.jsxs("span",{className:J.metaTimestamp,children:["Created ",b_(U.createdAt)]}),U.updatedAt&&U.updatedAt!==U.createdAt&&a.jsxs("span",{className:J.metaTimestamp,children:["· Updated ",b_(U.updatedAt)]})]})]}),se>0&&a.jsxs("div",{className:J.progressBarContainer,"data-testid":"progress-bar",children:[a.jsx("div",{className:J.progressBar,children:a.jsx("div",{className:J.progressFill,style:{width:`${oe}%`}})}),a.jsxs("span",{className:J.progressLabel,children:[R,"/",se]})]}),le&&le.costMillicents>0&&a.jsx("div",{className:J.progressBarContainer,children:a.jsxs("span",{className:J.progressLabel,children:["Usage: ",Is(le.costMillicents)," (",le.sessionCount," session",le.sessionCount!==1?"s":"",")"]})}),U&&(U.tokenBudget>0||U.costBudgetMillicents>0)&&a.jsx("div",{className:J.progressBarContainer,children:a.jsxs("span",{className:J.progressLabel,children:["Budget:"," ",U.tokenBudget>0&&a.jsxs(a.Fragment,{children:["Tokens: ",zo(((le==null?void 0:le.inputTokens)??0)+((le==null?void 0:le.outputTokens)??0))," / ",zo(U.tokenBudget)]}),U.tokenBudget>0&&U.costBudgetMillicents>0&&" | ",U.costBudgetMillicents>0&&a.jsxs(a.Fragment,{children:["Cost: ",Is((le==null?void 0:le.costMillicents)??0)," / ",Is(U.costBudgetMillicents)]})]})}),a.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${J.tab} ${C==="graph"?J.active:""}`,onClick:()=>A("graph"),children:"Graph"}),a.jsx("button",{role:"tab","aria-selected":C==="board",className:`${J.tab} ${C==="board"?J.active:""}`,onClick:()=>A("board"),"data-testid":"board-tab",children:"Board"}),a.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${J.tab} ${C==="tasks"?J.active:""}`,onClick:()=>A("tasks"),children:"Tasks"})]}),C==="tasks"&&se>0&&a.jsxs("div",{className:J.workspaceSummary,children:[a.jsx("span",{className:J.workspaceSummaryTitle,children:`${R}/${se} tasks complete`}),a.jsx("span",{className:J.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&se===0&&a.jsxs("div",{className:J.emptyCta,children:[a.jsx("button",{className:J.ctaButton,onClick:()=>o($i(t,void 0,X)),children:"Create Task"}),a.jsx("div",{className:J.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&a.jsx(X$,{workspaceId:t,environmentId:X,tasks:r,sessions:k,personas:x,environments:c}),C==="graph"&&a.jsx(Yw,{workspaceId:t,environmentId:X,tasks:r,resolvedThemeId:T}),a.jsx(ks,{isOpen:L,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{U&&(m(U.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const FP="_container_3pgew_1",ZP="_header_3pgew_8",KP="_headerTitle_3pgew_35",YP="_headerActions_3pgew_44",JP="_body_3pgew_51",WP="_btnPrimary_3pgew_63",XP="_btnGhost_3pgew_94",QP="_error_3pgew_116",Za={container:FP,header:ZP,headerTitle:KP,headerActions:YP,body:JP,btnPrimary:WP,btnGhost:XP,error:QP};function eU(t){const s={};return t.name.trim()||(s.name="Name is required"),t.repoUrl.trim()&&!/^https?:\/\/.+/i.test(t.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),t.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const tU=[{label:"Home",url:Ii},{label:"New Workspace",url:void 0}];function nU(){const[t]=Ip(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ot(),{showToast:u}=pn(),m=dt(),[p,g]=y.useState(()=>{var N;return cz(void 0,s||((N=o[0])==null?void 0:N.id))}),[v,_]=y.useState(),[b,x]=y.useState();y.useEffect(()=>{s||p.environmentId||o.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=o[0])==null?void 0:T.id)??""}})},[o,s,p.environmentId]);const k=()=>{const N=eU(p);if(N){_(N),x(void 0);return}_(void 0),x(void 0),c(p.name.trim(),p.description,p.repoUrl.trim(),p.environmentId,p.defaultPersonaId,p.useWorktrees,p.workingDirectory,()=>{u("Workspace created","success"),m(Ii,{replace:!0})},T=>{x(T)}).catch(()=>{})},j=()=>{m(s?Mi(s):Ii,{replace:!0})};return a.jsxs("div",{className:Za.container,children:[a.jsxs("div",{className:Za.header,children:[a.jsx("div",{className:Za.headerTitle,children:a.jsx(Ss,{segments:tU})}),a.jsxs("div",{className:Za.headerActions,children:[a.jsx("button",{className:Za.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),a.jsx("button",{className:Za.btnPrimary,onClick:k,disabled:d||!p.name.trim()||!p.environmentId,"data-testid":"workspace-create-save",children:d?a.jsx(L1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),a.jsxs("div",{className:Za.body,children:[a.jsx(uz,{values:p,onChange:N=>{g(N),_(void 0),x(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),b&&a.jsx("div",{className:Za.error,"data-testid":"workspace-create-submit-error",children:b})]})]})}function __(){const{workspaceId:t,environmentId:s}=qn(),[o]=Ip(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:m},workspaces:{workspaces:p},personas:{personas:g}}=ot(),{showToast:v}=pn();return a.jsx(W1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:p,personas:g,onCreateTask:(_,b,x,k,j,N,T,C,A)=>{u(_,b,x,k,j,N,T,C,A).catch(()=>{})},onUpdateTask:(_,b,x,k,j)=>{m(_,b,x,k,j).catch(()=>{})},onShowToast:v})}function sU(){return a.jsxs("div",{className:J.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:J.header,children:a.jsxs("span",{className:J.headerTitle,children:[a.jsx(we,{width:"12rem",height:"1rem"}),a.jsx(we,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),a.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("span",{className:`${J.tab} ${J.active}`,children:"Overview"}),a.jsx("span",{className:J.tab,children:"Stream"}),a.jsx("span",{className:J.tab,children:"Findings"})]}),a.jsx("div",{className:J.overviewContent,children:a.jsxs("div",{className:J.overviewDashboard,children:[a.jsx("div",{className:J.overviewHero,children:a.jsx(we,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),a.jsxs("div",{className:J.overviewSection,children:[a.jsx("div",{className:J.overviewLabel,children:"Description"}),a.jsx(vp,{lines:2})]}),a.jsxs("div",{className:J.overviewSection,children:[a.jsx("div",{className:J.overviewLabel,children:"Environment"}),a.jsxs("div",{className:J.envRow,children:[a.jsx(we,{width:"0.5rem",height:"0.5rem",variant:"circular"}),a.jsx(we,{width:"8rem",height:"0.875rem"})]})]}),a.jsxs("div",{className:J.overviewSection,children:[a.jsx("div",{className:J.overviewLabel,children:"Dependencies"}),a.jsx(vp,{lines:2})]}),a.jsxs("div",{className:J.overviewSection,children:[a.jsx("div",{className:J.overviewLabel,children:"Timeline"}),a.jsx("div",{className:J.timeline,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:J.timelineRow,children:[a.jsx(we,{width:"4rem",height:"0.75rem"}),a.jsx(we,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Ka(){const{taskId:t,workspaceId:s,environmentId:o}=qn(),r=Jt(),c=dt(),{showToast:d}=pn(),{sessions:{events:u,eventsDropped:m,sessions:p,loadSessionEvents:g,taskSessions:v,loadTaskSessions:_,sendInput:b,spawn:x,kill:k},tasks:{tasks:j,tasksLoading:N,startTask:T,stopTask:C,resumeTask:A,deleteTask:L,createTask:E,updateTask:O},environments:{environments:z,provisionEnvironment:D},findings:{findings:H,loadFindings:Y},workspaces:{workspaces:U},personas:{personas:X},usageCache:ge,loadUsage:W}=ot(),le=y.useRef(void 0),B=y.useRef(void 0),R=y.useRef(void 0),se=y.useRef(void 0),oe=y.useRef(void 0),q=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",me=r.pathname.endsWith("/edit"),[de,xe]=y.useState(q),[Se,Pe]=y.useState(!1),[gt,_e]=y.useState(void 0),[Ie,Mt]=y.useState(""),[hn,ce]=y.useState(me),Ue=y.useRef(q),ut=y.useRef(me),te=j.find(Ee=>Ee.id===t),re=(te==null?void 0:te.workspaceId)||void 0,ve=U.find(Ee=>Ee.id===re);y.useEffect(()=>{q!==Ue.current&&(Ue.current=q,q!==de&&xe(q))},[q,de]),y.useEffect(()=>{me!==ut.current&&(ut.current=me,me!==hn&&ce(me))},[me,hn]),y.useEffect(()=>{if(Ie===""){if(ve!=null&&ve.linkedEnvironmentIds[0])Mt(ve.linkedEnvironmentIds[0]);else if(z.length>0){const Ee=z.find(Ve=>Ve.status==="connected");Mt((Ee==null?void 0:Ee.id)??z[0].id)}}},[Ie,ve==null?void 0:ve.linkedEnvironmentIds[0],z]);const ft=te?v[te.id]??[]:[];let Me;gt&&ft.some(Ee=>Ee.id===gt)?Me=gt:Me=(te==null?void 0:te.latestSessionId)||void 0;const rn=()=>{Pe(!0)},ga=()=>{if(!te)return;L(te.id).catch(()=>{}),Pe(!1);const Ee=o??(ve==null?void 0:ve.linkedEnvironmentIds[0]);c(te.workspaceId&&Ee?Ri(te.workspaceId,Ee):"/",{replace:!0})};y.useEffect(()=>{(te==null?void 0:te.id)!==B.current&&(B.current=te==null?void 0:te.id,_e(void 0),Mt(""),ce(me))},[te==null?void 0:te.id,me]),y.useEffect(()=>{if(!(te!=null&&te.id))return;const Ee=te.id!==se.current,Ve=te.latestSessionId!==oe.current;(Ee||Ve)&&(se.current=te.id,oe.current=te.latestSessionId,_(te.id).catch(()=>{}))},[te==null?void 0:te.id,te==null?void 0:te.latestSessionId,_]),y.useEffect(()=>{if((te==null?void 0:te.status)!==R.current){const Ee=R.current===void 0;R.current=te==null?void 0:te.status;const Ve=(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;Ve&&Ve!==de&&!(Ee&&q!=="overview")&&xe(Ve)}},[te==null?void 0:te.status,de,q]);const fs=y.useMemo(()=>new Map(j.map(Ee=>[Ee.id,Ee])),[j]),ti=y.useMemo(()=>{const Ee=Me?u.filter(Ve=>Ve.sessionId===Me):[];return _h(bh(Ee))},[u,Me]),va=te?te.dependsOn.some(Ee=>{const Ve=fs.get(Ee);return Ve!==void 0&&Ve.status!=="complete"}):!1,en=y.useMemo(()=>Az(t,o,U,z,fs),[t,o,U,z,fs]);y.useEffect(()=>{Me&&Me!==le.current&&(le.current=Me,g(Me).catch(()=>{}))},[Me,g]),y.useEffect(()=>{de==="findings"&&re&&Y(re).catch(()=>{})},[de,re,Y]);const Hi=ft.reduce((Ee,Ve)=>Ee+(Ve.costMillicents??0),0);y.useEffect(()=>{te&&(W("task",te.id).catch(()=>{}),te.childTaskIds.length>0&&W("task_tree",te.id).catch(()=>{}))},[te==null?void 0:te.id,te==null?void 0:te.childTaskIds.length,W,Hi]);const ya=te?`task:${te.id}`:"",ni=ya in ge?ge[ya]:void 0,js=te?`task_tree:${te.id}`:"",Pi=te&&te.childTaskIds.length>0&&js in ge?ge[js]:void 0,Gn=Ee=>{xe(Ee),c(Pn(t,Ee==="overview"?void 0:Ee,s,o))};return ca({key:"1"},()=>Gn("overview")),ca({key:"2"},()=>Gn("stream")),ca({key:"3"},()=>Gn("findings")),!te&&N?a.jsx(sU,{}):a.jsxs("div",{className:J.panelContainer,children:[a.jsx(Ss,{segments:en}),a.jsxs("div",{className:J.header,children:[a.jsxs("span",{className:J.headerTitle,children:[a.jsx("span",{"data-testid":"task-title",children:(te==null?void 0:te.title)||t}),te&&a.jsx("span",{className:J.taskStatusBadge,"data-testid":"task-status",children:te.status}),(te==null?void 0:te.branch)&&a.jsx("span",{className:J.taskBranch,children:te.branch}),va&&a.jsx("span",{className:J.taskBlockedBadge,children:"blocked"})]}),te&&a.jsx(EB,{task:te,sessionId:Me,isBlocked:va,onStart:()=>{T(te.id,void 0,Ie).catch(Ee=>{const Ve=Ee instanceof da?Ee.message:"Failed to start task";d(Ve,"error")})},onResume:()=>{A(te.id).catch(()=>{})},onStop:()=>{C(te.id).catch(()=>{})},onPause:()=>{Me&&k(Me).catch(()=>{})},onDelete:rn,onEdit:()=>ce(!0)})]}),a.jsxs("div",{className:J.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("button",{role:"tab","aria-selected":de==="overview",className:`${J.tab} ${de==="overview"?J.active:""}`,onClick:()=>Gn("overview"),children:"Overview"}),a.jsx("button",{role:"tab","aria-selected":de==="stream",className:`${J.tab} ${de==="stream"?J.active:""}`,onClick:()=>Gn("stream"),children:"Stream"}),a.jsx("button",{role:"tab","aria-selected":de==="findings",className:`${J.tab} ${de==="findings"?J.active:""}`,onClick:()=>Gn("findings"),children:"Findings"})]}),a.jsxs(ls,{mode:"wait",children:[de==="overview"&&a.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:J.overviewContent,"data-testid":"task-overview",children:hn&&te?a.jsx(W1,{mode:"edit",taskId:te.id,workspaceId:re,environmentId:o,tasks:j,workspaces:U,personas:X,onCreateTask:(Ee,Ve,tn,Ct,yn,nn,Ui,Vi,qi)=>{E(Ee,Ve,tn,Ct,yn,nn,Ui,Vi,qi).catch(()=>{})},onUpdateTask:(Ee,Ve,tn,Ct,yn)=>{O(Ee,Ve,tn,Ct,yn).catch(()=>{})},onEditDone:()=>{me?c(Pn(te.id,void 0,s,o),{replace:!0}):ce(!1)},onShowToast:d}):te?a.jsx(g8,{task:te,tasksById:fs,environments:z,workspaces:U,taskSessions:ft,selectedEnvId:Ie,taskUsage:ni,treeUsage:Pi}):a.jsx("div",{className:J.waitingMessage,children:"No additional details"})},"overview"),de==="stream"&&a.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:[a.jsx(h6,{taskSessions:ft,selectedSessionId:Me,onSelect:Ee=>_e(Ee)}),a.jsx(al,{events:ti,eventsDropped:m,emptyState:!Me&&te?va?a.jsx("div",{className:J.emptyCta,"data-testid":"stream-blocked-message",children:a.jsx("div",{className:J.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):a.jsxs("div",{className:J.emptyCta,children:[a.jsx("button",{"data-testid":"stream-start-cta",className:J.ctaButton,onClick:()=>{T(te.id,void 0,Ie).catch(Ee=>{const Ve=Ee instanceof da?Ee.message:"Failed to start task";d(Ve,"error")})},children:"Start Task"}),a.jsx("div",{className:J.ctaDescription,children:"Click to begin agent execution"})]}):Me&&ti.length===0?a.jsx("div",{className:J.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),de==="findings"&&a.jsx(Rt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:J.tabContent,children:re?a.jsx(Y1,{findings:H.filter(Ee=>Ee.workspaceId===re)}):a.jsx("div",{className:J.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!te||te.status!=="working"&&te.status!=="paused")return;const Ee=Me?p.find(Ve=>Ve.id===Me):void 0;if(!(!Ee||Ee.status==="stopped"))return a.jsx(Rd,{mode:"send",sessionId:Ee.id,environmentId:Ee.environmentId,personas:X,environments:z,onSendInput:(Ve,tn)=>{b(Ve,tn).catch(()=>{d("Failed to send message","error")})},onSpawn:(Ve,tn,Ct)=>{x(Ve,tn,Ct,void 0,re).catch(()=>{})},onStartTask:(Ve,tn,Ct)=>{T(Ve,tn,Ct).catch(()=>{})},onProvisionEnvironment:Ve=>{D(Ve).catch(()=>{})},onShowToast:d})})(),te&&a.jsx(ks,{isOpen:Se,title:"Delete Task?",description:`"${te.title}" will be permanently removed.`,onConfirm:ga,onCancel:()=>Pe(!1)})]})}function aU(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:m,createCodespace:p},dockerContainers:{dockerContainers:g,dockerContainersError:v,listDockerContainers:_},githubAccounts:{githubAccounts:b}}=ot(),{showToast:x}=pn();return a.jsx(X1,{mode:"new",environments:t,githubAccounts:b,onAddEnvironment:(k,j,N,T)=>{s(k,j,N,T).catch(()=>{})},onUpdateEnvironment:(k,j)=>{o(k,j).catch(()=>{})},onListCodespaces:k=>{m(k).catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(k,j)=>{p(k,j).catch(()=>{})},onListDockerContainers:()=>{_().catch(()=>{})},dockerContainers:g,dockerContainersError:v,onShowToast:x})}function iU(){const{environmentId:t}=qn(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:m,listCodespaces:p,createCodespace:g},dockerContainers:{dockerContainers:v,dockerContainersError:_,listDockerContainers:b},githubAccounts:{githubAccounts:x}}=ot(),{showToast:k}=pn();return a.jsx(X1,{mode:"edit",environmentId:t,environments:s,githubAccounts:x,onAddEnvironment:(j,N,T,C)=>{o(j,N,T,C).catch(()=>{})},onUpdateEnvironment:(j,N)=>{r(j,N).catch(()=>{})},onListCodespaces:j=>{p(j).catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:m,onCreateCodespace:(j,N)=>{g(j,N).catch(()=>{})},onListDockerContainers:()=>{b().catch(()=>{})},dockerContainers:v,dockerContainersError:_,onShowToast:k})}const oU="_layout_11u79_1",rU="_content_11u79_8",lU="_tabPanel_11u79_14",ol={layout:oU,content:rU,tabPanel:lU};function cU(){const t=Nz();return a.jsxs("div",{className:ol.layout,children:[a.jsx(Ss,{segments:t}),a.jsx("div",{className:ol.content,children:a.jsx(ha,{})})]})}const dU="_container_144a4_1",uU="_envHeader_144a4_6",fU="_envTitleRow_144a4_10",mU="_statusDot_144a4_16",pU="_envName_144a4_21",hU="_statusBadge_144a4_27",gU="_envMeta_144a4_33",vU="_metaTag_144a4_39",yU="_actions_144a4_51",bU="_provisionMessage_144a4_59",_U="_errorMessage_144a4_64",xU="_section_144a4_69",kU="_sectionHeader_144a4_73",SU="_cardList_144a4_121",jU="_card_144a4_121",TU="_cardHeader_144a4_138",NU="_cardName_144a4_144",wU="_cardActions_144a4_149",CU="_cardDescription_144a4_154",EU="_cardMeta_144a4_160",AU="_repoLink_144a4_166",DU="_empty_144a4_174",RU="_errorHint_144a4_180",MU="_btnPrimary_144a4_186",IU="_btnOutline_144a4_220",OU="_btnSmall_144a4_247",LU="_btnDanger_144a4_273",Re={container:dU,envHeader:uU,envTitleRow:fU,statusDot:mU,envName:pU,statusBadge:hU,envMeta:gU,metaTag:vU,actions:yU,provisionMessage:bU,errorMessage:_U,section:xU,sectionHeader:kU,cardList:SU,card:jU,cardHeader:TU,cardName:NU,cardActions:wU,cardDescription:CU,cardMeta:EU,repoLink:AU,empty:DU,errorHint:RU,btnPrimary:MU,btnOutline:IU,btnSmall:OU,btnDanger:LU};function BU(){return a.jsxs("div",{className:Re.container,"aria-hidden":"true",children:[a.jsxs("div",{className:Re.envHeader,children:[a.jsxs("div",{className:Re.envTitleRow,children:[a.jsx(we,{width:"0.875rem",height:"0.875rem",variant:"circular"}),a.jsx(we,{width:"12rem",height:"1.5rem"}),a.jsx(we,{width:"4rem",height:"0.875rem"})]}),a.jsxs("div",{className:Re.envMeta,children:[a.jsx(we,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),a.jsxs("div",{className:Re.actions,children:[a.jsx(we,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(we,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),a.jsxs("div",{className:Re.section,children:[a.jsx("div",{className:Re.sectionHeader,children:a.jsx("h3",{style:{margin:0},children:"Workspaces"})}),a.jsxs("div",{className:Re.cardList,children:[a.jsx(Sd,{lines:2}),a.jsx(Sd,{lines:2})]})]})]})}const $U={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function zU(){const{environmentId:t}=qn(),s=dt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:m},workspaces:{workspaces:p,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:_,linkOperationError:b,clearLinkOperationError:x},sessions:{sessions:k}}=ot(),[j,N]=y.useState(!1),[T,C]=y.useState(!1),[A,L]=y.useState(void 0),E=o.find(R=>R.id===t);if(!E&&r)return a.jsx(BU,{});if(!t||!E)return a.jsx(rs,{to:$o,replace:!0});const O=p.filter(R=>R.linkedEnvironmentIds.includes(E.id)),z=k.filter(R=>R.environmentId===E.id),D=z.reduce((R,se)=>R+(se.costMillicents??0),0),H=$U[E.status]||"var(--text-tertiary)",Y=E.status==="connected",U=E.status==="connecting",X=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",ge=E.id in c?c[E.id]:void 0,W=()=>{m(E.id).catch(()=>{}),N(!1),s($o,{replace:!0})},le=()=>{C(!1),d(E.id,!0).catch(()=>{})},B=R=>{g(R).catch(()=>{}),L(void 0)};return a.jsxs("div",{className:Re.container,children:[a.jsx(ks,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:W,onCancel:()=>N(!1)}),a.jsx(ks,{isOpen:T,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:le,onCancel:()=>C(!1)}),a.jsxs("div",{className:Re.envHeader,children:[a.jsxs("div",{className:Re.envTitleRow,children:[a.jsx("span",{className:Re.statusDot,style:{color:H},children:"●"}),a.jsx("h2",{className:Re.envName,children:E.displayName||E.id}),a.jsx("span",{className:Re.statusBadge,style:{color:H},children:E.status})]}),a.jsxs("div",{className:Re.envMeta,children:[a.jsxs("span",{className:Re.metaTag,children:["Adapter: ",E.adapterType]}),z.length>0&&a.jsxs("span",{className:Re.metaTag,children:[z.length," session",z.length!==1?"s":""]}),D>0&&a.jsxs("span",{className:Re.metaTag,children:["Cost: ",Is(D)]})]})]}),a.jsxs("div",{className:Re.actions,children:[Y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Re.btnPrimary,onClick:()=>s(tx(E.id)),children:"New Chat"}),a.jsx("button",{className:Re.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),a.jsx("button",{className:Re.btnOutline,onClick:()=>C(!0),disabled:ge!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),X&&a.jsx("button",{className:Re.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),U&&ge!==void 0&&a.jsx("span",{className:Re.provisionMessage,children:ge.message}),E.status==="error"&&(ge==null?void 0:ge.stage)==="error"&&a.jsx("span",{className:Re.errorMessage,children:ge.message}),a.jsx("button",{className:Re.btnOutline,onClick:()=>s($w(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),a.jsx("button",{className:Re.btnDanger,onClick:()=>N(!0),children:"Delete"})]}),a.jsxs("div",{className:Re.section,children:[a.jsxs("div",{className:Re.sectionHeader,children:[a.jsx("h3",{children:"Workspaces"}),a.jsx("button",{className:Re.btnPrimary,onClick:()=>s(`${ax}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const R=p.filter(se=>!se.linkedEnvironmentIds.includes(E.id)&&se.status==="active");return R.length===0?null:a.jsxs("select",{className:Re.btnPrimary,value:"",onChange:se=>{se.target.value&&v(se.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[a.jsx("option",{value:"",children:"+ Link Workspace"}),R.map(se=>a.jsx("option",{value:se.id,children:se.name},se.id))]})})()]}),b&&a.jsxs("p",{className:Re.errorHint,"data-testid":"link-operation-error",role:"alert",children:[b,a.jsx("button",{className:Re.btnSmall,onClick:x,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),O.length===0&&a.jsx("p",{className:Re.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),a.jsx("div",{className:Re.cardList,"data-testid":"linked-workspaces-list",children:O.map(R=>a.jsx(HU,{workspace:R,confirmArchiveId:A,onOpen:()=>s(Ri(R.id,E.id)),onArchive:()=>L(R.id),onConfirmArchive:()=>B(R.id),onCancelArchive:()=>L(void 0),onUnlink:()=>{_(R.id,E.id).catch(()=>{})}},R.id))})]})]})}function HU({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const m=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return a.jsxs("div",{className:Re.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[a.jsxs("div",{className:Re.cardHeader,children:[a.jsx("strong",{className:Re.cardName,children:t.name}),a.jsxs("div",{className:Re.cardActions,children:[a.jsx("button",{className:Re.btnSmall,onClick:o,children:"Open"}),a.jsx("button",{className:Re.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),m?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Re.btnDanger,onClick:c,children:"Confirm"}),a.jsx("button",{className:Re.btnSmall,onClick:d,children:"Cancel"})]}):a.jsx("button",{className:Re.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&a.jsx("p",{className:Re.cardDescription,children:t.description}),t.repoUrl&&a.jsx("div",{className:Re.cardMeta,children:p?a.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Re.repoLink,children:t.repoUrl}):a.jsx("span",{children:t.repoUrl})})]})}const PU={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function UU(){const s=Jt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=PU[s],r=Tz(o);return a.jsxs("div",{className:ol.layout,children:[a.jsx(Ss,{segments:r}),a.jsx("div",{className:ol.content,children:a.jsx("div",{className:ol.tabPanel,children:a.jsx(ha,{})},s)})]})}function VU(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ot(),{showToast:d}=pn();return a.jsxs(a.Fragment,{children:[a.jsx(Y8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),a.jsx(QL,{tokens:t,onSetToken:(u,m,p,g,v)=>{s(u,m,p,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function qU(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=ot(),{showToast:u}=pn();return a.jsx(y8,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function GU(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=ot(),{showToast:c}=pn(),d=dt();return a.jsx(l7,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(m){throw console.error("Failed to delete persona",{personaId:u,error:m}),c("Failed to delete persona","error"),m}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(m){console.error("Failed to set app default persona ID",{personaId:u,error:m}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(Hw),onNavigateToPersona:u=>d(nx(u))})}const FU="_container_1ooin_1",ZU="_form_1ooin_7",KU="_formActions_1ooin_75",YU="_editableSection_1ooin_82",JU="_defaultBadge_1ooin_93",WU="_typeToggle_1ooin_107",XU="_scriptEditor_1ooin_121",QU="_optional_1ooin_128",_s={container:FU,form:ZU,formActions:KU,editableSection:YU,defaultBadge:JU,typeToggle:WU,scriptEditor:XU,optional:QU},x_=[{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)"}],k_=[{value:"genaiscript",label:"genaiscript"}],eV="0";function S_(){const{personaId:t}=qn(),s=dt(),{showToast:o}=pn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:m,setAppDefaultPersonaId:p}=ot(),g=t===void 0,v=g?void 0:r.find(b=>b.id===t);if(!g&&r.length>0&&!v)return a.jsx(rs,{to:rm,replace:!0});const _=[{label:"Settings",url:Ai},{label:"Personas",url:rm},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return a.jsxs("div",{className:_s.container,children:[a.jsx(Ss,{segments:_}),a.jsx(tV,{existing:v,isNew:g,appDefaultPersonaId:m,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:p,onDone:()=>{s(rm)},showToast:o})]})}function tV({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:m,showToast:p}){const g=dt(),[v,_]=y.useState((t==null?void 0:t.name)??""),[b,x]=y.useState((t==null?void 0:t.description)??""),[k,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,A]=y.useState((t==null?void 0:t.model)??"sonnet"),[L,E]=y.useState((t==null?void 0:t.maxTurns)??0),[O,z]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[D,H]=y.useState((t==null?void 0:t.script)??""),[Y,U]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[X,ge]=y.useState(!1),[W,le]=y.useState(null),[B,R]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!B){R(!0),_(t.name),x(t.description),j(t.systemPrompt);const ce=t.type==="script"?"script":"agent";T(ce==="script"?t.runtime||"genaiscript":t.runtime),A(t.model),E(t.maxTurns),z(ce),H(t.script||""),U(t.allowedMcpTools)}},[s,t,B]);const se=ce=>{z(ce),ce==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},oe=!s&&t===void 0,q=v.trim().length>0&&!oe&&k.trim().length>0&&(O==="script"?D.trim().length>0:!!N&&!!C),me=s&&q,de=!s&&o===(t==null?void 0:t.id),xe=!s&&t&&!de&&O==="agent"&&!!N&&!!C,Se=(ce,Ue)=>{if(!ce.trim())return`${Ue} is required`},Pe=ce=>{if(ce.preventDefault(),!(oe||!q)){if(t){c(t.id,v,b,k,N,C,L,O,D).then(()=>{p("Persona updated","success"),m()},()=>{p("Failed to save persona","error")});return}r(v,b,k,N,C,L,O,D,Y).then(Ue=>{p("Persona created","success"),g(nx(Ue.id),{replace:!0})},()=>{p("Failed to save persona","error")})}},gt=()=>{t&&d(t.id).then(()=>{p("Persona deleted","success"),m()},()=>{p("Failed to delete persona","error")})},_e=async(ce,Ue,ut,te)=>ce().then(()=>{Ue(),p(ut,"success")},()=>{p(te,"error")}),Ie=(ce,Ue)=>{if(!t)return;const ut=ce==="type"?String(Ue):O,te=ce==="runtime"?String(Ue):ce==="type"?String(Ue)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,re=ce==="model"?String(Ue):C,ve=ce==="maxTurns"?Number(Ue):L,ft=ce==="systemPrompt"?String(Ue):k,Me=ce==="script"?String(Ue):D;_e(()=>c(t.id,ce==="name"?String(Ue):v,ce==="description"?String(Ue):b,ft,te,re,ve,ut,Me),()=>{if(ce==="type"){const rn=String(Ue)==="script"?"script":"agent";z(rn),T(te)}ce==="runtime"&&T(String(Ue)),ce==="name"&&_(String(Ue)),ce==="description"&&x(String(Ue)),ce==="systemPrompt"&&j(String(Ue)),ce==="model"&&A(String(Ue)),ce==="maxTurns"&&E(Number(Ue)),ce==="script"&&H(String(Ue))},"Persona updated","Failed to update persona").catch(()=>{})},Mt=ce=>{Pe(ce)},hn=()=>{t&&u(t.id).then(()=>{p("Set as app default","success")},()=>{p("Failed to set app default","error")})};return a.jsxs(a.Fragment,{children:[oe?a.jsxs("div",{className:_s.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsx("p",{children:"Loading persona..."})]}):s?a.jsxs("form",{onSubmit:Mt,className:_s.form,children:[a.jsx("h3",{children:"Create Persona"}),a.jsxs("div",{className:_s.typeToggle,"data-testid":"persona-type-toggle",children:[a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:O==="agent",onChange:()=>se("agent")}),"Agent"]}),a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"script",checked:O==="script",onChange:()=>se("script")}),"Script"]})]}),a.jsxs("label",{children:["Name",a.jsx("input",{type:"text",value:v,onChange:ce=>_(ce.target.value),placeholder:O==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),a.jsxs("label",{children:["Description",a.jsx("input",{type:"text",value:b,onChange:ce=>x(ce.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Runtime",a.jsx("select",{value:N,onChange:ce=>T(ce.target.value),"data-testid":"persona-runtime-select",children:(O==="script"?k_:x_).map(ce=>a.jsx("option",{value:ce.value,children:ce.label},ce.value))})]}),O==="agent"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model",a.jsx("input",{type:"text",value:C,onChange:ce=>A(ce.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx("input",{type:"number",value:L,onChange:ce=>E(parseInt(ce.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:k,onChange:ce=>j(ce.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),O==="script"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model ",a.jsx("span",{className:_s.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:C,onChange:ce=>A(ce.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:k,onChange:ce=>j(ce.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),a.jsxs("label",{children:["Script",a.jsx("textarea",{value:D,onChange:ce=>H(ce.target.value),placeholder:`script({ model: "openai:gpt-4o" });
741
-
742
- const grackle = await host.mcpServer({
743
- id: "grackle",
744
- url: env.vars.GRACKLE_MCP_URL,
745
- });
746
-
747
- $\`Summarize the current tasks.\`;`,rows:20,className:_s.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),O==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(l_,{selectedTools:Y,onChange:U})]}),a.jsxs("div",{className:_s.formActions,children:[a.jsx(on,{type:"submit",variant:"primary",size:"md",disabled:!me,"data-testid":"persona-detail-save",children:"Create"}),a.jsx(on,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:_s.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsxs("div",{className:_s.formActions,children:[a.jsx(on,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),xe&&a.jsx(on,{type:"button",variant:"ghost",size:"md",onClick:hn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),de&&a.jsx("span",{className:_s.defaultBadge,children:"App Default"}),a.jsx(on,{type:"button",variant:"danger",size:"md",onClick:()=>ge(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:_s.editableSection,children:[a.jsxs("label",{children:["Name",a.jsx(Ut,{value:v,onSave:ce=>{Ie("name",ce)},validate:ce=>Se(ce,"Name"),fieldId:"persona-name",activeFieldId:W,onActivate:le,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),a.jsxs("label",{children:["Description",a.jsx(Ut,{value:b,onSave:ce=>{Ie("description",ce)},fieldId:"persona-description",activeFieldId:W,onActivate:le,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Type",a.jsx(jd,{value:O,onSave:ce=>{Ie("type",ce)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:W,onActivate:le,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),a.jsxs("label",{children:["Runtime",a.jsx(jd,{value:N,onSave:ce=>{Ie("runtime",ce)},options:O==="script"?k_:x_,fieldId:"persona-runtime",activeFieldId:W,onActivate:le,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),a.jsxs("label",{children:["Model",O==="script"?" (optional)":"",a.jsx(Ut,{value:C,onSave:ce=>{Ie("model",ce)},validate:O==="agent"?ce=>Se(ce,"Model"):void 0,fieldId:"persona-model",activeFieldId:W,onActivate:le,placeholder:O==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx(Ut,{value:String(L),onSave:ce=>{Ie("maxTurns",parseInt(ce,10)||0)},validate:ce=>/^\d+$/.test(ce.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:W,onActivate:le,placeholder:eV,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx(yp,{value:k,onSave:ce=>{Ie("systemPrompt",ce)},validate:ce=>Se(ce,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:W,onActivate:le,placeholder:O==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),O==="script"&&a.jsxs("label",{children:["Script",a.jsx(yp,{value:D,onSave:ce=>{Ie("script",ce)},validate:ce=>Se(ce,"Script"),fieldId:"persona-script",activeFieldId:W,onActivate:le,placeholder:`script({ model: "openai:gpt-4o" });
748
-
749
- const grackle = await host.mcpServer({
750
- id: "grackle",
751
- url: env.vars.GRACKLE_MCP_URL,
752
- });
753
-
754
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),O==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(l_,{selectedTools:Y,onChange:ce=>{U(ce),_e(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ce),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!xe&&!de&&a.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,a.jsx(ks,{isOpen:X,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:gt,onCancel:()=>ge(!1)})]})}function nV(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=ot(),{showToast:c}=pn(),d=dt();return a.jsx(B7,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(m){throw console.error("Failed to delete schedule",{scheduleId:u,error:m}),c("Failed to delete schedule","error"),m}},onToggleEnabled:async(u,m)=>{try{return await o(u,m)}catch(p){throw console.error("Failed to update schedule",{scheduleId:u,error:p}),c("Failed to update schedule","error"),p}},onNavigateToNew:()=>d(Pw),onNavigateToSchedule:u=>d(sx(u))})}const sV="_container_1g4qh_1",aV="_form_1g4qh_7",iV="_formActions_1g4qh_66",oV="_editableSection_1g4qh_73",rV="_helperText_1g4qh_84",lV="_metaSection_1g4qh_90",cV="_optional_1g4qh_108",dV="_readonlyValue_1g4qh_113",$n={container:sV,form:aV,formActions:iV,editableSection:oV,helperText:rV,metaSection:lV,optional:cV,readonlyValue:dV};function j_(){const{scheduleId:t}=qn(),s=dt(),{showToast:o}=pn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:m},personas:{personas:p},workspaces:{workspaces:g}}=ot(),v=t===void 0,_=v?void 0:r.find(x=>x.id===t);if(!v&&!c&&r.length>0&&!_)return a.jsx(rs,{to:lm,replace:!0});const b=[{label:"Settings",url:Ai},{label:"Schedules",url:lm},{label:v?"New Schedule":(_==null?void 0:_.title)??"Schedule",url:void 0}];return a.jsxs("div",{className:$n.container,children:[a.jsx(Ss,{segments:b}),a.jsx(uV,{existing:_,isNew:v,personas:p,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:m,onDone:()=>{s(lm)},showToast:o})]})}function uV({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:m,showToast:p}){var B;const g=dt(),[v,_]=y.useState((t==null?void 0:t.title)??""),[b,x]=y.useState((t==null?void 0:t.description)??""),[k,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[N,T]=y.useState((t==null?void 0:t.personaId)??""),[C,A]=y.useState((t==null?void 0:t.workspaceId)??""),[L,E]=y.useState(!1),[O,z]=y.useState(null);y.useEffect(()=>{s||t&&O===null&&(_(t.title),x(t.description),j(t.scheduleExpression),T(t.personaId),A(t.workspaceId))},[s,t,O]);const D=!s&&t===void 0,H=s&&v.trim().length>0&&k.trim().length>0&&N.length>0,Y=o.map(R=>({value:R.id,label:R.name})),U=[{value:"",label:"System-level (no workspace)"},...r.map(R=>({value:R.id,label:R.name}))],X=R=>{R.preventDefault(),H&&c(v,b,k,N,C||void 0).then(se=>{p("Schedule created","success"),g(sx(se.id),{replace:!0})},()=>{p("Failed to create schedule","error")})},ge=(R,se)=>{t&&d(t.id,{[R]:se}).then(()=>{p("Schedule updated","success"),R==="title"&&_(String(se)),R==="description"&&x(String(se)),R==="scheduleExpression"&&j(String(se)),R==="personaId"&&T(String(se))},()=>{p("Failed to update schedule","error")})},W=()=>{if(!t)return;const R=!t.enabled;d(t.id,{enabled:R}).then(()=>{p(R?"Schedule enabled":"Schedule disabled","success")},()=>{p("Failed to update schedule","error")})},le=()=>{t&&u(t.id).then(()=>{p("Schedule deleted","success"),m()},()=>{p("Failed to delete schedule","error")})};return a.jsxs(a.Fragment,{children:[D?a.jsxs("div",{className:$n.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsx("p",{children:"Loading schedule..."})]}):s?a.jsxs("form",{onSubmit:X,className:$n.form,children:[a.jsx("h3",{children:"Create Schedule"}),a.jsxs("label",{children:["Title",a.jsx("input",{type:"text",value:v,onChange:R=>_(R.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description ",a.jsx("span",{className:$n.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:b,onChange:R=>x(R.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx("input",{type:"text",value:k,onChange:R=>j(R.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),a.jsxs("p",{className:$n.helperText,children:["Interval: ",a.jsx("code",{children:"30s"}),", ",a.jsx("code",{children:"5m"}),", ",a.jsx("code",{children:"1h"}),", ",a.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",a.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),a.jsxs("label",{children:["Persona",a.jsxs("select",{value:N,onChange:R=>T(R.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[a.jsx("option",{value:"",children:"Select a persona..."}),Y.map(R=>a.jsx("option",{value:R.value,children:R.label},R.value))]})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:$n.optional,children:"(optional)"}),a.jsx("select",{value:C,onChange:R=>A(R.target.value),"data-testid":"schedule-detail-workspace",children:U.map(R=>a.jsx("option",{value:R.value,children:R.label},R.value))})]}),a.jsxs("div",{className:$n.formActions,children:[a.jsx(on,{type:"submit",variant:"primary",size:"md",disabled:!H,"data-testid":"schedule-detail-save",children:"Create"}),a.jsx(on,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:$n.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsxs("div",{className:$n.formActions,children:[a.jsx(on,{type:"button",variant:"outline",size:"md",onClick:m,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),a.jsx(on,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:W,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),a.jsx(on,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:$n.editableSection,children:[a.jsxs("label",{children:["Title",a.jsx(Ut,{value:v,onSave:R=>{ge("title",R)},validate:R=>R.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:O,onActivate:z,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description",a.jsx(Ut,{value:b,onSave:R=>{ge("description",R)},fieldId:"schedule-description",activeFieldId:O,onActivate:z,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx(Ut,{value:k,onSave:R=>{ge("scheduleExpression",R)},validate:R=>R.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:O,onActivate:z,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),a.jsxs("label",{children:["Persona",a.jsx(jd,{value:N,onSave:R=>{ge("personaId",R)},options:Y,fieldId:"schedule-persona",activeFieldId:O,onActivate:z,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:$n.optional,children:"(optional — set at creation)"}),a.jsx("span",{className:$n.readonlyValue,"data-testid":"schedule-detail-workspace",children:((B=r.find(R=>R.id===t.workspaceId))==null?void 0:B.name)??"System-level (no workspace)"})]})]}),a.jsxs("div",{className:$n.metaSection,children:[t.lastRunAt?a.jsxs("span",{children:["Last run: ",Vo(t.lastRunAt)]}):a.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?a.jsxs("span",{children:["Next run: ",q1(t.nextRunAt)]}):null,t.runCount>0&&a.jsxs("span",{children:["Total runs: ",t.runCount]}),a.jsxs("span",{children:["Created: ",Vo(t.createdAt)]})]})]}):null,a.jsx(ks,{isOpen:L,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:le,onCancel:()=>E(!1)})]})}function fV(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=ak();return a.jsx(eB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function mV(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await $e.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function pV(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=ot(),r=mV();return a.jsxs(a.Fragment,{children:[r&&a.jsx(eL,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),a.jsx(sB,{connectionStatus:t,environments:s,sessions:o})]})}function hV(){return a.jsx(Z8,{})}function gV(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=ot();return a.jsx(v8,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const T_=$i();function vV(){const t=dt();return ca({key:"?"},()=>{t(Uw)}),ca({key:"n"},()=>{t(T_)}),ca({key:"N"},()=>{t(T_)}),a.jsx(a.Fragment,{})}function Yo(t){const s=_z();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function yV(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ot(),o=y.useMemo(()=>a.jsx(AO,{workspaces:t,tasks:s}),[t,s]);return Yo(o),a.jsx(ha,{})}function bV(){const{environments:{environments:t}}=ot(),s=y.useMemo(()=>a.jsx(HI,{environments:t}),[t]);return Yo(s),a.jsx(ha,{})}function _V(){const t=y.useMemo(()=>a.jsx(U7,{}),[]);return Yo(t),a.jsx(ha,{})}function xV(){const{findings:{findings:t,loadFindings:s,loadAllFindings:o}}=ot(),{workspaceId:r,environmentId:c}=qn();y.useEffect(()=>{r?s(r).catch(()=>{}):o().catch(()=>{})},[r,s,o]);const d=y.useMemo(()=>a.jsx(WI,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return Yo(d),a.jsx(ha,{})}function kV(){const{knowledge:t,workspaces:{workspaces:s}}=ot(),o=y.useCallback(m=>{t.search(m).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(m=>{t.selectNode(m).catch(()=>{})},[t]),d=y.useCallback(m=>{t.loadRecent(m||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>a.jsx(Y5,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:o,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,o,r,c,d]);return Yo(u),a.jsx(ha,{})}function SV(){const{streams:{streams:t,streamsLoading:s,streamsLoadError:o,streamsLoadedOnce:r,loadStreams:c}}=ot(),d=y.useCallback(()=>{c().catch(()=>{})},[c]),u=y.useMemo(()=>a.jsx(e$,{streams:t,loading:s,streamsLoadError:o,streamsLoadedOnce:r,onRefresh:d}),[t,s,o,r,d]);return Yo(u),a.jsx(ha,{})}const jV="_container_ce571_1",TV="_title_ce571_6",wd={container:jV,title:TV};function NV(){return a.jsxs("div",{className:wd.container,"aria-hidden":"true",children:[a.jsx("h1",{className:wd.title,children:"Findings"}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>a.jsx(Sd,{lines:3},s))})]})}function N_(){const{environmentId:t,workspaceId:s}=qn(),{findings:{findings:o,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=ot(),m=dt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const p=y.useCallback(v=>{m(Qm(v,s,t))},[m,s,t]);if(r)return a.jsx(NV,{});const g=s&&t?uk("Findings",s,t,d,u).slice(0,-1):Rz();return a.jsxs("div",{className:wd.container,"data-testid":"findings-list-page",children:[a.jsx(Ss,{segments:g}),a.jsx("h1",{className:wd.title,children:"Findings"}),a.jsx(Y1,{findings:o,onFindingClick:p})]})}const wV="_container_1wwpb_1",CV="_notFound_1wwpb_6",EV="_header_1wwpb_12",AV="_categoryBadge_1wwpb_19",DV="_title_1wwpb_28",RV="_content_1wwpb_35",MV="_tags_1wwpb_77",IV="_tag_1wwpb_77",OV="_meta_1wwpb_92",LV="_metaTimestamp_1wwpb_100",BV="_metaLink_1wwpb_105",kn={container:wV,notFound:CV,header:EV,categoryBadge:AV,title:DV,content:RV,tags:MV,tag:IV,meta:OV,metaTimestamp:LV,metaLink:BV};function w_(){const{findingId:t,environmentId:s,workspaceId:o}=qn(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:m}}=ot(),p=dt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return a.jsx("div",{className:kn.container,"data-testid":"finding-detail-page",children:a.jsx("div",{className:kn.notFound,children:"Loading..."})});if(!r)return a.jsx("div",{className:kn.container,"data-testid":"finding-detail-page",children:a.jsx("div",{className:kn.notFound,children:"Finding not found."})});const g=uk(r.title,o,s,u,m),v=Td(r.category);return a.jsxs("div",{className:kn.container,"data-testid":"finding-detail-page",children:[a.jsx(Ss,{segments:g}),a.jsxs("div",{className:kn.header,children:[a.jsx("span",{className:kn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),a.jsx("h1",{className:kn.title,children:r.title})]}),r.content&&a.jsx("div",{className:kn.content,children:a.jsx(Ed,{remarkPlugins:[Ad],children:r.content})}),r.tags.length>0&&a.jsx("div",{className:kn.tags,children:r.tags.map(_=>a.jsx("span",{className:kn.tag,children:_},_))}),a.jsxs("div",{className:kn.meta,children:[a.jsx("span",{className:kn.metaTimestamp,title:r.createdAt,children:Vo(r.createdAt)}),r.taskId&&a.jsx("button",{type:"button",className:kn.metaLink,onClick:()=>{p(Pn(r.taskId))},children:"View Task"}),r.sessionId&&a.jsx("button",{type:"button",className:kn.metaLink,onClick:()=>{p(Bd(r.sessionId))},children:"View Session"})]})]})}const $V="_wizard_1260s_1",zV="_container_1260s_10",HV="_stepContent_1260s_19",PV="_logoArea_1260s_28",UV="_logoImage_1260s_32",VV="_heading_1260s_41",qV="_tagline_1260s_49",GV="_subtitle_1260s_56",FV="_featureList_1260s_64",ZV="_runtimeGrid_1260s_89",KV="_runtimeCard_1260s_101",YV="_runtimeName_1260s_133",JV="_runtimeDescription_1260s_139",WV="_buttonRow_1260s_144",XV="_primaryButton_1260s_151",QV="_ghostButton_1260s_185",eq="_dots_1260s_213",tq="_dot_1260s_213",Xe={wizard:$V,container:zV,stepContent:HV,logoArea:PV,logoImage:UV,heading:VV,tagline:qV,subtitle:GV,featureList:FV,runtimeGrid:ZV,runtimeCard:KV,runtimeName:YV,runtimeDescription:JV,buttonRow:WV,primaryButton:XV,ghostButton:QV,dots:eq,dot:tq};function nq({onNext:t}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-welcome",children:[a.jsx("div",{className:Xe.logoArea,children:a.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Xe.logoImage})}),a.jsx("h1",{className:Xe.heading,children:"Welcome to Grackle"}),a.jsx("p",{className:Xe.tagline,children:"Multi-agent orchestration for software teams"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function sq({onNext:t,onBack:s}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-about",children:[a.jsx("h2",{className:Xe.heading,children:"What is Grackle?"}),a.jsxs("ul",{className:Xe.featureList,children:[a.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),a.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),a.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),a.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),a.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const aq=[{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 iq({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-runtime",children:[a.jsx("h2",{className:Xe.heading,children:"Choose Your Runtime"}),a.jsx("p",{className:Xe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),a.jsx("div",{className:Xe.runtimeGrid,children:aq.map(u=>a.jsxs("button",{type:"button",className:Xe.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[a.jsx("span",{className:Xe.runtimeName,children:u.name}),a.jsx("span",{className:Xe.runtimeDescription,children:u.description})]},u.id))}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:o,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function oq(){return typeof Notification<"u"}function rq({onFinish:t,onBack:s,finishDisabled:o}){const r=oq(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-notifications",children:[a.jsx("h2",{className:Xe.heading,children:"Stay in the Loop"}),a.jsx("p",{className:Xe.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?a.jsx("p",{className:Xe.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const lq=4,C_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function cq(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=ot(),{showToast:c}=pn(),d=dt(),[u,m]=y.useState(0),[p,g]=y.useState("claude-code"),[v,_]=y.useState(!1),b=t.find(j=>j.id==="claude-code"),x=y.useCallback(j=>{g(j),m(3)},[]),k=y.useCallback(()=>{const j=p;_(!0);const N=[];if(b&&j!==b.runtime){const C=C_[j]??"sonnet";N.push(s(b.id,void 0,void 0,void 0,j,C))}const T=t.find(C=>C.id===hy);if(T&&j!==T.runtime){const C=C_[j]??"sonnet";N.push(s(hy,void 0,void 0,void 0,j,C))}Promise.all(N).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),_(!1)})},[p,b,t,s,o,d,c]);return r===!0?a.jsx(rs,{to:"/",replace:!0}):a.jsx("div",{className:Xe.wizard,"data-testid":"setup-wizard",children:a.jsxs("div",{className:Xe.container,children:[a.jsx(ls,{mode:"wait",children:a.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&&a.jsx(nq,{onNext:()=>m(1)}),u===1&&a.jsx(sq,{onNext:()=>m(2),onBack:()=>m(0)}),u===2&&a.jsx(iq,{currentRuntime:p,onFinish:x,onBack:()=>m(1),finishDisabled:!b}),u===3&&a.jsx(rq,{onFinish:k,onBack:()=>m(2),finishDisabled:v})]},u)}),a.jsx("div",{className:Xe.dots,children:Array.from({length:lq},(j,N)=>a.jsx("span",{className:Xe.dot,"data-active":N===u},N))})]})})}const dq="_root_zndgp_1",uq="_body_zndgp_7",fq="_main_zndgp_19",mq="_sidebarWrapper_zndgp_26",pq="_overlay_zndgp_51",Qr={root:dq,body:uq,main:fq,sidebarWrapper:mq,overlay:pq},hq=y.lazy(()=>aj(()=>import("./KnowledgePage-sxh-VcHe.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),gk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function gq({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=ot(),{toasts:d,dismissToast:u}=pn(),m=Jt(),p=bz(),g=p!==void 0,[v,_]=y.useState(!1),b=y.useCallback(()=>_(x=>!x),[]);return y.useEffect(()=>{_(!1)},[m.pathname]),y.useEffect(()=>{if(!v)return;const x=k=>{k.key==="Escape"&&_(!1)};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}},[v]),a.jsxs(a.Fragment,{children:[a.jsx(lI,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?b:void 0,sidebarOpen:v}),a.jsx(gI,{tabs:t}),a.jsxs("div",{className:Qr.body,children:[g&&a.jsx("div",{className:Qr.sidebarWrapper,"data-sidebar-open":v,children:a.jsx(kI,{content:p})}),g&&v&&a.jsx("div",{className:Qr.overlay,"data-testid":"drawer-overlay",onClick:()=>_(!1)}),a.jsxs("div",{className:Qr.main,children:[a.jsx(ha,{}),a.jsx(AI,{sessions:r,tasks:c,environments:o})]})]}),a.jsx(VO,{toasts:d,onDismiss:u}),a.jsx(vV,{})]})}function vq(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=ot(),{pluginNames:m}=xh(),{showToast:p}=pn();RH(s,p),BH(c,p),MH(o,r,p);const g=dt(),v=Jt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Bd(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return a.jsx(rs,{to:"/setup",replace:!0});const _=eH(m);return a.jsx(yz,{children:a.jsxs("div",{className:Qr.root,children:[gk&&a.jsx(yC,{}),a.jsx(gq,{tabs:_})]})})}function Km(){const{workspaceId:t}=qn(),{workspaces:{workspaces:s}}=ot(),o=Jt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:a.jsx(rs,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,m=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",p=`/environments/${encodeURIComponent(c)}/workspaces/${d}${m}${o.search}${o.hash}`;return a.jsx(rs,{to:p,replace:!0})}function yq(){const{pluginNames:t}=xh(),s=t.includes("orchestration"),o=t.includes("knowledge");return a.jsxs(nw,{children:[a.jsx(Ne,{path:"setup",element:a.jsx(cq,{})}),a.jsxs(Ne,{element:a.jsx(vq,{}),children:[a.jsx(Ne,{index:!0,element:a.jsx(SP,{})}),a.jsx(Ne,{path:"sessions/new",element:a.jsx(BP,{})}),a.jsxs(Ne,{element:a.jsx(SV,{}),children:[a.jsx(Ne,{path:"chat",element:a.jsx(y_,{})}),a.jsx(Ne,{path:"chat/:streamId",element:a.jsx(y_,{})})]}),a.jsx(Ne,{path:"sessions/:sessionId",element:a.jsx(PP,{})}),o&&a.jsx(Ne,{element:a.jsx(kV,{}),children:a.jsx(Ne,{path:"knowledge",element:a.jsx(y.Suspense,{fallback:a.jsx(B1,{}),children:a.jsx(hq,{})})})}),s&&a.jsxs(Ne,{element:a.jsx(yV,{}),children:[a.jsx(Ne,{path:"tasks",element:a.jsx(xP,{})}),a.jsx(Ne,{path:"tasks/new",element:a.jsx(__,{})}),a.jsx(Ne,{path:"tasks/:taskId",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"tasks/:taskId/edit",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"tasks/:taskId/stream",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"tasks/:taskId/findings",element:a.jsx(Ka,{})})]}),s&&a.jsxs(Ne,{element:a.jsx(xV,{}),children:[a.jsx(Ne,{path:"findings",element:a.jsx(N_,{})}),a.jsx(Ne,{path:"findings/:findingId",element:a.jsx(w_,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:a.jsx(N_,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:a.jsx(w_,{})})]}),a.jsxs(Ne,{element:a.jsx(bV,{}),children:[a.jsx(Ne,{path:"workspaces",element:a.jsx(rs,{to:"/environments",replace:!0})}),a.jsx(Ne,{path:"workspaces/new",element:a.jsx(nU,{})}),a.jsx(Ne,{path:"workspaces/:workspaceId",element:a.jsx(Km,{})}),a.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Km,{})}),a.jsx(Ne,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:a.jsx(Km,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId",element:a.jsx(GP,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:a.jsx(__,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:a.jsx(Ka,{})}),a.jsx(Ne,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:a.jsx(Ka,{})}),a.jsxs(Ne,{path:"environments",element:a.jsx(cU,{}),children:[a.jsx(Ne,{index:!0,element:a.jsx(kP,{})}),a.jsx(Ne,{path:"new",element:a.jsx(aU,{})}),a.jsx(Ne,{path:":environmentId",element:a.jsx(zU,{})}),a.jsx(Ne,{path:":environmentId/edit",element:a.jsx(iU,{})})]})]}),a.jsx(Ne,{element:a.jsx(_V,{}),children:a.jsxs(Ne,{path:"settings",element:a.jsx(UU,{}),children:[a.jsx(Ne,{index:!0,element:a.jsx(rs,{to:"credentials",replace:!0})}),a.jsx(Ne,{path:"environments",element:a.jsx(rs,{to:"/environments",replace:!0})}),a.jsx(Ne,{path:"credentials",element:a.jsx(VU,{})}),a.jsx(Ne,{path:"github-accounts",element:a.jsx(qU,{})}),a.jsx(Ne,{path:"tokens",element:a.jsx(rs,{to:"../credentials",replace:!0})}),a.jsx(Ne,{path:"personas",element:a.jsx(GU,{})}),a.jsx(Ne,{path:"personas/new",element:a.jsx(S_,{})}),a.jsx(Ne,{path:"personas/:personaId",element:a.jsx(S_,{})}),a.jsx(Ne,{path:"schedules",element:a.jsx(nV,{})}),a.jsx(Ne,{path:"schedules/new",element:a.jsx(j_,{})}),a.jsx(Ne,{path:"schedules/:scheduleId",element:a.jsx(j_,{})}),a.jsx(Ne,{path:"appearance",element:a.jsx(fV,{})}),a.jsx(Ne,{path:"shortcuts",element:a.jsx(hV,{})}),a.jsx(Ne,{path:"plugins",element:a.jsx(gV,{})}),a.jsx(Ne,{path:"about",element:a.jsx(pV,{})})]})}),a.jsx(Ne,{path:"*",element:a.jsx(rs,{to:"/",replace:!0})})]})]})}const bq=1e4;function _q(){const{onboardingCompleted:t}=ot(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),bq);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return a.jsx(ls,{mode:"wait",children:r?a.jsx(Rt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:a.jsx(B1,{})},"splash"):a.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:a.jsx(ww,{basename:"/".replace(/\/$/,""),children:a.jsx(yq,{})})},"app")})}function xq(){const t=gk?Zz:DH;return a.jsx(Jz,{children:a.jsx(vz,{children:a.jsx(mz,{children:a.jsx(t,{children:a.jsx(_q,{})})})})})}tj.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(xq,{})}));export{Ss as B,ix as K,ot as a,Qm as f,Bd as s,Pn as t,dt as u};