@grackle-ai/web 0.121.0 → 0.123.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-MdNH9jtw.js","assets/dagview-tHPW3Rz3.js","assets/grpc-ABDxUTnA.js","assets/KnowledgePage-MWT_iA9F.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as _2,a as x2,b as y,j as i,d as ty,H as ny,P as sy,i as k2,B as S2,c as T2,C as j2,M as w2,e as N2}from"./dagview-tHPW3Rz3.js";import{c as C2,a as hd,G as E2,b as A2,d as D2,e as M2,f as R2,M as I2,D as y_,A as b_,W as O2,O as B2,g as L2,C as ra,h as __,i as x_,w as z2,t as $2,p as Cc,j as H2,R as Ec,S as ay}from"./grpc-ABDxUTnA.js";import{v as P2,r as U2,t as Ac,i as V2,f as q2,M as um,a as fm}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 Uf={exports:{}},Rr={},Vf={exports:{}},qf={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-CTtvGo4M.js","assets/dagview-tHPW3Rz3.js","assets/grpc-BF7BKcvW.js","assets/KnowledgePage-Dlx-9yf1.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
+ import{r as _2,a as x2,b as y,j as i,d as ty,H as ny,P as sy,i as k2,B as S2,c as j2,C as T2,M as w2,e as N2}from"./dagview-tHPW3Rz3.js";import{c as C2,a as hd,G as E2,b as A2,d as D2,e as M2,f as R2,M as I2,D as y_,A as b_,W as O2,O as B2,g as L2,C as la,h as __,i as x_,w as z2,t as $2,p as Cc,j as H2,R as Ec,S as ay}from"./grpc-BF7BKcvW.js";import{v as P2,r as U2,t as Ac,i as V2,f as q2,M as um,a as fm}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 Uf={exports:{}},Ir={},Vf={exports:{}},qf={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ import{r as _2,a as x2,b as y,j as i,d as ty,H as ny,P as sy,i as k2,B as S2,c a
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var iy;function G2(){return iy||(iy=1,(function(t){function s(H,B){var F=H.length;H.push(B);e:for(;0<F;){var ge=F-1>>>1,ne=H[ge];if(0<c(ne,B))H[ge]=B,H[F]=ne,F=ge;else break e}}function o(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var B=H[0],F=H.pop();if(F!==B){H[0]=F;e:for(var ge=0,ne=H.length,ce=ne>>>1;ge<ce;){var me=2*(ge+1)-1,ke=H[me],De=me+1,ot=H[De];if(0>c(ke,F))De<ne&&0>c(ot,ke)?(H[ge]=ot,H[De]=F,ge=De):(H[ge]=ke,H[me]=F,ge=me);else if(De<ne&&0>c(ot,F))H[ge]=ot,H[De]=F,ge=De;else break e}}return B}function c(H,B){var F=H.sortIndex-B.sortIndex;return F!==0?F:H.id-B.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,_=3,k=!1,S=!1,T=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var B=o(g);B!==null;){if(B.callback===null)r(g);else if(B.startTime<=H)r(g),B.sortIndex=B.expirationTime,s(m,B);else break;B=o(g)}}function E(H){if(T=!1,A(H),!S)if(o(m)!==null)S=!0,R||(R=!0,ee());else{var B=o(g);B!==null&&ae(E,B.startTime-H)}}var R=!1,O=-1,M=5,$=-1;function Y(){return j?!0:!(t.unstable_now()-$<M)}function V(){if(j=!1,R){var H=t.unstable_now();$=H;var B=!0;try{e:{S=!1,T&&(T=!1,C(O),O=-1),k=!0;var F=_;try{t:{for(A(H),b=o(m);b!==null&&!(b.expirationTime>H&&Y());){var ge=b.callback;if(typeof ge=="function"){b.callback=null,_=b.priorityLevel;var ne=ge(b.expirationTime<=H);if(H=t.unstable_now(),typeof ne=="function"){b.callback=ne,A(H),B=!0;break t}b===o(m)&&r(m),A(H)}else r(m);b=o(m)}if(b!==null)B=!0;else{var ce=o(g);ce!==null&&ae(E,ce.startTime-H),B=!1}}break e}finally{b=null,_=F,k=!1}B=void 0}}finally{B?ee():R=!1}}}var ee;if(typeof D=="function")ee=function(){D(V)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,Z=le.port2;le.port1.onmessage=V,ee=function(){Z.postMessage(null)}}else ee=function(){w(V,0)};function ae(H,B){O=w(function(){H(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(H){switch(_){case 1:case 2:case 3:var B=3;break;default:B=_}var F=_;_=B;try{return H()}finally{_=F}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(H,B){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var F=_;_=H;try{return B()}finally{_=F}},t.unstable_scheduleCallback=function(H,B,F){var ge=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ge+F:ge):F=ge,H){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=F+ne,H={id:v++,callback:B,priorityLevel:H,startTime:F,expirationTime:ne,sortIndex:-1},F>ge?(H.sortIndex=F,s(g,H),o(m)===null&&H===o(g)&&(T?(C(O),O=-1):T=!0,ae(E,F-ge))):(H.sortIndex=ne,s(m,H),S||k||(S=!0,R||(R=!0,ee()))),H},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(H){var B=_;return function(){var F=_;_=B;try{return H.apply(this,arguments)}finally{_=F}}}})(qf)),qf}var oy;function F2(){return oy||(oy=1,Vf.exports=G2()),Vf.exports}/**
10
+ */var iy;function G2(){return iy||(iy=1,(function(t){function s(H,B){var F=H.length;H.push(B);e:for(;0<F;){var ge=F-1>>>1,ee=H[ge];if(0<c(ee,B))H[ge]=B,H[F]=ee,F=ge;else break e}}function o(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var B=H[0],F=H.pop();if(F!==B){H[0]=F;e:for(var ge=0,ee=H.length,ce=ee>>>1;ge<ce;){var me=2*(ge+1)-1,xe=H[me],De=me+1,ot=H[De];if(0>c(xe,F))De<ee&&0>c(ot,xe)?(H[ge]=ot,H[De]=F,ge=De):(H[ge]=xe,H[me]=F,ge=me);else if(De<ee&&0>c(ot,F))H[ge]=ot,H[De]=F,ge=De;else break e}}return B}function c(H,B){var F=H.sortIndex-B.sortIndex;return F!==0?F:H.id-B.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,_=3,k=!1,S=!1,j=!1,T=!1,w=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var B=o(g);B!==null;){if(B.callback===null)r(g);else if(B.startTime<=H)r(g),B.sortIndex=B.expirationTime,s(m,B);else break;B=o(g)}}function E(H){if(j=!1,A(H),!S)if(o(m)!==null)S=!0,R||(R=!0,ne());else{var B=o(g);B!==null&&se(E,B.startTime-H)}}var R=!1,O=-1,M=5,$=-1;function Y(){return T?!0:!(t.unstable_now()-$<M)}function V(){if(T=!1,R){var H=t.unstable_now();$=H;var B=!0;try{e:{S=!1,j&&(j=!1,C(O),O=-1),k=!0;var F=_;try{t:{for(A(H),b=o(m);b!==null&&!(b.expirationTime>H&&Y());){var ge=b.callback;if(typeof ge=="function"){b.callback=null,_=b.priorityLevel;var ee=ge(b.expirationTime<=H);if(H=t.unstable_now(),typeof ee=="function"){b.callback=ee,A(H),B=!0;break t}b===o(m)&&r(m),A(H)}else r(m);b=o(m)}if(b!==null)B=!0;else{var ce=o(g);ce!==null&&se(E,ce.startTime-H),B=!1}}break e}finally{b=null,_=F,k=!1}B=void 0}}finally{B?ne():R=!1}}}var ne;if(typeof D=="function")ne=function(){D(V)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,Z=le.port2;le.port1.onmessage=V,ne=function(){Z.postMessage(null)}}else ne=function(){w(V,0)};function se(H,B){O=w(function(){H(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(H){switch(_){case 1:case 2:case 3:var B=3;break;default:B=_}var F=_;_=B;try{return H()}finally{_=F}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(H,B){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var F=_;_=H;try{return B()}finally{_=F}},t.unstable_scheduleCallback=function(H,B,F){var ge=t.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ge+F:ge):F=ge,H){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=F+ee,H={id:v++,callback:B,priorityLevel:H,startTime:F,expirationTime:ee,sortIndex:-1},F>ge?(H.sortIndex=F,s(g,H),o(m)===null&&H===o(g)&&(j?(C(O),O=-1):j=!0,se(E,F-ge))):(H.sortIndex=ee,s(m,H),S||k||(S=!0,R||(R=!0,ne()))),H},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(H){var B=_;return function(){var F=_;_=B;try{return H.apply(this,arguments)}finally{_=F}}}})(qf)),qf}var oy;function F2(){return oy||(oy=1,Vf.exports=G2()),Vf.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,255 +15,255 @@ import{r as _2,a as x2,b as y,j as i,d as ty,H as ny,P as sy,i as k2,B as S2,c a
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var ry;function K2(){if(ry)return Rr;ry=1;var t=F2(),s=_2(),o=x2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var x=!1,N=f.child;N;){if(N===a){x=!0,a=f,l=h;break}if(N===l){x=!0,l=f,a=h;break}N=N.sibling}if(!x){for(N=h.child;N;){if(N===a){x=!0,a=h,l=f;break}if(N===l){x=!0,l=h,a=f;break}N=N.sibling}if(!x)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function ee(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function Z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case w:return"Profiler";case j:return"StrictMode";case E:return"Suspense";case R:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:Z(e.type)||"Memo";case M:n=e._payload,e=e._init;try{return Z(e(n))}catch{}}return null}var ae=Array.isArray,H=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ge=[],ne=-1;function ce(e){return{current:e}}function me(e){0>ne||(e.current=ge[ne],ge[ne]=null,ne--)}function ke(e,n){ne++,ge[ne]=e.current,e.current=n}var De=ce(null),ot=ce(null),yt=ce(null),_e=ce(null);function Oe(e,n){switch(ke(yt,n),ke(ot,e),ke(De,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?T0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=T0(n),e=j0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}me(De),ke(De,e)}function Ht(){me(De),me(ot),me(yt)}function Nt(e){e.memoizedState!==null&&ke(_e,e);var n=De.current,a=j0(n,e.type);n!==a&&(ke(ot,e),ke(De,a))}function ue(e){ot.current===e&&(me(De),me(ot)),_e.current===e&&(me(_e),Er._currentValue=F)}var Re,Q;function et(e){if(Re===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Q=-1<a.stack.indexOf(`
18
+ */var ry;function K2(){if(ry)return Ir;ry=1;var t=F2(),s=_2(),o=x2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var x=!1,N=f.child;N;){if(N===a){x=!0,a=f,l=h;break}if(N===l){x=!0,l=f,a=h;break}N=N.sibling}if(!x){for(N=h.child;N;){if(N===a){x=!0,a=h,l=f;break}if(N===l){x=!0,l=h,a=f;break}N=N.sibling}if(!x)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function ne(e){return e===null||typeof e!="object"?null:(e=V&&e[V]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function Z(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case w:return"Profiler";case T:return"StrictMode";case E:return"Suspense";case R:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case O:return n=e.displayName||null,n!==null?n:Z(e.type)||"Memo";case M:n=e._payload,e=e._init;try{return Z(e(n))}catch{}}return null}var se=Array.isArray,H=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ge=[],ee=-1;function ce(e){return{current:e}}function me(e){0>ee||(e.current=ge[ee],ge[ee]=null,ee--)}function xe(e,n){ee++,ge[ee]=e.current,e.current=n}var De=ce(null),ot=ce(null),yt=ce(null),lt=ce(null);function Pe(e,n){switch(xe(yt,n),xe(ot,e),xe(De,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?j0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=j0(n),e=T0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}me(De),xe(De,e)}function ke(){me(De),me(ot),me(yt)}function ct(e){e.memoizedState!==null&&xe(lt,e);var n=De.current,a=T0(n,e.type);n!==a&&(xe(ot,e),xe(De,a))}function ue(e){ot.current===e&&(me(De),me(ot)),lt.current===e&&(me(lt),Ar._currentValue=F)}var Re,Q;function nt(e){if(Re===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Q=-1<a.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
20
  `+Re+e+Q}var re=!1;function ve(e,n){if(!e||re)return"";re=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(J){var K=J}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(J){K=J}e.call(ie.prototype)}}else{try{throw Error()}catch(J){K=J}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(J){if(J&&K&&typeof J.stack=="string")return[J.stack,K.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),x=h[0],N=h[1];if(x&&N){var I=x.split(`
21
21
  `),G=N.split(`
22
22
  `);for(f=l=0;l<I.length&&!I[l].includes("DetermineComponentFrameRoot");)l++;for(;f<G.length&&!G[f].includes("DetermineComponentFrameRoot");)f++;if(l===I.length||f===G.length)for(l=I.length-1,f=G.length-1;1<=l&&0<=f&&I[l]!==G[f];)f--;for(;1<=l&&0<=f;l--,f--)if(I[l]!==G[f]){if(l!==1||f!==1)do if(l--,f--,0>f||I[l]!==G[f]){var X=`
23
- `+I[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=f);break}}}finally{re=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?et(a):""}function Xe(e,n){switch(e.tag){case 26:case 27:case 5:return et(e.type);case 16:return et("Lazy");case 13:return e.child!==n&&n!==null?et("Suspense Fallback"):et("Suspense");case 19:return et("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return et("Activity");default:return""}}function an(e){try{var n="",a=null;do n+=Xe(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
23
+ `+I[l].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=l&&0<=f);break}}}finally{re=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?nt(a):""}function et(e,n){switch(e.tag){case 26:case 27:case 5:return nt(e.type);case 16:return nt("Lazy");case 13:return e.child!==n&&n!==null?nt("Suspense Fallback"):nt("Suspense");case 19:return nt("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 nt("Activity");default:return""}}function sn(e){try{var n="",a=null;do n+=et(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var _s=Object.prototype.hasOwnProperty,ls=t.unstable_scheduleCallback,Os=t.unstable_cancelCallback,pa=t.unstable_shouldYield,Ri=t.unstable_requestPaint,Wt=t.unstable_now,Wa=t.unstable_getCurrentPriorityLevel,Xa=t.unstable_ImmediatePriority,ma=t.unstable_UserBlockingPriority,Bs=t.unstable_NormalPriority,xs=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Ue=t.log,_n=t.unstable_setDisableYieldValue,mn=null,Pt=null;function Cn(e){if(typeof Ue=="function"&&_n(e),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(mn,e)}catch{}}var Xt=Math.clz32?Math.clz32:hl,Ii=Math.log,Oi=Math.LN2;function hl(e){return e>>>=0,e===0?32:31-(Ii(e)/Oi|0)|0}var Bi=256,U=262144,se=4194304;function de(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pe(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var N=l&134217727;return N!==0?(l=N&~h,l!==0?f=de(l):(x&=N,x!==0?f=de(x):a||(a=N&~e,a!==0&&(f=de(a))))):(N=l&~h,N!==0?f=de(N):x!==0?f=de(x):a||(a=l&~e,a!==0&&(f=de(a)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:f}function ye(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function Qe(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Te(){var e=se;return se<<=1,(se&62914560)===0&&(se=4194304),e}function Be(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Ge(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ht(e,n,a,l,f,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,I=e.expirationTimes,G=e.hiddenUpdates;for(a=x&~a;0<a;){var X=31-Xt(a),ie=1<<X;N[X]=0,I[X]=-1;var K=G[X];if(K!==null)for(G[X]=null,X=0;X<K.length;X++){var J=K[X];J!==null&&(J.lane&=-536870913)}a&=~ie}l!==0&&tt(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function tt(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Xt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Qt(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Xt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function on(e,n){var a=n&-n;return a=(a&42)!==0?1:Et(a),(a&(e.suspendedLanes|n))!==0?0:a}function Et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ks(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ss(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:Z0(e.type))}function Li(e,n){var a=B.p;try{return B.p=e,n()}finally{B.p=a}}var ha=Math.random().toString(36).slice(2),rn="__reactFiber$"+ha,xn="__reactProps$"+ha,zi="__reactContainer$"+ha,Md="__reactEvents$"+ha,ck="__reactListeners$"+ha,dk="__reactHandles$"+ha,uh="__reactResources$"+ha,qo="__reactMarker$"+ha;function Rd(e){delete e[rn],delete e[xn],delete e[Md],delete e[ck],delete e[dk]}function $i(e){var n=e[rn];if(n)return n;for(var a=e.parentNode;a;){if(n=a[zi]||a[rn]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=M0(e);e!==null;){if(a=e[rn])return a;e=M0(e)}return n}e=a,a=e.parentNode}return null}function Hi(e){if(e=e[rn]||e[zi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Go(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Pi(e){var n=e[uh];return n||(n=e[uh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function en(e){e[qo]=!0}var fh=new Set,ph={};function Qa(e,n){Ui(e,n),Ui(e+"Capture",n)}function Ui(e,n){for(ph[e]=n,e=0;e<n.length;e++)fh.add(n[e])}var uk=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]*$"),mh={},hh={};function fk(e){return _s.call(hh,e)?!0:_s.call(mh,e)?!1:uk.test(e)?hh[e]=!0:(mh[e]=!0,!1)}function gl(e,n,a){if(fk(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function vl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function Ls(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function pk(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Id(e){if(!e._valueTracker){var n=gh(e)?"checked":"value";e._valueTracker=pk(e,n,""+e[n])}}function vh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=gh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function yl(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 mk=/[\n"\\]/g;function Vn(e){return e.replace(mk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Od(e,n,a,l,f,h,x,N){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Un(n)):e.value!==""+Un(n)&&(e.value=""+Un(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Bd(e,x,Un(n)):a!=null?Bd(e,x,Un(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Un(N):e.removeAttribute("name")}function yh(e,n,a,l,f,h,x,N){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Id(e);return}a=a!=null?""+Un(a):"",n=n!=null?""+Un(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=N?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Id(e)}function Bd(e,n,a){n==="number"&&yl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Vi(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Un(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function bh(e,n,a){if(n!=null&&(n=""+Un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Un(a):""}function _h(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(ae(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Un(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Id(e)}function qi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var hk=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 xh(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||hk.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function kh(e,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&xh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&xh(e,h,n[h])}function Ld(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 gk=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"]]),vk=/^[\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 bl(e){return vk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zs(){}var zd=null;function $d(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Gi=null,Fi=null;function Sh(e){var n=Hi(e);if(n&&(e=n.stateNode)){var a=e[xn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Od(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[xn]||null;if(!f)throw Error(r(90));Od(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===e.form&&vh(l)}break e;case"textarea":bh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Vi(e,!!a.multiple,n,!1)}}}var Hd=!1;function Th(e,n,a){if(Hd)return e(n,a);Hd=!0;try{var l=e(n);return l}finally{if(Hd=!1,(Gi!==null||Fi!==null)&&(oc(),Gi&&(n=Gi,e=Fi,Fi=Gi=null,Sh(n),e)))for(n=0;n<e.length;n++)Sh(e[n])}}function Fo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[xn]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var $s=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pd=!1;if($s)try{var Ko={};Object.defineProperty(Ko,"passive",{get:function(){Pd=!0}}),window.addEventListener("test",Ko,Ko),window.removeEventListener("test",Ko,Ko)}catch{Pd=!1}var ga=null,Ud=null,_l=null;function jh(){if(_l)return _l;var e,n=Ud,a=n.length,l,f="value"in ga?ga.value:ga.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return _l=f.slice(e,1<l?1-l:void 0)}function xl(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 kl(){return!0}function wh(){return!1}function kn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?kl:wh,this.isPropagationStopped=wh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),n}var ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sl=kn(ei),Zo=b({},ei,{view:0,detail:0}),yk=kn(Zo),Vd,qd,Yo,Tl=b({},Zo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Yo&&(Yo&&e.type==="mousemove"?(Vd=e.screenX-Yo.screenX,qd=e.screenY-Yo.screenY):qd=Vd=0,Yo=e),Vd)},movementY:function(e){return"movementY"in e?e.movementY:qd}}),Nh=kn(Tl),bk=b({},Tl,{dataTransfer:0}),_k=kn(bk),xk=b({},Zo,{relatedTarget:0}),Gd=kn(xk),kk=b({},ei,{animationName:0,elapsedTime:0,pseudoElement:0}),Sk=kn(kk),Tk=b({},ei,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jk=kn(Tk),wk=b({},ei,{data:0}),Ch=kn(wk),Nk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ck={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ek={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ak(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Ek[e])?!!n[e]:!1}function Fd(){return Ak}var Dk=b({},Zo,{key:function(e){if(e.key){var n=Nk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=xl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ck[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fd,charCode:function(e){return e.type==="keypress"?xl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mk=kn(Dk),Rk=b({},Tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eh=kn(Rk),Ik=b({},Zo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fd}),Ok=kn(Ik),Bk=b({},ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lk=kn(Bk),zk=b({},Tl,{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}),$k=kn(zk),Hk=b({},ei,{newState:0,oldState:0}),Pk=kn(Hk),Uk=[9,13,27,32],Kd=$s&&"CompositionEvent"in window,Jo=null;$s&&"documentMode"in document&&(Jo=document.documentMode);var Vk=$s&&"TextEvent"in window&&!Jo,Ah=$s&&(!Kd||Jo&&8<Jo&&11>=Jo),Dh=" ",Mh=!1;function Rh(e,n){switch(e){case"keyup":return Uk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ih(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ki=!1;function qk(e,n){switch(e){case"compositionend":return Ih(n);case"keypress":return n.which!==32?null:(Mh=!0,Dh);case"textInput":return e=n.data,e===Dh&&Mh?null:e;default:return null}}function Gk(e,n){if(Ki)return e==="compositionend"||!Kd&&Rh(e,n)?(e=jh(),_l=Ud=ga=null,Ki=!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 Ah&&n.locale!=="ko"?null:n.data;default:return null}}var Fk={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 Oh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Fk[e.type]:n==="textarea"}function Bh(e,n,a,l){Gi?Fi?Fi.push(l):Fi=[l]:Gi=l,n=pc(n,"onChange"),0<n.length&&(a=new Sl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Wo=null,Xo=null;function Kk(e){y0(e,0)}function jl(e){var n=Go(e);if(vh(n))return e}function Lh(e,n){if(e==="change")return n}var zh=!1;if($s){var Zd;if($s){var Yd="oninput"in document;if(!Yd){var $h=document.createElement("div");$h.setAttribute("oninput","return;"),Yd=typeof $h.oninput=="function"}Zd=Yd}else Zd=!1;zh=Zd&&(!document.documentMode||9<document.documentMode)}function Hh(){Wo&&(Wo.detachEvent("onpropertychange",Ph),Xo=Wo=null)}function Ph(e){if(e.propertyName==="value"&&jl(Xo)){var n=[];Bh(n,Xo,e,$d(e)),Th(Kk,n)}}function Zk(e,n,a){e==="focusin"?(Hh(),Wo=n,Xo=a,Wo.attachEvent("onpropertychange",Ph)):e==="focusout"&&Hh()}function Yk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(Xo)}function Jk(e,n){if(e==="click")return jl(n)}function Wk(e,n){if(e==="input"||e==="change")return jl(n)}function Xk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var En=typeof Object.is=="function"?Object.is:Xk;function Qo(e,n){if(En(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!_s.call(n,f)||!En(e[f],n[f]))return!1}return!0}function Uh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vh(e,n){var a=Uh(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Uh(a)}}function qh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?qh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=yl(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=yl(e.document)}return n}function Jd(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 Qk=$s&&"documentMode"in document&&11>=document.documentMode,Zi=null,Wd=null,er=null,Xd=!1;function Fh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Xd||Zi==null||Zi!==yl(l)||(l=Zi,"selectionStart"in l&&Jd(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),er&&Qo(er,l)||(er=l,l=pc(Wd,"onSelect"),0<l.length&&(n=new Sl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Zi)))}function ti(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Yi={animationend:ti("Animation","AnimationEnd"),animationiteration:ti("Animation","AnimationIteration"),animationstart:ti("Animation","AnimationStart"),transitionrun:ti("Transition","TransitionRun"),transitionstart:ti("Transition","TransitionStart"),transitioncancel:ti("Transition","TransitionCancel"),transitionend:ti("Transition","TransitionEnd")},Qd={},Kh={};$s&&(Kh=document.createElement("div").style,"AnimationEvent"in window||(delete Yi.animationend.animation,delete Yi.animationiteration.animation,delete Yi.animationstart.animation),"TransitionEvent"in window||delete Yi.transitionend.transition);function ni(e){if(Qd[e])return Qd[e];if(!Yi[e])return e;var n=Yi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Kh)return Qd[e]=n[a];return e}var Zh=ni("animationend"),Yh=ni("animationiteration"),Jh=ni("animationstart"),eS=ni("transitionrun"),tS=ni("transitionstart"),nS=ni("transitioncancel"),Wh=ni("transitionend"),Xh=new Map,eu="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(" ");eu.push("scrollEnd");function cs(e,n){Xh.set(e,n),Qa(n,[e])}var wl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},qn=[],Ji=0,tu=0;function Nl(){for(var e=Ji,n=tu=Ji=0;n<e;){var a=qn[n];qn[n++]=null;var l=qn[n];qn[n++]=null;var f=qn[n];qn[n++]=null;var h=qn[n];if(qn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Qh(a,f,h)}}function Cl(e,n,a,l){qn[Ji++]=e,qn[Ji++]=n,qn[Ji++]=a,qn[Ji++]=l,tu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function nu(e,n,a,l){return Cl(e,n,a,l),El(e)}function si(e,n){return Cl(e,null,null,n),El(e)}function Qh(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Xt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function El(e){if(50<kr)throw kr=0,ff=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Wi={};function sS(e,n,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(e,n,a,l){return new sS(e,n,a,l)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hs(e,n){var a=e.alternate;return a===null?(a=An(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function eg(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Al(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")su(e)&&(x=1);else if(typeof e=="string")x=l2(e,a,De.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=An(31,a,n,f),e.elementType=$,e.lanes=h,e;case T:return ai(a.children,f,h,n);case j:x=8,f|=24;break;case w:return e=An(12,a,n,f|2),e.elementType=w,e.lanes=h,e;case E:return e=An(13,a,n,f),e.elementType=E,e.lanes=h,e;case R:return e=An(19,a,n,f),e.elementType=R,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:x=10;break e;case C:x=9;break e;case A:x=11;break e;case O:x=14;break e;case M:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=An(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function ai(e,n,a,l){return e=An(7,e,l,n),e.lanes=a,e}function au(e,n,a){return e=An(6,e,null,n),e.lanes=a,e}function tg(e){var n=An(18,null,null,0);return n.stateNode=e,n}function iu(e,n,a){return n=An(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var ng=new WeakMap;function Gn(e,n){if(typeof e=="object"&&e!==null){var a=ng.get(e);return a!==void 0?a:(n={value:e,source:n,stack:an(n)},ng.set(e,n),n)}return{value:e,source:n,stack:an(n)}}var Xi=[],Qi=0,Dl=null,tr=0,Fn=[],Kn=0,va=null,Ts=1,js="";function Ps(e,n){Xi[Qi++]=tr,Xi[Qi++]=Dl,Dl=e,tr=n}function sg(e,n,a){Fn[Kn++]=Ts,Fn[Kn++]=js,Fn[Kn++]=va,va=e;var l=Ts;e=js;var f=32-Xt(l)-1;l&=~(1<<f),a+=1;var h=32-Xt(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,Ts=1<<32-Xt(n)+f|a<<f|l,js=h+e}else Ts=1<<h|a<<f|l,js=e}function ou(e){e.return!==null&&(Ps(e,1),sg(e,1,0))}function ru(e){for(;e===Dl;)Dl=Xi[--Qi],Xi[Qi]=null,tr=Xi[--Qi],Xi[Qi]=null;for(;e===va;)va=Fn[--Kn],Fn[Kn]=null,js=Fn[--Kn],Fn[Kn]=null,Ts=Fn[--Kn],Fn[Kn]=null}function ag(e,n){Fn[Kn++]=Ts,Fn[Kn++]=js,Fn[Kn++]=va,Ts=n.id,js=n.overflow,va=e}var ln=null,bt=null,Ye=!1,ya=null,Zn=!1,lu=Error(r(519));function ba(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nr(Gn(n,e)),lu}function ig(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[rn]=e,n[xn]=l,a){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(a=0;a<Tr.length;a++)qe(Tr[a],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),yh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),_h(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||k0(n.textContent,a)?(l.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),l.onScroll!=null&&qe("scroll",n),l.onScrollEnd!=null&&qe("scrollend",n),l.onClick!=null&&(n.onclick=zs),n=!0):n=!1,n||ba(e,!0)}function og(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:ln=ln.return}}function eo(e){if(e!==ln)return!1;if(!Ye)return og(e),Ye=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Nf(e.type,e.memoizedProps)),a=!a),a&&bt&&ba(e),og(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));bt=D0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));bt=D0(e)}else n===27?(n=bt,Ra(e.type)?(e=Mf,Mf=null,bt=e):bt=n):bt=ln?Jn(e.stateNode.nextSibling):null;return!0}function ii(){bt=ln=null,Ye=!1}function cu(){var e=ya;return e!==null&&(wn===null?wn=e:wn.push.apply(wn,e),ya=null),e}function nr(e){ya===null?ya=[e]:ya.push(e)}var du=ce(null),oi=null,Us=null;function _a(e,n,a){ke(du,n._currentValue),n._currentValue=a}function Vs(e){e._currentValue=du.current,me(du)}function uu(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function fu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var N=h;h=f;for(var I=0;I<n.length;I++)if(N.context===n[I]){h.lanes|=a,N=h.alternate,N!==null&&(N.lanes|=a),uu(h.return,a,e),l||(x=null);break e}h=N.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),uu(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function to(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var N=f.type;En(f.pendingProps.value,x.value)||(e!==null?e.push(N):e=[N])}}else if(f===_e.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Er):e=[Er])}f=f.return}e!==null&&fu(n,e,a,l),n.flags|=262144}function Ml(e){for(e=e.firstContext;e!==null;){if(!En(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ri(e){oi=e,Us=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return rg(oi,e)}function Rl(e,n){return oi===null&&ri(e),rg(e,n)}function rg(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Us===null){if(e===null)throw Error(r(308));Us=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Us=Us.next=n;return a}var aS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},iS=t.unstable_scheduleCallback,oS=t.unstable_NormalPriority,Ut={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new aS,data:new Map,refCount:0}}function sr(e){e.refCount--,e.refCount===0&&iS(oS,function(){e.controller.abort()})}var ar=null,mu=0,no=0,so=null;function rS(e,n){if(ar===null){var a=ar=[];mu=0,no=yf(),so={status:"pending",value:void 0,then:function(l){a.push(l)}}}return mu++,n.then(lg,lg),n}function lg(){if(--mu===0&&ar!==null){so!==null&&(so.status="fulfilled");var e=ar;ar=null,no=0,so=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function lS(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var cg=H.S;H.S=function(e,n){Fv=Wt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&rS(e,n),cg!==null&&cg(e,n)};var li=ce(null);function hu(){var e=li.current;return e!==null?e:gt.pooledCache}function Il(e,n){n===null?ke(li,li.current):ke(li,n.pool)}function dg(){var e=hu();return e===null?null:{parent:Ut._currentValue,pool:e}}var ao=Error(r(460)),gu=Error(r(474)),Ol=Error(r(542)),Bl={then:function(){}};function ug(e){return e=e.status,e==="fulfilled"||e==="rejected"}function fg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(zs,zs),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,mg(e),e;default:if(typeof n.status=="string")n.then(zs,zs);else{if(e=gt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,mg(e),e}throw di=n,ao}}function ci(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(di=a,ao):a}}var di=null;function pg(){if(di===null)throw Error(r(459));var e=di;return di=null,e}function mg(e){if(e===ao||e===Ol)throw Error(r(483))}var io=null,ir=0;function Ll(e){var n=ir;return ir+=1,io===null&&(io=[]),fg(io,e,n)}function or(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function zl(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function hg(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function a(P,z){if(!e)return null;for(;z!==null;)n(P,z),z=z.sibling;return null}function l(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function f(P,z){return P=Hs(P,z),P.index=0,P.sibling=null,P}function h(P,z,q){return P.index=q,e?(q=P.alternate,q!==null?(q=q.index,q<z?(P.flags|=67108866,z):q):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function x(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function N(P,z,q,te){return z===null||z.tag!==6?(z=au(q,P.mode,te),z.return=P,z):(z=f(z,q),z.return=P,z)}function I(P,z,q,te){var we=q.type;return we===T?X(P,z,q.props.children,te,q.key):z!==null&&(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&ci(we)===z.type)?(z=f(z,q.props),or(z,q),z.return=P,z):(z=Al(q.type,q.key,q.props,null,P.mode,te),or(z,q),z.return=P,z)}function G(P,z,q,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=iu(q,P.mode,te),z.return=P,z):(z=f(z,q.children||[]),z.return=P,z)}function X(P,z,q,te,we){return z===null||z.tag!==7?(z=ai(q,P.mode,te,we),z.return=P,z):(z=f(z,q),z.return=P,z)}function ie(P,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=au(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return q=Al(z.type,z.key,z.props,null,P.mode,q),or(q,z),q.return=P,q;case S:return z=iu(z,P.mode,q),z.return=P,z;case M:return z=ci(z),ie(P,z,q)}if(ae(z)||ee(z))return z=ai(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ie(P,Ll(z),q);if(z.$$typeof===D)return ie(P,Rl(P,z),q);zl(P,z)}return null}function K(P,z,q,te){var we=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return we!==null?null:N(P,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return q.key===we?I(P,z,q,te):null;case S:return q.key===we?G(P,z,q,te):null;case M:return q=ci(q),K(P,z,q,te)}if(ae(q)||ee(q))return we!==null?null:X(P,z,q,te,null);if(typeof q.then=="function")return K(P,z,Ll(q),te);if(q.$$typeof===D)return K(P,z,Rl(P,q),te);zl(P,q)}return null}function J(P,z,q,te,we){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return P=P.get(q)||null,N(z,P,""+te,we);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case k:return P=P.get(te.key===null?q:te.key)||null,I(z,P,te,we);case S:return P=P.get(te.key===null?q:te.key)||null,G(z,P,te,we);case M:return te=ci(te),J(P,z,q,te,we)}if(ae(te)||ee(te))return P=P.get(q)||null,X(z,P,te,we,null);if(typeof te.then=="function")return J(P,z,q,Ll(te),we);if(te.$$typeof===D)return J(P,z,q,Rl(z,te),we);zl(z,te)}return null}function xe(P,z,q,te){for(var we=null,nt=null,Se=z,He=z=0,Ke=null;Se!==null&&He<q.length;He++){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var st=K(P,Se,q[He],te);if(st===null){Se===null&&(Se=Ke);break}e&&Se&&st.alternate===null&&n(P,Se),z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st,Se=Ke}if(He===q.length)return a(P,Se),Ye&&Ps(P,He),we;if(Se===null){for(;He<q.length;He++)Se=ie(P,q[He],te),Se!==null&&(z=h(Se,z,He),nt===null?we=Se:nt.sibling=Se,nt=Se);return Ye&&Ps(P,He),we}for(Se=l(Se);He<q.length;He++)Ke=J(Se,P,He,q[He],te),Ke!==null&&(e&&Ke.alternate!==null&&Se.delete(Ke.key===null?He:Ke.key),z=h(Ke,z,He),nt===null?we=Ke:nt.sibling=Ke,nt=Ke);return e&&Se.forEach(function(za){return n(P,za)}),Ye&&Ps(P,He),we}function Ce(P,z,q,te){if(q==null)throw Error(r(151));for(var we=null,nt=null,Se=z,He=z=0,Ke=null,st=q.next();Se!==null&&!st.done;He++,st=q.next()){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var za=K(P,Se,st.value,te);if(za===null){Se===null&&(Se=Ke);break}e&&Se&&za.alternate===null&&n(P,Se),z=h(za,z,He),nt===null?we=za:nt.sibling=za,nt=za,Se=Ke}if(st.done)return a(P,Se),Ye&&Ps(P,He),we;if(Se===null){for(;!st.done;He++,st=q.next())st=ie(P,st.value,te),st!==null&&(z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st);return Ye&&Ps(P,He),we}for(Se=l(Se);!st.done;He++,st=q.next())st=J(Se,P,He,st.value,te),st!==null&&(e&&st.alternate!==null&&Se.delete(st.key===null?He:st.key),z=h(st,z,He),nt===null?we=st:nt.sibling=st,nt=st);return e&&Se.forEach(function(b2){return n(P,b2)}),Ye&&Ps(P,He),we}function mt(P,z,q,te){if(typeof q=="object"&&q!==null&&q.type===T&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case k:e:{for(var we=q.key;z!==null;){if(z.key===we){if(we=q.type,we===T){if(z.tag===7){a(P,z.sibling),te=f(z,q.props.children),te.return=P,P=te;break e}}else if(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&ci(we)===z.type){a(P,z.sibling),te=f(z,q.props),or(te,q),te.return=P,P=te;break e}a(P,z);break}else n(P,z);z=z.sibling}q.type===T?(te=ai(q.props.children,P.mode,te,q.key),te.return=P,P=te):(te=Al(q.type,q.key,q.props,null,P.mode,te),or(te,q),te.return=P,P=te)}return x(P);case S:e:{for(we=q.key;z!==null;){if(z.key===we)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){a(P,z.sibling),te=f(z,q.children||[]),te.return=P,P=te;break e}else{a(P,z);break}else n(P,z);z=z.sibling}te=iu(q,P.mode,te),te.return=P,P=te}return x(P);case M:return q=ci(q),mt(P,z,q,te)}if(ae(q))return xe(P,z,q,te);if(ee(q)){if(we=ee(q),typeof we!="function")throw Error(r(150));return q=we.call(q),Ce(P,z,q,te)}if(typeof q.then=="function")return mt(P,z,Ll(q),te);if(q.$$typeof===D)return mt(P,z,Rl(P,q),te);zl(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(a(P,z.sibling),te=f(z,q),te.return=P,P=te):(a(P,z),te=au(q,P.mode,te),te.return=P,P=te),x(P)):a(P,z)}return function(P,z,q,te){try{ir=0;var we=mt(P,z,q,te);return io=null,we}catch(Se){if(Se===ao||Se===Ol)throw Se;var nt=An(29,Se,null,P.mode);return nt.lanes=te,nt.return=P,nt}finally{}}}var ui=hg(!0),gg=hg(!1),xa=!1;function vu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=El(e),Qh(e,null,a),n}return Cl(e,l,n,a),El(e)}function rr(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Qt(e,a)}}function bu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var _u=!1;function lr(){if(_u){var e=so;if(e!==null)throw e}}function cr(e,n,a,l){_u=!1;var f=e.updateQueue;xa=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var I=N,G=I.next;I.next=null,x===null?h=G:x.next=G,x=I;var X=e.alternate;X!==null&&(X=X.updateQueue,N=X.lastBaseUpdate,N!==x&&(N===null?X.firstBaseUpdate=G:N.next=G,X.lastBaseUpdate=I))}if(h!==null){var ie=f.baseState;x=0,X=G=I=null,N=h;do{var K=N.lane&-536870913,J=K!==N.lane;if(J?(Fe&K)===K:(l&K)===K){K!==0&&K===no&&(_u=!0),X!==null&&(X=X.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var xe=e,Ce=N;K=n;var mt=a;switch(Ce.tag){case 1:if(xe=Ce.payload,typeof xe=="function"){ie=xe.call(mt,ie,K);break e}ie=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ce.payload,K=typeof xe=="function"?xe.call(mt,ie,K):xe,K==null)break e;ie=b({},ie,K);break e;case 2:xa=!0}}K=N.callback,K!==null&&(e.flags|=64,J&&(e.flags|=8192),J=f.callbacks,J===null?f.callbacks=[K]:J.push(K))}else J={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},X===null?(G=X=J,I=ie):X=X.next=J,x|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;J=N,N=J.next,J.next=null,f.lastBaseUpdate=J,f.shared.pending=null}}while(!0);X===null&&(I=ie),f.baseState=I,f.firstBaseUpdate=G,f.lastBaseUpdate=X,h===null&&(f.shared.lanes=0),Ca|=x,e.lanes=x,e.memoizedState=ie}}function vg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function yg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)vg(a[e],n)}var oo=ce(null),$l=ce(0);function bg(e,n){e=Xs,ke($l,e),ke(oo,n),Xs=e|n.baseLanes}function xu(){ke($l,Xs),ke(oo,oo.current)}function ku(){Xs=$l.current,me(oo),me($l)}var Dn=ce(null),Yn=null;function Ta(e){var n=e.alternate;ke(Rt,Rt.current&1),ke(Dn,e),Yn===null&&(n===null||oo.current!==null||n.memoizedState!==null)&&(Yn=e)}function Su(e){ke(Rt,Rt.current),ke(Dn,e),Yn===null&&(Yn=e)}function _g(e){e.tag===22?(ke(Rt,Rt.current),ke(Dn,e),Yn===null&&(Yn=e)):ja()}function ja(){ke(Rt,Rt.current),ke(Dn,Dn.current)}function Mn(e){me(Dn),Yn===e&&(Yn=null),me(Rt)}var Rt=ce(0);function Hl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Af(a)||Df(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var qs=0,$e=null,ft=null,Vt=null,Pl=!1,ro=!1,fi=!1,Ul=0,dr=0,lo=null,cS=0;function At(){throw Error(r(321))}function Tu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!En(e[a],n[a]))return!1;return!0}function ju(e,n,a,l,f,h){return qs=h,$e=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?sv:Hu,fi=!1,h=a(l,f),fi=!1,ro&&(h=kg(n,a,l,f)),xg(e),h}function xg(e){H.H=pr;var n=ft!==null&&ft.next!==null;if(qs=0,Vt=ft=$e=null,Pl=!1,dr=0,lo=null,n)throw Error(r(300));e===null||qt||(e=e.dependencies,e!==null&&Ml(e)&&(qt=!0))}function kg(e,n,a,l){$e=e;var f=0;do{if(ro&&(lo=null),dr=0,ro=!1,25<=f)throw Error(r(301));if(f+=1,Vt=ft=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}H.H=av,h=n(a,l)}while(ro);return h}function dS(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?ur(n):n,e=e.useState()[0],(ft!==null?ft.memoizedState:null)!==e&&($e.flags|=1024),n}function wu(){var e=Ul!==0;return Ul=0,e}function Nu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Cu(e){if(Pl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Pl=!1}qs=0,Vt=ft=$e=null,ro=!1,dr=Ul=0,lo=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?$e.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function It(){if(ft===null){var e=$e.alternate;e=e!==null?e.memoizedState:null}else e=ft.next;var n=Vt===null?$e.memoizedState:Vt.next;if(n!==null)Vt=n,ft=e;else{if(e===null)throw $e.alternate===null?Error(r(467)):Error(r(310));ft=e,e={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},Vt===null?$e.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Vl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ur(e){var n=dr;return dr+=1,lo===null&&(lo=[]),e=fg(lo,e,n),n=$e,(Vt===null?n.memoizedState:Vt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?sv:Hu),e}function ql(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ur(e);if(e.$$typeof===D)return cn(e)}throw Error(r(438,String(e)))}function Eu(e){var n=null,a=$e.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=$e.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Vl(),$e.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=Y;return n.index++,a}function Gs(e,n){return typeof n=="function"?n(e):n}function Gl(e){var n=It();return Au(n,ft,e)}function Au(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var N=x=null,I=null,G=n,X=!1;do{var ie=G.lane&-536870913;if(ie!==G.lane?(Fe&ie)===ie:(qs&ie)===ie){var K=G.revertLane;if(K===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ie===no&&(X=!0);else if((qs&K)===K){G=G.next,K===no&&(X=!0);continue}else ie={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=ie,x=h):I=I.next=ie,$e.lanes|=K,Ca|=K;ie=G.action,fi&&a(h,ie),h=G.hasEagerState?G.eagerState:a(h,ie)}else K={lane:ie,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=K,x=h):I=I.next=K,$e.lanes|=ie,Ca|=ie;G=G.next}while(G!==null&&G!==n);if(I===null?x=h:I.next=N,!En(h,e.memoizedState)&&(qt=!0,X&&(a=so,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=I,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Du(e){var n=It(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);En(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function Sg(e,n,a){var l=$e,f=It(),h=Ye;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!En((ft||f).memoizedState,a);if(x&&(f.memoizedState=a,qt=!0),f=f.queue,Iu(wg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,co(9,{destroy:void 0},jg.bind(null,l,f,a,n),null),gt===null)throw Error(r(349));h||(qs&127)!==0||Tg(l,n,a)}return a}function Tg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=$e.updateQueue,n===null?(n=Vl(),$e.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function jg(e,n,a,l){n.value=a,n.getSnapshot=l,Ng(n)&&Cg(e)}function wg(e,n,a){return a(function(){Ng(n)&&Cg(e)})}function Ng(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!En(e,a)}catch{return!0}}function Cg(e){var n=si(e,2);n!==null&&Nn(n,e,2)}function Mu(e){var n=vn();if(typeof e=="function"){var a=e;if(e=a(),fi){Cn(!0);try{a()}finally{Cn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:e},n}function Eg(e,n,a,l){return e.baseState=a,Au(e,ft,typeof l=="function"?l:Gs)}function uS(e,n,a,l,f){if(Zl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};H.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Ag(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Ag(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=H.T,x={};H.T=x;try{var N=a(f,l),I=H.S;I!==null&&I(x,N),Dg(e,n,N)}catch(G){Ru(e,n,G)}finally{h!==null&&x.types!==null&&(h.types=x.types),H.T=h}}else try{h=a(f,l),Dg(e,n,h)}catch(G){Ru(e,n,G)}}function Dg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Mg(e,n,l)},function(l){return Ru(e,n,l)}):Mg(e,n,a)}function Mg(e,n,a){n.status="fulfilled",n.value=a,Rg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Ag(e,a)))}function Ru(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,Rg(n),n=n.next;while(n!==l)}e.action=null}function Rg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ig(e,n){return n}function Og(e,n){if(Ye){var a=gt.formState;if(a!==null){e:{var l=$e;if(Ye){if(bt){t:{for(var f=bt,h=Zn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Jn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){bt=Jn(f.nextSibling),l=f.data==="F!";break e}}ba(l)}l=!1}l&&(n=a[0])}}return a=vn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:n},a.queue=l,a=ev.bind(null,$e,l),l.dispatch=a,l=Mu(!1),h=$u.bind(null,$e,!1,l.queue),l=vn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=uS.bind(null,$e,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Bg(e){var n=It();return Lg(n,ft,e)}function Lg(e,n,a){if(n=Au(e,n,Ig)[0],e=Gl(Gs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=ur(n)}catch(x){throw x===ao?Ol:x}else l=n;n=It();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&($e.flags|=2048,co(9,{destroy:void 0},fS.bind(null,f,a),null)),[l,h,e]}function fS(e,n){e.action=n}function zg(e){var n=It(),a=ft;if(a!==null)return Lg(n,a,e);It(),n=n.memoizedState,a=It();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function co(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=$e.updateQueue,n===null&&(n=Vl(),$e.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function $g(){return It().memoizedState}function Fl(e,n,a,l){var f=vn();$e.flags|=e,f.memoizedState=co(1|n,{destroy:void 0},a,l===void 0?null:l)}function Kl(e,n,a,l){var f=It();l=l===void 0?null:l;var h=f.memoizedState.inst;ft!==null&&l!==null&&Tu(l,ft.memoizedState.deps)?f.memoizedState=co(n,h,a,l):($e.flags|=e,f.memoizedState=co(1|n,h,a,l))}function Hg(e,n){Fl(8390656,8,e,n)}function Iu(e,n){Kl(2048,8,e,n)}function pS(e){$e.flags|=4;var n=$e.updateQueue;if(n===null)n=Vl(),$e.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Pg(e){var n=It().memoizedState;return pS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ug(e,n){return Kl(4,2,e,n)}function Vg(e,n){return Kl(4,4,e,n)}function qg(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gg(e,n,a){a=a!=null?a.concat([e]):null,Kl(4,4,qg.bind(null,n,e),a)}function Ou(){}function Fg(e,n){var a=It();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&Tu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Kg(e,n){var a=It();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&Tu(n,l[1]))return l[0];if(l=e(),fi){Cn(!0);try{e()}finally{Cn(!1)}}return a.memoizedState=[l,n],l}function Bu(e,n,a){return a===void 0||(qs&1073741824)!==0&&(Fe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Zv(),$e.lanes|=e,Ca|=e,a)}function Zg(e,n,a,l){return En(a,n)?a:oo.current!==null?(e=Bu(e,a,l),En(e,n)||(qt=!0),e):(qs&42)===0||(qs&1073741824)!==0&&(Fe&261930)===0?(qt=!0,e.memoizedState=a):(e=Zv(),$e.lanes|=e,Ca|=e,n)}function Yg(e,n,a,l,f){var h=B.p;B.p=h!==0&&8>h?h:8;var x=H.T,N={};H.T=N,$u(e,!1,n,a);try{var I=f(),G=H.S;if(G!==null&&G(N,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var X=lS(I,l);fr(e,n,X,On(e))}else fr(e,n,l,On(e))}catch(ie){fr(e,n,{then:function(){},status:"rejected",reason:ie},On())}finally{B.p=h,x!==null&&N.types!==null&&(x.types=N.types),H.T=x}}function mS(){}function Lu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Jg(e).queue;Yg(e,f,n,F,a===null?mS:function(){return Wg(e),a(l)})}function Jg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:F},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Wg(e){var n=Jg(e);n.next===null&&(n=e.alternate.memoizedState),fr(e,n.next.queue,{},On())}function zu(){return cn(Er)}function Xg(){return It().memoizedState}function Qg(){return It().memoizedState}function hS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=On();e=ka(a);var l=Sa(n,e,a);l!==null&&(Nn(l,n,a),rr(l,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function gS(e,n,a){var l=On();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zl(e)?tv(n,a):(a=nu(e,n,a,l),a!==null&&(Nn(a,e,l),nv(a,n,l)))}function ev(e,n,a){var l=On();fr(e,n,a,l)}function fr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zl(e))tv(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,N=h(x,a);if(f.hasEagerState=!0,f.eagerState=N,En(N,x))return Cl(e,n,f,0),gt===null&&Nl(),!1}catch{}finally{}if(a=nu(e,n,f,l),a!==null)return Nn(a,e,l),nv(a,n,l),!0}return!1}function $u(e,n,a,l){if(l={lane:2,revertLane:yf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Zl(e)){if(n)throw Error(r(479))}else n=nu(e,a,l,2),n!==null&&Nn(n,e,2)}function Zl(e){var n=e.alternate;return e===$e||n!==null&&n===$e}function tv(e,n){ro=Pl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function nv(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Qt(e,a)}}var pr={readContext:cn,use:ql,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};pr.useEffectEvent=At;var sv={readContext:cn,use:ql,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:Hg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Fl(4194308,4,qg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Fl(4194308,4,e,n)},useInsertionEffect:function(e,n){Fl(4,2,e,n)},useMemo:function(e,n){var a=vn();n=n===void 0?null:n;var l=e();if(fi){Cn(!0);try{e()}finally{Cn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=vn();if(a!==void 0){var f=a(n);if(fi){Cn(!0);try{a(n)}finally{Cn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=gS.bind(null,$e,e),[l.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=Mu(e);var n=e.queue,a=ev.bind(null,$e,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Ou,useDeferredValue:function(e,n){var a=vn();return Bu(a,e,n)},useTransition:function(){var e=Mu(!1);return e=Yg.bind(null,$e,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=$e,f=vn();if(Ye){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),gt===null)throw Error(r(349));(Fe&127)!==0||Tg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Hg(wg.bind(null,l,h,e),[e]),l.flags|=2048,co(9,{destroy:void 0},jg.bind(null,l,h,a,n),null),a},useId:function(){var e=vn(),n=gt.identifierPrefix;if(Ye){var a=js,l=Ts;a=(l&~(1<<32-Xt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ul++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=cS++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:zu,useFormState:Og,useActionState:Og,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=$u.bind(null,$e,!0,a),a.dispatch=n,[e,n]},useMemoCache:Eu,useCacheRefresh:function(){return vn().memoizedState=hS.bind(null,$e)},useEffectEvent:function(e){var n=vn(),a={impl:e};return n.memoizedState=a,function(){if((rt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Hu={readContext:cn,use:ql,useCallback:Fg,useContext:cn,useEffect:Iu,useImperativeHandle:Gg,useInsertionEffect:Ug,useLayoutEffect:Vg,useMemo:Kg,useReducer:Gl,useRef:$g,useState:function(){return Gl(Gs)},useDebugValue:Ou,useDeferredValue:function(e,n){var a=It();return Zg(a,ft.memoizedState,e,n)},useTransition:function(){var e=Gl(Gs)[0],n=It().memoizedState;return[typeof e=="boolean"?e:ur(e),n]},useSyncExternalStore:Sg,useId:Xg,useHostTransitionStatus:zu,useFormState:Bg,useActionState:Bg,useOptimistic:function(e,n){var a=It();return Eg(a,ft,e,n)},useMemoCache:Eu,useCacheRefresh:Qg};Hu.useEffectEvent=Pg;var av={readContext:cn,use:ql,useCallback:Fg,useContext:cn,useEffect:Iu,useImperativeHandle:Gg,useInsertionEffect:Ug,useLayoutEffect:Vg,useMemo:Kg,useReducer:Du,useRef:$g,useState:function(){return Du(Gs)},useDebugValue:Ou,useDeferredValue:function(e,n){var a=It();return ft===null?Bu(a,e,n):Zg(a,ft.memoizedState,e,n)},useTransition:function(){var e=Du(Gs)[0],n=It().memoizedState;return[typeof e=="boolean"?e:ur(e),n]},useSyncExternalStore:Sg,useId:Xg,useHostTransitionStatus:zu,useFormState:zg,useActionState:zg,useOptimistic:function(e,n){var a=It();return ft!==null?Eg(a,ft,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Eu,useCacheRefresh:Qg};av.useEffectEvent=Pg;function Pu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Uu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(Nn(n,e,l),rr(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(Nn(n,e,l),rr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=On(),l=ka(a);l.tag=2,n!=null&&(l.callback=n),n=Sa(e,l,a),n!==null&&(Nn(n,e,a),rr(n,e,a))}};function iv(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!Qo(a,l)||!Qo(f,h):!0}function ov(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&Uu.enqueueReplaceState(n,n.state,null)}function pi(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function rv(e){wl(e)}function lv(e){console.error(e)}function cv(e){wl(e)}function Yl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function dv(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Vu(e,n,a){return a=ka(a),a.tag=3,a.payload={element:null},a.callback=function(){Yl(e,n)},a}function uv(e){return e=ka(e),e.tag=3,e}function fv(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){dv(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){dv(n,a,l),typeof f!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}function vS(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&to(n,a,f,!0),a=Dn.current,a!==null){switch(a.tag){case 31:case 13:return Yn===null?rc():a.alternate===null&&Dt===0&&(Dt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Bl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),hf(e,l,f)),!1;case 22:return a.flags|=65536,l===Bl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),hf(e,l,f)),!1}throw Error(r(435,a.tag))}return hf(e,l,f),rc(),!1}if(Ye)return n=Dn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==lu&&(e=Error(r(422),{cause:l}),nr(Gn(e,a)))):(l!==lu&&(n=Error(r(423),{cause:l}),nr(Gn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Gn(l,a),f=Vu(e.stateNode,l,f),bu(e,f),Dt!==4&&(Dt=2)),!1;var h=Error(r(520),{cause:l});if(h=Gn(h,a),xr===null?xr=[h]:xr.push(h),Dt!==4&&(Dt=2),n===null)return!0;l=Gn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Vu(a.stateNode,l,e),bu(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ea===null||!Ea.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=uv(f),fv(f,e,a,l),bu(a,f),!1}a=a.return}while(a!==null);return!1}var qu=Error(r(461)),qt=!1;function dn(e,n,a,l){n.child=e===null?gg(n,null,a,l):ui(n,e.child,a,l)}function pv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var N in l)N!=="ref"&&(x[N]=l[N])}else x=l;return ri(n),l=ju(e,n,a,x,h,f),N=wu(),e!==null&&!qt?(Nu(e,n,f),Fs(e,n,f)):(Ye&&N&&ou(n),n.flags|=1,dn(e,n,l,f),n.child)}function mv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!su(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,hv(e,n,h,l,f)):(e=Al(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Xu(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:Qo,a(x,l)&&e.ref===n.ref)return Fs(e,n,f)}return n.flags|=1,e=Hs(h,l),e.ref=n.ref,e.return=n,n.child=e}function hv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(Qo(h,l)&&e.ref===n.ref)if(qt=!1,n.pendingProps=l=h,Xu(e,f))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,Fs(e,n,f)}return Gu(e,n,a,l,f)}function gv(e,n,a,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return vv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Il(n,h!==null?h.cachePool:null),h!==null?bg(n,h):xu(),_g(n);else return l=n.lanes=536870912,vv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Il(n,h.cachePool),bg(n,h),ja(),n.memoizedState=null):(e!==null&&Il(n,null),xu(),ja());return dn(e,n,f,a),n.child}function mr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function vv(e,n,a,l,f){var h=hu();return h=h===null?null:{parent:Ut._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Il(n,null),xu(),_g(n),e!==null&&to(e,n,l,!0),n.childLanes=f,null}function Jl(e,n){return n=Xl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function yv(e,n,a){return ui(n,e.child,null,a),e=Jl(n,n.pendingProps),e.flags|=2,Mn(n),n.memoizedState=null,e}function yS(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Ye){if(l.mode==="hidden")return e=Jl(n,l),n.lanes=536870912,mr(null,e);if(Su(n),(e=bt)?(e=A0(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:Ts,overflow:js}:null,retryLane:536870912,hydrationErrors:null},a=tg(e),a.return=n,n.child=a,ln=n,bt=null)):e=null,e===null)throw ba(n);return n.lanes=536870912,null}return Jl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(Su(n),f)if(n.flags&256)n.flags&=-257,n=yv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(qt||to(e,n,a,!1),f=(a&e.childLanes)!==0,qt||f){if(l=gt,l!==null&&(x=on(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,si(e,x),Nn(l,e,x),qu;rc(),n=yv(e,n,a)}else e=h.treeContext,bt=Jn(x.nextSibling),ln=n,Ye=!0,ya=null,Zn=!1,e!==null&&ag(n,e),n=Jl(n,l),n.flags|=4096;return n}return e=Hs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Wl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Gu(e,n,a,l,f){return ri(n),a=ju(e,n,a,l,void 0,f),l=wu(),e!==null&&!qt?(Nu(e,n,f),Fs(e,n,f)):(Ye&&l&&ou(n),n.flags|=1,dn(e,n,a,f),n.child)}function bv(e,n,a,l,f,h){return ri(n),n.updateQueue=null,a=kg(n,l,a,f),xg(e),l=wu(),e!==null&&!qt?(Nu(e,n,h),Fs(e,n,h)):(Ye&&l&&ou(n),n.flags|=1,dn(e,n,a,h),n.child)}function _v(e,n,a,l,f){if(ri(n),n.stateNode===null){var h=Wi,x=a.contextType;typeof x=="object"&&x!==null&&(h=cn(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Uu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},vu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?cn(x):Wi,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Pu(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Uu.enqueueReplaceState(h,h.state,null),cr(n,l,h,f),lr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var N=n.memoizedProps,I=pi(a,N);h.props=I;var G=h.context,X=a.contextType;x=Wi,typeof X=="object"&&X!==null&&(x=cn(X));var ie=a.getDerivedStateFromProps;X=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||G!==x)&&ov(n,h,l,x),xa=!1;var K=n.memoizedState;h.state=K,cr(n,l,h,f),lr(),G=n.memoizedState,N||K!==G||xa?(typeof ie=="function"&&(Pu(n,a,ie,l),G=n.memoizedState),(I=xa||iv(n,a,I,l,K,G,x))?(X||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=G),h.props=l,h.state=G,h.context=x,l=I):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,yu(e,n),x=n.memoizedProps,X=pi(a,x),h.props=X,ie=n.pendingProps,K=h.context,G=a.contextType,I=Wi,typeof G=="object"&&G!==null&&(I=cn(G)),N=a.getDerivedStateFromProps,(G=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ie||K!==I)&&ov(n,h,l,I),xa=!1,K=n.memoizedState,h.state=K,cr(n,l,h,f),lr();var J=n.memoizedState;x!==ie||K!==J||xa||e!==null&&e.dependencies!==null&&Ml(e.dependencies)?(typeof N=="function"&&(Pu(n,a,N,l),J=n.memoizedState),(X=xa||iv(n,a,X,l,K,J,I)||e!==null&&e.dependencies!==null&&Ml(e.dependencies))?(G||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,J,I),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,J,I)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=J),h.props=l,h.state=J,h.context=I,l=X):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Wl(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=ui(n,e.child,null,f),n.child=ui(n,null,a,f)):dn(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Fs(e,n,f),e}function xv(e,n,a,l){return ii(),n.flags|=256,dn(e,n,a,l),n.child}var Fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ku(e){return{baseLanes:e,cachePool:dg()}}function Zu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=In),e}function kv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Ye){if(f?Ta(n):ja(),(e=bt)?(e=A0(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:Ts,overflow:js}:null,retryLane:536870912,hydrationErrors:null},a=tg(e),a.return=n,n.child=a,ln=n,bt=null)):e=null,e===null)throw ba(n);return Df(e)?n.lanes=32:n.lanes=536870912,null}var N=l.children;return l=l.fallback,f?(ja(),f=n.mode,N=Xl({mode:"hidden",children:N},f),l=ai(l,f,a,null),N.return=n,l.return=n,N.sibling=l,n.child=N,l=n.child,l.memoizedState=Ku(a),l.childLanes=Zu(e,x,a),n.memoizedState=Fu,mr(null,l)):(Ta(n),Yu(n,N))}var I=e.memoizedState;if(I!==null&&(N=I.dehydrated,N!==null)){if(h)n.flags&256?(Ta(n),n.flags&=-257,n=Ju(e,n,a)):n.memoizedState!==null?(ja(),n.child=e.child,n.flags|=128,n=null):(ja(),N=l.fallback,f=n.mode,l=Xl({mode:"visible",children:l.children},f),N=ai(N,f,a,null),N.flags|=2,l.return=n,N.return=n,l.sibling=N,n.child=l,ui(n,e.child,null,a),l=n.child,l.memoizedState=Ku(a),l.childLanes=Zu(e,x,a),n.memoizedState=Fu,n=mr(null,l));else if(Ta(n),Df(N)){if(x=N.nextSibling&&N.nextSibling.dataset,x)var G=x.dgst;x=G,l=Error(r(419)),l.stack="",l.digest=x,nr({value:l,source:null,stack:null}),n=Ju(e,n,a)}else if(qt||to(e,n,a,!1),x=(a&e.childLanes)!==0,qt||x){if(x=gt,x!==null&&(l=on(x,a),l!==0&&l!==I.retryLane))throw I.retryLane=l,si(e,l),Nn(x,e,l),qu;Af(N)||rc(),n=Ju(e,n,a)}else Af(N)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,bt=Jn(N.nextSibling),ln=n,Ye=!0,ya=null,Zn=!1,e!==null&&ag(n,e),n=Yu(n,l.children),n.flags|=4096);return n}return f?(ja(),N=l.fallback,f=n.mode,I=e.child,G=I.sibling,l=Hs(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,G!==null?N=Hs(G,N):(N=ai(N,f,a,null),N.flags|=2),N.return=n,l.return=n,l.sibling=N,n.child=l,mr(null,l),l=n.child,N=e.child.memoizedState,N===null?N=Ku(a):(f=N.cachePool,f!==null?(I=Ut._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=dg(),N={baseLanes:N.baseLanes|a,cachePool:f}),l.memoizedState=N,l.childLanes=Zu(e,x,a),n.memoizedState=Fu,mr(e.child,l)):(Ta(n),a=e.child,e=a.sibling,a=Hs(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Yu(e,n){return n=Xl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Xl(e,n){return e=An(22,e,null,n),e.lanes=0,e}function Ju(e,n,a){return ui(n,e.child,null,a),e=Yu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Sv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),uu(e.return,n,a)}function Wu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function Tv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=Rt.current,N=(x&2)!==0;if(N?(x=x&1|2,n.flags|=128):x&=1,ke(Rt,x),dn(e,n,l,a),l=Ye?tr:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sv(e,a,n);else if(e.tag===19)Sv(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&Hl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Wu(n,!1,f,a,h,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Hl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Wu(n,!0,a,null,h,l);break;case"together":Wu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Fs(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Ca|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(to(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,a=Hs(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Hs(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Xu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ml(e)))}function bS(e,n,a){switch(n.tag){case 3:Oe(n,n.stateNode.containerInfo),_a(n,Ut,e.memoizedState.cache),ii();break;case 27:case 5:Nt(n);break;case 4:Oe(n,n.stateNode.containerInfo);break;case 10:_a(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Su(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Ta(n),n.flags|=128,null):(a&n.child.childLanes)!==0?kv(e,n,a):(Ta(n),e=Fs(e,n,a),e!==null?e.sibling:null);Ta(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(to(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return Tv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ke(Rt,Rt.current),l)break;return null;case 22:return n.lanes=0,gv(e,n,a,n.pendingProps);case 24:_a(n,Ut,e.memoizedState.cache)}return Fs(e,n,a)}function jv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!Xu(e,a)&&(n.flags&128)===0)return qt=!1,bS(e,n,a);qt=(e.flags&131072)!==0}else qt=!1,Ye&&(n.flags&1048576)!==0&&sg(n,tr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ci(n.elementType),n.type=e,typeof e=="function")su(e)?(l=pi(e,l),n.tag=1,n=_v(null,n,e,l,a)):(n.tag=0,n=Gu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===A){n.tag=11,n=pv(null,n,e,l,a);break e}else if(f===O){n.tag=14,n=mv(null,n,e,l,a);break e}}throw n=Z(e)||e,Error(r(306,n,""))}}return n;case 0:return Gu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=pi(l,n.pendingProps),_v(e,n,l,f,a);case 3:e:{if(Oe(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,yu(e,n),cr(n,l,null,a);var x=n.memoizedState;if(l=x.cache,_a(n,Ut,l),l!==h.cache&&fu(n,[Ut],a,!0),lr(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=xv(e,n,l,a);break e}else if(l!==f){f=Gn(Error(r(424)),n),nr(f),n=xv(e,n,l,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(bt=Jn(e.firstChild),ln=n,Ye=!0,ya=null,Zn=!0,a=gg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ii(),l===f){n=Fs(e,n,a);break e}dn(e,n,l,a)}n=n.child}return n;case 26:return Wl(e,n),e===null?(a=B0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Ye||(a=n.type,e=n.pendingProps,l=mc(yt.current).createElement(a),l[rn]=n,l[xn]=e,un(l,a,e),en(l),n.stateNode=l):n.memoizedState=B0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Nt(n),e===null&&Ye&&(l=n.stateNode=R0(n.type,n.pendingProps,yt.current),ln=n,Zn=!0,f=bt,Ra(n.type)?(Mf=f,bt=Jn(l.firstChild)):bt=f),dn(e,n,n.pendingProps.children,a),Wl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Ye&&((f=l=bt)&&(l=YS(l,n.type,n.pendingProps,Zn),l!==null?(n.stateNode=l,ln=n,bt=Jn(l.firstChild),Zn=!1,f=!0):f=!1),f||ba(n)),Nt(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,Nf(f,h)?l=null:x!==null&&Nf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=ju(e,n,dS,null,null,a),Er._currentValue=f),Wl(e,n),dn(e,n,l,a),n.child;case 6:return e===null&&Ye&&((e=a=bt)&&(a=JS(a,n.pendingProps,Zn),a!==null?(n.stateNode=a,ln=n,bt=null,e=!0):e=!1),e||ba(n)),null;case 13:return kv(e,n,a);case 4:return Oe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ui(n,null,l,a):dn(e,n,l,a),n.child;case 11:return pv(e,n,n.type,n.pendingProps,a);case 7:return dn(e,n,n.pendingProps,a),n.child;case 8:return dn(e,n,n.pendingProps.children,a),n.child;case 12:return dn(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,_a(n,n.type,l.value),dn(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ri(n),f=cn(f),l=l(f),n.flags|=1,dn(e,n,l,a),n.child;case 14:return mv(e,n,n.type,n.pendingProps,a);case 15:return hv(e,n,n.type,n.pendingProps,a);case 19:return Tv(e,n,a);case 31:return yS(e,n,a);case 22:return gv(e,n,a,n.pendingProps);case 24:return ri(n),l=cn(Ut),e===null?(f=hu(),f===null&&(f=gt,h=pu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},vu(n),_a(n,Ut,f)):((e.lanes&a)!==0&&(yu(e,n),cr(n,null,null,a),lr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),_a(n,Ut,l)):(l=h.cache,_a(n,Ut,l),l!==f.cache&&fu(n,[Ut],a,!0))),dn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Ks(e){e.flags|=4}function Qu(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Xv())e.flags|=8192;else throw di=Bl,gu}else e.flags&=-16777217}function wv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!P0(n))if(Xv())e.flags|=8192;else throw di=Bl,gu}function Ql(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Te():536870912,e.lanes|=n,mo|=n)}function hr(e,n){if(!Ye)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function _t(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function _S(e,n,a){var l=n.pendingProps;switch(ru(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(n),null;case 1:return _t(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Vs(Ut),Ht(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(eo(n)?Ks(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,cu())),_t(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Ks(n),h!==null?(_t(n),wv(n,h)):(_t(n),Qu(n,f,null,l,a))):h?h!==e.memoizedState?(Ks(n),_t(n),wv(n,h)):(_t(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ks(n),_t(n),Qu(n,f,e,l,a)),null;case 27:if(ue(n),a=yt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return _t(n),null}e=De.current,eo(n)?ig(n):(e=R0(f,l,a),n.stateNode=e,Ks(n))}return _t(n),null;case 5:if(ue(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return _t(n),null}if(h=De.current,eo(n))ig(n);else{var x=mc(yt.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[rn]=n,h[xn]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(un(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Ks(n)}}return _t(n),Qu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Ks(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=yt.current,eo(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=ln,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[rn]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||k0(e.nodeValue,a)),e||ba(n,!0)}else e=mc(e).createTextNode(l),e[rn]=n,n.stateNode=e}return _t(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=eo(n),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[rn]=n}else ii(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),e=!1}else a=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Mn(n),n):(Mn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return _t(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=eo(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[rn]=n}else ii(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;_t(n),f=!1}else f=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Mn(n),n):(Mn(n),null)}return Mn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ql(n,n.updateQueue),_t(n),null);case 4:return Ht(),e===null&&kf(n.stateNode.containerInfo),_t(n),null;case 10:return Vs(n.type),_t(n),null;case 19:if(me(Rt),l=n.memoizedState,l===null)return _t(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)hr(l,!1);else{if(Dt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Hl(e),h!==null){for(n.flags|=128,hr(l,!1),e=h.updateQueue,n.updateQueue=e,Ql(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)eg(a,e),a=a.sibling;return ke(Rt,Rt.current&1|2),Ye&&Ps(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Wt()>ac&&(n.flags|=128,f=!0,hr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Hl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Ql(n,e),hr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ye)return _t(n),null}else 2*Wt()-l.renderingStartTime>ac&&a!==536870912&&(n.flags|=128,f=!0,hr(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Wt(),e.sibling=null,a=Rt.current,ke(Rt,f?a&1|2:a&1),Ye&&Ps(n,l.treeForkCount),e):(_t(n),null);case 22:case 23:return Mn(n),ku(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(_t(n),n.subtreeFlags&6&&(n.flags|=8192)):_t(n),a=n.updateQueue,a!==null&&Ql(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&me(li),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Vs(Ut),_t(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function xS(e,n){switch(ru(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Vs(Ut),Ht(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(Mn(n),n.alternate===null)throw Error(r(340));ii()}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));ii()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(Rt),null;case 4:return Ht(),null;case 10:return Vs(n.type),null;case 22:case 23:return Mn(n),ku(),e!==null&&me(li),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Vs(Ut),null;case 25:return null;default:return null}}function Nv(e,n){switch(ru(n),n.tag){case 3:Vs(Ut),Ht();break;case 26:case 27:case 5:ue(n);break;case 4:Ht();break;case 31:n.memoizedState!==null&&Mn(n);break;case 13:Mn(n);break;case 19:me(Rt);break;case 10:Vs(n.type);break;case 22:case 23:Mn(n),ku(),e!==null&&me(li);break;case 24:Vs(Ut)}}function gr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(N){dt(n,n.return,N)}}function wa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var x=l.inst,N=x.destroy;if(N!==void 0){x.destroy=void 0,f=n;var I=a,G=N;try{G()}catch(X){dt(f,I,X)}}}l=l.next}while(l!==h)}}catch(X){dt(n,n.return,X)}}function Cv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{yg(n,a)}catch(l){dt(e,e.return,l)}}}function Ev(e,n,a){a.props=pi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){dt(e,n,l)}}function vr(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){dt(e,n,f)}}function ws(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){dt(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){dt(e,n,f)}else a.current=null}function Av(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){dt(e,e.return,f)}}function ef(e,n,a){try{var l=e.stateNode;VS(l,e.type,a,n),l[xn]=n}catch(f){dt(e,e.return,f)}}function Dv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ra(e.type)||e.tag===4}function tf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ra(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function nf(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=zs));else if(l!==4&&(l===27&&Ra(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(nf(e,n,a),e=e.sibling;e!==null;)nf(e,n,a),e=e.sibling}function ec(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&Ra(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ec(e,n,a),e=e.sibling;e!==null;)ec(e,n,a),e=e.sibling}function Mv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,l,a),n[rn]=e,n[xn]=a}catch(h){dt(e,e.return,h)}}var Zs=!1,Gt=!1,sf=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,tn=null;function kS(e,n){if(e=e.containerInfo,jf=xc,e=Gh(e),Jd(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,N=-1,I=-1,G=0,X=0,ie=e,K=null;t:for(;;){for(var J;ie!==a||f!==0&&ie.nodeType!==3||(N=x+f),ie!==h||l!==0&&ie.nodeType!==3||(I=x+l),ie.nodeType===3&&(x+=ie.nodeValue.length),(J=ie.firstChild)!==null;)K=ie,ie=J;for(;;){if(ie===e)break t;if(K===a&&++G===f&&(N=x),K===h&&++X===l&&(I=x),(J=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=J}a=N===-1||I===-1?null:{start:N,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(wf={focusedElem:e,selectionRange:a},xc=!1,tn=n;tn!==null;)if(n=tn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,tn=e;else for(;tn!==null;){switch(n=tn,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var xe=pi(a.type,f);e=l.getSnapshotBeforeUpdate(xe,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){dt(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Ef(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ef(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,tn=e;break}tn=n.return}}function Iv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Js(e,a),l&4&&gr(5,a);break;case 1:if(Js(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){dt(a,a.return,x)}else{var f=pi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){dt(a,a.return,x)}}l&64&&Cv(a),l&512&&vr(a,a.return);break;case 3:if(Js(e,a),l&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{yg(e,n)}catch(x){dt(a,a.return,x)}}break;case 27:n===null&&l&4&&Mv(a);case 26:case 5:Js(e,a),n===null&&l&4&&Av(a),l&512&&vr(a,a.return);break;case 12:Js(e,a);break;case 31:Js(e,a),l&4&&Lv(e,a);break;case 13:Js(e,a),l&4&&zv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=DS.bind(null,a),WS(e,a))));break;case 22:if(l=a.memoizedState!==null||Zs,!l){n=n!==null&&n.memoizedState!==null||Gt,f=Zs;var h=Gt;Zs=l,(Gt=n)&&!h?Ws(e,a,(a.subtreeFlags&8772)!==0):Js(e,a),Zs=f,Gt=h}break;case 30:break;default:Js(e,a)}}function Ov(e){var n=e.alternate;n!==null&&(e.alternate=null,Ov(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Rd(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Tt=null,Sn=!1;function Ys(e,n,a){for(a=a.child;a!==null;)Bv(e,n,a),a=a.sibling}function Bv(e,n,a){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(mn,a)}catch{}switch(a.tag){case 26:Gt||ws(a,n),Ys(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||ws(a,n);var l=Tt,f=Sn;Ra(a.type)&&(Tt=a.stateNode,Sn=!1),Ys(e,n,a),wr(a.stateNode),Tt=l,Sn=f;break;case 5:Gt||ws(a,n);case 6:if(l=Tt,f=Sn,Tt=null,Ys(e,n,a),Tt=l,Sn=f,Tt!==null)if(Sn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(a.stateNode)}catch(h){dt(a,n,h)}else try{Tt.removeChild(a.stateNode)}catch(h){dt(a,n,h)}break;case 18:Tt!==null&&(Sn?(e=Tt,C0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ko(e)):C0(Tt,a.stateNode));break;case 4:l=Tt,f=Sn,Tt=a.stateNode.containerInfo,Sn=!0,Ys(e,n,a),Tt=l,Sn=f;break;case 0:case 11:case 14:case 15:wa(2,a,n),Gt||wa(4,a,n),Ys(e,n,a);break;case 1:Gt||(ws(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Ev(a,n,l)),Ys(e,n,a);break;case 21:Ys(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,Ys(e,n,a),Gt=l;break;default:Ys(e,n,a)}}function Lv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ko(e)}catch(a){dt(n,n.return,a)}}}function zv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ko(e)}catch(a){dt(n,n.return,a)}}function SS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Rv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Rv),n;default:throw Error(r(435,e.tag))}}function tc(e,n){var a=SS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=MS.bind(null,e,l);l.then(f,f)}})}function Tn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,N=x;e:for(;N!==null;){switch(N.tag){case 27:if(Ra(N.type)){Tt=N.stateNode,Sn=!1;break e}break;case 5:Tt=N.stateNode,Sn=!1;break e;case 3:case 4:Tt=N.stateNode.containerInfo,Sn=!0;break e}N=N.return}if(Tt===null)throw Error(r(160));Bv(h,x,f),Tt=null,Sn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)$v(n,e),n=n.sibling}var ds=null;function $v(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Tn(n,e),jn(e),l&4&&(wa(3,e,e.return),gr(3,e),wa(5,e,e.return));break;case 1:Tn(n,e),jn(e),l&512&&(Gt||a===null||ws(a,a.return)),l&64&&Zs&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=ds;if(Tn(n,e),jn(e),l&512&&(Gt||a===null||ws(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[qo]||h[rn]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),un(h,l,a),h[rn]=e,en(h),l=h;break e;case"link":var x=$0("link","href",f).get(l+(a.href||""));if(x){for(var N=0;N<x.length;N++)if(h=x[N],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,a),f.head.appendChild(h);break;case"meta":if(x=$0("meta","content",f).get(l+(a.content||""))){for(N=0;N<x.length;N++)if(h=x[N],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[rn]=e,en(h),l=h}e.stateNode=l}else H0(f,e.type,e.stateNode);else e.stateNode=z0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?H0(f,e.type,e.stateNode):z0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ef(e,e.memoizedProps,a.memoizedProps)}break;case 27:Tn(n,e),jn(e),l&512&&(Gt||a===null||ws(a,a.return)),a!==null&&l&4&&ef(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Tn(n,e),jn(e),l&512&&(Gt||a===null||ws(a,a.return)),e.flags&32){f=e.stateNode;try{qi(f,"")}catch(xe){dt(e,e.return,xe)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,ef(e,f,a!==null?a.memoizedProps:f)),l&1024&&(sf=!0);break;case 6:if(Tn(n,e),jn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(xe){dt(e,e.return,xe)}}break;case 3:if(vc=null,f=ds,ds=hc(n.containerInfo),Tn(n,e),ds=f,jn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ko(n.containerInfo)}catch(xe){dt(e,e.return,xe)}sf&&(sf=!1,Hv(e));break;case 4:l=ds,ds=hc(e.stateNode.containerInfo),Tn(n,e),jn(e),ds=l;break;case 12:Tn(n,e),jn(e);break;case 31:Tn(n,e),jn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 13:Tn(n,e),jn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(sc=Wt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 22:f=e.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,G=Zs,X=Gt;if(Zs=G||f,Gt=X||I,Tn(n,e),Gt=X,Zs=G,jn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||I||Zs||Gt||mi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){I=a=n;try{if(h=I.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{N=I.stateNode;var ie=I.memoizedProps.style,K=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;N.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(xe){dt(I,I.return,xe)}}}else if(n.tag===6){if(a===null){I=n;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(xe){dt(I,I.return,xe)}}}else if(n.tag===18){if(a===null){I=n;try{var J=I.stateNode;f?E0(J,!0):E0(I.stateNode,!1)}catch(xe){dt(I,I.return,xe)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,tc(e,a))));break;case 19:Tn(n,e),jn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 30:break;case 21:break;default:Tn(n,e),jn(e)}}function jn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Dv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=tf(e);ec(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(qi(x,""),a.flags&=-33);var N=tf(e);ec(e,N,x);break;case 3:case 4:var I=a.stateNode.containerInfo,G=tf(e);nf(e,G,I);break;default:throw Error(r(161))}}catch(X){dt(e,e.return,X)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Hv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Hv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Js(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Iv(e,n.alternate,n),n=n.sibling}function mi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:wa(4,n,n.return),mi(n);break;case 1:ws(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Ev(n,n.return,a),mi(n);break;case 27:wr(n.stateNode);case 26:case 5:ws(n,n.return),mi(n);break;case 22:n.memoizedState===null&&mi(n);break;case 30:mi(n);break;default:mi(n)}e=e.sibling}}function Ws(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:Ws(f,h,a),gr(4,h);break;case 1:if(Ws(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){dt(l,l.return,G)}if(l=h,f=l.updateQueue,f!==null){var N=l.stateNode;try{var I=f.shared.hiddenCallbacks;if(I!==null)for(f.shared.hiddenCallbacks=null,f=0;f<I.length;f++)vg(I[f],N)}catch(G){dt(l,l.return,G)}}a&&x&64&&Cv(h),vr(h,h.return);break;case 27:Mv(h);case 26:case 5:Ws(f,h,a),a&&l===null&&x&4&&Av(h),vr(h,h.return);break;case 12:Ws(f,h,a);break;case 31:Ws(f,h,a),a&&x&4&&Lv(f,h);break;case 13:Ws(f,h,a),a&&x&4&&zv(f,h);break;case 22:h.memoizedState===null&&Ws(f,h,a),vr(h,h.return);break;case 30:break;default:Ws(f,h,a)}n=n.sibling}}function af(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&sr(a))}function of(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&sr(e))}function us(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Pv(e,n,a,l),n=n.sibling}function Pv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:us(e,n,a,l),f&2048&&gr(9,n);break;case 1:us(e,n,a,l);break;case 3:us(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&sr(e)));break;case 12:if(f&2048){us(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,N=h.onPostCommit;typeof N=="function"&&N(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){dt(n,n.return,I)}}else us(e,n,a,l);break;case 31:us(e,n,a,l);break;case 13:us(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?us(e,n,a,l):yr(e,n):h._visibility&2?us(e,n,a,l):(h._visibility|=2,uo(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&af(x,n);break;case 24:us(e,n,a,l),f&2048&&of(n.alternate,n);break;default:us(e,n,a,l)}}function uo(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,N=a,I=l,G=x.flags;switch(x.tag){case 0:case 11:case 15:uo(h,x,N,I,f),gr(8,x);break;case 23:break;case 22:var X=x.stateNode;x.memoizedState!==null?X._visibility&2?uo(h,x,N,I,f):yr(h,x):(X._visibility|=2,uo(h,x,N,I,f)),f&&G&2048&&af(x.alternate,x);break;case 24:uo(h,x,N,I,f),f&&G&2048&&of(x.alternate,x);break;default:uo(h,x,N,I,f)}n=n.sibling}}function yr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:yr(a,l),f&2048&&af(l.alternate,l);break;case 24:yr(a,l),f&2048&&of(l.alternate,l);break;default:yr(a,l)}n=n.sibling}}var br=8192;function fo(e,n,a){if(e.subtreeFlags&br)for(e=e.child;e!==null;)Uv(e,n,a),e=e.sibling}function Uv(e,n,a){switch(e.tag){case 26:fo(e,n,a),e.flags&br&&e.memoizedState!==null&&c2(a,ds,e.memoizedState,e.memoizedProps);break;case 5:fo(e,n,a);break;case 3:case 4:var l=ds;ds=hc(e.stateNode.containerInfo),fo(e,n,a),ds=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=br,br=16777216,fo(e,n,a),br=l):fo(e,n,a));break;default:fo(e,n,a)}}function Vv(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 _r(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];tn=l,Gv(l,e)}Vv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)qv(e),e=e.sibling}function qv(e){switch(e.tag){case 0:case 11:case 15:_r(e),e.flags&2048&&wa(9,e,e.return);break;case 3:_r(e);break;case 12:_r(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,nc(e)):_r(e);break;default:_r(e)}}function nc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];tn=l,Gv(l,e)}Vv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:wa(8,n,n.return),nc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,nc(n));break;default:nc(n)}e=e.sibling}}function Gv(e,n){for(;tn!==null;){var a=tn;switch(a.tag){case 0:case 11:case 15:wa(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:sr(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,tn=l;else e:for(a=e;tn!==null;){l=tn;var f=l.sibling,h=l.return;if(Ov(l),l===a){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var TS={getCacheForType:function(e){var n=cn(Ut),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return cn(Ut).controller.signal}},jS=typeof WeakMap=="function"?WeakMap:Map,rt=0,gt=null,Ve=null,Fe=0,ct=0,Rn=null,Na=!1,po=!1,rf=!1,Xs=0,Dt=0,Ca=0,hi=0,lf=0,In=0,mo=0,xr=null,wn=null,cf=!1,sc=0,Fv=0,ac=1/0,ic=null,Ea=null,Ft=0,Aa=null,ho=null,Qs=0,df=0,uf=null,Kv=null,kr=0,ff=null;function On(){return(rt&2)!==0&&Fe!==0?Fe&-Fe:H.T!==null?yf():Ss()}function Zv(){if(In===0)if((Fe&536870912)===0||Ye){var e=U;U<<=1,(U&3932160)===0&&(U=262144),In=e}else In=536870912;return e=Dn.current,e!==null&&(e.flags|=32),In}function Nn(e,n,a){(e===gt&&(ct===2||ct===9)||e.cancelPendingCommit!==null)&&(go(e,0),Da(e,Fe,In,!1)),Ge(e,a),((rt&2)===0||e!==gt)&&(e===gt&&((rt&2)===0&&(hi|=a),Dt===4&&Da(e,Fe,In,!1)),Ns(e))}function Yv(e,n,a){if((rt&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),f=l?CS(e,n):mf(e,n,!0),h=l;do{if(f===0){po&&!l&&Da(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!wS(a)){f=mf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var N=e;f=xr;var I=N.current.memoizedState.isDehydrated;if(I&&(go(N,x).flags|=256),x=mf(N,x,!1),x!==2){if(rf&&!I){N.errorRecoveryDisabledLanes|=h,hi|=h,f=4;break e}h=wn,wn=f,h!==null&&(wn===null?wn=h:wn.push.apply(wn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){go(e,0),Da(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Da(l,n,In,!Na);break e;case 2:wn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=sc+300-Wt(),10<f)){if(Da(l,n,In,!Na),pe(l,0,!0)!==0)break e;Qs=n,l.timeoutHandle=w0(Jv.bind(null,l,a,wn,ic,cf,n,In,hi,mo,Na,h,"Throttled",-0,0),f);break e}Jv(l,a,wn,ic,cf,n,In,hi,mo,Na,h,null,-0,0)}}break}while(!0);Ns(e)}function Jv(e,n,a,l,f,h,x,N,I,G,X,ie,K,J){if(e.timeoutHandle=-1,ie=n.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zs},Uv(n,h,ie);var xe=(h&62914560)===h?sc-Wt():(h&4194048)===h?Fv-Wt():0;if(xe=d2(ie,xe),xe!==null){Qs=h,e.cancelPendingCommit=xe(a0.bind(null,e,n,h,a,l,f,x,N,I,X,ie,null,K,J)),Da(e,h,x,!G);return}}a0(e,n,h,a,l,f,x,N,I)}function wS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!En(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Da(e,n,a,l){n&=~lf,n&=~hi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Xt(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&tt(e,a,n)}function oc(){return(rt&6)===0?(Sr(0),!1):!0}function pf(){if(Ve!==null){if(ct===0)var e=Ve.return;else e=Ve,Us=oi=null,Cu(e),io=null,ir=0,e=Ve;for(;e!==null;)Nv(e.alternate,e),e=e.return;Ve=null}}function go(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,FS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Qs=0,pf(),gt=e,Ve=a=Hs(e.current,null),Fe=n,ct=0,Rn=null,Na=!1,po=ye(e,n),rf=!1,mo=In=lf=hi=Ca=Dt=0,wn=xr=null,cf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-Xt(l),h=1<<f;n|=e[f],l&=~h}return Xs=n,Nl(),a}function Wv(e,n){$e=null,H.H=pr,n===ao||n===Ol?(n=pg(),ct=3):n===gu?(n=pg(),ct=4):ct=n===qu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Rn=n,Ve===null&&(Dt=1,Yl(e,Gn(n,e.current)))}function Xv(){var e=Dn.current;return e===null?!0:(Fe&4194048)===Fe?Yn===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?e===Yn:!1}function Qv(){var e=H.H;return H.H=pr,e===null?pr:e}function e0(){var e=H.A;return H.A=TS,e}function rc(){Dt=4,Na||(Fe&4194048)!==Fe&&Dn.current!==null||(po=!0),(Ca&134217727)===0&&(hi&134217727)===0||gt===null||Da(gt,Fe,In,!1)}function mf(e,n,a){var l=rt;rt|=2;var f=Qv(),h=e0();(gt!==e||Fe!==n)&&(ic=null,go(e,n)),n=!1;var x=Dt;e:do try{if(ct!==0&&Ve!==null){var N=Ve,I=Rn;switch(ct){case 8:pf(),x=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(n=!0);var G=ct;if(ct=0,Rn=null,vo(e,N,I,G),a&&po){x=0;break e}break;default:G=ct,ct=0,Rn=null,vo(e,N,I,G)}}NS(),x=Dt;break}catch(X){Wv(e,X)}while(!0);return n&&e.shellSuspendCounter++,Us=oi=null,rt=l,H.H=f,H.A=h,Ve===null&&(gt=null,Fe=0,Nl()),x}function NS(){for(;Ve!==null;)t0(Ve)}function CS(e,n){var a=rt;rt|=2;var l=Qv(),f=e0();gt!==e||Fe!==n?(ic=null,ac=Wt()+500,go(e,n)):po=ye(e,n);e:do try{if(ct!==0&&Ve!==null){n=Ve;var h=Rn;t:switch(ct){case 1:ct=0,Rn=null,vo(e,n,h,1);break;case 2:case 9:if(ug(h)){ct=0,Rn=null,n0(n);break}n=function(){ct!==2&&ct!==9||gt!==e||(ct=7),Ns(e)},h.then(n,n);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:ug(h)?(ct=0,Rn=null,n0(n)):(ct=0,Rn=null,vo(e,n,h,7));break;case 5:var x=null;switch(Ve.tag){case 26:x=Ve.memoizedState;case 5:case 27:var N=Ve;if(x?P0(x):N.stateNode.complete){ct=0,Rn=null;var I=N.sibling;if(I!==null)Ve=I;else{var G=N.return;G!==null?(Ve=G,lc(G)):Ve=null}break t}}ct=0,Rn=null,vo(e,n,h,5);break;case 6:ct=0,Rn=null,vo(e,n,h,6);break;case 8:pf(),Dt=6;break e;default:throw Error(r(462))}}ES();break}catch(X){Wv(e,X)}while(!0);return Us=oi=null,H.H=l,H.A=f,rt=a,Ve!==null?0:(gt=null,Fe=0,Nl(),Dt)}function ES(){for(;Ve!==null&&!pa();)t0(Ve)}function t0(e){var n=jv(e.alternate,e,Xs);e.memoizedProps=e.pendingProps,n===null?lc(e):Ve=n}function n0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=bv(a,n,n.pendingProps,n.type,void 0,Fe);break;case 11:n=bv(a,n,n.pendingProps,n.type.render,n.ref,Fe);break;case 5:Cu(n);default:Nv(a,n),n=Ve=eg(n,Xs),n=jv(a,n,Xs)}e.memoizedProps=e.pendingProps,n===null?lc(e):Ve=n}function vo(e,n,a,l){Us=oi=null,Cu(n),io=null,ir=0;var f=n.return;try{if(vS(e,f,n,a,Fe)){Dt=1,Yl(e,Gn(a,e.current)),Ve=null;return}}catch(h){if(f!==null)throw Ve=f,h;Dt=1,Yl(e,Gn(a,e.current)),Ve=null;return}n.flags&32768?(Ye||l===1?e=!0:po||(Fe&536870912)!==0?e=!1:(Na=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),s0(n,e)):lc(n)}function lc(e){var n=e;do{if((n.flags&32768)!==0){s0(n,Na);return}e=n.return;var a=_S(n.alternate,n,Xs);if(a!==null){Ve=a;return}if(n=n.sibling,n!==null){Ve=n;return}Ve=n=e}while(n!==null);Dt===0&&(Dt=5)}function s0(e,n){do{var a=xS(e.alternate,e);if(a!==null){a.flags&=32767,Ve=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Ve=e;return}Ve=e=a}while(e!==null);Dt=6,Ve=null}function a0(e,n,a,l,f,h,x,N,I){e.cancelPendingCommit=null;do cc();while(Ft!==0);if((rt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=tu,ht(e,a,h,x,N,I),e===gt&&(Ve=gt=null,Fe=0),ho=n,Aa=e,Qs=a,df=h,uf=f,Kv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,RS(Bs,function(){return c0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,f=B.p,B.p=2,x=rt,rt|=4;try{kS(e,n,a)}finally{rt=x,B.p=f,H.T=l}}Ft=1,i0(),o0(),r0()}}function i0(){if(Ft===1){Ft=0;var e=Aa,n=ho,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{$v(n,e);var h=wf,x=Gh(e.containerInfo),N=h.focusedElem,I=h.selectionRange;if(x!==N&&N&&N.ownerDocument&&qh(N.ownerDocument.documentElement,N)){if(I!==null&&Jd(N)){var G=I.start,X=I.end;if(X===void 0&&(X=G),"selectionStart"in N)N.selectionStart=G,N.selectionEnd=Math.min(X,N.value.length);else{var ie=N.ownerDocument||document,K=ie&&ie.defaultView||window;if(K.getSelection){var J=K.getSelection(),xe=N.textContent.length,Ce=Math.min(I.start,xe),mt=I.end===void 0?Ce:Math.min(I.end,xe);!J.extend&&Ce>mt&&(x=mt,mt=Ce,Ce=x);var P=Vh(N,Ce),z=Vh(N,mt);if(P&&z&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==z.node||J.focusOffset!==z.offset)){var q=ie.createRange();q.setStart(P.node,P.offset),J.removeAllRanges(),Ce>mt?(J.addRange(q),J.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),J.addRange(q))}}}}for(ie=[],J=N;J=J.parentNode;)J.nodeType===1&&ie.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ie.length;N++){var te=ie[N];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}xc=!!jf,wf=jf=null}finally{rt=f,B.p=l,H.T=a}}e.current=n,Ft=2}}function o0(){if(Ft===2){Ft=0;var e=Aa,n=ho,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Iv(e,n.alternate,n)}finally{rt=f,B.p=l,H.T=a}}Ft=3}}function r0(){if(Ft===4||Ft===3){Ft=0,Ri();var e=Aa,n=ho,a=Qs,l=Kv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ft=5:(Ft=0,ho=Aa=null,l0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ea=null),ks(a),n=n.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(mn,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=H.T,f=B.p,B.p=2,H.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var N=l[x];h(N.value,{componentStack:N.stack})}}finally{H.T=n,B.p=f}}(Qs&3)!==0&&cc(),Ns(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===ff?kr++:(kr=0,ff=e):kr=0,Sr(0)}}function l0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,sr(n)))}function cc(){return i0(),o0(),r0(),c0()}function c0(){if(Ft!==5)return!1;var e=Aa,n=df;df=0;var a=ks(Qs),l=H.T,f=B.p;try{B.p=32>a?32:a,H.T=null,a=uf,uf=null;var h=Aa,x=Qs;if(Ft=0,ho=Aa=null,Qs=0,(rt&6)!==0)throw Error(r(331));var N=rt;if(rt|=4,qv(h.current),Pv(h,h.current,x,a),rt=N,Sr(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(mn,h)}catch{}return!0}finally{B.p=f,H.T=l,l0(e,n)}}function d0(e,n,a){n=Gn(a,n),n=Vu(e.stateNode,n,2),e=Sa(e,n,2),e!==null&&(Ge(e,2),Ns(e))}function dt(e,n,a){if(e.tag===3)d0(e,e,a);else for(;n!==null;){if(n.tag===3){d0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))){e=Gn(a,e),a=uv(2),l=Sa(n,a,2),l!==null&&(fv(a,l,n,e),Ge(l,2),Ns(l));break}}n=n.return}}function hf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new jS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(rf=!0,f.add(a),e=AS.bind(null,e,n,a),n.then(e,e))}function AS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,gt===e&&(Fe&a)===a&&(Dt===4||Dt===3&&(Fe&62914560)===Fe&&300>Wt()-sc?(rt&2)===0&&go(e,0):lf|=a,mo===Fe&&(mo=0)),Ns(e)}function u0(e,n){n===0&&(n=Te()),e=si(e,n),e!==null&&(Ge(e,n),Ns(e))}function DS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),u0(e,a)}function MS(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),u0(e,a)}function RS(e,n){return ls(e,n)}var dc=null,yo=null,gf=!1,uc=!1,vf=!1,Ma=0;function Ns(e){e!==yo&&e.next===null&&(yo===null?dc=yo=e:yo=yo.next=e),uc=!0,gf||(gf=!0,OS())}function Sr(e,n){if(!vf&&uc){vf=!0;do for(var a=!1,l=dc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,N=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(x&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,h0(l,h))}else h=Fe,h=pe(l,l===gt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ye(l,h)||(a=!0,h0(l,h));l=l.next}while(a);vf=!1}}function IS(){f0()}function f0(){uc=gf=!1;var e=0;Ma!==0&&GS()&&(e=Ma);for(var n=Wt(),a=null,l=dc;l!==null;){var f=l.next,h=p0(l,n);h===0?(l.next=null,a===null?dc=f:a.next=f,f===null&&(yo=a)):(a=l,(e!==0||(h&3)!==0)&&(uc=!0)),l=f}Ft!==0&&Ft!==5||Sr(e),Ma!==0&&(Ma=0)}function p0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Xt(h),N=1<<x,I=f[x];I===-1?((N&a)===0||(N&l)!==0)&&(f[x]=Qe(N,n)):I<=n&&(e.expiredLanes|=N),h&=~N}if(n=gt,a=Fe,a=pe(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(ct===2||ct===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Os(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ye(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&Os(l),ks(a)){case 2:case 8:a=ma;break;case 32:a=Bs;break;case 268435456:a=Ne;break;default:a=Bs}return l=m0.bind(null,e),a=ls(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&Os(l),e.callbackPriority=2,e.callbackNode=null,2}function m0(e,n){if(Ft!==0&&Ft!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(cc()&&e.callbackNode!==a)return null;var l=Fe;return l=pe(e,e===gt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Yv(e,l,n),p0(e,Wt()),e.callbackNode!=null&&e.callbackNode===a?m0.bind(null,e):null)}function h0(e,n){if(cc())return null;Yv(e,n,!0)}function OS(){KS(function(){(rt&6)!==0?ls(Xa,IS):f0()})}function yf(){if(Ma===0){var e=no;e===0&&(e=Bi,Bi<<=1,(Bi&261888)===0&&(Bi=256)),Ma=e}return Ma}function g0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bl(""+e)}function v0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function BS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=g0((f[xn]||null).action),x=l.submitter;x&&(n=(n=x[xn]||null)?g0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var N=new Sl("action","action",null,l,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ma!==0){var I=x?v0(f,x):new FormData(f);Lu(a,{pending:!0,data:I,method:f.method,action:h},null,I)}}else typeof h=="function"&&(N.preventDefault(),I=x?v0(f,x):new FormData(f),Lu(a,{pending:!0,data:I,method:f.method,action:h},h,I))},currentTarget:f}]})}}for(var bf=0;bf<eu.length;bf++){var _f=eu[bf],LS=_f.toLowerCase(),zS=_f[0].toUpperCase()+_f.slice(1);cs(LS,"on"+zS)}cs(Zh,"onAnimationEnd"),cs(Yh,"onAnimationIteration"),cs(Jh,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(eS,"onTransitionRun"),cs(tS,"onTransitionStart"),cs(nS,"onTransitionCancel"),cs(Wh,"onTransitionEnd"),Ui("onMouseEnter",["mouseout","mouseover"]),Ui("onMouseLeave",["mouseout","mouseover"]),Ui("onPointerEnter",["pointerout","pointerover"]),Ui("onPointerLeave",["pointerout","pointerover"]),Qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$S=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tr));function y0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var x=l.length-1;0<=x;x--){var N=l[x],I=N.instance,G=N.currentTarget;if(N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){wl(X)}f.currentTarget=null,h=I}else for(x=0;x<l.length;x++){if(N=l[x],I=N.instance,G=N.currentTarget,N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){wl(X)}f.currentTarget=null,h=I}}}}function qe(e,n){var a=n[Md];a===void 0&&(a=n[Md]=new Set);var l=e+"__bubble";a.has(l)||(b0(n,e,2,!1),a.add(l))}function xf(e,n,a){var l=0;n&&(l|=4),b0(a,e,l,n)}var fc="_reactListening"+Math.random().toString(36).slice(2);function kf(e){if(!e[fc]){e[fc]=!0,fh.forEach(function(a){a!=="selectionchange"&&($S.has(a)||xf(a,!1,e),xf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[fc]||(n[fc]=!0,xf("selectionchange",!1,n))}}function b0(e,n,a,l){switch(Z0(n)){case 2:var f=p2;break;case 8:f=m2;break;default:f=Lf}a=f.bind(null,n,a,e),f=void 0,!Pd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function Sf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var N=l.stateNode.containerInfo;if(N===f)break;if(x===4)for(x=l.return;x!==null;){var I=x.tag;if((I===3||I===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;N!==null;){if(x=$i(N),x===null)return;if(I=x.tag,I===5||I===6||I===26||I===27){l=h=x;continue e}N=N.parentNode}}l=l.return}Th(function(){var G=h,X=$d(a),ie=[];e:{var K=Xh.get(e);if(K!==void 0){var J=Sl,xe=e;switch(e){case"keypress":if(xl(a)===0)break e;case"keydown":case"keyup":J=Mk;break;case"focusin":xe="focus",J=Gd;break;case"focusout":xe="blur",J=Gd;break;case"beforeblur":case"afterblur":J=Gd;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=_k;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Ok;break;case Zh:case Yh:case Jh:J=Sk;break;case Wh:J=Lk;break;case"scroll":case"scrollend":J=yk;break;case"wheel":J=$k;break;case"copy":case"cut":case"paste":J=jk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Eh;break;case"toggle":case"beforetoggle":J=Pk}var Ce=(n&4)!==0,mt=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?K!==null?K+"Capture":null:K;Ce=[];for(var z=G,q;z!==null;){var te=z;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||P===null||(te=Fo(z,P),te!=null&&Ce.push(jr(z,te,q))),mt)break;z=z.return}0<Ce.length&&(K=new J(K,xe,null,a,X),ie.push({event:K,listeners:Ce}))}}if((n&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",K&&a!==zd&&(xe=a.relatedTarget||a.fromElement)&&($i(xe)||xe[zi]))break e;if((J||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,J?(xe=a.relatedTarget||a.toElement,J=G,xe=xe?$i(xe):null,xe!==null&&(mt=d(xe),Ce=xe.tag,xe!==mt||Ce!==5&&Ce!==27&&Ce!==6)&&(xe=null)):(J=null,xe=G),J!==xe)){if(Ce=Nh,te="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Eh,te="onPointerLeave",P="onPointerEnter",z="pointer"),mt=J==null?K:Go(J),q=xe==null?K:Go(xe),K=new Ce(te,z+"leave",J,a,X),K.target=mt,K.relatedTarget=q,te=null,$i(X)===G&&(Ce=new Ce(P,z+"enter",xe,a,X),Ce.target=q,Ce.relatedTarget=mt,te=Ce),mt=te,J&&xe)t:{for(Ce=HS,P=J,z=xe,q=0,te=P;te;te=Ce(te))q++;te=0;for(var we=z;we;we=Ce(we))te++;for(;0<q-te;)P=Ce(P),q--;for(;0<te-q;)z=Ce(z),te--;for(;q--;){if(P===z||z!==null&&P===z.alternate){Ce=P;break t}P=Ce(P),z=Ce(z)}Ce=null}else Ce=null;J!==null&&_0(ie,K,J,Ce,!1),xe!==null&&mt!==null&&_0(ie,mt,xe,Ce,!0)}}e:{if(K=G?Go(G):window,J=K.nodeName&&K.nodeName.toLowerCase(),J==="select"||J==="input"&&K.type==="file")var nt=Lh;else if(Oh(K))if(zh)nt=Wk;else{nt=Yk;var Se=Zk}else J=K.nodeName,!J||J.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&Ld(G.elementType)&&(nt=Lh):nt=Jk;if(nt&&(nt=nt(e,G))){Bh(ie,nt,a,X);break e}Se&&Se(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&Bd(K,"number",K.value)}switch(Se=G?Go(G):window,e){case"focusin":(Oh(Se)||Se.contentEditable==="true")&&(Zi=Se,Wd=G,er=null);break;case"focusout":er=Wd=Zi=null;break;case"mousedown":Xd=!0;break;case"contextmenu":case"mouseup":case"dragend":Xd=!1,Fh(ie,a,X);break;case"selectionchange":if(Qk)break;case"keydown":case"keyup":Fh(ie,a,X)}var He;if(Kd)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Ki?Rh(e,a)&&(Ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ke="onCompositionStart");Ke&&(Ah&&a.locale!=="ko"&&(Ki||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Ki&&(He=jh()):(ga=X,Ud="value"in ga?ga.value:ga.textContent,Ki=!0)),Se=pc(G,Ke),0<Se.length&&(Ke=new Ch(Ke,e,null,a,X),ie.push({event:Ke,listeners:Se}),He?Ke.data=He:(He=Ih(a),He!==null&&(Ke.data=He)))),(He=Vk?qk(e,a):Gk(e,a))&&(Ke=pc(G,"onBeforeInput"),0<Ke.length&&(Se=new Ch("onBeforeInput","beforeinput",null,a,X),ie.push({event:Se,listeners:Ke}),Se.data=He)),BS(ie,e,G,a,X)}y0(ie,n)})}function jr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function pc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Fo(e,a),f!=null&&l.unshift(jr(e,f,h)),f=Fo(e,n),f!=null&&l.push(jr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function HS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function _0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var N=a,I=N.alternate,G=N.stateNode;if(N=N.tag,I!==null&&I===l)break;N!==5&&N!==26&&N!==27||G===null||(I=G,f?(G=Fo(a,h),G!=null&&x.unshift(jr(a,G,I))):f||(G=Fo(a,h),G!=null&&x.push(jr(a,G,I)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var PS=/\r\n?/g,US=/\u0000|\uFFFD/g;function x0(e){return(typeof e=="string"?e:""+e).replace(PS,`
26
- `).replace(US,"")}function k0(e,n){return n=x0(n),x0(e)===n}function pt(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||qi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&qi(e,""+l);break;case"className":vl(e,"class",l);break;case"tabIndex":vl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":vl(e,a,l);break;case"style":kh(e,l,h);break;case"data":if(n!=="object"){vl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=bl(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&pt(e,n,"name",f.name,f,null),pt(e,n,"formEncType",f.formEncType,f,null),pt(e,n,"formMethod",f.formMethod,f,null),pt(e,n,"formTarget",f.formTarget,f,null)):(pt(e,n,"encType",f.encType,f,null),pt(e,n,"method",f.method,f,null),pt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=bl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=zs);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=bl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":qe("beforetoggle",e),qe("toggle",e),gl(e,"popover",l);break;case"xlinkActuate":Ls(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ls(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ls(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ls(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ls(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ls(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ls(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":gl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=gk.get(a)||a,gl(e,a,l))}}function Tf(e,n,a,l,f,h){switch(a){case"style":kh(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?qi(e,l):(typeof l=="number"||typeof l=="bigint")&&qi(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ph.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),h=e[xn]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):gl(e,a,l)}}}function un(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:pt(e,n,h,x,a,null)}}f&&pt(e,n,"srcSet",a.srcSet,a,null),l&&pt(e,n,"src",a.src,a,null);return;case"input":qe("invalid",e);var N=h=x=f=null,I=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var X=a[l];if(X!=null)switch(l){case"name":f=X;break;case"type":x=X;break;case"checked":I=X;break;case"defaultChecked":G=X;break;case"value":h=X;break;case"defaultValue":N=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:pt(e,n,l,X,a,null)}}yh(e,h,N,I,G,x,f,!1);return;case"select":qe("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(N=a[f],N!=null))switch(f){case"value":h=N;break;case"defaultValue":x=N;break;case"multiple":l=N;default:pt(e,n,f,N,a,null)}n=h,a=x,e.multiple=!!l,n!=null?Vi(e,!!l,n,!1):a!=null&&Vi(e,!!l,a,!0);return;case"textarea":qe("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(N=a[x],N!=null))switch(x){case"value":l=N;break;case"defaultValue":f=N;break;case"children":h=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:pt(e,n,x,N,a,null)}_h(e,l,f,h);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(l=a[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:pt(e,n,I,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<Tr.length;l++)qe(Tr[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(G in a)if(a.hasOwnProperty(G)&&(l=a[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:pt(e,n,G,l,a,null)}return;default:if(Ld(n)){for(X in a)a.hasOwnProperty(X)&&(l=a[X],l!==void 0&&Tf(e,n,X,l,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(l=a[N],l!=null&&pt(e,n,N,l,a,null))}function VS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,N=null,I=null,G=null,X=null;for(J in a){var ie=a[J];if(a.hasOwnProperty(J)&&ie!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":I=ie;default:l.hasOwnProperty(J)||pt(e,n,J,null,l,ie)}}for(var K in l){var J=l[K];if(ie=a[K],l.hasOwnProperty(K)&&(J!=null||ie!=null))switch(K){case"type":h=J;break;case"name":f=J;break;case"checked":G=J;break;case"defaultChecked":X=J;break;case"value":x=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:J!==ie&&pt(e,n,K,J,l,ie)}}Od(e,x,N,I,G,X,h,f);return;case"select":J=x=N=K=null;for(h in a)if(I=a[h],a.hasOwnProperty(h)&&I!=null)switch(h){case"value":break;case"multiple":J=I;default:l.hasOwnProperty(h)||pt(e,n,h,null,l,I)}for(f in l)if(h=l[f],I=a[f],l.hasOwnProperty(f)&&(h!=null||I!=null))switch(f){case"value":K=h;break;case"defaultValue":N=h;break;case"multiple":x=h;default:h!==I&&pt(e,n,f,h,l,I)}n=N,a=x,l=J,K!=null?Vi(e,!!a,K,!1):!!l!=!!a&&(n!=null?Vi(e,!!a,n,!0):Vi(e,!!a,a?[]:"",!1));return;case"textarea":J=K=null;for(N in a)if(f=a[N],a.hasOwnProperty(N)&&f!=null&&!l.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:pt(e,n,N,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":K=f;break;case"defaultValue":J=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&pt(e,n,x,f,l,h)}bh(e,K,J);return;case"option":for(var xe in a)if(K=a[xe],a.hasOwnProperty(xe)&&K!=null&&!l.hasOwnProperty(xe))switch(xe){case"selected":e.selected=!1;break;default:pt(e,n,xe,null,l,K)}for(I in l)if(K=l[I],J=a[I],l.hasOwnProperty(I)&&K!==J&&(K!=null||J!=null))switch(I){case"selected":e.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:pt(e,n,I,K,l,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in a)K=a[Ce],a.hasOwnProperty(Ce)&&K!=null&&!l.hasOwnProperty(Ce)&&pt(e,n,Ce,null,l,K);for(G in l)if(K=l[G],J=a[G],l.hasOwnProperty(G)&&K!==J&&(K!=null||J!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:pt(e,n,G,K,l,J)}return;default:if(Ld(n)){for(var mt in a)K=a[mt],a.hasOwnProperty(mt)&&K!==void 0&&!l.hasOwnProperty(mt)&&Tf(e,n,mt,void 0,l,K);for(X in l)K=l[X],J=a[X],!l.hasOwnProperty(X)||K===J||K===void 0&&J===void 0||Tf(e,n,X,K,l,J);return}}for(var P in a)K=a[P],a.hasOwnProperty(P)&&K!=null&&!l.hasOwnProperty(P)&&pt(e,n,P,null,l,K);for(ie in l)K=l[ie],J=a[ie],!l.hasOwnProperty(ie)||K===J||K==null&&J==null||pt(e,n,ie,K,l,J)}function S0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,x=f.initiatorType,N=f.duration;if(h&&N&&S0(x)){for(x=0,N=f.responseEnd,l+=1;l<a.length;l++){var I=a[l],G=I.startTime;if(G>N)break;var X=I.transferSize,ie=I.initiatorType;X&&S0(ie)&&(I=I.responseEnd,x+=X*(I<N?1:(N-G)/(I-G)))}if(--l,n+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var jf=null,wf=null;function mc(e){return e.nodeType===9?e:e.ownerDocument}function T0(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 j0(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 Nf(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 Cf=null;function GS(){var e=window.event;return e&&e.type==="popstate"?e===Cf?!1:(Cf=e,!0):(Cf=null,!1)}var w0=typeof setTimeout=="function"?setTimeout:void 0,FS=typeof clearTimeout=="function"?clearTimeout:void 0,N0=typeof Promise=="function"?Promise:void 0,KS=typeof queueMicrotask=="function"?queueMicrotask:typeof N0<"u"?function(e){return N0.resolve(null).then(e).catch(ZS)}:w0;function ZS(e){setTimeout(function(){throw e})}function Ra(e){return e==="head"}function C0(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),ko(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")wr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,wr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,N=h.nodeName;h[qo]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&wr(e.ownerDocument.body);a=f}while(a);ko(n)}function E0(e,n){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Ef(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ef(a),Rd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function YS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[qo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Jn(e.nextSibling),e===null)break}return null}function JS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Jn(e.nextSibling),e===null))return null;return e}function A0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function Af(e){return e.data==="$?"||e.data==="$~"}function Df(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function WS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Jn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Mf=null;function D0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Jn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function M0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function R0(e,n,a){switch(n=mc(a),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function wr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Rd(e)}var Wn=new Map,I0=new Set;function hc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ea=B.d;B.d={f:XS,r:QS,D:e2,C:t2,L:n2,m:s2,X:i2,S:a2,M:o2};function XS(){var e=ea.f(),n=oc();return e||n}function QS(e){var n=Hi(e);n!==null&&n.tag===5&&n.type==="form"?Wg(n):ea.r(e)}var bo=typeof document>"u"?null:document;function O0(e,n,a){var l=bo;if(l&&typeof n=="string"&&n){var f=Vn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),I0.has(f)||(I0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function e2(e){ea.D(e),O0("dns-prefetch",e,null)}function t2(e,n){ea.C(e,n),O0("preconnect",e,n)}function n2(e,n,a){ea.L(e,n,a);var l=bo;if(l&&e&&n){var f='link[rel="preload"][as="'+Vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Vn(a.imageSizes)+'"]')):f+='[href="'+Vn(e)+'"]';var h=f;switch(n){case"style":h=_o(e);break;case"script":h=xo(e)}Wn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Wn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Nr(h))||n==="script"&&l.querySelector(Cr(h))||(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function s2(e,n){ea.m(e,n);var a=bo;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Vn(l)+'"][href="'+Vn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=xo(e)}if(!Wn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Wn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Cr(h)))return}l=a.createElement("link"),un(l,"link",e),en(l),a.head.appendChild(l)}}}function a2(e,n,a){ea.S(e,n,a);var l=bo;if(l&&e){var f=Pi(l).hoistableStyles,h=_o(e);n=n||"default";var x=f.get(h);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(Nr(h)))N.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Wn.get(h))&&Rf(e,a);var I=x=l.createElement("link");en(I),un(I,"link",e),I._p=new Promise(function(G,X){I.onload=G,I.onerror=X}),I.addEventListener("load",function(){N.loading|=1}),I.addEventListener("error",function(){N.loading|=2}),N.loading|=4,gc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:N},f.set(h,x)}}}function i2(e,n){ea.X(e,n);var a=bo;if(a&&e){var l=Pi(a).hoistableScripts,f=xo(e),h=l.get(f);h||(h=a.querySelector(Cr(f)),h||(e=b({src:e,async:!0},n),(n=Wn.get(f))&&If(e,n),h=a.createElement("script"),en(h),un(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function o2(e,n){ea.M(e,n);var a=bo;if(a&&e){var l=Pi(a).hoistableScripts,f=xo(e),h=l.get(f);h||(h=a.querySelector(Cr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Wn.get(f))&&If(e,n),h=a.createElement("script"),en(h),un(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function B0(e,n,a,l){var f=(f=yt.current)?hc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=_o(a.href),a=Pi(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=_o(a.href);var h=Pi(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(Nr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Wn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Wn.set(e,a),h||r2(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=xo(a),a=Pi(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function _o(e){return'href="'+Vn(e)+'"'}function Nr(e){return'link[rel="stylesheet"]['+e+"]"}function L0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function r2(e,n,a,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),un(n,"link",a),en(n),e.head.appendChild(n))}function xo(e){return'[src="'+Vn(e)+'"]'}function Cr(e){return"script[async]"+e}function z0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Vn(a.href)+'"]');if(l)return n.instance=l,en(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),en(l),un(l,"style",f),gc(l,a.precedence,e),n.instance=l;case"stylesheet":f=_o(a.href);var h=e.querySelector(Nr(f));if(h)return n.state.loading|=4,n.instance=h,en(h),h;l=L0(a),(f=Wn.get(f))&&Rf(l,f),h=(e.ownerDocument||e).createElement("link"),en(h);var x=h;return x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),un(h,"link",l),n.state.loading|=4,gc(h,a.precedence,e),n.instance=h;case"script":return h=xo(a.src),(f=e.querySelector(Cr(h)))?(n.instance=f,en(f),f):(l=a,(f=Wn.get(h))&&(l=b({},a),If(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),en(f),un(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,gc(l,a.precedence,e));return n.instance}function gc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,x=0;x<l.length;x++){var N=l[x];if(N.dataset.precedence===n)h=N;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Rf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function If(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var vc=null;function $0(e,n,a){if(vc===null){var l=new Map,f=vc=new Map;f.set(a,l)}else f=vc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var h=a[f];if(!(h[qo]||h[rn]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var N=l.get(x);N?N.push(h):l.set(x,[h])}}return l}function H0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function l2(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function P0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function c2(e,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=_o(l.href),h=n.querySelector(Nr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=yc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,en(h);return}h=n.ownerDocument||n,l=L0(l),(f=Wn.get(f))&&Rf(l,f),h=h.createElement("link"),en(h);var x=h;x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),un(h,"link",l),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=yc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Of=0;function d2(e,n){return e.stylesheets&&e.count===0&&_c(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Of===0&&(Of=62500*qS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Of?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function yc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_c(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bc=null;function _c(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bc=new Map,n.forEach(u2,e),bc=null,yc.call(e))}function u2(e,n){if(!(n.state.loading&4)){var a=bc.get(e);if(a)var l=a.get(null);else{a=new Map,bc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=yc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var Er={$$typeof:D,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function f2(e,n,a,l,f,h,x,N,I){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.hiddenUpdates=Be(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function U0(e,n,a,l,f,h,x,N,I,G,X,ie){return e=new f2(e,n,a,x,I,G,X,ie,N),n=1,h===!0&&(n|=24),h=An(3,null,null,n),e.current=h,h.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},vu(h),e}function V0(e){return e?(e=Wi,e):Wi}function q0(e,n,a,l,f,h){f=V0(f),l.context===null?l.context=f:l.pendingContext=f,l=ka(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=Sa(e,l,n),a!==null&&(Nn(a,e,n),rr(a,e,n))}function G0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Bf(e,n){G0(e,n),(e=e.alternate)&&G0(e,n)}function F0(e){if(e.tag===13||e.tag===31){var n=si(e,67108864);n!==null&&Nn(n,e,67108864),Bf(e,67108864)}}function K0(e){if(e.tag===13||e.tag===31){var n=On();n=Et(n);var a=si(e,n);a!==null&&Nn(a,e,n),Bf(e,n)}}var xc=!0;function p2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=2,Lf(e,n,a,l)}finally{B.p=h,H.T=f}}function m2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=8,Lf(e,n,a,l)}finally{B.p=h,H.T=f}}function Lf(e,n,a,l){if(xc){var f=zf(l);if(f===null)Sf(e,n,l,kc,a),Y0(e,l);else if(g2(f,e,n,a,l))l.stopPropagation();else if(Y0(e,l),n&4&&-1<h2.indexOf(e)){for(;f!==null;){var h=Hi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=de(h.pendingLanes);if(x!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;x;){var I=1<<31-Xt(x);N.entanglements[1]|=I,x&=~I}Ns(h),(rt&6)===0&&(ac=Wt()+500,Sr(0))}}break;case 31:case 13:N=si(h,2),N!==null&&Nn(N,h,2),oc(),Bf(h,2)}if(h=zf(l),h===null&&Sf(e,n,l,kc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else Sf(e,n,l,null,a)}}function zf(e){return e=$d(e),$f(e)}var kc=null;function $f(e){if(kc=null,e=$i(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return kc=e,null}function Z0(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(Wa()){case Xa:return 2;case ma:return 8;case Bs:case xs:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var Hf=!1,Ia=null,Oa=null,Ba=null,Ar=new Map,Dr=new Map,La=[],h2="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 Y0(e,n){switch(e){case"focusin":case"focusout":Ia=null;break;case"dragenter":case"dragleave":Oa=null;break;case"mouseover":case"mouseout":Ba=null;break;case"pointerover":case"pointerout":Ar.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dr.delete(n.pointerId)}}function Mr(e,n,a,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Hi(n),n!==null&&F0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function g2(e,n,a,l,f){switch(n){case"focusin":return Ia=Mr(Ia,e,n,a,l,f),!0;case"dragenter":return Oa=Mr(Oa,e,n,a,l,f),!0;case"mouseover":return Ba=Mr(Ba,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Ar.set(h,Mr(Ar.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Dr.set(h,Mr(Dr.get(h)||null,e,n,a,l,f)),!0}return!1}function J0(e){var n=$i(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,Li(e.priority,function(){K0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Li(e.priority,function(){K0(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=zf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);zd=l,a.target.dispatchEvent(l),zd=null}else return n=Hi(a),n!==null&&F0(n),e.blockedOn=a,!1;n.shift()}return!0}function W0(e,n,a){Sc(e)&&a.delete(n)}function v2(){Hf=!1,Ia!==null&&Sc(Ia)&&(Ia=null),Oa!==null&&Sc(Oa)&&(Oa=null),Ba!==null&&Sc(Ba)&&(Ba=null),Ar.forEach(W0),Dr.forEach(W0)}function Tc(e,n){e.blockedOn===n&&(e.blockedOn=null,Hf||(Hf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,v2)))}var jc=null;function X0(e){jc!==e&&(jc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jc===e&&(jc=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if($f(l||a)===null)continue;break}var h=Hi(a);h!==null&&(e.splice(n,3),n-=3,Lu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function ko(e){function n(I){return Tc(I,e)}Ia!==null&&Tc(Ia,e),Oa!==null&&Tc(Oa,e),Ba!==null&&Tc(Ba,e),Ar.forEach(n),Dr.forEach(n);for(var a=0;a<La.length;a++){var l=La[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<La.length&&(a=La[0],a.blockedOn===null);)J0(a),a.blockedOn===null&&La.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],x=f[xn]||null;if(typeof h=="function")x||X0(a);else if(x){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[xn]||null)N=x.formAction;else if($f(f)!==null)continue}else N=x.action;typeof N=="function"?a[l+1]=N:(a.splice(l,3),l-=3),X0(a)}}}function Q0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Pf(e){this._internalRoot=e}wc.prototype.render=Pf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=On();q0(a,l,e,n,null,null)},wc.prototype.unmount=Pf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;q0(e.current,2,null,e,null,null),oc(),n[zi]=null}};function wc(e){this._internalRoot=e}wc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ss();e={blockedOn:null,target:e,priority:n};for(var a=0;a<La.length&&n!==0&&n<La[a].priority;a++);La.splice(a,0,e),a===0&&J0(e)}};var ey=s.version;if(ey!=="19.2.4")throw Error(r(527,ey,"19.2.4"));B.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var y2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nc.isDisabled&&Nc.supportsFiber)try{mn=Nc.inject(y2),Pt=Nc}catch{}}return Rr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=rv,h=lv,x=cv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=U0(e,1,!1,null,null,a,l,null,f,h,x,Q0),e[zi]=n.current,kf(e),new Pf(n)},Rr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=rv,x=lv,N=cv,I=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),n=U0(e,1,!0,n,a??null,l,f,I,h,x,N,Q0),n.context=V0(null),a=n.current,l=On(),l=Et(l),f=ka(l),f.callback=null,Sa(a,f,l),a=l,n.current.lanes=a,Ge(n,a),Ns(n),e[zi]=n.current,kf(e),new wc(n)},Rr.version="19.2.4",Rr}var ly;function Z2(){if(ly)return Uf.exports;ly=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(),Uf.exports=K2(),Uf.exports}var Y2=Z2();const J2="modulepreload",W2=function(t){return"/"+t},cy={},k_=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(o.map(g=>{if(g=W2(g),g in cy)return;cy[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":J2,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((k,S)=>{_.addEventListener("load",k),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},X2=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),gd=C2({baseUrl:"/",fetch:X2}),ze=hd(E2,gd),Ln=hd(A2,gd),Dc=hd(D2,gd),Mc=hd(M2,gd),Q2="_bar_1xlm9_1",eT="_textarea_1xlm9_32",tT="_select_1xlm9_73",nT="_btnPrimary_1xlm9_109",sT="_btnGhost_1xlm9_179",aT="_badge_1xlm9_201",iT="_disconnectHint_1xlm9_211",vs={bar:Q2,textarea:eT,select:tT,btnPrimary:nT,btnGhost:sT,badge:aT,disconnectHint:iT},oT=200;function rT(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 lT({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:vs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:vs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Gf({value:t,onChange:s,onSubmit:o,placeholder:r,disabled:c,autoFocus:d,ariaLabel:u}){const p=y.useRef(null);y.useLayoutEffect(()=>{const g=p.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,oT)}px`)},[t]);const m=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.nativeEvent.isComposing&&(g.preventDefault(),o())};return i.jsx("textarea",{ref:p,rows:1,value:t,onChange:g=>s(g.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:vs.textarea,"aria-label":u})}function vd({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,k]=y.useState(""),[S,T]=y.useState(""),j=rT(o,u),w=()=>{if(_.trim())if(t==="send"){if(!s||j)return;p(s,_),k("")}else if(t==="spawn"){if(!o)return;m(o,_,S),b==null||b("Session started","success"),k(""),T("")}else{if(!r)return;g(r,void 0,o,_),k("")}},C=D=>{D.preventDefault(),w()};return t==="spawn"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx("span",{className:vs.badge,children:"new chat"}),i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&i.jsxs("select",{value:S,onChange:D=>T(D.target.value),className:vs.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(D=>i.jsx("option",{value:D.id,children:D.name},D.id))]}),i.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:vs.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),i.jsx("button",{type:"submit",disabled:!_.trim(),className:vs.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:C,className:vs.bar,children:[j&&o&&i.jsx(lT,{environmentId:o,onReconnect:v}),i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!j,disabled:j,ariaLabel:"Type a message"}),i.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!_.trim()||j,className:vs.btnPrimary,children:"Send"})})]})}const dy=220,uy=70,cT=40,dT=60,uT="hierarchy",fT="dependency";function pT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new ty.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:cT,ranksep:dT});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:dy,height:uy});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:uT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:fT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return ty.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-dy/2,y:p.y-uy/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
25
+ `+l.stack}}var _s=Object.prototype.hasOwnProperty,ls=t.unstable_scheduleCallback,Bs=t.unstable_cancelCallback,ma=t.unstable_shouldYield,Ri=t.unstable_requestPaint,Wt=t.unstable_now,Wa=t.unstable_getCurrentPriorityLevel,Xa=t.unstable_ImmediatePriority,ha=t.unstable_UserBlockingPriority,Ls=t.unstable_NormalPriority,xs=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Ve=t.log,bn=t.unstable_setDisableYieldValue,pn=null,Pt=null;function Nn(e){if(typeof Ve=="function"&&bn(e),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(pn,e)}catch{}}var Xt=Math.clz32?Math.clz32:Bi,Ii=Math.log,Oi=Math.LN2;function Bi(e){return e>>>=0,e===0?32:31-(Ii(e)/Oi|0)|0}var Li=256,U=262144,ae=4194304;function de(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function pe(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var N=l&134217727;return N!==0?(l=N&~h,l!==0?f=de(l):(x&=N,x!==0?f=de(x):a||(a=N&~e,a!==0&&(f=de(a))))):(N=l&~h,N!==0?f=de(N):x!==0?f=de(x):a||(a=l&~e,a!==0&&(f=de(a)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:f}function ye(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function tt(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function je(){var e=ae;return ae<<=1,(ae&62914560)===0&&(ae=4194304),e}function Le(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function Ue(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function At(e,n,a,l,f,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var N=e.entanglements,I=e.expirationTimes,G=e.hiddenUpdates;for(a=x&~a;0<a;){var X=31-Xt(a),ie=1<<X;N[X]=0,I[X]=-1;var K=G[X];if(K!==null)for(G[X]=null,X=0;X<K.length;X++){var J=K[X];J!==null&&(J.lane&=-536870913)}a&=~ie}l!==0&&qe(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function qe(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Xt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function an(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-Xt(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function Cn(e,n){var a=n&-n;return a=(a&42)!==0?1:bt(a),(a&(e.suspendedLanes|n))!==0?0:a}function bt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ks(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function zi(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:Z0(e.type))}function Ss(e,n){var a=B.p;try{return B.p=e,n()}finally{B.p=a}}var js=Math.random().toString(36).slice(2),on="__reactFiber$"+js,_n="__reactProps$"+js,$i="__reactContainer$"+js,Md="__reactEvents$"+js,ck="__reactListeners$"+js,dk="__reactHandles$"+js,uh="__reactResources$"+js,Go="__reactMarker$"+js;function Rd(e){delete e[on],delete e[_n],delete e[Md],delete e[ck],delete e[dk]}function Hi(e){var n=e[on];if(n)return n;for(var a=e.parentNode;a;){if(n=a[$i]||a[on]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=M0(e);e!==null;){if(a=e[on])return a;e=M0(e)}return n}e=a,a=e.parentNode}return null}function Pi(e){if(e=e[on]||e[$i]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Fo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Ui(e){var n=e[uh];return n||(n=e[uh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Qt(e){e[Go]=!0}var fh=new Set,ph={};function Qa(e,n){Vi(e,n),Vi(e+"Capture",n)}function Vi(e,n){for(ph[e]=n,e=0;e<n.length;e++)fh.add(n[e])}var uk=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]*$"),mh={},hh={};function fk(e){return _s.call(hh,e)?!0:_s.call(mh,e)?!1:uk.test(e)?hh[e]=!0:(mh[e]=!0,!1)}function gl(e,n,a){if(fk(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function vl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function zs(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function pk(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Id(e){if(!e._valueTracker){var n=gh(e)?"checked":"value";e._valueTracker=pk(e,n,""+e[n])}}function vh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=gh(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function yl(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 mk=/[\n"\\]/g;function Vn(e){return e.replace(mk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Od(e,n,a,l,f,h,x,N){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Un(n)):e.value!==""+Un(n)&&(e.value=""+Un(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Bd(e,x,Un(n)):a!=null?Bd(e,x,Un(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Un(N):e.removeAttribute("name")}function yh(e,n,a,l,f,h,x,N){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Id(e);return}a=a!=null?""+Un(a):"",n=n!=null?""+Un(n):a,N||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=N?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),Id(e)}function Bd(e,n,a){n==="number"&&yl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function qi(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Un(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function bh(e,n,a){if(n!=null&&(n=""+Un(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Un(a):""}function _h(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(se(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Un(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),Id(e)}function Gi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var hk=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 xh(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||hk.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function kh(e,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&xh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&xh(e,h,n[h])}function Ld(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 gk=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"]]),vk=/^[\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 bl(e){return vk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function $s(){}var zd=null;function $d(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fi=null,Ki=null;function Sh(e){var n=Pi(e);if(n&&(e=n.stateNode)){var a=e[_n]||null;e:switch(e=n.stateNode,n.type){case"input":if(Od(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Vn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[_n]||null;if(!f)throw Error(r(90));Od(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===e.form&&vh(l)}break e;case"textarea":bh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&qi(e,!!a.multiple,n,!1)}}}var Hd=!1;function jh(e,n,a){if(Hd)return e(n,a);Hd=!0;try{var l=e(n);return l}finally{if(Hd=!1,(Fi!==null||Ki!==null)&&(oc(),Fi&&(n=Fi,e=Ki,Ki=Fi=null,Sh(n),e)))for(n=0;n<e.length;n++)Sh(e[n])}}function Ko(e,n){var a=e.stateNode;if(a===null)return null;var l=a[_n]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pd=!1;if(Hs)try{var Zo={};Object.defineProperty(Zo,"passive",{get:function(){Pd=!0}}),window.addEventListener("test",Zo,Zo),window.removeEventListener("test",Zo,Zo)}catch{Pd=!1}var ga=null,Ud=null,_l=null;function Th(){if(_l)return _l;var e,n=Ud,a=n.length,l,f="value"in ga?ga.value:ga.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return _l=f.slice(e,1<l?1-l:void 0)}function xl(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 kl(){return!0}function wh(){return!1}function xn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(a=e[N],this[N]=a?a(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?kl:wh,this.isPropagationStopped=wh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),n}var ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sl=xn(ei),Yo=b({},ei,{view:0,detail:0}),yk=xn(Yo),Vd,qd,Jo,jl=b({},Yo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fd,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!==Jo&&(Jo&&e.type==="mousemove"?(Vd=e.screenX-Jo.screenX,qd=e.screenY-Jo.screenY):qd=Vd=0,Jo=e),Vd)},movementY:function(e){return"movementY"in e?e.movementY:qd}}),Nh=xn(jl),bk=b({},jl,{dataTransfer:0}),_k=xn(bk),xk=b({},Yo,{relatedTarget:0}),Gd=xn(xk),kk=b({},ei,{animationName:0,elapsedTime:0,pseudoElement:0}),Sk=xn(kk),jk=b({},ei,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Tk=xn(jk),wk=b({},ei,{data:0}),Ch=xn(wk),Nk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ck={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ek={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ak(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Ek[e])?!!n[e]:!1}function Fd(){return Ak}var Dk=b({},Yo,{key:function(e){if(e.key){var n=Nk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=xl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ck[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fd,charCode:function(e){return e.type==="keypress"?xl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mk=xn(Dk),Rk=b({},jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Eh=xn(Rk),Ik=b({},Yo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fd}),Ok=xn(Ik),Bk=b({},ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lk=xn(Bk),zk=b({},jl,{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}),$k=xn(zk),Hk=b({},ei,{newState:0,oldState:0}),Pk=xn(Hk),Uk=[9,13,27,32],Kd=Hs&&"CompositionEvent"in window,Wo=null;Hs&&"documentMode"in document&&(Wo=document.documentMode);var Vk=Hs&&"TextEvent"in window&&!Wo,Ah=Hs&&(!Kd||Wo&&8<Wo&&11>=Wo),Dh=" ",Mh=!1;function Rh(e,n){switch(e){case"keyup":return Uk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ih(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zi=!1;function qk(e,n){switch(e){case"compositionend":return Ih(n);case"keypress":return n.which!==32?null:(Mh=!0,Dh);case"textInput":return e=n.data,e===Dh&&Mh?null:e;default:return null}}function Gk(e,n){if(Zi)return e==="compositionend"||!Kd&&Rh(e,n)?(e=Th(),_l=Ud=ga=null,Zi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Ah&&n.locale!=="ko"?null:n.data;default:return null}}var Fk={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 Oh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Fk[e.type]:n==="textarea"}function Bh(e,n,a,l){Fi?Ki?Ki.push(l):Ki=[l]:Fi=l,n=pc(n,"onChange"),0<n.length&&(a=new Sl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Xo=null,Qo=null;function Kk(e){y0(e,0)}function Tl(e){var n=Fo(e);if(vh(n))return e}function Lh(e,n){if(e==="change")return n}var zh=!1;if(Hs){var Zd;if(Hs){var Yd="oninput"in document;if(!Yd){var $h=document.createElement("div");$h.setAttribute("oninput","return;"),Yd=typeof $h.oninput=="function"}Zd=Yd}else Zd=!1;zh=Zd&&(!document.documentMode||9<document.documentMode)}function Hh(){Xo&&(Xo.detachEvent("onpropertychange",Ph),Qo=Xo=null)}function Ph(e){if(e.propertyName==="value"&&Tl(Qo)){var n=[];Bh(n,Qo,e,$d(e)),jh(Kk,n)}}function Zk(e,n,a){e==="focusin"?(Hh(),Xo=n,Qo=a,Xo.attachEvent("onpropertychange",Ph)):e==="focusout"&&Hh()}function Yk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tl(Qo)}function Jk(e,n){if(e==="click")return Tl(n)}function Wk(e,n){if(e==="input"||e==="change")return Tl(n)}function Xk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var En=typeof Object.is=="function"?Object.is:Xk;function er(e,n){if(En(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!_s.call(n,f)||!En(e[f],n[f]))return!1}return!0}function Uh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vh(e,n){var a=Uh(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Uh(a)}}function qh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?qh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Gh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=yl(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=yl(e.document)}return n}function Jd(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 Qk=Hs&&"documentMode"in document&&11>=document.documentMode,Yi=null,Wd=null,tr=null,Xd=!1;function Fh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Xd||Yi==null||Yi!==yl(l)||(l=Yi,"selectionStart"in l&&Jd(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}),tr&&er(tr,l)||(tr=l,l=pc(Wd,"onSelect"),0<l.length&&(n=new Sl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Yi)))}function ti(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Ji={animationend:ti("Animation","AnimationEnd"),animationiteration:ti("Animation","AnimationIteration"),animationstart:ti("Animation","AnimationStart"),transitionrun:ti("Transition","TransitionRun"),transitionstart:ti("Transition","TransitionStart"),transitioncancel:ti("Transition","TransitionCancel"),transitionend:ti("Transition","TransitionEnd")},Qd={},Kh={};Hs&&(Kh=document.createElement("div").style,"AnimationEvent"in window||(delete Ji.animationend.animation,delete Ji.animationiteration.animation,delete Ji.animationstart.animation),"TransitionEvent"in window||delete Ji.transitionend.transition);function ni(e){if(Qd[e])return Qd[e];if(!Ji[e])return e;var n=Ji[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Kh)return Qd[e]=n[a];return e}var Zh=ni("animationend"),Yh=ni("animationiteration"),Jh=ni("animationstart"),eS=ni("transitionrun"),tS=ni("transitionstart"),nS=ni("transitioncancel"),Wh=ni("transitionend"),Xh=new Map,eu="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(" ");eu.push("scrollEnd");function cs(e,n){Xh.set(e,n),Qa(n,[e])}var wl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},qn=[],Wi=0,tu=0;function Nl(){for(var e=Wi,n=tu=Wi=0;n<e;){var a=qn[n];qn[n++]=null;var l=qn[n];qn[n++]=null;var f=qn[n];qn[n++]=null;var h=qn[n];if(qn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Qh(a,f,h)}}function Cl(e,n,a,l){qn[Wi++]=e,qn[Wi++]=n,qn[Wi++]=a,qn[Wi++]=l,tu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function nu(e,n,a,l){return Cl(e,n,a,l),El(e)}function si(e,n){return Cl(e,null,null,n),El(e)}function Qh(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Xt(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function El(e){if(50<Sr)throw Sr=0,ff=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Xi={};function sS(e,n,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(e,n,a,l){return new sS(e,n,a,l)}function su(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ps(e,n){var a=e.alternate;return a===null?(a=An(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function eg(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Al(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")su(e)&&(x=1);else if(typeof e=="string")x=l2(e,a,De.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=An(31,a,n,f),e.elementType=$,e.lanes=h,e;case j:return ai(a.children,f,h,n);case T:x=8,f|=24;break;case w:return e=An(12,a,n,f|2),e.elementType=w,e.lanes=h,e;case E:return e=An(13,a,n,f),e.elementType=E,e.lanes=h,e;case R:return e=An(19,a,n,f),e.elementType=R,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:x=10;break e;case C:x=9;break e;case A:x=11;break e;case O:x=14;break e;case M:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=An(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function ai(e,n,a,l){return e=An(7,e,l,n),e.lanes=a,e}function au(e,n,a){return e=An(6,e,null,n),e.lanes=a,e}function tg(e){var n=An(18,null,null,0);return n.stateNode=e,n}function iu(e,n,a){return n=An(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var ng=new WeakMap;function Gn(e,n){if(typeof e=="object"&&e!==null){var a=ng.get(e);return a!==void 0?a:(n={value:e,source:n,stack:sn(n)},ng.set(e,n),n)}return{value:e,source:n,stack:sn(n)}}var Qi=[],eo=0,Dl=null,nr=0,Fn=[],Kn=0,va=null,Ts=1,ws="";function Us(e,n){Qi[eo++]=nr,Qi[eo++]=Dl,Dl=e,nr=n}function sg(e,n,a){Fn[Kn++]=Ts,Fn[Kn++]=ws,Fn[Kn++]=va,va=e;var l=Ts;e=ws;var f=32-Xt(l)-1;l&=~(1<<f),a+=1;var h=32-Xt(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,Ts=1<<32-Xt(n)+f|a<<f|l,ws=h+e}else Ts=1<<h|a<<f|l,ws=e}function ou(e){e.return!==null&&(Us(e,1),sg(e,1,0))}function ru(e){for(;e===Dl;)Dl=Qi[--eo],Qi[eo]=null,nr=Qi[--eo],Qi[eo]=null;for(;e===va;)va=Fn[--Kn],Fn[Kn]=null,ws=Fn[--Kn],Fn[Kn]=null,Ts=Fn[--Kn],Fn[Kn]=null}function ag(e,n){Fn[Kn++]=Ts,Fn[Kn++]=ws,Fn[Kn++]=va,Ts=n.id,ws=n.overflow,va=e}var rn=null,xt=null,Je=!1,ya=null,Zn=!1,lu=Error(r(519));function ba(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw sr(Gn(n,e)),lu}function ig(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[on]=e,n[_n]=l,a){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(a=0;a<Tr.length;a++)Fe(Tr[a],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),yh(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),_h(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||k0(n.textContent,a)?(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=$s),n=!0):n=!1,n||ba(e,!0)}function og(e){for(rn=e.return;rn;)switch(rn.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:rn=rn.return}}function to(e){if(e!==rn)return!1;if(!Je)return og(e),Je=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Nf(e.type,e.memoizedProps)),a=!a),a&&xt&&ba(e),og(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));xt=D0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));xt=D0(e)}else n===27?(n=xt,Ra(e.type)?(e=Mf,Mf=null,xt=e):xt=n):xt=rn?Jn(e.stateNode.nextSibling):null;return!0}function ii(){xt=rn=null,Je=!1}function cu(){var e=ya;return e!==null&&(Tn===null?Tn=e:Tn.push.apply(Tn,e),ya=null),e}function sr(e){ya===null?ya=[e]:ya.push(e)}var du=ce(null),oi=null,Vs=null;function _a(e,n,a){xe(du,n._currentValue),n._currentValue=a}function qs(e){e._currentValue=du.current,me(du)}function uu(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function fu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var N=h;h=f;for(var I=0;I<n.length;I++)if(N.context===n[I]){h.lanes|=a,N=h.alternate,N!==null&&(N.lanes|=a),uu(h.return,a,e),l||(x=null);break e}h=N.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),uu(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function no(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var N=f.type;En(f.pendingProps.value,x.value)||(e!==null?e.push(N):e=[N])}}else if(f===lt.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Ar):e=[Ar])}f=f.return}e!==null&&fu(n,e,a,l),n.flags|=262144}function Ml(e){for(e=e.firstContext;e!==null;){if(!En(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ri(e){oi=e,Vs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ln(e){return rg(oi,e)}function Rl(e,n){return oi===null&&ri(e),rg(e,n)}function rg(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Vs===null){if(e===null)throw Error(r(308));Vs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Vs=Vs.next=n;return a}var aS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},iS=t.unstable_scheduleCallback,oS=t.unstable_NormalPriority,Ut={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pu(){return{controller:new aS,data:new Map,refCount:0}}function ar(e){e.refCount--,e.refCount===0&&iS(oS,function(){e.controller.abort()})}var ir=null,mu=0,so=0,ao=null;function rS(e,n){if(ir===null){var a=ir=[];mu=0,so=yf(),ao={status:"pending",value:void 0,then:function(l){a.push(l)}}}return mu++,n.then(lg,lg),n}function lg(){if(--mu===0&&ir!==null){ao!==null&&(ao.status="fulfilled");var e=ir;ir=null,so=0,ao=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function lS(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var cg=H.S;H.S=function(e,n){Fv=Wt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&rS(e,n),cg!==null&&cg(e,n)};var li=ce(null);function hu(){var e=li.current;return e!==null?e:vt.pooledCache}function Il(e,n){n===null?xe(li,li.current):xe(li,n.pool)}function dg(){var e=hu();return e===null?null:{parent:Ut._currentValue,pool:e}}var io=Error(r(460)),gu=Error(r(474)),Ol=Error(r(542)),Bl={then:function(){}};function ug(e){return e=e.status,e==="fulfilled"||e==="rejected"}function fg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then($s,$s),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,mg(e),e;default:if(typeof n.status=="string")n.then($s,$s);else{if(e=vt,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,mg(e),e}throw di=n,io}}function ci(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(di=a,io):a}}var di=null;function pg(){if(di===null)throw Error(r(459));var e=di;return di=null,e}function mg(e){if(e===io||e===Ol)throw Error(r(483))}var oo=null,or=0;function Ll(e){var n=or;return or+=1,oo===null&&(oo=[]),fg(oo,e,n)}function rr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function zl(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function hg(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function a(P,z){if(!e)return null;for(;z!==null;)n(P,z),z=z.sibling;return null}function l(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function f(P,z){return P=Ps(P,z),P.index=0,P.sibling=null,P}function h(P,z,q){return P.index=q,e?(q=P.alternate,q!==null?(q=q.index,q<z?(P.flags|=67108866,z):q):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function x(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function N(P,z,q,te){return z===null||z.tag!==6?(z=au(q,P.mode,te),z.return=P,z):(z=f(z,q),z.return=P,z)}function I(P,z,q,te){var we=q.type;return we===j?X(P,z,q.props.children,te,q.key):z!==null&&(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&ci(we)===z.type)?(z=f(z,q.props),rr(z,q),z.return=P,z):(z=Al(q.type,q.key,q.props,null,P.mode,te),rr(z,q),z.return=P,z)}function G(P,z,q,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=iu(q,P.mode,te),z.return=P,z):(z=f(z,q.children||[]),z.return=P,z)}function X(P,z,q,te,we){return z===null||z.tag!==7?(z=ai(q,P.mode,te,we),z.return=P,z):(z=f(z,q),z.return=P,z)}function ie(P,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=au(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return q=Al(z.type,z.key,z.props,null,P.mode,q),rr(q,z),q.return=P,q;case S:return z=iu(z,P.mode,q),z.return=P,z;case M:return z=ci(z),ie(P,z,q)}if(se(z)||ne(z))return z=ai(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ie(P,Ll(z),q);if(z.$$typeof===D)return ie(P,Rl(P,z),q);zl(P,z)}return null}function K(P,z,q,te){var we=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return we!==null?null:N(P,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return q.key===we?I(P,z,q,te):null;case S:return q.key===we?G(P,z,q,te):null;case M:return q=ci(q),K(P,z,q,te)}if(se(q)||ne(q))return we!==null?null:X(P,z,q,te,null);if(typeof q.then=="function")return K(P,z,Ll(q),te);if(q.$$typeof===D)return K(P,z,Rl(P,q),te);zl(P,q)}return null}function J(P,z,q,te,we){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return P=P.get(q)||null,N(z,P,""+te,we);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case k:return P=P.get(te.key===null?q:te.key)||null,I(z,P,te,we);case S:return P=P.get(te.key===null?q:te.key)||null,G(z,P,te,we);case M:return te=ci(te),J(P,z,q,te,we)}if(se(te)||ne(te))return P=P.get(q)||null,X(z,P,te,we,null);if(typeof te.then=="function")return J(P,z,q,Ll(te),we);if(te.$$typeof===D)return J(P,z,q,Rl(z,te),we);zl(z,te)}return null}function _e(P,z,q,te){for(var we=null,st=null,Se=z,$e=z=0,Ze=null;Se!==null&&$e<q.length;$e++){Se.index>$e?(Ze=Se,Se=null):Ze=Se.sibling;var at=K(P,Se,q[$e],te);if(at===null){Se===null&&(Se=Ze);break}e&&Se&&at.alternate===null&&n(P,Se),z=h(at,z,$e),st===null?we=at:st.sibling=at,st=at,Se=Ze}if($e===q.length)return a(P,Se),Je&&Us(P,$e),we;if(Se===null){for(;$e<q.length;$e++)Se=ie(P,q[$e],te),Se!==null&&(z=h(Se,z,$e),st===null?we=Se:st.sibling=Se,st=Se);return Je&&Us(P,$e),we}for(Se=l(Se);$e<q.length;$e++)Ze=J(Se,P,$e,q[$e],te),Ze!==null&&(e&&Ze.alternate!==null&&Se.delete(Ze.key===null?$e:Ze.key),z=h(Ze,z,$e),st===null?we=Ze:st.sibling=Ze,st=Ze);return e&&Se.forEach(function(za){return n(P,za)}),Je&&Us(P,$e),we}function Ce(P,z,q,te){if(q==null)throw Error(r(151));for(var we=null,st=null,Se=z,$e=z=0,Ze=null,at=q.next();Se!==null&&!at.done;$e++,at=q.next()){Se.index>$e?(Ze=Se,Se=null):Ze=Se.sibling;var za=K(P,Se,at.value,te);if(za===null){Se===null&&(Se=Ze);break}e&&Se&&za.alternate===null&&n(P,Se),z=h(za,z,$e),st===null?we=za:st.sibling=za,st=za,Se=Ze}if(at.done)return a(P,Se),Je&&Us(P,$e),we;if(Se===null){for(;!at.done;$e++,at=q.next())at=ie(P,at.value,te),at!==null&&(z=h(at,z,$e),st===null?we=at:st.sibling=at,st=at);return Je&&Us(P,$e),we}for(Se=l(Se);!at.done;$e++,at=q.next())at=J(Se,P,$e,at.value,te),at!==null&&(e&&at.alternate!==null&&Se.delete(at.key===null?$e:at.key),z=h(at,z,$e),st===null?we=at:st.sibling=at,st=at);return e&&Se.forEach(function(b2){return n(P,b2)}),Je&&Us(P,$e),we}function gt(P,z,q,te){if(typeof q=="object"&&q!==null&&q.type===j&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case k:e:{for(var we=q.key;z!==null;){if(z.key===we){if(we=q.type,we===j){if(z.tag===7){a(P,z.sibling),te=f(z,q.props.children),te.return=P,P=te;break e}}else if(z.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===M&&ci(we)===z.type){a(P,z.sibling),te=f(z,q.props),rr(te,q),te.return=P,P=te;break e}a(P,z);break}else n(P,z);z=z.sibling}q.type===j?(te=ai(q.props.children,P.mode,te,q.key),te.return=P,P=te):(te=Al(q.type,q.key,q.props,null,P.mode,te),rr(te,q),te.return=P,P=te)}return x(P);case S:e:{for(we=q.key;z!==null;){if(z.key===we)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){a(P,z.sibling),te=f(z,q.children||[]),te.return=P,P=te;break e}else{a(P,z);break}else n(P,z);z=z.sibling}te=iu(q,P.mode,te),te.return=P,P=te}return x(P);case M:return q=ci(q),gt(P,z,q,te)}if(se(q))return _e(P,z,q,te);if(ne(q)){if(we=ne(q),typeof we!="function")throw Error(r(150));return q=we.call(q),Ce(P,z,q,te)}if(typeof q.then=="function")return gt(P,z,Ll(q),te);if(q.$$typeof===D)return gt(P,z,Rl(P,q),te);zl(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(a(P,z.sibling),te=f(z,q),te.return=P,P=te):(a(P,z),te=au(q,P.mode,te),te.return=P,P=te),x(P)):a(P,z)}return function(P,z,q,te){try{or=0;var we=gt(P,z,q,te);return oo=null,we}catch(Se){if(Se===io||Se===Ol)throw Se;var st=An(29,Se,null,P.mode);return st.lanes=te,st.return=P,st}finally{}}}var ui=hg(!0),gg=hg(!1),xa=!1;function vu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Sa(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=El(e),Qh(e,null,a),n}return Cl(e,l,n,a),El(e)}function lr(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,an(e,a)}}function bu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var _u=!1;function cr(){if(_u){var e=ao;if(e!==null)throw e}}function dr(e,n,a,l){_u=!1;var f=e.updateQueue;xa=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var I=N,G=I.next;I.next=null,x===null?h=G:x.next=G,x=I;var X=e.alternate;X!==null&&(X=X.updateQueue,N=X.lastBaseUpdate,N!==x&&(N===null?X.firstBaseUpdate=G:N.next=G,X.lastBaseUpdate=I))}if(h!==null){var ie=f.baseState;x=0,X=G=I=null,N=h;do{var K=N.lane&-536870913,J=K!==N.lane;if(J?(Ke&K)===K:(l&K)===K){K!==0&&K===so&&(_u=!0),X!==null&&(X=X.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var _e=e,Ce=N;K=n;var gt=a;switch(Ce.tag){case 1:if(_e=Ce.payload,typeof _e=="function"){ie=_e.call(gt,ie,K);break e}ie=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ce.payload,K=typeof _e=="function"?_e.call(gt,ie,K):_e,K==null)break e;ie=b({},ie,K);break e;case 2:xa=!0}}K=N.callback,K!==null&&(e.flags|=64,J&&(e.flags|=8192),J=f.callbacks,J===null?f.callbacks=[K]:J.push(K))}else J={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},X===null?(G=X=J,I=ie):X=X.next=J,x|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;J=N,N=J.next,J.next=null,f.lastBaseUpdate=J,f.shared.pending=null}}while(!0);X===null&&(I=ie),f.baseState=I,f.firstBaseUpdate=G,f.lastBaseUpdate=X,h===null&&(f.shared.lanes=0),Ca|=x,e.lanes=x,e.memoizedState=ie}}function vg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function yg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)vg(a[e],n)}var ro=ce(null),$l=ce(0);function bg(e,n){e=Qs,xe($l,e),xe(ro,n),Qs=e|n.baseLanes}function xu(){xe($l,Qs),xe(ro,ro.current)}function ku(){Qs=$l.current,me(ro),me($l)}var Dn=ce(null),Yn=null;function ja(e){var n=e.alternate;xe(It,It.current&1),xe(Dn,e),Yn===null&&(n===null||ro.current!==null||n.memoizedState!==null)&&(Yn=e)}function Su(e){xe(It,It.current),xe(Dn,e),Yn===null&&(Yn=e)}function _g(e){e.tag===22?(xe(It,It.current),xe(Dn,e),Yn===null&&(Yn=e)):Ta()}function Ta(){xe(It,It.current),xe(Dn,Dn.current)}function Mn(e){me(Dn),Yn===e&&(Yn=null),me(It)}var It=ce(0);function Hl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Af(a)||Df(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Gs=0,ze=null,mt=null,Vt=null,Pl=!1,lo=!1,fi=!1,Ul=0,ur=0,co=null,cS=0;function Dt(){throw Error(r(321))}function ju(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!En(e[a],n[a]))return!1;return!0}function Tu(e,n,a,l,f,h){return Gs=h,ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?sv:Hu,fi=!1,h=a(l,f),fi=!1,lo&&(h=kg(n,a,l,f)),xg(e),h}function xg(e){H.H=mr;var n=mt!==null&&mt.next!==null;if(Gs=0,Vt=mt=ze=null,Pl=!1,ur=0,co=null,n)throw Error(r(300));e===null||qt||(e=e.dependencies,e!==null&&Ml(e)&&(qt=!0))}function kg(e,n,a,l){ze=e;var f=0;do{if(lo&&(co=null),ur=0,lo=!1,25<=f)throw Error(r(301));if(f+=1,Vt=mt=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}H.H=av,h=n(a,l)}while(lo);return h}function dS(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?fr(n):n,e=e.useState()[0],(mt!==null?mt.memoizedState:null)!==e&&(ze.flags|=1024),n}function wu(){var e=Ul!==0;return Ul=0,e}function Nu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function Cu(e){if(Pl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Pl=!1}Gs=0,Vt=mt=ze=null,lo=!1,ur=Ul=0,co=null}function gn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?ze.memoizedState=Vt=e:Vt=Vt.next=e,Vt}function Ot(){if(mt===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=mt.next;var n=Vt===null?ze.memoizedState:Vt.next;if(n!==null)Vt=n,mt=e;else{if(e===null)throw ze.alternate===null?Error(r(467)):Error(r(310));mt=e,e={memoizedState:mt.memoizedState,baseState:mt.baseState,baseQueue:mt.baseQueue,queue:mt.queue,next:null},Vt===null?ze.memoizedState=Vt=e:Vt=Vt.next=e}return Vt}function Vl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fr(e){var n=ur;return ur+=1,co===null&&(co=[]),e=fg(co,e,n),n=ze,(Vt===null?n.memoizedState:Vt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?sv:Hu),e}function ql(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return fr(e);if(e.$$typeof===D)return ln(e)}throw Error(r(438,String(e)))}function Eu(e){var n=null,a=ze.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=ze.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Vl(),ze.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=Y;return n.index++,a}function Fs(e,n){return typeof n=="function"?n(e):n}function Gl(e){var n=Ot();return Au(n,mt,e)}function Au(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var N=x=null,I=null,G=n,X=!1;do{var ie=G.lane&-536870913;if(ie!==G.lane?(Ke&ie)===ie:(Gs&ie)===ie){var K=G.revertLane;if(K===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null}),ie===so&&(X=!0);else if((Gs&K)===K){G=G.next,K===so&&(X=!0);continue}else ie={lane:0,revertLane:G.revertLane,gesture:null,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=ie,x=h):I=I.next=ie,ze.lanes|=K,Ca|=K;ie=G.action,fi&&a(h,ie),h=G.hasEagerState?G.eagerState:a(h,ie)}else K={lane:ie,revertLane:G.revertLane,gesture:G.gesture,action:G.action,hasEagerState:G.hasEagerState,eagerState:G.eagerState,next:null},I===null?(N=I=K,x=h):I=I.next=K,ze.lanes|=ie,Ca|=ie;G=G.next}while(G!==null&&G!==n);if(I===null?x=h:I.next=N,!En(h,e.memoizedState)&&(qt=!0,X&&(a=ao,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=I,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Du(e){var n=Ot(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);En(h,n.memoizedState)||(qt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function Sg(e,n,a){var l=ze,f=Ot(),h=Je;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!En((mt||f).memoizedState,a);if(x&&(f.memoizedState=a,qt=!0),f=f.queue,Iu(wg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,uo(9,{destroy:void 0},Tg.bind(null,l,f,a,n),null),vt===null)throw Error(r(349));h||(Gs&127)!==0||jg(l,n,a)}return a}function jg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=ze.updateQueue,n===null?(n=Vl(),ze.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function Tg(e,n,a,l){n.value=a,n.getSnapshot=l,Ng(n)&&Cg(e)}function wg(e,n,a){return a(function(){Ng(n)&&Cg(e)})}function Ng(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!En(e,a)}catch{return!0}}function Cg(e){var n=si(e,2);n!==null&&wn(n,e,2)}function Mu(e){var n=gn();if(typeof e=="function"){var a=e;if(e=a(),fi){Nn(!0);try{a()}finally{Nn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:e},n}function Eg(e,n,a,l){return e.baseState=a,Au(e,mt,typeof l=="function"?l:Fs)}function uS(e,n,a,l,f){if(Zl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};H.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,Ag(n,h)):(h.next=a.next,n.pending=a.next=h)}}function Ag(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=H.T,x={};H.T=x;try{var N=a(f,l),I=H.S;I!==null&&I(x,N),Dg(e,n,N)}catch(G){Ru(e,n,G)}finally{h!==null&&x.types!==null&&(h.types=x.types),H.T=h}}else try{h=a(f,l),Dg(e,n,h)}catch(G){Ru(e,n,G)}}function Dg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Mg(e,n,l)},function(l){return Ru(e,n,l)}):Mg(e,n,a)}function Mg(e,n,a){n.status="fulfilled",n.value=a,Rg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,Ag(e,a)))}function Ru(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,Rg(n),n=n.next;while(n!==l)}e.action=null}function Rg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Ig(e,n){return n}function Og(e,n){if(Je){var a=vt.formState;if(a!==null){e:{var l=ze;if(Je){if(xt){t:{for(var f=xt,h=Zn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Jn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){xt=Jn(f.nextSibling),l=f.data==="F!";break e}}ba(l)}l=!1}l&&(n=a[0])}}return a=gn(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ig,lastRenderedState:n},a.queue=l,a=ev.bind(null,ze,l),l.dispatch=a,l=Mu(!1),h=$u.bind(null,ze,!1,l.queue),l=gn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=uS.bind(null,ze,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Bg(e){var n=Ot();return Lg(n,mt,e)}function Lg(e,n,a){if(n=Au(e,n,Ig)[0],e=Gl(Fs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=fr(n)}catch(x){throw x===io?Ol:x}else l=n;n=Ot();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(ze.flags|=2048,uo(9,{destroy:void 0},fS.bind(null,f,a),null)),[l,h,e]}function fS(e,n){e.action=n}function zg(e){var n=Ot(),a=mt;if(a!==null)return Lg(n,a,e);Ot(),n=n.memoizedState,a=Ot();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function uo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=ze.updateQueue,n===null&&(n=Vl(),ze.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function $g(){return Ot().memoizedState}function Fl(e,n,a,l){var f=gn();ze.flags|=e,f.memoizedState=uo(1|n,{destroy:void 0},a,l===void 0?null:l)}function Kl(e,n,a,l){var f=Ot();l=l===void 0?null:l;var h=f.memoizedState.inst;mt!==null&&l!==null&&ju(l,mt.memoizedState.deps)?f.memoizedState=uo(n,h,a,l):(ze.flags|=e,f.memoizedState=uo(1|n,h,a,l))}function Hg(e,n){Fl(8390656,8,e,n)}function Iu(e,n){Kl(2048,8,e,n)}function pS(e){ze.flags|=4;var n=ze.updateQueue;if(n===null)n=Vl(),ze.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Pg(e){var n=Ot().memoizedState;return pS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ug(e,n){return Kl(4,2,e,n)}function Vg(e,n){return Kl(4,4,e,n)}function qg(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Gg(e,n,a){a=a!=null?a.concat([e]):null,Kl(4,4,qg.bind(null,n,e),a)}function Ou(){}function Fg(e,n){var a=Ot();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&ju(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Kg(e,n){var a=Ot();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&ju(n,l[1]))return l[0];if(l=e(),fi){Nn(!0);try{e()}finally{Nn(!1)}}return a.memoizedState=[l,n],l}function Bu(e,n,a){return a===void 0||(Gs&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Zv(),ze.lanes|=e,Ca|=e,a)}function Zg(e,n,a,l){return En(a,n)?a:ro.current!==null?(e=Bu(e,a,l),En(e,n)||(qt=!0),e):(Gs&42)===0||(Gs&1073741824)!==0&&(Ke&261930)===0?(qt=!0,e.memoizedState=a):(e=Zv(),ze.lanes|=e,Ca|=e,n)}function Yg(e,n,a,l,f){var h=B.p;B.p=h!==0&&8>h?h:8;var x=H.T,N={};H.T=N,$u(e,!1,n,a);try{var I=f(),G=H.S;if(G!==null&&G(N,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var X=lS(I,l);pr(e,n,X,On(e))}else pr(e,n,l,On(e))}catch(ie){pr(e,n,{then:function(){},status:"rejected",reason:ie},On())}finally{B.p=h,x!==null&&N.types!==null&&(x.types=N.types),H.T=x}}function mS(){}function Lu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Jg(e).queue;Yg(e,f,n,F,a===null?mS:function(){return Wg(e),a(l)})}function Jg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:F},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Wg(e){var n=Jg(e);n.next===null&&(n=e.alternate.memoizedState),pr(e,n.next.queue,{},On())}function zu(){return ln(Ar)}function Xg(){return Ot().memoizedState}function Qg(){return Ot().memoizedState}function hS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=On();e=ka(a);var l=Sa(n,e,a);l!==null&&(wn(l,n,a),lr(l,n,a)),n={cache:pu()},e.payload=n;return}n=n.return}}function gS(e,n,a){var l=On();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Zl(e)?tv(n,a):(a=nu(e,n,a,l),a!==null&&(wn(a,e,l),nv(a,n,l)))}function ev(e,n,a){var l=On();pr(e,n,a,l)}function pr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Zl(e))tv(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,N=h(x,a);if(f.hasEagerState=!0,f.eagerState=N,En(N,x))return Cl(e,n,f,0),vt===null&&Nl(),!1}catch{}finally{}if(a=nu(e,n,f,l),a!==null)return wn(a,e,l),nv(a,n,l),!0}return!1}function $u(e,n,a,l){if(l={lane:2,revertLane:yf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Zl(e)){if(n)throw Error(r(479))}else n=nu(e,a,l,2),n!==null&&wn(n,e,2)}function Zl(e){var n=e.alternate;return e===ze||n!==null&&n===ze}function tv(e,n){lo=Pl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function nv(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,an(e,a)}}var mr={readContext:ln,use:ql,useCallback:Dt,useContext:Dt,useEffect:Dt,useImperativeHandle:Dt,useLayoutEffect:Dt,useInsertionEffect:Dt,useMemo:Dt,useReducer:Dt,useRef:Dt,useState:Dt,useDebugValue:Dt,useDeferredValue:Dt,useTransition:Dt,useSyncExternalStore:Dt,useId:Dt,useHostTransitionStatus:Dt,useFormState:Dt,useActionState:Dt,useOptimistic:Dt,useMemoCache:Dt,useCacheRefresh:Dt};mr.useEffectEvent=Dt;var sv={readContext:ln,use:ql,useCallback:function(e,n){return gn().memoizedState=[e,n===void 0?null:n],e},useContext:ln,useEffect:Hg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Fl(4194308,4,qg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Fl(4194308,4,e,n)},useInsertionEffect:function(e,n){Fl(4,2,e,n)},useMemo:function(e,n){var a=gn();n=n===void 0?null:n;var l=e();if(fi){Nn(!0);try{e()}finally{Nn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=gn();if(a!==void 0){var f=a(n);if(fi){Nn(!0);try{a(n)}finally{Nn(!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=gS.bind(null,ze,e),[l.memoizedState,e]},useRef:function(e){var n=gn();return e={current:e},n.memoizedState=e},useState:function(e){e=Mu(e);var n=e.queue,a=ev.bind(null,ze,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Ou,useDeferredValue:function(e,n){var a=gn();return Bu(a,e,n)},useTransition:function(){var e=Mu(!1);return e=Yg.bind(null,ze,e.queue,!0,!1),gn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=ze,f=gn();if(Je){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),vt===null)throw Error(r(349));(Ke&127)!==0||jg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Hg(wg.bind(null,l,h,e),[e]),l.flags|=2048,uo(9,{destroy:void 0},Tg.bind(null,l,h,a,n),null),a},useId:function(){var e=gn(),n=vt.identifierPrefix;if(Je){var a=ws,l=Ts;a=(l&~(1<<32-Xt(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ul++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=cS++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:zu,useFormState:Og,useActionState:Og,useOptimistic:function(e){var n=gn();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=$u.bind(null,ze,!0,a),a.dispatch=n,[e,n]},useMemoCache:Eu,useCacheRefresh:function(){return gn().memoizedState=hS.bind(null,ze)},useEffectEvent:function(e){var n=gn(),a={impl:e};return n.memoizedState=a,function(){if((rt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Hu={readContext:ln,use:ql,useCallback:Fg,useContext:ln,useEffect:Iu,useImperativeHandle:Gg,useInsertionEffect:Ug,useLayoutEffect:Vg,useMemo:Kg,useReducer:Gl,useRef:$g,useState:function(){return Gl(Fs)},useDebugValue:Ou,useDeferredValue:function(e,n){var a=Ot();return Zg(a,mt.memoizedState,e,n)},useTransition:function(){var e=Gl(Fs)[0],n=Ot().memoizedState;return[typeof e=="boolean"?e:fr(e),n]},useSyncExternalStore:Sg,useId:Xg,useHostTransitionStatus:zu,useFormState:Bg,useActionState:Bg,useOptimistic:function(e,n){var a=Ot();return Eg(a,mt,e,n)},useMemoCache:Eu,useCacheRefresh:Qg};Hu.useEffectEvent=Pg;var av={readContext:ln,use:ql,useCallback:Fg,useContext:ln,useEffect:Iu,useImperativeHandle:Gg,useInsertionEffect:Ug,useLayoutEffect:Vg,useMemo:Kg,useReducer:Du,useRef:$g,useState:function(){return Du(Fs)},useDebugValue:Ou,useDeferredValue:function(e,n){var a=Ot();return mt===null?Bu(a,e,n):Zg(a,mt.memoizedState,e,n)},useTransition:function(){var e=Du(Fs)[0],n=Ot().memoizedState;return[typeof e=="boolean"?e:fr(e),n]},useSyncExternalStore:Sg,useId:Xg,useHostTransitionStatus:zu,useFormState:zg,useActionState:zg,useOptimistic:function(e,n){var a=Ot();return mt!==null?Eg(a,mt,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Eu,useCacheRefresh:Qg};av.useEffectEvent=Pg;function Pu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Uu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(wn(n,e,l),lr(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=On(),f=ka(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=Sa(e,f,l),n!==null&&(wn(n,e,l),lr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=On(),l=ka(a);l.tag=2,n!=null&&(l.callback=n),n=Sa(e,l,a),n!==null&&(wn(n,e,a),lr(n,e,a))}};function iv(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!er(a,l)||!er(f,h):!0}function ov(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&Uu.enqueueReplaceState(n,n.state,null)}function pi(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function rv(e){wl(e)}function lv(e){console.error(e)}function cv(e){wl(e)}function Yl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function dv(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Vu(e,n,a){return a=ka(a),a.tag=3,a.payload={element:null},a.callback=function(){Yl(e,n)},a}function uv(e){return e=ka(e),e.tag=3,e}function fv(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){dv(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){dv(n,a,l),typeof f!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}function vS(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&no(n,a,f,!0),a=Dn.current,a!==null){switch(a.tag){case 31:case 13:return Yn===null?rc():a.alternate===null&&Mt===0&&(Mt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Bl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),hf(e,l,f)),!1;case 22:return a.flags|=65536,l===Bl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),hf(e,l,f)),!1}throw Error(r(435,a.tag))}return hf(e,l,f),rc(),!1}if(Je)return n=Dn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==lu&&(e=Error(r(422),{cause:l}),sr(Gn(e,a)))):(l!==lu&&(n=Error(r(423),{cause:l}),sr(Gn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Gn(l,a),f=Vu(e.stateNode,l,f),bu(e,f),Mt!==4&&(Mt=2)),!1;var h=Error(r(520),{cause:l});if(h=Gn(h,a),kr===null?kr=[h]:kr.push(h),Mt!==4&&(Mt=2),n===null)return!0;l=Gn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Vu(a.stateNode,l,e),bu(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ea===null||!Ea.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=uv(f),fv(f,e,a,l),bu(a,f),!1}a=a.return}while(a!==null);return!1}var qu=Error(r(461)),qt=!1;function cn(e,n,a,l){n.child=e===null?gg(n,null,a,l):ui(n,e.child,a,l)}function pv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var N in l)N!=="ref"&&(x[N]=l[N])}else x=l;return ri(n),l=Tu(e,n,a,x,h,f),N=wu(),e!==null&&!qt?(Nu(e,n,f),Ks(e,n,f)):(Je&&N&&ou(n),n.flags|=1,cn(e,n,l,f),n.child)}function mv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!su(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,hv(e,n,h,l,f)):(e=Al(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Xu(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:er,a(x,l)&&e.ref===n.ref)return Ks(e,n,f)}return n.flags|=1,e=Ps(h,l),e.ref=n.ref,e.return=n,n.child=e}function hv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(er(h,l)&&e.ref===n.ref)if(qt=!1,n.pendingProps=l=h,Xu(e,f))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,Ks(e,n,f)}return Gu(e,n,a,l,f)}function gv(e,n,a,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return vv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Il(n,h!==null?h.cachePool:null),h!==null?bg(n,h):xu(),_g(n);else return l=n.lanes=536870912,vv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(Il(n,h.cachePool),bg(n,h),Ta(),n.memoizedState=null):(e!==null&&Il(n,null),xu(),Ta());return cn(e,n,f,a),n.child}function hr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function vv(e,n,a,l,f){var h=hu();return h=h===null?null:{parent:Ut._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&Il(n,null),xu(),_g(n),e!==null&&no(e,n,l,!0),n.childLanes=f,null}function Jl(e,n){return n=Xl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function yv(e,n,a){return ui(n,e.child,null,a),e=Jl(n,n.pendingProps),e.flags|=2,Mn(n),n.memoizedState=null,e}function yS(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=Jl(n,l),n.lanes=536870912,hr(null,e);if(Su(n),(e=xt)?(e=A0(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:Ts,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},a=tg(e),a.return=n,n.child=a,rn=n,xt=null)):e=null,e===null)throw ba(n);return n.lanes=536870912,null}return Jl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(Su(n),f)if(n.flags&256)n.flags&=-257,n=yv(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(qt||no(e,n,a,!1),f=(a&e.childLanes)!==0,qt||f){if(l=vt,l!==null&&(x=Cn(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,si(e,x),wn(l,e,x),qu;rc(),n=yv(e,n,a)}else e=h.treeContext,xt=Jn(x.nextSibling),rn=n,Je=!0,ya=null,Zn=!1,e!==null&&ag(n,e),n=Jl(n,l),n.flags|=4096;return n}return e=Ps(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Wl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Gu(e,n,a,l,f){return ri(n),a=Tu(e,n,a,l,void 0,f),l=wu(),e!==null&&!qt?(Nu(e,n,f),Ks(e,n,f)):(Je&&l&&ou(n),n.flags|=1,cn(e,n,a,f),n.child)}function bv(e,n,a,l,f,h){return ri(n),n.updateQueue=null,a=kg(n,l,a,f),xg(e),l=wu(),e!==null&&!qt?(Nu(e,n,h),Ks(e,n,h)):(Je&&l&&ou(n),n.flags|=1,cn(e,n,a,h),n.child)}function _v(e,n,a,l,f){if(ri(n),n.stateNode===null){var h=Xi,x=a.contextType;typeof x=="object"&&x!==null&&(h=ln(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Uu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},vu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?ln(x):Xi,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Pu(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Uu.enqueueReplaceState(h,h.state,null),dr(n,l,h,f),cr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var N=n.memoizedProps,I=pi(a,N);h.props=I;var G=h.context,X=a.contextType;x=Xi,typeof X=="object"&&X!==null&&(x=ln(X));var ie=a.getDerivedStateFromProps;X=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",N=n.pendingProps!==N,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(N||G!==x)&&ov(n,h,l,x),xa=!1;var K=n.memoizedState;h.state=K,dr(n,l,h,f),cr(),G=n.memoizedState,N||K!==G||xa?(typeof ie=="function"&&(Pu(n,a,ie,l),G=n.memoizedState),(I=xa||iv(n,a,I,l,K,G,x))?(X||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=G),h.props=l,h.state=G,h.context=x,l=I):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,yu(e,n),x=n.memoizedProps,X=pi(a,x),h.props=X,ie=n.pendingProps,K=h.context,G=a.contextType,I=Xi,typeof G=="object"&&G!==null&&(I=ln(G)),N=a.getDerivedStateFromProps,(G=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ie||K!==I)&&ov(n,h,l,I),xa=!1,K=n.memoizedState,h.state=K,dr(n,l,h,f),cr();var J=n.memoizedState;x!==ie||K!==J||xa||e!==null&&e.dependencies!==null&&Ml(e.dependencies)?(typeof N=="function"&&(Pu(n,a,N,l),J=n.memoizedState),(X=xa||iv(n,a,X,l,K,J,I)||e!==null&&e.dependencies!==null&&Ml(e.dependencies))?(G||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,J,I),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,J,I)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=J),h.props=l,h.state=J,h.context=I,l=X):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Wl(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=ui(n,e.child,null,f),n.child=ui(n,null,a,f)):cn(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Ks(e,n,f),e}function xv(e,n,a,l){return ii(),n.flags|=256,cn(e,n,a,l),n.child}var Fu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ku(e){return{baseLanes:e,cachePool:dg()}}function Zu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=In),e}function kv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(It.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Je){if(f?ja(n):Ta(),(e=xt)?(e=A0(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:va!==null?{id:Ts,overflow:ws}:null,retryLane:536870912,hydrationErrors:null},a=tg(e),a.return=n,n.child=a,rn=n,xt=null)):e=null,e===null)throw ba(n);return Df(e)?n.lanes=32:n.lanes=536870912,null}var N=l.children;return l=l.fallback,f?(Ta(),f=n.mode,N=Xl({mode:"hidden",children:N},f),l=ai(l,f,a,null),N.return=n,l.return=n,N.sibling=l,n.child=N,l=n.child,l.memoizedState=Ku(a),l.childLanes=Zu(e,x,a),n.memoizedState=Fu,hr(null,l)):(ja(n),Yu(n,N))}var I=e.memoizedState;if(I!==null&&(N=I.dehydrated,N!==null)){if(h)n.flags&256?(ja(n),n.flags&=-257,n=Ju(e,n,a)):n.memoizedState!==null?(Ta(),n.child=e.child,n.flags|=128,n=null):(Ta(),N=l.fallback,f=n.mode,l=Xl({mode:"visible",children:l.children},f),N=ai(N,f,a,null),N.flags|=2,l.return=n,N.return=n,l.sibling=N,n.child=l,ui(n,e.child,null,a),l=n.child,l.memoizedState=Ku(a),l.childLanes=Zu(e,x,a),n.memoizedState=Fu,n=hr(null,l));else if(ja(n),Df(N)){if(x=N.nextSibling&&N.nextSibling.dataset,x)var G=x.dgst;x=G,l=Error(r(419)),l.stack="",l.digest=x,sr({value:l,source:null,stack:null}),n=Ju(e,n,a)}else if(qt||no(e,n,a,!1),x=(a&e.childLanes)!==0,qt||x){if(x=vt,x!==null&&(l=Cn(x,a),l!==0&&l!==I.retryLane))throw I.retryLane=l,si(e,l),wn(x,e,l),qu;Af(N)||rc(),n=Ju(e,n,a)}else Af(N)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,xt=Jn(N.nextSibling),rn=n,Je=!0,ya=null,Zn=!1,e!==null&&ag(n,e),n=Yu(n,l.children),n.flags|=4096);return n}return f?(Ta(),N=l.fallback,f=n.mode,I=e.child,G=I.sibling,l=Ps(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,G!==null?N=Ps(G,N):(N=ai(N,f,a,null),N.flags|=2),N.return=n,l.return=n,l.sibling=N,n.child=l,hr(null,l),l=n.child,N=e.child.memoizedState,N===null?N=Ku(a):(f=N.cachePool,f!==null?(I=Ut._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=dg(),N={baseLanes:N.baseLanes|a,cachePool:f}),l.memoizedState=N,l.childLanes=Zu(e,x,a),n.memoizedState=Fu,hr(e.child,l)):(ja(n),a=e.child,e=a.sibling,a=Ps(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Yu(e,n){return n=Xl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Xl(e,n){return e=An(22,e,null,n),e.lanes=0,e}function Ju(e,n,a){return ui(n,e.child,null,a),e=Yu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Sv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),uu(e.return,n,a)}function Wu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function jv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=It.current,N=(x&2)!==0;if(N?(x=x&1|2,n.flags|=128):x&=1,xe(It,x),cn(e,n,l,a),l=Je?nr:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sv(e,a,n);else if(e.tag===19)Sv(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&Hl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Wu(n,!1,f,a,h,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Hl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Wu(n,!0,a,null,h,l);break;case"together":Wu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ks(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),Ca|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(no(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,a=Ps(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Ps(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Xu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Ml(e)))}function bS(e,n,a){switch(n.tag){case 3:Pe(n,n.stateNode.containerInfo),_a(n,Ut,e.memoizedState.cache),ii();break;case 27:case 5:ct(n);break;case 4:Pe(n,n.stateNode.containerInfo);break;case 10:_a(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Su(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ja(n),n.flags|=128,null):(a&n.child.childLanes)!==0?kv(e,n,a):(ja(n),e=Ks(e,n,a),e!==null?e.sibling:null);ja(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(no(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return jv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),xe(It,It.current),l)break;return null;case 22:return n.lanes=0,gv(e,n,a,n.pendingProps);case 24:_a(n,Ut,e.memoizedState.cache)}return Ks(e,n,a)}function Tv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!Xu(e,a)&&(n.flags&128)===0)return qt=!1,bS(e,n,a);qt=(e.flags&131072)!==0}else qt=!1,Je&&(n.flags&1048576)!==0&&sg(n,nr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ci(n.elementType),n.type=e,typeof e=="function")su(e)?(l=pi(e,l),n.tag=1,n=_v(null,n,e,l,a)):(n.tag=0,n=Gu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===A){n.tag=11,n=pv(null,n,e,l,a);break e}else if(f===O){n.tag=14,n=mv(null,n,e,l,a);break e}}throw n=Z(e)||e,Error(r(306,n,""))}}return n;case 0:return Gu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=pi(l,n.pendingProps),_v(e,n,l,f,a);case 3:e:{if(Pe(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,yu(e,n),dr(n,l,null,a);var x=n.memoizedState;if(l=x.cache,_a(n,Ut,l),l!==h.cache&&fu(n,[Ut],a,!0),cr(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=xv(e,n,l,a);break e}else if(l!==f){f=Gn(Error(r(424)),n),sr(f),n=xv(e,n,l,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(xt=Jn(e.firstChild),rn=n,Je=!0,ya=null,Zn=!0,a=gg(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ii(),l===f){n=Ks(e,n,a);break e}cn(e,n,l,a)}n=n.child}return n;case 26:return Wl(e,n),e===null?(a=B0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Je||(a=n.type,e=n.pendingProps,l=mc(yt.current).createElement(a),l[on]=n,l[_n]=e,dn(l,a,e),Qt(l),n.stateNode=l):n.memoizedState=B0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ct(n),e===null&&Je&&(l=n.stateNode=R0(n.type,n.pendingProps,yt.current),rn=n,Zn=!0,f=xt,Ra(n.type)?(Mf=f,xt=Jn(l.firstChild)):xt=f),cn(e,n,n.pendingProps.children,a),Wl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Je&&((f=l=xt)&&(l=YS(l,n.type,n.pendingProps,Zn),l!==null?(n.stateNode=l,rn=n,xt=Jn(l.firstChild),Zn=!1,f=!0):f=!1),f||ba(n)),ct(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,Nf(f,h)?l=null:x!==null&&Nf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=Tu(e,n,dS,null,null,a),Ar._currentValue=f),Wl(e,n),cn(e,n,l,a),n.child;case 6:return e===null&&Je&&((e=a=xt)&&(a=JS(a,n.pendingProps,Zn),a!==null?(n.stateNode=a,rn=n,xt=null,e=!0):e=!1),e||ba(n)),null;case 13:return kv(e,n,a);case 4:return Pe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ui(n,null,l,a):cn(e,n,l,a),n.child;case 11:return pv(e,n,n.type,n.pendingProps,a);case 7:return cn(e,n,n.pendingProps,a),n.child;case 8:return cn(e,n,n.pendingProps.children,a),n.child;case 12:return cn(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,_a(n,n.type,l.value),cn(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ri(n),f=ln(f),l=l(f),n.flags|=1,cn(e,n,l,a),n.child;case 14:return mv(e,n,n.type,n.pendingProps,a);case 15:return hv(e,n,n.type,n.pendingProps,a);case 19:return jv(e,n,a);case 31:return yS(e,n,a);case 22:return gv(e,n,a,n.pendingProps);case 24:return ri(n),l=ln(Ut),e===null?(f=hu(),f===null&&(f=vt,h=pu(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},vu(n),_a(n,Ut,f)):((e.lanes&a)!==0&&(yu(e,n),dr(n,null,null,a),cr()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),_a(n,Ut,l)):(l=h.cache,_a(n,Ut,l),l!==f.cache&&fu(n,[Ut],a,!0))),cn(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Zs(e){e.flags|=4}function Qu(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Xv())e.flags|=8192;else throw di=Bl,gu}else e.flags&=-16777217}function wv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!P0(n))if(Xv())e.flags|=8192;else throw di=Bl,gu}function Ql(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?je():536870912,e.lanes|=n,ho|=n)}function gr(e,n){if(!Je)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function kt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function _S(e,n,a){var l=n.pendingProps;switch(ru(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(n),null;case 1:return kt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),qs(Ut),ke(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(to(n)?Zs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,cu())),kt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Zs(n),h!==null?(kt(n),wv(n,h)):(kt(n),Qu(n,f,null,l,a))):h?h!==e.memoizedState?(Zs(n),kt(n),wv(n,h)):(kt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Zs(n),kt(n),Qu(n,f,e,l,a)),null;case 27:if(ue(n),a=yt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return kt(n),null}e=De.current,to(n)?ig(n):(e=R0(f,l,a),n.stateNode=e,Zs(n))}return kt(n),null;case 5:if(ue(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Zs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return kt(n),null}if(h=De.current,to(n))ig(n);else{var x=mc(yt.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[on]=n,h[_n]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(dn(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Zs(n)}}return kt(n),Qu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Zs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=yt.current,to(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=rn,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[on]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||k0(e.nodeValue,a)),e||ba(n,!0)}else e=mc(e).createTextNode(l),e[on]=n,n.stateNode=e}return kt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=to(n),a!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[on]=n}else ii(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;kt(n),e=!1}else a=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Mn(n),n):(Mn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return kt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=to(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[on]=n}else ii(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;kt(n),f=!1}else f=cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Mn(n),n):(Mn(n),null)}return Mn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Ql(n,n.updateQueue),kt(n),null);case 4:return ke(),e===null&&kf(n.stateNode.containerInfo),kt(n),null;case 10:return qs(n.type),kt(n),null;case 19:if(me(It),l=n.memoizedState,l===null)return kt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)gr(l,!1);else{if(Mt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Hl(e),h!==null){for(n.flags|=128,gr(l,!1),e=h.updateQueue,n.updateQueue=e,Ql(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)eg(a,e),a=a.sibling;return xe(It,It.current&1|2),Je&&Us(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Wt()>ac&&(n.flags|=128,f=!0,gr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Hl(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Ql(n,e),gr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return kt(n),null}else 2*Wt()-l.renderingStartTime>ac&&a!==536870912&&(n.flags|=128,f=!0,gr(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Wt(),e.sibling=null,a=It.current,xe(It,f?a&1|2:a&1),Je&&Us(n,l.treeForkCount),e):(kt(n),null);case 22:case 23:return Mn(n),ku(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(kt(n),n.subtreeFlags&6&&(n.flags|=8192)):kt(n),a=n.updateQueue,a!==null&&Ql(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&me(li),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),qs(Ut),kt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function xS(e,n){switch(ru(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return qs(Ut),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(Mn(n),n.alternate===null)throw Error(r(340));ii()}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));ii()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(It),null;case 4:return ke(),null;case 10:return qs(n.type),null;case 22:case 23:return Mn(n),ku(),e!==null&&me(li),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return qs(Ut),null;case 25:return null;default:return null}}function Nv(e,n){switch(ru(n),n.tag){case 3:qs(Ut),ke();break;case 26:case 27:case 5:ue(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&Mn(n);break;case 13:Mn(n);break;case 19:me(It);break;case 10:qs(n.type);break;case 22:case 23:Mn(n),ku(),e!==null&&me(li);break;case 24:qs(Ut)}}function vr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(N){ft(n,n.return,N)}}function wa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var x=l.inst,N=x.destroy;if(N!==void 0){x.destroy=void 0,f=n;var I=a,G=N;try{G()}catch(X){ft(f,I,X)}}}l=l.next}while(l!==h)}}catch(X){ft(n,n.return,X)}}function Cv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{yg(n,a)}catch(l){ft(e,e.return,l)}}}function Ev(e,n,a){a.props=pi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){ft(e,n,l)}}function yr(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){ft(e,n,f)}}function Ns(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){ft(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){ft(e,n,f)}else a.current=null}function Av(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){ft(e,e.return,f)}}function ef(e,n,a){try{var l=e.stateNode;VS(l,e.type,a,n),l[_n]=n}catch(f){ft(e,e.return,f)}}function Dv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ra(e.type)||e.tag===4}function tf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ra(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function nf(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=$s));else if(l!==4&&(l===27&&Ra(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(nf(e,n,a),e=e.sibling;e!==null;)nf(e,n,a),e=e.sibling}function ec(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&Ra(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(ec(e,n,a),e=e.sibling;e!==null;)ec(e,n,a),e=e.sibling}function Mv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);dn(n,l,a),n[on]=e,n[_n]=a}catch(h){ft(e,e.return,h)}}var Ys=!1,Gt=!1,sf=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,en=null;function kS(e,n){if(e=e.containerInfo,Tf=xc,e=Gh(e),Jd(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,N=-1,I=-1,G=0,X=0,ie=e,K=null;t:for(;;){for(var J;ie!==a||f!==0&&ie.nodeType!==3||(N=x+f),ie!==h||l!==0&&ie.nodeType!==3||(I=x+l),ie.nodeType===3&&(x+=ie.nodeValue.length),(J=ie.firstChild)!==null;)K=ie,ie=J;for(;;){if(ie===e)break t;if(K===a&&++G===f&&(N=x),K===h&&++X===l&&(I=x),(J=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=J}a=N===-1||I===-1?null:{start:N,end:I}}else a=null}a=a||{start:0,end:0}}else a=null;for(wf={focusedElem:e,selectionRange:a},xc=!1,en=n;en!==null;)if(n=en,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,en=e;else for(;en!==null;){switch(n=en,h=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var _e=pi(a.type,f);e=l.getSnapshotBeforeUpdate(_e,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){ft(a,a.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)Ef(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ef(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,en=e;break}en=n.return}}function Iv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ws(e,a),l&4&&vr(5,a);break;case 1:if(Ws(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){ft(a,a.return,x)}else{var f=pi(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){ft(a,a.return,x)}}l&64&&Cv(a),l&512&&yr(a,a.return);break;case 3:if(Ws(e,a),l&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{yg(e,n)}catch(x){ft(a,a.return,x)}}break;case 27:n===null&&l&4&&Mv(a);case 26:case 5:Ws(e,a),n===null&&l&4&&Av(a),l&512&&yr(a,a.return);break;case 12:Ws(e,a);break;case 31:Ws(e,a),l&4&&Lv(e,a);break;case 13:Ws(e,a),l&4&&zv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=DS.bind(null,a),WS(e,a))));break;case 22:if(l=a.memoizedState!==null||Ys,!l){n=n!==null&&n.memoizedState!==null||Gt,f=Ys;var h=Gt;Ys=l,(Gt=n)&&!h?Xs(e,a,(a.subtreeFlags&8772)!==0):Ws(e,a),Ys=f,Gt=h}break;case 30:break;default:Ws(e,a)}}function Ov(e){var n=e.alternate;n!==null&&(e.alternate=null,Ov(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Rd(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 wt=null,kn=!1;function Js(e,n,a){for(a=a.child;a!==null;)Bv(e,n,a),a=a.sibling}function Bv(e,n,a){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(pn,a)}catch{}switch(a.tag){case 26:Gt||Ns(a,n),Js(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Gt||Ns(a,n);var l=wt,f=kn;Ra(a.type)&&(wt=a.stateNode,kn=!1),Js(e,n,a),Nr(a.stateNode),wt=l,kn=f;break;case 5:Gt||Ns(a,n);case 6:if(l=wt,f=kn,wt=null,Js(e,n,a),wt=l,kn=f,wt!==null)if(kn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(a.stateNode)}catch(h){ft(a,n,h)}else try{wt.removeChild(a.stateNode)}catch(h){ft(a,n,h)}break;case 18:wt!==null&&(kn?(e=wt,C0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),So(e)):C0(wt,a.stateNode));break;case 4:l=wt,f=kn,wt=a.stateNode.containerInfo,kn=!0,Js(e,n,a),wt=l,kn=f;break;case 0:case 11:case 14:case 15:wa(2,a,n),Gt||wa(4,a,n),Js(e,n,a);break;case 1:Gt||(Ns(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Ev(a,n,l)),Js(e,n,a);break;case 21:Js(e,n,a);break;case 22:Gt=(l=Gt)||a.memoizedState!==null,Js(e,n,a),Gt=l;break;default:Js(e,n,a)}}function Lv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{So(e)}catch(a){ft(n,n.return,a)}}}function zv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{So(e)}catch(a){ft(n,n.return,a)}}function SS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Rv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Rv),n;default:throw Error(r(435,e.tag))}}function tc(e,n){var a=SS(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=MS.bind(null,e,l);l.then(f,f)}})}function Sn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,N=x;e:for(;N!==null;){switch(N.tag){case 27:if(Ra(N.type)){wt=N.stateNode,kn=!1;break e}break;case 5:wt=N.stateNode,kn=!1;break e;case 3:case 4:wt=N.stateNode.containerInfo,kn=!0;break e}N=N.return}if(wt===null)throw Error(r(160));Bv(h,x,f),wt=null,kn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)$v(n,e),n=n.sibling}var ds=null;function $v(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Sn(n,e),jn(e),l&4&&(wa(3,e,e.return),vr(3,e),wa(5,e,e.return));break;case 1:Sn(n,e),jn(e),l&512&&(Gt||a===null||Ns(a,a.return)),l&64&&Ys&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=ds;if(Sn(n,e),jn(e),l&512&&(Gt||a===null||Ns(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Go]||h[on]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),dn(h,l,a),h[on]=e,Qt(h),l=h;break e;case"link":var x=$0("link","href",f).get(l+(a.href||""));if(x){for(var N=0;N<x.length;N++)if(h=x[N],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(N,1);break t}}h=f.createElement(l),dn(h,l,a),f.head.appendChild(h);break;case"meta":if(x=$0("meta","content",f).get(l+(a.content||""))){for(N=0;N<x.length;N++)if(h=x[N],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(N,1);break t}}h=f.createElement(l),dn(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[on]=e,Qt(h),l=h}e.stateNode=l}else H0(f,e.type,e.stateNode);else e.stateNode=z0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?H0(f,e.type,e.stateNode):z0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&ef(e,e.memoizedProps,a.memoizedProps)}break;case 27:Sn(n,e),jn(e),l&512&&(Gt||a===null||Ns(a,a.return)),a!==null&&l&4&&ef(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Sn(n,e),jn(e),l&512&&(Gt||a===null||Ns(a,a.return)),e.flags&32){f=e.stateNode;try{Gi(f,"")}catch(_e){ft(e,e.return,_e)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,ef(e,f,a!==null?a.memoizedProps:f)),l&1024&&(sf=!0);break;case 6:if(Sn(n,e),jn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(_e){ft(e,e.return,_e)}}break;case 3:if(vc=null,f=ds,ds=hc(n.containerInfo),Sn(n,e),ds=f,jn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{So(n.containerInfo)}catch(_e){ft(e,e.return,_e)}sf&&(sf=!1,Hv(e));break;case 4:l=ds,ds=hc(e.stateNode.containerInfo),Sn(n,e),jn(e),ds=l;break;case 12:Sn(n,e),jn(e);break;case 31:Sn(n,e),jn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 13:Sn(n,e),jn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(sc=Wt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 22:f=e.memoizedState!==null;var I=a!==null&&a.memoizedState!==null,G=Ys,X=Gt;if(Ys=G||f,Gt=X||I,Sn(n,e),Gt=X,Ys=G,jn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||I||Ys||Gt||mi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){I=a=n;try{if(h=I.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{N=I.stateNode;var ie=I.memoizedProps.style,K=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;N.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===6){if(a===null){I=n;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===18){if(a===null){I=n;try{var J=I.stateNode;f?E0(J,!0):E0(I.stateNode,!1)}catch(_e){ft(I,I.return,_e)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,tc(e,a))));break;case 19:Sn(n,e),jn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,tc(e,l)));break;case 30:break;case 21:break;default:Sn(n,e),jn(e)}}function jn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(Dv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=tf(e);ec(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(Gi(x,""),a.flags&=-33);var N=tf(e);ec(e,N,x);break;case 3:case 4:var I=a.stateNode.containerInfo,G=tf(e);nf(e,G,I);break;default:throw Error(r(161))}}catch(X){ft(e,e.return,X)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Hv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Hv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ws(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Iv(e,n.alternate,n),n=n.sibling}function mi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:wa(4,n,n.return),mi(n);break;case 1:Ns(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&Ev(n,n.return,a),mi(n);break;case 27:Nr(n.stateNode);case 26:case 5:Ns(n,n.return),mi(n);break;case 22:n.memoizedState===null&&mi(n);break;case 30:mi(n);break;default:mi(n)}e=e.sibling}}function Xs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:Xs(f,h,a),vr(4,h);break;case 1:if(Xs(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(G){ft(l,l.return,G)}if(l=h,f=l.updateQueue,f!==null){var N=l.stateNode;try{var I=f.shared.hiddenCallbacks;if(I!==null)for(f.shared.hiddenCallbacks=null,f=0;f<I.length;f++)vg(I[f],N)}catch(G){ft(l,l.return,G)}}a&&x&64&&Cv(h),yr(h,h.return);break;case 27:Mv(h);case 26:case 5:Xs(f,h,a),a&&l===null&&x&4&&Av(h),yr(h,h.return);break;case 12:Xs(f,h,a);break;case 31:Xs(f,h,a),a&&x&4&&Lv(f,h);break;case 13:Xs(f,h,a),a&&x&4&&zv(f,h);break;case 22:h.memoizedState===null&&Xs(f,h,a),yr(h,h.return);break;case 30:break;default:Xs(f,h,a)}n=n.sibling}}function af(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&ar(a))}function of(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ar(e))}function us(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Pv(e,n,a,l),n=n.sibling}function Pv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:us(e,n,a,l),f&2048&&vr(9,n);break;case 1:us(e,n,a,l);break;case 3:us(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&ar(e)));break;case 12:if(f&2048){us(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,N=h.onPostCommit;typeof N=="function"&&N(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){ft(n,n.return,I)}}else us(e,n,a,l);break;case 31:us(e,n,a,l);break;case 13:us(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?us(e,n,a,l):br(e,n):h._visibility&2?us(e,n,a,l):(h._visibility|=2,fo(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&af(x,n);break;case 24:us(e,n,a,l),f&2048&&of(n.alternate,n);break;default:us(e,n,a,l)}}function fo(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,N=a,I=l,G=x.flags;switch(x.tag){case 0:case 11:case 15:fo(h,x,N,I,f),vr(8,x);break;case 23:break;case 22:var X=x.stateNode;x.memoizedState!==null?X._visibility&2?fo(h,x,N,I,f):br(h,x):(X._visibility|=2,fo(h,x,N,I,f)),f&&G&2048&&af(x.alternate,x);break;case 24:fo(h,x,N,I,f),f&&G&2048&&of(x.alternate,x);break;default:fo(h,x,N,I,f)}n=n.sibling}}function br(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:br(a,l),f&2048&&af(l.alternate,l);break;case 24:br(a,l),f&2048&&of(l.alternate,l);break;default:br(a,l)}n=n.sibling}}var _r=8192;function po(e,n,a){if(e.subtreeFlags&_r)for(e=e.child;e!==null;)Uv(e,n,a),e=e.sibling}function Uv(e,n,a){switch(e.tag){case 26:po(e,n,a),e.flags&_r&&e.memoizedState!==null&&c2(a,ds,e.memoizedState,e.memoizedProps);break;case 5:po(e,n,a);break;case 3:case 4:var l=ds;ds=hc(e.stateNode.containerInfo),po(e,n,a),ds=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=_r,_r=16777216,po(e,n,a),_r=l):po(e,n,a));break;default:po(e,n,a)}}function Vv(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function xr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,Gv(l,e)}Vv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)qv(e),e=e.sibling}function qv(e){switch(e.tag){case 0:case 11:case 15:xr(e),e.flags&2048&&wa(9,e,e.return);break;case 3:xr(e);break;case 12:xr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,nc(e)):xr(e);break;default:xr(e)}}function nc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];en=l,Gv(l,e)}Vv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:wa(8,n,n.return),nc(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,nc(n));break;default:nc(n)}e=e.sibling}}function Gv(e,n){for(;en!==null;){var a=en;switch(a.tag){case 0:case 11:case 15:wa(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ar(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,en=l;else e:for(a=e;en!==null;){l=en;var f=l.sibling,h=l.return;if(Ov(l),l===a){en=null;break e}if(f!==null){f.return=h,en=f;break e}en=h}}}var jS={getCacheForType:function(e){var n=ln(Ut),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return ln(Ut).controller.signal}},TS=typeof WeakMap=="function"?WeakMap:Map,rt=0,vt=null,Ge=null,Ke=0,ut=0,Rn=null,Na=!1,mo=!1,rf=!1,Qs=0,Mt=0,Ca=0,hi=0,lf=0,In=0,ho=0,kr=null,Tn=null,cf=!1,sc=0,Fv=0,ac=1/0,ic=null,Ea=null,Ft=0,Aa=null,go=null,ea=0,df=0,uf=null,Kv=null,Sr=0,ff=null;function On(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:H.T!==null?yf():zi()}function Zv(){if(In===0)if((Ke&536870912)===0||Je){var e=U;U<<=1,(U&3932160)===0&&(U=262144),In=e}else In=536870912;return e=Dn.current,e!==null&&(e.flags|=32),In}function wn(e,n,a){(e===vt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&(vo(e,0),Da(e,Ke,In,!1)),Ue(e,a),((rt&2)===0||e!==vt)&&(e===vt&&((rt&2)===0&&(hi|=a),Mt===4&&Da(e,Ke,In,!1)),Cs(e))}function Yv(e,n,a){if((rt&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),f=l?CS(e,n):mf(e,n,!0),h=l;do{if(f===0){mo&&!l&&Da(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!wS(a)){f=mf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var N=e;f=kr;var I=N.current.memoizedState.isDehydrated;if(I&&(vo(N,x).flags|=256),x=mf(N,x,!1),x!==2){if(rf&&!I){N.errorRecoveryDisabledLanes|=h,hi|=h,f=4;break e}h=Tn,Tn=f,h!==null&&(Tn===null?Tn=h:Tn.push.apply(Tn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){vo(e,0),Da(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Da(l,n,In,!Na);break e;case 2:Tn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=sc+300-Wt(),10<f)){if(Da(l,n,In,!Na),pe(l,0,!0)!==0)break e;ea=n,l.timeoutHandle=w0(Jv.bind(null,l,a,Tn,ic,cf,n,In,hi,ho,Na,h,"Throttled",-0,0),f);break e}Jv(l,a,Tn,ic,cf,n,In,hi,ho,Na,h,null,-0,0)}}break}while(!0);Cs(e)}function Jv(e,n,a,l,f,h,x,N,I,G,X,ie,K,J){if(e.timeoutHandle=-1,ie=n.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:$s},Uv(n,h,ie);var _e=(h&62914560)===h?sc-Wt():(h&4194048)===h?Fv-Wt():0;if(_e=d2(ie,_e),_e!==null){ea=h,e.cancelPendingCommit=_e(a0.bind(null,e,n,h,a,l,f,x,N,I,X,ie,null,K,J)),Da(e,h,x,!G);return}}a0(e,n,h,a,l,f,x,N,I)}function wS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!En(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Da(e,n,a,l){n&=~lf,n&=~hi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Xt(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&qe(e,a,n)}function oc(){return(rt&6)===0?(jr(0),!1):!0}function pf(){if(Ge!==null){if(ut===0)var e=Ge.return;else e=Ge,Vs=oi=null,Cu(e),oo=null,or=0,e=Ge;for(;e!==null;)Nv(e.alternate,e),e=e.return;Ge=null}}function vo(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,FS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ea=0,pf(),vt=e,Ge=a=Ps(e.current,null),Ke=n,ut=0,Rn=null,Na=!1,mo=ye(e,n),rf=!1,ho=In=lf=hi=Ca=Mt=0,Tn=kr=null,cf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-Xt(l),h=1<<f;n|=e[f],l&=~h}return Qs=n,Nl(),a}function Wv(e,n){ze=null,H.H=mr,n===io||n===Ol?(n=pg(),ut=3):n===gu?(n=pg(),ut=4):ut=n===qu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Rn=n,Ge===null&&(Mt=1,Yl(e,Gn(n,e.current)))}function Xv(){var e=Dn.current;return e===null?!0:(Ke&4194048)===Ke?Yn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Yn:!1}function Qv(){var e=H.H;return H.H=mr,e===null?mr:e}function e0(){var e=H.A;return H.A=jS,e}function rc(){Mt=4,Na||(Ke&4194048)!==Ke&&Dn.current!==null||(mo=!0),(Ca&134217727)===0&&(hi&134217727)===0||vt===null||Da(vt,Ke,In,!1)}function mf(e,n,a){var l=rt;rt|=2;var f=Qv(),h=e0();(vt!==e||Ke!==n)&&(ic=null,vo(e,n)),n=!1;var x=Mt;e:do try{if(ut!==0&&Ge!==null){var N=Ge,I=Rn;switch(ut){case 8:pf(),x=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(n=!0);var G=ut;if(ut=0,Rn=null,yo(e,N,I,G),a&&mo){x=0;break e}break;default:G=ut,ut=0,Rn=null,yo(e,N,I,G)}}NS(),x=Mt;break}catch(X){Wv(e,X)}while(!0);return n&&e.shellSuspendCounter++,Vs=oi=null,rt=l,H.H=f,H.A=h,Ge===null&&(vt=null,Ke=0,Nl()),x}function NS(){for(;Ge!==null;)t0(Ge)}function CS(e,n){var a=rt;rt|=2;var l=Qv(),f=e0();vt!==e||Ke!==n?(ic=null,ac=Wt()+500,vo(e,n)):mo=ye(e,n);e:do try{if(ut!==0&&Ge!==null){n=Ge;var h=Rn;t:switch(ut){case 1:ut=0,Rn=null,yo(e,n,h,1);break;case 2:case 9:if(ug(h)){ut=0,Rn=null,n0(n);break}n=function(){ut!==2&&ut!==9||vt!==e||(ut=7),Cs(e)},h.then(n,n);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:ug(h)?(ut=0,Rn=null,n0(n)):(ut=0,Rn=null,yo(e,n,h,7));break;case 5:var x=null;switch(Ge.tag){case 26:x=Ge.memoizedState;case 5:case 27:var N=Ge;if(x?P0(x):N.stateNode.complete){ut=0,Rn=null;var I=N.sibling;if(I!==null)Ge=I;else{var G=N.return;G!==null?(Ge=G,lc(G)):Ge=null}break t}}ut=0,Rn=null,yo(e,n,h,5);break;case 6:ut=0,Rn=null,yo(e,n,h,6);break;case 8:pf(),Mt=6;break e;default:throw Error(r(462))}}ES();break}catch(X){Wv(e,X)}while(!0);return Vs=oi=null,H.H=l,H.A=f,rt=a,Ge!==null?0:(vt=null,Ke=0,Nl(),Mt)}function ES(){for(;Ge!==null&&!ma();)t0(Ge)}function t0(e){var n=Tv(e.alternate,e,Qs);e.memoizedProps=e.pendingProps,n===null?lc(e):Ge=n}function n0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=bv(a,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=bv(a,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Cu(n);default:Nv(a,n),n=Ge=eg(n,Qs),n=Tv(a,n,Qs)}e.memoizedProps=e.pendingProps,n===null?lc(e):Ge=n}function yo(e,n,a,l){Vs=oi=null,Cu(n),oo=null,or=0;var f=n.return;try{if(vS(e,f,n,a,Ke)){Mt=1,Yl(e,Gn(a,e.current)),Ge=null;return}}catch(h){if(f!==null)throw Ge=f,h;Mt=1,Yl(e,Gn(a,e.current)),Ge=null;return}n.flags&32768?(Je||l===1?e=!0:mo||(Ke&536870912)!==0?e=!1:(Na=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),s0(n,e)):lc(n)}function lc(e){var n=e;do{if((n.flags&32768)!==0){s0(n,Na);return}e=n.return;var a=_S(n.alternate,n,Qs);if(a!==null){Ge=a;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);Mt===0&&(Mt=5)}function s0(e,n){do{var a=xS(e.alternate,e);if(a!==null){a.flags&=32767,Ge=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=a}while(e!==null);Mt=6,Ge=null}function a0(e,n,a,l,f,h,x,N,I){e.cancelPendingCommit=null;do cc();while(Ft!==0);if((rt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=tu,At(e,a,h,x,N,I),e===vt&&(Ge=vt=null,Ke=0),go=n,Aa=e,ea=a,df=h,uf=f,Kv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,RS(Ls,function(){return c0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,f=B.p,B.p=2,x=rt,rt|=4;try{kS(e,n,a)}finally{rt=x,B.p=f,H.T=l}}Ft=1,i0(),o0(),r0()}}function i0(){if(Ft===1){Ft=0;var e=Aa,n=go,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{$v(n,e);var h=wf,x=Gh(e.containerInfo),N=h.focusedElem,I=h.selectionRange;if(x!==N&&N&&N.ownerDocument&&qh(N.ownerDocument.documentElement,N)){if(I!==null&&Jd(N)){var G=I.start,X=I.end;if(X===void 0&&(X=G),"selectionStart"in N)N.selectionStart=G,N.selectionEnd=Math.min(X,N.value.length);else{var ie=N.ownerDocument||document,K=ie&&ie.defaultView||window;if(K.getSelection){var J=K.getSelection(),_e=N.textContent.length,Ce=Math.min(I.start,_e),gt=I.end===void 0?Ce:Math.min(I.end,_e);!J.extend&&Ce>gt&&(x=gt,gt=Ce,Ce=x);var P=Vh(N,Ce),z=Vh(N,gt);if(P&&z&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==z.node||J.focusOffset!==z.offset)){var q=ie.createRange();q.setStart(P.node,P.offset),J.removeAllRanges(),Ce>gt?(J.addRange(q),J.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),J.addRange(q))}}}}for(ie=[],J=N;J=J.parentNode;)J.nodeType===1&&ie.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ie.length;N++){var te=ie[N];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}xc=!!Tf,wf=Tf=null}finally{rt=f,B.p=l,H.T=a}}e.current=n,Ft=2}}function o0(){if(Ft===2){Ft=0;var e=Aa,n=go,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Iv(e,n.alternate,n)}finally{rt=f,B.p=l,H.T=a}}Ft=3}}function r0(){if(Ft===4||Ft===3){Ft=0,Ri();var e=Aa,n=go,a=ea,l=Kv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Ft=5:(Ft=0,go=Aa=null,l0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ea=null),ks(a),n=n.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(pn,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=H.T,f=B.p,B.p=2,H.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var N=l[x];h(N.value,{componentStack:N.stack})}}finally{H.T=n,B.p=f}}(ea&3)!==0&&cc(),Cs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===ff?Sr++:(Sr=0,ff=e):Sr=0,jr(0)}}function l0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,ar(n)))}function cc(){return i0(),o0(),r0(),c0()}function c0(){if(Ft!==5)return!1;var e=Aa,n=df;df=0;var a=ks(ea),l=H.T,f=B.p;try{B.p=32>a?32:a,H.T=null,a=uf,uf=null;var h=Aa,x=ea;if(Ft=0,go=Aa=null,ea=0,(rt&6)!==0)throw Error(r(331));var N=rt;if(rt|=4,qv(h.current),Pv(h,h.current,x,a),rt=N,jr(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(pn,h)}catch{}return!0}finally{B.p=f,H.T=l,l0(e,n)}}function d0(e,n,a){n=Gn(a,n),n=Vu(e.stateNode,n,2),e=Sa(e,n,2),e!==null&&(Ue(e,2),Cs(e))}function ft(e,n,a){if(e.tag===3)d0(e,e,a);else for(;n!==null;){if(n.tag===3){d0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))){e=Gn(a,e),a=uv(2),l=Sa(n,a,2),l!==null&&(fv(a,l,n,e),Ue(l,2),Cs(l));break}}n=n.return}}function hf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new TS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(rf=!0,f.add(a),e=AS.bind(null,e,n,a),n.then(e,e))}function AS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,vt===e&&(Ke&a)===a&&(Mt===4||Mt===3&&(Ke&62914560)===Ke&&300>Wt()-sc?(rt&2)===0&&vo(e,0):lf|=a,ho===Ke&&(ho=0)),Cs(e)}function u0(e,n){n===0&&(n=je()),e=si(e,n),e!==null&&(Ue(e,n),Cs(e))}function DS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),u0(e,a)}function MS(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),u0(e,a)}function RS(e,n){return ls(e,n)}var dc=null,bo=null,gf=!1,uc=!1,vf=!1,Ma=0;function Cs(e){e!==bo&&e.next===null&&(bo===null?dc=bo=e:bo=bo.next=e),uc=!0,gf||(gf=!0,OS())}function jr(e,n){if(!vf&&uc){vf=!0;do for(var a=!1,l=dc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,N=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(x&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,h0(l,h))}else h=Ke,h=pe(l,l===vt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ye(l,h)||(a=!0,h0(l,h));l=l.next}while(a);vf=!1}}function IS(){f0()}function f0(){uc=gf=!1;var e=0;Ma!==0&&GS()&&(e=Ma);for(var n=Wt(),a=null,l=dc;l!==null;){var f=l.next,h=p0(l,n);h===0?(l.next=null,a===null?dc=f:a.next=f,f===null&&(bo=a)):(a=l,(e!==0||(h&3)!==0)&&(uc=!0)),l=f}Ft!==0&&Ft!==5||jr(e),Ma!==0&&(Ma=0)}function p0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Xt(h),N=1<<x,I=f[x];I===-1?((N&a)===0||(N&l)!==0)&&(f[x]=tt(N,n)):I<=n&&(e.expiredLanes|=N),h&=~N}if(n=vt,a=Ke,a=pe(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Bs(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ye(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&Bs(l),ks(a)){case 2:case 8:a=ha;break;case 32:a=Ls;break;case 268435456:a=Ne;break;default:a=Ls}return l=m0.bind(null,e),a=ls(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&Bs(l),e.callbackPriority=2,e.callbackNode=null,2}function m0(e,n){if(Ft!==0&&Ft!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(cc()&&e.callbackNode!==a)return null;var l=Ke;return l=pe(e,e===vt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Yv(e,l,n),p0(e,Wt()),e.callbackNode!=null&&e.callbackNode===a?m0.bind(null,e):null)}function h0(e,n){if(cc())return null;Yv(e,n,!0)}function OS(){KS(function(){(rt&6)!==0?ls(Xa,IS):f0()})}function yf(){if(Ma===0){var e=so;e===0&&(e=Li,Li<<=1,(Li&261888)===0&&(Li=256)),Ma=e}return Ma}function g0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:bl(""+e)}function v0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function BS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=g0((f[_n]||null).action),x=l.submitter;x&&(n=(n=x[_n]||null)?g0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var N=new Sl("action","action",null,l,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ma!==0){var I=x?v0(f,x):new FormData(f);Lu(a,{pending:!0,data:I,method:f.method,action:h},null,I)}}else typeof h=="function"&&(N.preventDefault(),I=x?v0(f,x):new FormData(f),Lu(a,{pending:!0,data:I,method:f.method,action:h},h,I))},currentTarget:f}]})}}for(var bf=0;bf<eu.length;bf++){var _f=eu[bf],LS=_f.toLowerCase(),zS=_f[0].toUpperCase()+_f.slice(1);cs(LS,"on"+zS)}cs(Zh,"onAnimationEnd"),cs(Yh,"onAnimationIteration"),cs(Jh,"onAnimationStart"),cs("dblclick","onDoubleClick"),cs("focusin","onFocus"),cs("focusout","onBlur"),cs(eS,"onTransitionRun"),cs(tS,"onTransitionStart"),cs(nS,"onTransitionCancel"),cs(Wh,"onTransitionEnd"),Vi("onMouseEnter",["mouseout","mouseover"]),Vi("onMouseLeave",["mouseout","mouseover"]),Vi("onPointerEnter",["pointerout","pointerover"]),Vi("onPointerLeave",["pointerout","pointerover"]),Qa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$S=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tr));function y0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var x=l.length-1;0<=x;x--){var N=l[x],I=N.instance,G=N.currentTarget;if(N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){wl(X)}f.currentTarget=null,h=I}else for(x=0;x<l.length;x++){if(N=l[x],I=N.instance,G=N.currentTarget,N=N.listener,I!==h&&f.isPropagationStopped())break e;h=N,f.currentTarget=G;try{h(f)}catch(X){wl(X)}f.currentTarget=null,h=I}}}}function Fe(e,n){var a=n[Md];a===void 0&&(a=n[Md]=new Set);var l=e+"__bubble";a.has(l)||(b0(n,e,2,!1),a.add(l))}function xf(e,n,a){var l=0;n&&(l|=4),b0(a,e,l,n)}var fc="_reactListening"+Math.random().toString(36).slice(2);function kf(e){if(!e[fc]){e[fc]=!0,fh.forEach(function(a){a!=="selectionchange"&&($S.has(a)||xf(a,!1,e),xf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[fc]||(n[fc]=!0,xf("selectionchange",!1,n))}}function b0(e,n,a,l){switch(Z0(n)){case 2:var f=p2;break;case 8:f=m2;break;default:f=Lf}a=f.bind(null,n,a,e),f=void 0,!Pd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function Sf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var N=l.stateNode.containerInfo;if(N===f)break;if(x===4)for(x=l.return;x!==null;){var I=x.tag;if((I===3||I===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;N!==null;){if(x=Hi(N),x===null)return;if(I=x.tag,I===5||I===6||I===26||I===27){l=h=x;continue e}N=N.parentNode}}l=l.return}jh(function(){var G=h,X=$d(a),ie=[];e:{var K=Xh.get(e);if(K!==void 0){var J=Sl,_e=e;switch(e){case"keypress":if(xl(a)===0)break e;case"keydown":case"keyup":J=Mk;break;case"focusin":_e="focus",J=Gd;break;case"focusout":_e="blur",J=Gd;break;case"beforeblur":case"afterblur":J=Gd;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=_k;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Ok;break;case Zh:case Yh:case Jh:J=Sk;break;case Wh:J=Lk;break;case"scroll":case"scrollend":J=yk;break;case"wheel":J=$k;break;case"copy":case"cut":case"paste":J=Tk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Eh;break;case"toggle":case"beforetoggle":J=Pk}var Ce=(n&4)!==0,gt=!Ce&&(e==="scroll"||e==="scrollend"),P=Ce?K!==null?K+"Capture":null:K;Ce=[];for(var z=G,q;z!==null;){var te=z;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||P===null||(te=Ko(z,P),te!=null&&Ce.push(wr(z,te,q))),gt)break;z=z.return}0<Ce.length&&(K=new J(K,_e,null,a,X),ie.push({event:K,listeners:Ce}))}}if((n&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",K&&a!==zd&&(_e=a.relatedTarget||a.fromElement)&&(Hi(_e)||_e[$i]))break e;if((J||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,J?(_e=a.relatedTarget||a.toElement,J=G,_e=_e?Hi(_e):null,_e!==null&&(gt=d(_e),Ce=_e.tag,_e!==gt||Ce!==5&&Ce!==27&&Ce!==6)&&(_e=null)):(J=null,_e=G),J!==_e)){if(Ce=Nh,te="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Eh,te="onPointerLeave",P="onPointerEnter",z="pointer"),gt=J==null?K:Fo(J),q=_e==null?K:Fo(_e),K=new Ce(te,z+"leave",J,a,X),K.target=gt,K.relatedTarget=q,te=null,Hi(X)===G&&(Ce=new Ce(P,z+"enter",_e,a,X),Ce.target=q,Ce.relatedTarget=gt,te=Ce),gt=te,J&&_e)t:{for(Ce=HS,P=J,z=_e,q=0,te=P;te;te=Ce(te))q++;te=0;for(var we=z;we;we=Ce(we))te++;for(;0<q-te;)P=Ce(P),q--;for(;0<te-q;)z=Ce(z),te--;for(;q--;){if(P===z||z!==null&&P===z.alternate){Ce=P;break t}P=Ce(P),z=Ce(z)}Ce=null}else Ce=null;J!==null&&_0(ie,K,J,Ce,!1),_e!==null&&gt!==null&&_0(ie,gt,_e,Ce,!0)}}e:{if(K=G?Fo(G):window,J=K.nodeName&&K.nodeName.toLowerCase(),J==="select"||J==="input"&&K.type==="file")var st=Lh;else if(Oh(K))if(zh)st=Wk;else{st=Yk;var Se=Zk}else J=K.nodeName,!J||J.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&Ld(G.elementType)&&(st=Lh):st=Jk;if(st&&(st=st(e,G))){Bh(ie,st,a,X);break e}Se&&Se(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&Bd(K,"number",K.value)}switch(Se=G?Fo(G):window,e){case"focusin":(Oh(Se)||Se.contentEditable==="true")&&(Yi=Se,Wd=G,tr=null);break;case"focusout":tr=Wd=Yi=null;break;case"mousedown":Xd=!0;break;case"contextmenu":case"mouseup":case"dragend":Xd=!1,Fh(ie,a,X);break;case"selectionchange":if(Qk)break;case"keydown":case"keyup":Fh(ie,a,X)}var $e;if(Kd)e:{switch(e){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Zi?Rh(e,a)&&(Ze="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ze="onCompositionStart");Ze&&(Ah&&a.locale!=="ko"&&(Zi||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Zi&&($e=Th()):(ga=X,Ud="value"in ga?ga.value:ga.textContent,Zi=!0)),Se=pc(G,Ze),0<Se.length&&(Ze=new Ch(Ze,e,null,a,X),ie.push({event:Ze,listeners:Se}),$e?Ze.data=$e:($e=Ih(a),$e!==null&&(Ze.data=$e)))),($e=Vk?qk(e,a):Gk(e,a))&&(Ze=pc(G,"onBeforeInput"),0<Ze.length&&(Se=new Ch("onBeforeInput","beforeinput",null,a,X),ie.push({event:Se,listeners:Ze}),Se.data=$e)),BS(ie,e,G,a,X)}y0(ie,n)})}function wr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function pc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Ko(e,a),f!=null&&l.unshift(wr(e,f,h)),f=Ko(e,n),f!=null&&l.push(wr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function HS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function _0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var N=a,I=N.alternate,G=N.stateNode;if(N=N.tag,I!==null&&I===l)break;N!==5&&N!==26&&N!==27||G===null||(I=G,f?(G=Ko(a,h),G!=null&&x.unshift(wr(a,G,I))):f||(G=Ko(a,h),G!=null&&x.push(wr(a,G,I)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var PS=/\r\n?/g,US=/\u0000|\uFFFD/g;function x0(e){return(typeof e=="string"?e:""+e).replace(PS,`
26
+ `).replace(US,"")}function k0(e,n){return n=x0(n),x0(e)===n}function ht(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Gi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Gi(e,""+l);break;case"className":vl(e,"class",l);break;case"tabIndex":vl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":vl(e,a,l);break;case"style":kh(e,l,h);break;case"data":if(n!=="object"){vl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=bl(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(n!=="input"&&ht(e,n,"name",f.name,f,null),ht(e,n,"formEncType",f.formEncType,f,null),ht(e,n,"formMethod",f.formMethod,f,null),ht(e,n,"formTarget",f.formTarget,f,null)):(ht(e,n,"encType",f.encType,f,null),ht(e,n,"method",f.method,f,null),ht(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=bl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=$s);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(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=bl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),gl(e,"popover",l);break;case"xlinkActuate":zs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":zs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":zs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":zs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":zs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":zs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":zs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":zs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":zs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":gl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=gk.get(a)||a,gl(e,a,l))}}function jf(e,n,a,l,f,h){switch(a){case"style":kh(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Gi(e,l):(typeof l=="number"||typeof l=="bigint")&&Gi(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=$s);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ph.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),h=e[_n]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):gl(e,a,l)}}}function dn(e,n,a){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 a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ht(e,n,h,x,a,null)}}f&&ht(e,n,"srcSet",a.srcSet,a,null),l&&ht(e,n,"src",a.src,a,null);return;case"input":Fe("invalid",e);var N=h=x=f=null,I=null,G=null;for(l in a)if(a.hasOwnProperty(l)){var X=a[l];if(X!=null)switch(l){case"name":f=X;break;case"type":x=X;break;case"checked":I=X;break;case"defaultChecked":G=X;break;case"value":h=X;break;case"defaultValue":N=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:ht(e,n,l,X,a,null)}}yh(e,h,N,I,G,x,f,!1);return;case"select":Fe("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(N=a[f],N!=null))switch(f){case"value":h=N;break;case"defaultValue":x=N;break;case"multiple":l=N;default:ht(e,n,f,N,a,null)}n=h,a=x,e.multiple=!!l,n!=null?qi(e,!!l,n,!1):a!=null&&qi(e,!!l,a,!0);return;case"textarea":Fe("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(N=a[x],N!=null))switch(x){case"value":l=N;break;case"defaultValue":f=N;break;case"children":h=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:ht(e,n,x,N,a,null)}_h(e,l,f,h);return;case"option":for(I in a)if(a.hasOwnProperty(I)&&(l=a[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ht(e,n,I,l,a,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<Tr.length;l++)Fe(Tr[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(G in a)if(a.hasOwnProperty(G)&&(l=a[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ht(e,n,G,l,a,null)}return;default:if(Ld(n)){for(X in a)a.hasOwnProperty(X)&&(l=a[X],l!==void 0&&jf(e,n,X,l,a,void 0));return}}for(N in a)a.hasOwnProperty(N)&&(l=a[N],l!=null&&ht(e,n,N,l,a,null))}function VS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,N=null,I=null,G=null,X=null;for(J in a){var ie=a[J];if(a.hasOwnProperty(J)&&ie!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":I=ie;default:l.hasOwnProperty(J)||ht(e,n,J,null,l,ie)}}for(var K in l){var J=l[K];if(ie=a[K],l.hasOwnProperty(K)&&(J!=null||ie!=null))switch(K){case"type":h=J;break;case"name":f=J;break;case"checked":G=J;break;case"defaultChecked":X=J;break;case"value":x=J;break;case"defaultValue":N=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:J!==ie&&ht(e,n,K,J,l,ie)}}Od(e,x,N,I,G,X,h,f);return;case"select":J=x=N=K=null;for(h in a)if(I=a[h],a.hasOwnProperty(h)&&I!=null)switch(h){case"value":break;case"multiple":J=I;default:l.hasOwnProperty(h)||ht(e,n,h,null,l,I)}for(f in l)if(h=l[f],I=a[f],l.hasOwnProperty(f)&&(h!=null||I!=null))switch(f){case"value":K=h;break;case"defaultValue":N=h;break;case"multiple":x=h;default:h!==I&&ht(e,n,f,h,l,I)}n=N,a=x,l=J,K!=null?qi(e,!!a,K,!1):!!l!=!!a&&(n!=null?qi(e,!!a,n,!0):qi(e,!!a,a?[]:"",!1));return;case"textarea":J=K=null;for(N in a)if(f=a[N],a.hasOwnProperty(N)&&f!=null&&!l.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:ht(e,n,N,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":K=f;break;case"defaultValue":J=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ht(e,n,x,f,l,h)}bh(e,K,J);return;case"option":for(var _e in a)if(K=a[_e],a.hasOwnProperty(_e)&&K!=null&&!l.hasOwnProperty(_e))switch(_e){case"selected":e.selected=!1;break;default:ht(e,n,_e,null,l,K)}for(I in l)if(K=l[I],J=a[I],l.hasOwnProperty(I)&&K!==J&&(K!=null||J!=null))switch(I){case"selected":e.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:ht(e,n,I,K,l,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ce in a)K=a[Ce],a.hasOwnProperty(Ce)&&K!=null&&!l.hasOwnProperty(Ce)&&ht(e,n,Ce,null,l,K);for(G in l)if(K=l[G],J=a[G],l.hasOwnProperty(G)&&K!==J&&(K!=null||J!=null))switch(G){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:ht(e,n,G,K,l,J)}return;default:if(Ld(n)){for(var gt in a)K=a[gt],a.hasOwnProperty(gt)&&K!==void 0&&!l.hasOwnProperty(gt)&&jf(e,n,gt,void 0,l,K);for(X in l)K=l[X],J=a[X],!l.hasOwnProperty(X)||K===J||K===void 0&&J===void 0||jf(e,n,X,K,l,J);return}}for(var P in a)K=a[P],a.hasOwnProperty(P)&&K!=null&&!l.hasOwnProperty(P)&&ht(e,n,P,null,l,K);for(ie in l)K=l[ie],J=a[ie],!l.hasOwnProperty(ie)||K===J||K==null&&J==null||ht(e,n,ie,K,l,J)}function S0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,x=f.initiatorType,N=f.duration;if(h&&N&&S0(x)){for(x=0,N=f.responseEnd,l+=1;l<a.length;l++){var I=a[l],G=I.startTime;if(G>N)break;var X=I.transferSize,ie=I.initiatorType;X&&S0(ie)&&(I=I.responseEnd,x+=X*(I<N?1:(N-G)/(I-G)))}if(--l,n+=8*(h+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Tf=null,wf=null;function mc(e){return e.nodeType===9?e:e.ownerDocument}function j0(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 T0(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 Nf(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 Cf=null;function GS(){var e=window.event;return e&&e.type==="popstate"?e===Cf?!1:(Cf=e,!0):(Cf=null,!1)}var w0=typeof setTimeout=="function"?setTimeout:void 0,FS=typeof clearTimeout=="function"?clearTimeout:void 0,N0=typeof Promise=="function"?Promise:void 0,KS=typeof queueMicrotask=="function"?queueMicrotask:typeof N0<"u"?function(e){return N0.resolve(null).then(e).catch(ZS)}:w0;function ZS(e){setTimeout(function(){throw e})}function Ra(e){return e==="head"}function C0(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),So(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Nr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Nr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,N=h.nodeName;h[Go]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&Nr(e.ownerDocument.body);a=f}while(a);So(n)}function E0(e,n){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Ef(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ef(a),Rd(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function YS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Go])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Jn(e.nextSibling),e===null)break}return null}function JS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Jn(e.nextSibling),e===null))return null;return e}function A0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function Af(e){return e.data==="$?"||e.data==="$~"}function Df(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function WS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Jn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Mf=null;function D0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Jn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function M0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function R0(e,n,a){switch(n=mc(a),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Nr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Rd(e)}var Wn=new Map,I0=new Set;function hc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ta=B.d;B.d={f:XS,r:QS,D:e2,C:t2,L:n2,m:s2,X:i2,S:a2,M:o2};function XS(){var e=ta.f(),n=oc();return e||n}function QS(e){var n=Pi(e);n!==null&&n.tag===5&&n.type==="form"?Wg(n):ta.r(e)}var _o=typeof document>"u"?null:document;function O0(e,n,a){var l=_o;if(l&&typeof n=="string"&&n){var f=Vn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),I0.has(f)||(I0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),dn(n,"link",e),Qt(n),l.head.appendChild(n)))}}function e2(e){ta.D(e),O0("dns-prefetch",e,null)}function t2(e,n){ta.C(e,n),O0("preconnect",e,n)}function n2(e,n,a){ta.L(e,n,a);var l=_o;if(l&&e&&n){var f='link[rel="preload"][as="'+Vn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Vn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Vn(a.imageSizes)+'"]')):f+='[href="'+Vn(e)+'"]';var h=f;switch(n){case"style":h=xo(e);break;case"script":h=ko(e)}Wn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Wn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Cr(h))||n==="script"&&l.querySelector(Er(h))||(n=l.createElement("link"),dn(n,"link",e),Qt(n),l.head.appendChild(n)))}}function s2(e,n){ta.m(e,n);var a=_o;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Vn(l)+'"][href="'+Vn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=ko(e)}if(!Wn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Wn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Er(h)))return}l=a.createElement("link"),dn(l,"link",e),Qt(l),a.head.appendChild(l)}}}function a2(e,n,a){ta.S(e,n,a);var l=_o;if(l&&e){var f=Ui(l).hoistableStyles,h=xo(e);n=n||"default";var x=f.get(h);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(Cr(h)))N.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Wn.get(h))&&Rf(e,a);var I=x=l.createElement("link");Qt(I),dn(I,"link",e),I._p=new Promise(function(G,X){I.onload=G,I.onerror=X}),I.addEventListener("load",function(){N.loading|=1}),I.addEventListener("error",function(){N.loading|=2}),N.loading|=4,gc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:N},f.set(h,x)}}}function i2(e,n){ta.X(e,n);var a=_o;if(a&&e){var l=Ui(a).hoistableScripts,f=ko(e),h=l.get(f);h||(h=a.querySelector(Er(f)),h||(e=b({src:e,async:!0},n),(n=Wn.get(f))&&If(e,n),h=a.createElement("script"),Qt(h),dn(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function o2(e,n){ta.M(e,n);var a=_o;if(a&&e){var l=Ui(a).hoistableScripts,f=ko(e),h=l.get(f);h||(h=a.querySelector(Er(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Wn.get(f))&&If(e,n),h=a.createElement("script"),Qt(h),dn(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function B0(e,n,a,l){var f=(f=yt.current)?hc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=xo(a.href),a=Ui(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=xo(a.href);var h=Ui(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(Cr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Wn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Wn.set(e,a),h||r2(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=ko(a),a=Ui(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function xo(e){return'href="'+Vn(e)+'"'}function Cr(e){return'link[rel="stylesheet"]['+e+"]"}function L0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function r2(e,n,a,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),dn(n,"link",a),Qt(n),e.head.appendChild(n))}function ko(e){return'[src="'+Vn(e)+'"]'}function Er(e){return"script[async]"+e}function z0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Vn(a.href)+'"]');if(l)return n.instance=l,Qt(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Qt(l),dn(l,"style",f),gc(l,a.precedence,e),n.instance=l;case"stylesheet":f=xo(a.href);var h=e.querySelector(Cr(f));if(h)return n.state.loading|=4,n.instance=h,Qt(h),h;l=L0(a),(f=Wn.get(f))&&Rf(l,f),h=(e.ownerDocument||e).createElement("link"),Qt(h);var x=h;return x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),dn(h,"link",l),n.state.loading|=4,gc(h,a.precedence,e),n.instance=h;case"script":return h=ko(a.src),(f=e.querySelector(Er(h)))?(n.instance=f,Qt(f),f):(l=a,(f=Wn.get(h))&&(l=b({},a),If(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Qt(f),dn(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,gc(l,a.precedence,e));return n.instance}function gc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,x=0;x<l.length;x++){var N=l[x];if(N.dataset.precedence===n)h=N;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Rf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function If(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var vc=null;function $0(e,n,a){if(vc===null){var l=new Map,f=vc=new Map;f.set(a,l)}else f=vc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var h=a[f];if(!(h[Go]||h[on]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var N=l.get(x);N?N.push(h):l.set(x,[h])}}return l}function H0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function l2(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function P0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function c2(e,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=xo(l.href),h=n.querySelector(Cr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=yc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Qt(h);return}h=n.ownerDocument||n,l=L0(l),(f=Wn.get(f))&&Rf(l,f),h=h.createElement("link"),Qt(h);var x=h;x._p=new Promise(function(N,I){x.onload=N,x.onerror=I}),dn(h,"link",l),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=yc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Of=0;function d2(e,n){return e.stylesheets&&e.count===0&&_c(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Of===0&&(Of=62500*qS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&_c(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Of?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function yc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_c(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bc=null;function _c(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bc=new Map,n.forEach(u2,e),bc=null,yc.call(e))}function u2(e,n){if(!(n.state.loading&4)){var a=bc.get(e);if(a)var l=a.get(null);else{a=new Map,bc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=yc.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 Ar={$$typeof:D,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function f2(e,n,a,l,f,h,x,N,I){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Le(0),this.hiddenUpdates=Le(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function U0(e,n,a,l,f,h,x,N,I,G,X,ie){return e=new f2(e,n,a,x,I,G,X,ie,N),n=1,h===!0&&(n|=24),h=An(3,null,null,n),e.current=h,h.stateNode=e,n=pu(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},vu(h),e}function V0(e){return e?(e=Xi,e):Xi}function q0(e,n,a,l,f,h){f=V0(f),l.context===null?l.context=f:l.pendingContext=f,l=ka(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=Sa(e,l,n),a!==null&&(wn(a,e,n),lr(a,e,n))}function G0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Bf(e,n){G0(e,n),(e=e.alternate)&&G0(e,n)}function F0(e){if(e.tag===13||e.tag===31){var n=si(e,67108864);n!==null&&wn(n,e,67108864),Bf(e,67108864)}}function K0(e){if(e.tag===13||e.tag===31){var n=On();n=bt(n);var a=si(e,n);a!==null&&wn(a,e,n),Bf(e,n)}}var xc=!0;function p2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=2,Lf(e,n,a,l)}finally{B.p=h,H.T=f}}function m2(e,n,a,l){var f=H.T;H.T=null;var h=B.p;try{B.p=8,Lf(e,n,a,l)}finally{B.p=h,H.T=f}}function Lf(e,n,a,l){if(xc){var f=zf(l);if(f===null)Sf(e,n,l,kc,a),Y0(e,l);else if(g2(f,e,n,a,l))l.stopPropagation();else if(Y0(e,l),n&4&&-1<h2.indexOf(e)){for(;f!==null;){var h=Pi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=de(h.pendingLanes);if(x!==0){var N=h;for(N.pendingLanes|=2,N.entangledLanes|=2;x;){var I=1<<31-Xt(x);N.entanglements[1]|=I,x&=~I}Cs(h),(rt&6)===0&&(ac=Wt()+500,jr(0))}}break;case 31:case 13:N=si(h,2),N!==null&&wn(N,h,2),oc(),Bf(h,2)}if(h=zf(l),h===null&&Sf(e,n,l,kc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else Sf(e,n,l,null,a)}}function zf(e){return e=$d(e),$f(e)}var kc=null;function $f(e){if(kc=null,e=Hi(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return kc=e,null}function Z0(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(Wa()){case Xa:return 2;case ha:return 8;case Ls:case xs:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var Hf=!1,Ia=null,Oa=null,Ba=null,Dr=new Map,Mr=new Map,La=[],h2="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 Y0(e,n){switch(e){case"focusin":case"focusout":Ia=null;break;case"dragenter":case"dragleave":Oa=null;break;case"mouseover":case"mouseout":Ba=null;break;case"pointerover":case"pointerout":Dr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mr.delete(n.pointerId)}}function Rr(e,n,a,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Pi(n),n!==null&&F0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function g2(e,n,a,l,f){switch(n){case"focusin":return Ia=Rr(Ia,e,n,a,l,f),!0;case"dragenter":return Oa=Rr(Oa,e,n,a,l,f),!0;case"mouseover":return Ba=Rr(Ba,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return Dr.set(h,Rr(Dr.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Mr.set(h,Rr(Mr.get(h)||null,e,n,a,l,f)),!0}return!1}function J0(e){var n=Hi(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,Ss(e.priority,function(){K0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Ss(e.priority,function(){K0(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=zf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);zd=l,a.target.dispatchEvent(l),zd=null}else return n=Pi(a),n!==null&&F0(n),e.blockedOn=a,!1;n.shift()}return!0}function W0(e,n,a){Sc(e)&&a.delete(n)}function v2(){Hf=!1,Ia!==null&&Sc(Ia)&&(Ia=null),Oa!==null&&Sc(Oa)&&(Oa=null),Ba!==null&&Sc(Ba)&&(Ba=null),Dr.forEach(W0),Mr.forEach(W0)}function jc(e,n){e.blockedOn===n&&(e.blockedOn=null,Hf||(Hf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,v2)))}var Tc=null;function X0(e){Tc!==e&&(Tc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Tc===e&&(Tc=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if($f(l||a)===null)continue;break}var h=Pi(a);h!==null&&(e.splice(n,3),n-=3,Lu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function So(e){function n(I){return jc(I,e)}Ia!==null&&jc(Ia,e),Oa!==null&&jc(Oa,e),Ba!==null&&jc(Ba,e),Dr.forEach(n),Mr.forEach(n);for(var a=0;a<La.length;a++){var l=La[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<La.length&&(a=La[0],a.blockedOn===null);)J0(a),a.blockedOn===null&&La.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],x=f[_n]||null;if(typeof h=="function")x||X0(a);else if(x){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[_n]||null)N=x.formAction;else if($f(f)!==null)continue}else N=x.action;typeof N=="function"?a[l+1]=N:(a.splice(l,3),l-=3),X0(a)}}}function Q0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Pf(e){this._internalRoot=e}wc.prototype.render=Pf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=On();q0(a,l,e,n,null,null)},wc.prototype.unmount=Pf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;q0(e.current,2,null,e,null,null),oc(),n[$i]=null}};function wc(e){this._internalRoot=e}wc.prototype.unstable_scheduleHydration=function(e){if(e){var n=zi();e={blockedOn:null,target:e,priority:n};for(var a=0;a<La.length&&n!==0&&n<La[a].priority;a++);La.splice(a,0,e),a===0&&J0(e)}};var ey=s.version;if(ey!=="19.2.4")throw Error(r(527,ey,"19.2.4"));B.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var y2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nc.isDisabled&&Nc.supportsFiber)try{pn=Nc.inject(y2),Pt=Nc}catch{}}return Ir.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=rv,h=lv,x=cv;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=U0(e,1,!1,null,null,a,l,null,f,h,x,Q0),e[$i]=n.current,kf(e),new Pf(n)},Ir.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=rv,x=lv,N=cv,I=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(N=a.onRecoverableError),a.formState!==void 0&&(I=a.formState)),n=U0(e,1,!0,n,a??null,l,f,I,h,x,N,Q0),n.context=V0(null),a=n.current,l=On(),l=bt(l),f=ka(l),f.callback=null,Sa(a,f,l),a=l,n.current.lanes=a,Ue(n,a),Cs(n),e[$i]=n.current,kf(e),new wc(n)},Ir.version="19.2.4",Ir}var ly;function Z2(){if(ly)return Uf.exports;ly=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(),Uf.exports=K2(),Uf.exports}var Y2=Z2();const J2="modulepreload",W2=function(t){return"/"+t},cy={},k_=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(o.map(g=>{if(g=W2(g),g in cy)return;cy[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":J2,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((k,S)=>{_.addEventListener("load",k),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},X2=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),gd=C2({baseUrl:"/",fetch:X2}),Be=hd(E2,gd),Ln=hd(A2,gd),Dc=hd(D2,gd),Mc=hd(M2,gd),Q2="_bar_1xlm9_1",ej="_textarea_1xlm9_32",tj="_select_1xlm9_73",nj="_btnPrimary_1xlm9_109",sj="_btnGhost_1xlm9_179",aj="_badge_1xlm9_201",ij="_disconnectHint_1xlm9_211",vs={bar:Q2,textarea:ej,select:tj,btnPrimary:nj,btnGhost:sj,badge:aj,disconnectHint:ij},oj=200;function rj(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 lj({environmentId:t,onReconnect:s}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:vs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),i.jsx("button",{type:"button",onClick:()=>s(t),className:vs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Gf({value:t,onChange:s,onSubmit:o,placeholder:r,disabled:c,autoFocus:d,ariaLabel:u}){const p=y.useRef(null);y.useLayoutEffect(()=>{const g=p.current;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,oj)}px`)},[t]);const m=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.nativeEvent.isComposing&&(g.preventDefault(),o())};return i.jsx("textarea",{ref:p,rows:1,value:t,onChange:g=>s(g.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:vs.textarea,"aria-label":u})}function vd({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,k]=y.useState(""),[S,j]=y.useState(""),T=rj(o,u),w=()=>{if(_.trim())if(t==="send"){if(!s||T)return;p(s,_),k("")}else if(t==="spawn"){if(!o)return;m(o,_,S),b==null||b("Session started","success"),k(""),j("")}else{if(!r)return;g(r,void 0,o,_),k("")}},C=D=>{D.preventDefault(),w()};return t==="spawn"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx("span",{className:vs.badge,children:"new chat"}),i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&i.jsxs("select",{value:S,onChange:D=>j(D.target.value),className:vs.select,"aria-label":"Select persona",children:[i.jsx("option",{value:"",children:"(Default)"}),d.map(D=>i.jsx("option",{value:D.id,children:D.name},D.id))]}),i.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:vs.btnPrimary,children:"Go"})]}):t==="start"?i.jsxs("form",{onSubmit:C,className:vs.bar,children:[i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),i.jsx("button",{type:"submit",disabled:!_.trim(),className:vs.btnPrimary,children:"Send"})]}):i.jsxs("form",{onSubmit:C,className:vs.bar,children:[T&&o&&i.jsx(lj,{environmentId:o,onReconnect:v}),i.jsx(Gf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!T,disabled:T,ariaLabel:"Type a message"}),i.jsx("span",{title:T?"Environment is unavailable — reconnect first":void 0,children:i.jsx("button",{type:"submit",disabled:!_.trim()||T,className:vs.btnPrimary,children:"Send"})})]})}const dy=220,uy=70,cj=40,dj=60,uj="hierarchy",fj="dependency";function pj(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new ty.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:cj,ranksep:dj});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:dy,height:uy});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:uj},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:fj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return ty.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-dy/2,y:p.y-uy/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(g=>g.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
27
27
  * @license lucide-react v0.474.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const mT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),S_=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
31
+ */const mj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),S_=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
32
32
  * @license lucide-react v0.474.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */var hT={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"};/**
36
+ */var hj={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
37
  * @license lucide-react v0.474.0 - ISC
38
38
  *
39
39
  * This source code is licensed under the ISC license.
40
40
  * See the LICENSE file in the root directory of this source tree.
41
- */const gT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...hT,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:S_("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
41
+ */const gj=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...hj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:S_("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
42
42
  * @license lucide-react v0.474.0 - ISC
43
43
  *
44
44
  * This source code is licensed under the ISC license.
45
45
  * See the LICENSE file in the root directory of this source tree.
46
- */const Ie=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(gT,{ref:d,iconNode:s,className:S_(`lucide-${mT(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
46
+ */const Ie=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(gj,{ref:d,iconNode:s,className:S_(`lucide-${mj(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
47
47
  * @license lucide-react v0.474.0 - ISC
48
48
  *
49
49
  * This source code is licensed under the ISC license.
50
50
  * See the LICENSE file in the root directory of this source tree.
51
- */const vT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fy=Ie("ArrowDown",vT);/**
51
+ */const vj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fy=Ie("ArrowDown",vj);/**
52
52
  * @license lucide-react v0.474.0 - ISC
53
53
  *
54
54
  * This source code is licensed under the ISC license.
55
55
  * See the LICENSE file in the root directory of this source tree.
56
- */const yT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],py=Ie("ArrowUp",yT);/**
56
+ */const yj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],py=Ie("ArrowUp",yj);/**
57
57
  * @license lucide-react v0.474.0 - ISC
58
58
  *
59
59
  * This source code is licensed under the ISC license.
60
60
  * See the LICENSE file in the root directory of this source tree.
61
- */const bT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],_T=Ie("Ban",bT);/**
61
+ */const bj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],_j=Ie("Ban",bj);/**
62
62
  * @license lucide-react v0.474.0 - ISC
63
63
  *
64
64
  * This source code is licensed under the ISC license.
65
65
  * See the LICENSE file in the root directory of this source tree.
66
- */const xT=[["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"}]],kT=Ie("Brain",xT);/**
66
+ */const xj=[["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"}]],kj=Ie("Brain",xj);/**
67
67
  * @license lucide-react v0.474.0 - ISC
68
68
  *
69
69
  * This source code is licensed under the ISC license.
70
70
  * See the LICENSE file in the root directory of this source tree.
71
- */const ST=[["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"}]],TT=Ie("CalendarClock",ST);/**
71
+ */const Sj=[["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"}]],jj=Ie("CalendarClock",Sj);/**
72
72
  * @license lucide-react v0.474.0 - ISC
73
73
  *
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
- */const jT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ci=Ie("Check",jT);/**
76
+ */const Tj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ci=Ie("Check",Tj);/**
77
77
  * @license lucide-react v0.474.0 - ISC
78
78
  *
79
79
  * This source code is licensed under the ISC license.
80
80
  * See the LICENSE file in the root directory of this source tree.
81
- */const wT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],T_=Ie("ChevronDown",wT);/**
81
+ */const wj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],j_=Ie("ChevronDown",wj);/**
82
82
  * @license lucide-react v0.474.0 - ISC
83
83
  *
84
84
  * This source code is licensed under the ISC license.
85
85
  * See the LICENSE file in the root directory of this source tree.
86
- */const NT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],da=Ie("ChevronRight",NT);/**
86
+ */const Nj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ua=Ie("ChevronRight",Nj);/**
87
87
  * @license lucide-react v0.474.0 - ISC
88
88
  *
89
89
  * This source code is licensed under the ISC license.
90
90
  * See the LICENSE file in the root directory of this source tree.
91
- */const CT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ti=Ie("Circle",CT);/**
91
+ */const Cj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ji=Ie("Circle",Cj);/**
92
92
  * @license lucide-react v0.474.0 - ISC
93
93
  *
94
94
  * This source code is licensed under the ISC license.
95
95
  * See the LICENSE file in the root directory of this source tree.
96
- */const ET=[["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"}]],AT=Ie("ClipboardList",ET);/**
96
+ */const Ej=[["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"}]],Aj=Ie("ClipboardList",Ej);/**
97
97
  * @license lucide-react v0.474.0 - ISC
98
98
  *
99
99
  * This source code is licensed under the ISC license.
100
100
  * See the LICENSE file in the root directory of this source tree.
101
- */const DT=[["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"}]],j_=Ie("Clipboard",DT);/**
101
+ */const Dj=[["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"}]],T_=Ie("Clipboard",Dj);/**
102
102
  * @license lucide-react v0.474.0 - ISC
103
103
  *
104
104
  * This source code is licensed under the ISC license.
105
105
  * See the LICENSE file in the root directory of this source tree.
106
- */const MT=[["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"}]],RT=Ie("Cog",MT);/**
106
+ */const Mj=[["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"}]],Rj=Ie("Cog",Mj);/**
107
107
  * @license lucide-react v0.474.0 - ISC
108
108
  *
109
109
  * This source code is licensed under the ISC license.
110
110
  * See the LICENSE file in the root directory of this source tree.
111
- */const IT=[["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"}]],OT=Ie("Copy",IT);/**
111
+ */const Ij=[["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"}]],Oj=Ie("Copy",Ij);/**
112
112
  * @license lucide-react v0.474.0 - ISC
113
113
  *
114
114
  * This source code is licensed under the ISC license.
115
115
  * See the LICENSE file in the root directory of this source tree.
116
- */const BT=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],LT=Ie("CornerDownRight",BT);/**
116
+ */const Bj=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Lj=Ie("CornerDownRight",Bj);/**
117
117
  * @license lucide-react v0.474.0 - ISC
118
118
  *
119
119
  * This source code is licensed under the ISC license.
120
120
  * See the LICENSE file in the root directory of this source tree.
121
- */const zT=[["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"}]],$T=Ie("FilePen",zT);/**
121
+ */const zj=[["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"}]],$j=Ie("FilePen",zj);/**
122
122
  * @license lucide-react v0.474.0 - ISC
123
123
  *
124
124
  * This source code is licensed under the ISC license.
125
125
  * See the LICENSE file in the root directory of this source tree.
126
- */const HT=[["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"}]],PT=Ie("FileText",HT);/**
126
+ */const Hj=[["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"}]],Pj=Ie("FileText",Hj);/**
127
127
  * @license lucide-react v0.474.0 - ISC
128
128
  *
129
129
  * This source code is licensed under the ISC license.
130
130
  * See the LICENSE file in the root directory of this source tree.
131
- */const UT=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],VT=Ie("Forward",UT);/**
131
+ */const Uj=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],Vj=Ie("Forward",Uj);/**
132
132
  * @license lucide-react v0.474.0 - ISC
133
133
  *
134
134
  * This source code is licensed under the ISC license.
135
135
  * See the LICENSE file in the root directory of this source tree.
136
- */const qT=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],GT=Ie("GitBranch",qT);/**
136
+ */const qj=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Gj=Ie("GitBranch",qj);/**
137
137
  * @license lucide-react v0.474.0 - ISC
138
138
  *
139
139
  * This source code is licensed under the ISC license.
140
140
  * See the LICENSE file in the root directory of this source tree.
141
- */const FT=[["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"}]],KT=Ie("Github",FT);/**
141
+ */const Fj=[["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"}]],Kj=Ie("Github",Fj);/**
142
142
  * @license lucide-react v0.474.0 - ISC
143
143
  *
144
144
  * This source code is licensed under the ISC license.
145
145
  * See the LICENSE file in the root directory of this source tree.
146
- */const ZT=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],YT=Ie("Hash",ZT);/**
146
+ */const Zj=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Yj=Ie("Hash",Zj);/**
147
147
  * @license lucide-react v0.474.0 - ISC
148
148
  *
149
149
  * This source code is licensed under the ISC license.
150
150
  * See the LICENSE file in the root directory of this source tree.
151
- */const JT=[["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"}]],WT=Ie("House",JT);/**
151
+ */const Jj=[["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"}]],Wj=Ie("House",Jj);/**
152
152
  * @license lucide-react v0.474.0 - ISC
153
153
  *
154
154
  * This source code is licensed under the ISC license.
155
155
  * See the LICENSE file in the root directory of this source tree.
156
- */const XT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],pm=Ie("Info",XT);/**
156
+ */const Xj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],pm=Ie("Info",Xj);/**
157
157
  * @license lucide-react v0.474.0 - ISC
158
158
  *
159
159
  * This source code is licensed under the ISC license.
160
160
  * See the LICENSE file in the root directory of this source tree.
161
- */const QT=[["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"}]],ej=Ie("Key",QT);/**
161
+ */const Qj=[["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"}]],eT=Ie("Key",Qj);/**
162
162
  * @license lucide-react v0.474.0 - ISC
163
163
  *
164
164
  * This source code is licensed under the ISC license.
165
165
  * See the LICENSE file in the root directory of this source tree.
166
- */const tj=[["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"}]],nj=Ie("Keyboard",tj);/**
166
+ */const tT=[["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"}]],nT=Ie("Keyboard",tT);/**
167
167
  * @license lucide-react v0.474.0 - ISC
168
168
  *
169
169
  * This source code is licensed under the ISC license.
170
170
  * See the LICENSE file in the root directory of this source tree.
171
- */const sj=[["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"}]],aj=Ie("ListChecks",sj);/**
171
+ */const sT=[["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"}]],aT=Ie("ListChecks",sT);/**
172
172
  * @license lucide-react v0.474.0 - ISC
173
173
  *
174
174
  * This source code is licensed under the ISC license.
175
175
  * See the LICENSE file in the root directory of this source tree.
176
- */const ij=[["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"}]],oj=Ie("List",ij);/**
176
+ */const iT=[["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"}]],oT=Ie("List",iT);/**
177
177
  * @license lucide-react v0.474.0 - ISC
178
178
  *
179
179
  * This source code is licensed under the ISC license.
180
180
  * See the LICENSE file in the root directory of this source tree.
181
- */const rj=[["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"}]],lj=Ie("Loader",rj);/**
181
+ */const rT=[["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"}]],lT=Ie("Loader",rT);/**
182
182
  * @license lucide-react v0.474.0 - ISC
183
183
  *
184
184
  * This source code is licensed under the ISC license.
185
185
  * See the LICENSE file in the root directory of this source tree.
186
- */const cj=[["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"}]],dj=Ie("Menu",cj);/**
186
+ */const cT=[["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"}]],dT=Ie("Menu",cT);/**
187
187
  * @license lucide-react v0.474.0 - ISC
188
188
  *
189
189
  * This source code is licensed under the ISC license.
190
190
  * See the LICENSE file in the root directory of this source tree.
191
- */const uj=[["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"}]],fj=Ie("MessageSquare",uj);/**
191
+ */const uT=[["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"}]],fT=Ie("MessageSquare",uT);/**
192
192
  * @license lucide-react v0.474.0 - ISC
193
193
  *
194
194
  * This source code is licensed under the ISC license.
195
195
  * See the LICENSE file in the root directory of this source tree.
196
- */const pj=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],mj=Ie("MessagesSquare",pj);/**
196
+ */const pT=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],mT=Ie("MessagesSquare",pT);/**
197
197
  * @license lucide-react v0.474.0 - ISC
198
198
  *
199
199
  * This source code is licensed under the ISC license.
200
200
  * See the LICENSE file in the root directory of this source tree.
201
- */const hj=[["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"}]],gj=Ie("Monitor",hj);/**
201
+ */const hT=[["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"}]],gT=Ie("Monitor",hT);/**
202
202
  * @license lucide-react v0.474.0 - ISC
203
203
  *
204
204
  * This source code is licensed under the ISC license.
205
205
  * See the LICENSE file in the root directory of this source tree.
206
- */const vj=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],yj=Ie("Network",vj);/**
206
+ */const vT=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],yT=Ie("Network",vT);/**
207
207
  * @license lucide-react v0.474.0 - ISC
208
208
  *
209
209
  * This source code is licensed under the ISC license.
210
210
  * See the LICENSE file in the root directory of this source tree.
211
- */const bj=[["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"}]],_j=Ie("Palette",bj);/**
211
+ */const bT=[["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"}]],_T=Ie("Palette",bT);/**
212
212
  * @license lucide-react v0.474.0 - ISC
213
213
  *
214
214
  * This source code is licensed under the ISC license.
215
215
  * See the LICENSE file in the root directory of this source tree.
216
- */const xj=[["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"}]],kj=Ie("Pause",xj);/**
216
+ */const xT=[["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"}]],kT=Ie("Pause",xT);/**
217
217
  * @license lucide-react v0.474.0 - ISC
218
218
  *
219
219
  * This source code is licensed under the ISC license.
220
220
  * See the LICENSE file in the root directory of this source tree.
221
- */const Sj=[["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"}]],Tj=Ie("Pencil",Sj);/**
221
+ */const ST=[["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"}]],jT=Ie("Pencil",ST);/**
222
222
  * @license lucide-react v0.474.0 - ISC
223
223
  *
224
224
  * This source code is licensed under the ISC license.
225
225
  * See the LICENSE file in the root directory of this source tree.
226
- */const jj=[["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"}]],wj=Ie("Puzzle",jj);/**
226
+ */const TT=[["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"}]],wT=Ie("Puzzle",TT);/**
227
227
  * @license lucide-react v0.474.0 - ISC
228
228
  *
229
229
  * This source code is licensed under the ISC license.
230
230
  * See the LICENSE file in the root directory of this source tree.
231
- */const Nj=[["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"}]],Cj=Ie("RefreshCw",Nj);/**
231
+ */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"}]],CT=Ie("RefreshCw",NT);/**
232
232
  * @license lucide-react v0.474.0 - ISC
233
233
  *
234
234
  * This source code is licensed under the ISC license.
235
235
  * See the LICENSE file in the root directory of this source tree.
236
- */const Ej=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Rp=Ie("Search",Ej);/**
236
+ */const ET=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Rp=Ie("Search",ET);/**
237
237
  * @license lucide-react v0.474.0 - ISC
238
238
  *
239
239
  * This source code is licensed under the ISC license.
240
240
  * See the LICENSE file in the root directory of this source tree.
241
- */const Aj=[["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"}]],Dj=Ie("Settings",Aj);/**
241
+ */const AT=[["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"}]],DT=Ie("Settings",AT);/**
242
242
  * @license lucide-react v0.474.0 - ISC
243
243
  *
244
244
  * This source code is licensed under the ISC license.
245
245
  * See the LICENSE file in the root directory of this source tree.
246
- */const Mj=[["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"}]],Rj=Ie("SquareCheckBig",Mj);/**
246
+ */const MT=[["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=Ie("SquareCheckBig",MT);/**
247
247
  * @license lucide-react v0.474.0 - ISC
248
248
  *
249
249
  * This source code is licensed under the ISC license.
250
250
  * See the LICENSE file in the root directory of this source tree.
251
- */const Ij=[["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"}]],Oj=Ie("Star",Ij);/**
251
+ */const IT=[["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"}]],OT=Ie("Star",IT);/**
252
252
  * @license lucide-react v0.474.0 - ISC
253
253
  *
254
254
  * This source code is licensed under the ISC license.
255
255
  * See the LICENSE file in the root directory of this source tree.
256
- */const Bj=[["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"}]],mm=Ie("TriangleAlert",Bj);/**
256
+ */const BT=[["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"}]],mm=Ie("TriangleAlert",BT);/**
257
257
  * @license lucide-react v0.474.0 - ISC
258
258
  *
259
259
  * This source code is licensed under the ISC license.
260
260
  * See the LICENSE file in the root directory of this source tree.
261
- */const Lj=[["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"}]],zj=Ie("User",Lj);/**
261
+ */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"}]],zT=Ie("User",LT);/**
262
262
  * @license lucide-react v0.474.0 - ISC
263
263
  *
264
264
  * This source code is licensed under the ISC license.
265
265
  * See the LICENSE file in the root directory of this source tree.
266
- */const $j=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Is=Ie("X",$j),w_=8,Ze=12,zt=14,wt=16,Ip={not_started:{color:"var(--text-tertiary)",icon:i.jsx(Ti,{size:Ze}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(Ti,{size:Ze,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(kj,{size:Ze}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ci,{size:Ze}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Is,{size:Ze}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(_T,{size:Ze}),label:"Blocked"}};function Ka(t){return t==="blocked"?Ip.blocked:Ip[rl(t)]}const Hj={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function Pj(t){return Hj[rl(t)]??"statusPending"}const Uj=["working","paused","failed","not_started","blocked","complete"],my=["not_started","working","paused","complete","failed"],Vj={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function rl(t){return t in Ip&&t!=="blocked"?t:Vj[t]??"not_started"}const qj={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"},Gj="_dagContainer_js4w6_1",Fj="_taskNode_js4w6_26",Kj="_taskNodeBorder_js4w6_54",Zj="_taskNodeContent_js4w6_60",Yj="_taskNodeHeader_js4w6_70",Jj="_taskNodeIcon_js4w6_77",Wj="_taskNodeTitle_js4w6_82",Xj="_taskNodeBadges_js4w6_90",Qj="_childBadge_js4w6_95",ew="_depBadge_js4w6_107",tw="_handle_js4w6_119",nw="_emptyCta_js4w6_126",sw="_ctaDescription_js4w6_137",aw="_ctaButton_js4w6_144",bn={dagContainer:Gj,taskNode:Fj,taskNodeBorder:Kj,taskNodeContent:Zj,taskNodeHeader:Yj,taskNodeIcon:Jj,taskNodeTitle:Wj,taskNodeBadges:Xj,childBadge:Qj,depBadge:ew,handle:tw,emptyCta:nw,ctaDescription:sw,ctaButton:aw};function iw({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Ka(s.status);return i.jsxs("div",{className:bn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(ny,{type:"target",position:sy.Top,className:bn.handle}),i.jsx("div",{className:bn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:bn.taskNodeContent,children:[i.jsxs("div",{className:bn.taskNodeHeader,children:[i.jsx("span",{className:bn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:bn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:bn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:bn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:bn.depBadge,children:"dep"})]})]}),i.jsx(ny,{type:"source",position:sy.Bottom,className:bn.handle})]})}/**
266
+ */const $T=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Os=Ie("X",$T),w_=8,Ye=12,$t=14,Ct=16,Ip={not_started:{color:"var(--text-tertiary)",icon:i.jsx(ji,{size:Ye}),label:"Not Started"},working:{color:"var(--accent-green)",icon:i.jsx(ji,{size:Ye,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:i.jsx(kT,{size:Ye}),label:"Paused"},complete:{color:"var(--accent-green)",icon:i.jsx(Ci,{size:Ye}),label:"Complete"},failed:{color:"var(--accent-red)",icon:i.jsx(Os,{size:Ye}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:i.jsx(_j,{size:Ye}),label:"Blocked"}};function Ka(t){return t==="blocked"?Ip.blocked:Ip[ll(t)]}const HT={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function PT(t){return HT[ll(t)]??"statusPending"}const UT=["working","paused","failed","not_started","blocked","complete"],my=["not_started","working","paused","complete","failed"],VT={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function ll(t){return t in Ip&&t!=="blocked"?t:VT[t]??"not_started"}const qT={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"},GT="_dagContainer_js4w6_1",FT="_taskNode_js4w6_26",KT="_taskNodeBorder_js4w6_54",ZT="_taskNodeContent_js4w6_60",YT="_taskNodeHeader_js4w6_70",JT="_taskNodeIcon_js4w6_77",WT="_taskNodeTitle_js4w6_82",XT="_taskNodeBadges_js4w6_90",QT="_childBadge_js4w6_95",ew="_depBadge_js4w6_107",tw="_handle_js4w6_119",nw="_emptyCta_js4w6_126",sw="_ctaDescription_js4w6_137",aw="_ctaButton_js4w6_144",yn={dagContainer:GT,taskNode:FT,taskNodeBorder:KT,taskNodeContent:ZT,taskNodeHeader:YT,taskNodeIcon:JT,taskNodeTitle:WT,taskNodeBadges:XT,childBadge:QT,depBadge:ew,handle:tw,emptyCta:nw,ctaDescription:sw,ctaButton:aw};function iw({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Ka(s.status);return i.jsxs("div",{className:yn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[i.jsx(ny,{type:"target",position:sy.Top,className:yn.handle}),i.jsx("div",{className:yn.taskNodeBorder,style:{backgroundColor:d.color}}),i.jsxs("div",{className:yn.taskNodeContent,children:[i.jsxs("div",{className:yn.taskNodeHeader,children:[i.jsx("span",{className:yn.taskNodeIcon,style:{color:d.color},children:d.icon}),i.jsx("span",{className:yn.taskNodeTitle,children:s.title})]}),i.jsxs("div",{className:yn.taskNodeBadges,children:[o>0&&i.jsxs("span",{className:yn.childBadge,children:[r,"/",o]}),c&&i.jsx("span",{className:yn.depBadge,children:"dep"})]})]}),i.jsx(ny,{type:"source",position:sy.Bottom,className:yn.handle})]})}/**
267
267
  * react-router v7.13.2
268
268
  *
269
269
  * Copyright (c) Remix Software Inc.
@@ -272,34 +272,34 @@ Error generating stack: `+l.message+`
272
272
  * LICENSE.md file in the root directory of this source tree.
273
273
  *
274
274
  * @license MIT
275
- */var hy="popstate";function gy(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ow(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:m}=d||r.location;return Op("",{pathname:u,search:p,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:Qr(c)}return lw(s,o,null,t)}function kt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function is(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function rw(){return Math.random().toString(36).substring(2,10)}function vy(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 Op(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?$o(s):s,state:o,key:s&&s.key||r||rw(),unstable_mask:c}}function Qr({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function $o(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function lw(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let j=v(),w=j==null?null:j-g;g=j,m&&m({action:p,location:T.location,delta:w})}function _(j,w){p="PUSH";let C=gy(j)?j:Op(T.location,j,w);g=v()+1;let D=vy(C,g),A=T.createHref(C.unstable_mask||C);try{u.pushState(D,"",A)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(A)}d&&m&&m({action:p,location:T.location,delta:1})}function k(j,w){p="REPLACE";let C=gy(j)?j:Op(T.location,j,w);g=v();let D=vy(C,g),A=T.createHref(C.unstable_mask||C);u.replaceState(D,"",A),d&&m&&m({action:p,location:T.location,delta:0})}function S(j){return cw(j)}let T={get action(){return p},get location(){return t(c,u)},listen(j){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(hy,b),m=j,()=>{c.removeEventListener(hy,b),m=null}},createHref(j){return s(c,j)},createURL:S,encodeLocation(j){let w=S(j);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:k,go(j){return u.go(j)}};return T}function cw(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),kt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Qr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function N_(t,s,o="/"){return dw(t,s,o,!1)}function dw(t,s,o,r){let c=typeof s=="string"?$o(s):s,d=la(c.pathname||"/",o);if(d==null)return null;let u=C_(t);uw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=A_(d);p=_w(u[m],g,r)}return p}function C_(t,s=[],o=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;kt(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let b=Ds([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(kt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),C_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:yw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of E_(u.path))d(u,p,!0,g)}),s}function E_(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=E_(r.join("/")),p=[];return p.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&p.push(...u),p.map(m=>t.startsWith("/")&&m===""?"/":m)}function uw(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:bw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var fw=/^:[\w-]+$/,pw=3,mw=2,hw=1,gw=10,vw=-2,yy=t=>t==="*";function yw(t,s){let o=t.split("/"),r=o.length;return o.some(yy)&&(r+=vw),s&&(r+=mw),o.filter(c=>!yy(c)).reduce((c,d)=>c+(fw.test(d)?pw:d===""?hw:gw),r)}function bw(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 _w(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=el({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=el({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Ds([d,b.pathname]),pathnameBase:jw(Ds([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Ds([d,b.pathnameBase]))}return u}function el(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=xw(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let S=p[_]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[_];return b&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function xw(t,s=!1,o=!0){is(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function A_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return is(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function la(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var kw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Sw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?$o(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=by(o.substring(1),"/"):d=by(o,s)):d=s,{pathname:d,search:ww(r),hash:Nw(c)}}function by(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 Ff(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 Tw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function hm(t){let s=Tw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function yd(t,s,o,r=!1){let c;typeof t=="string"?c=$o(t):(c={...t},kt(!c.pathname||!c.pathname.includes("?"),Ff("?","pathname","search",c)),kt(!c.pathname||!c.pathname.includes("#"),Ff("#","pathname","hash",c)),kt(!c.search||!c.search.includes("#"),Ff("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Sw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Ds=t=>t.join("/").replace(/\/\/+/g,"/"),jw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),ww=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Nw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Cw=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 Ew(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Aw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var D_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function M_(t,s){let o=t;if(typeof o!="string"||!kw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(D_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=la(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{is(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var R_=["POST","PUT","PATCH","DELETE"];new Set(R_);var Dw=["GET",...R_];new Set(Dw);var Ho=y.createContext(null);Ho.displayName="DataRouter";var bd=y.createContext(null);bd.displayName="DataRouterState";var Mw=y.createContext(!1),I_=y.createContext({isTransitioning:!1});I_.displayName="ViewTransition";var Rw=y.createContext(new Map);Rw.displayName="Fetchers";var Iw=y.createContext(null);Iw.displayName="Await";var Pn=y.createContext(null);Pn.displayName="Navigation";var ll=y.createContext(null);ll.displayName="Location";var rs=y.createContext({outlet:null,matches:[],isDataRoute:!1});rs.displayName="Route";var gm=y.createContext(null);gm.displayName="RouteError";var O_="REACT_ROUTER_ERROR",Ow="REDIRECT",Bw="ROUTE_ERROR_RESPONSE";function Lw(t){if(t.startsWith(`${O_}:${Ow}:{`))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 zw(t){if(t.startsWith(`${O_}:${Bw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Cw(s.status,s.statusText,s.data)}catch{}}function $w(t,{relative:s}={}){kt(Ei(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Pn),{hash:c,pathname:d,search:u}=cl(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Ds([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Ei(){return y.useContext(ll)!=null}function Jt(){return kt(Ei(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(ll).location}function nn(t){kt(Ei(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Jt();return y.useMemo(()=>el(t,A_(s)),[s,t])}var B_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function L_(t){y.useContext(Pn).static||y.useLayoutEffect(t)}function _d(){let{isDataRoute:t}=y.useContext(rs);return t?eN():Hw()}function Hw(){kt(Ei(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ho),{basename:s,navigator:o}=y.useContext(Pn),{matches:r}=y.useContext(rs),{pathname:c}=Jt(),d=JSON.stringify(hm(r)),u=y.useRef(!1);return L_(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(is(u.current,B_),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=yd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Ds([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var Pw=y.createContext(null);function Uw(t){let s=y.useContext(rs).outlet;return y.useMemo(()=>s&&y.createElement(Pw.Provider,{value:t},s),[s,t])}function ua(){let{matches:t}=y.useContext(rs),s=t[t.length-1];return s?s.params:{}}function cl(t,{relative:s}={}){let{matches:o}=y.useContext(rs),{pathname:r}=Jt(),c=JSON.stringify(hm(o));return y.useMemo(()=>yd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Vw(t,s){return z_(t,s)}function z_(t,s,o){var j;kt(Ei(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Pn),{matches:c}=y.useContext(rs),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let w=g&&g.path||"";H_(p,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
275
+ */var hy="popstate";function gy(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ow(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:m}=d||r.location;return Op("",{pathname:u,search:p,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:el(c)}return lw(s,o,null,t)}function jt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function is(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function rw(){return Math.random().toString(36).substring(2,10)}function vy(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 Op(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Ho(s):s,state:o,key:s&&s.key||r||rw(),unstable_mask:c}}function el({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 Ho(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 lw(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let T=v(),w=T==null?null:T-g;g=T,m&&m({action:p,location:j.location,delta:w})}function _(T,w){p="PUSH";let C=gy(T)?T:Op(j.location,T,w);g=v()+1;let D=vy(C,g),A=j.createHref(C.unstable_mask||C);try{u.pushState(D,"",A)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(A)}d&&m&&m({action:p,location:j.location,delta:1})}function k(T,w){p="REPLACE";let C=gy(T)?T:Op(j.location,T,w);g=v();let D=vy(C,g),A=j.createHref(C.unstable_mask||C);u.replaceState(D,"",A),d&&m&&m({action:p,location:j.location,delta:0})}function S(T){return cw(T)}let j={get action(){return p},get location(){return t(c,u)},listen(T){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(hy,b),m=T,()=>{c.removeEventListener(hy,b),m=null}},createHref(T){return s(c,T)},createURL:S,encodeLocation(T){let w=S(T);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:_,replace:k,go(T){return u.go(T)}};return j}function cw(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),jt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:el(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function N_(t,s,o="/"){return dw(t,s,o,!1)}function dw(t,s,o,r){let c=typeof s=="string"?Ho(s):s,d=ca(c.pathname||"/",o);if(d==null)return null;let u=C_(t);uw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=A_(d);p=_w(u[m],g,r)}return p}function C_(t,s=[],o=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;jt(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let b=Ms([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(jt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),C_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:yw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of E_(u.path))d(u,p,!0,g)}),s}function E_(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=E_(r.join("/")),p=[];return p.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&p.push(...u),p.map(m=>t.startsWith("/")&&m===""?"/":m)}function uw(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:bw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var fw=/^:[\w-]+$/,pw=3,mw=2,hw=1,gw=10,vw=-2,yy=t=>t==="*";function yw(t,s){let o=t.split("/"),r=o.length;return o.some(yy)&&(r+=vw),s&&(r+=mw),o.filter(c=>!yy(c)).reduce((c,d)=>c+(fw.test(d)?pw:d===""?hw:gw),r)}function bw(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 _w(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=tl({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=tl({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Ms([d,b.pathname]),pathnameBase:Tw(Ms([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Ms([d,b.pathnameBase]))}return u}function tl(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=xw(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let S=p[_]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[_];return b&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function xw(t,s=!1,o=!0){is(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function A_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return is(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function ca(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 kw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Sw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?Ho(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=by(o.substring(1),"/"):d=by(o,s)):d=s,{pathname:d,search:ww(r),hash:Nw(c)}}function by(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 Ff(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 jw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function hm(t){let s=jw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function yd(t,s,o,r=!1){let c;typeof t=="string"?c=Ho(t):(c={...t},jt(!c.pathname||!c.pathname.includes("?"),Ff("?","pathname","search",c)),jt(!c.pathname||!c.pathname.includes("#"),Ff("#","pathname","hash",c)),jt(!c.search||!c.search.includes("#"),Ff("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Sw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Ms=t=>t.join("/").replace(/\/\/+/g,"/"),Tw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),ww=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Nw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Cw=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 Ew(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Aw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var D_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function M_(t,s){let o=t;if(typeof o!="string"||!kw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(D_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=ca(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{is(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var R_=["POST","PUT","PATCH","DELETE"];new Set(R_);var Dw=["GET",...R_];new Set(Dw);var Po=y.createContext(null);Po.displayName="DataRouter";var bd=y.createContext(null);bd.displayName="DataRouterState";var Mw=y.createContext(!1),I_=y.createContext({isTransitioning:!1});I_.displayName="ViewTransition";var Rw=y.createContext(new Map);Rw.displayName="Fetchers";var Iw=y.createContext(null);Iw.displayName="Await";var Pn=y.createContext(null);Pn.displayName="Navigation";var cl=y.createContext(null);cl.displayName="Location";var rs=y.createContext({outlet:null,matches:[],isDataRoute:!1});rs.displayName="Route";var gm=y.createContext(null);gm.displayName="RouteError";var O_="REACT_ROUTER_ERROR",Ow="REDIRECT",Bw="ROUTE_ERROR_RESPONSE";function Lw(t){if(t.startsWith(`${O_}:${Ow}:{`))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 zw(t){if(t.startsWith(`${O_}:${Bw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Cw(s.status,s.statusText,s.data)}catch{}}function $w(t,{relative:s}={}){jt(Ei(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Pn),{hash:c,pathname:d,search:u}=dl(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Ms([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Ei(){return y.useContext(cl)!=null}function Jt(){return jt(Ei(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(cl).location}function tn(t){jt(Ei(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Jt();return y.useMemo(()=>tl(t,A_(s)),[s,t])}var B_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function L_(t){y.useContext(Pn).static||y.useLayoutEffect(t)}function _d(){let{isDataRoute:t}=y.useContext(rs);return t?eN():Hw()}function Hw(){jt(Ei(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Po),{basename:s,navigator:o}=y.useContext(Pn),{matches:r}=y.useContext(rs),{pathname:c}=Jt(),d=JSON.stringify(hm(r)),u=y.useRef(!1);return L_(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(is(u.current,B_),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=yd(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Ms([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var Pw=y.createContext(null);function Uw(t){let s=y.useContext(rs).outlet;return y.useMemo(()=>s&&y.createElement(Pw.Provider,{value:t},s),[s,t])}function fa(){let{matches:t}=y.useContext(rs),s=t[t.length-1];return s?s.params:{}}function dl(t,{relative:s}={}){let{matches:o}=y.useContext(rs),{pathname:r}=Jt(),c=JSON.stringify(hm(o));return y.useMemo(()=>yd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Vw(t,s){return z_(t,s)}function z_(t,s,o){var T;jt(Ei(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Pn),{matches:c}=y.useContext(rs),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let w=g&&g.path||"";H_(p,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
276
276
 
277
- Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Jt(),b;if(s){let w=typeof s=="string"?$o(s):s;kt(m==="/"||((j=w.pathname)==null?void 0:j.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",k=_;if(m!=="/"){let w=m.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let S=N_(t,{pathname:k});is(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),is(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let T=Zw(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Ds([m,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Ds([m,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,o);return s&&T?y.createElement(ll.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},T):T}function qw(){let t=Qw(),s=Ew(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 Gw=y.createElement(qw,null),$_=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=zw(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(rs.Provider,{value:this.props.routeContext},y.createElement(gm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Fw,{error:t},s):s}};$_.contextType=Mw;var Kf=new WeakMap;function Fw({children:t,error:s}){let{basename:o}=y.useContext(Pn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Lw(s.digest);if(r){let c=Kf.get(s);if(c)throw c;let d=M_(r.location,o);if(D_&&!Kf.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 Kf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Kw({routeContext:t,match:s,children:o}){let r=y.useContext(Ho);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(rs.Provider,{value:t},o)}function Zw(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);kt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:_,errors:k}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||S){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,b)=>{var _,k;m(v,{location:r.location,params:((k=(_=r.matches)==null?void 0:_[0])==null?void 0:k.params)??{},unstable_pattern:Aw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let k,S=!1,T=null,j=null;r&&(k=d&&b.route.id?d[b.route.id]:void 0,T=b.route.errorElement||Gw,u&&(p<0&&_===0?(H_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):p===_&&(S=!0,j=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),C=()=>{let D;return k?D=T:S?D=j:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(Kw,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement($_,{location:r.location,revalidation:r.revalidation,component:T,error:k,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function vm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yw(t){let s=y.useContext(Ho);return kt(s,vm(t)),s}function Jw(t){let s=y.useContext(bd);return kt(s,vm(t)),s}function Ww(t){let s=y.useContext(rs);return kt(s,vm(t)),s}function ym(t){let s=Ww(t),o=s.matches[s.matches.length-1];return kt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Xw(){return ym("useRouteId")}function Qw(){var r;let t=y.useContext(gm),s=Jw("useRouteError"),o=ym("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function eN(){let{router:t}=Yw("useNavigate"),s=ym("useNavigate"),o=y.useRef(!1);return L_(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{is(o.current,B_),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var _y={};function H_(t,s,o){!s&&!_y[t]&&(_y[t]=!0,is(!1,o))}y.memo(tN);function tN({routes:t,future:s,state:o,isStatic:r,onError:c}){return z_(t,void 0,{state:o,isStatic:r,onError:c})}function zn({to:t,replace:s,state:o,relative:r}){kt(Ei(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Pn);is(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(rs),{pathname:u}=Jt(),p=_d(),m=yd(t,hm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Ai(t){return Uw(t.context)}function Ee(t){kt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function nN({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){kt(!Ei(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=$o(o));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:k="default",unstable_mask:S}=o,T=y.useMemo(()=>{let j=la(g,p);return j==null?null:{location:{pathname:j,search:v,hash:b,state:_,key:k,unstable_mask:S},navigationType:r}},[p,g,v,b,_,k,r,S]);return is(T!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:y.createElement(Pn.Provider,{value:m},y.createElement(ll.Provider,{children:s,value:T}))}function sN({children:t,location:s}){return Vw(Bp(t),s)}function Bp(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,Bp(r.props.children,d));return}kt(r.type===Ee,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),kt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Bp(r.props.children,d)),o.push(u)}),o}var Zc="get",Yc="application/x-www-form-urlencoded";function xd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function aN(t){return xd(t)&&t.tagName.toLowerCase()==="button"}function iN(t){return xd(t)&&t.tagName.toLowerCase()==="form"}function oN(t){return xd(t)&&t.tagName.toLowerCase()==="input"}function rN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lN(t,s){return t.button===0&&(!s||s==="_self")&&!rN(t)}function Lp(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 cN(t,s){let o=Lp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Rc=null;function dN(){if(Rc===null)try{new FormData(document.createElement("form"),0),Rc=!1}catch{Rc=!0}return Rc}var uN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zf(t){return t!=null&&!uN.has(t)?(is(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yc}"`),null):t}function fN(t,s){let o,r,c,d,u;if(iN(t)){let p=t.getAttribute("action");r=p?la(p,s):null,o=t.getAttribute("method")||Zc,c=Zf(t.getAttribute("enctype"))||Yc,d=new FormData(t)}else if(aN(t)||oN(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?la(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||Zc,c=Zf(t.getAttribute("formenctype"))||Zf(p.getAttribute("enctype"))||Yc,d=new FormData(p,t),!dN()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(xd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Zc,r=null,c=Yc,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 bm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function pN(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&la(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function mN(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 hN(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 gN(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await mN(d,o);return u.links?u.links():[]}return[]}));return _N(r.flat(1).filter(hN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function xy(t,s,o,r,c,d){let u=(m,g)=>o[g]?m.route.id!==o[g].route.id:!0,p=(m,g)=>{var v;return o[g].pathname!==m.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=o[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function vN(t,s,{includeHydrateFallback:o}={}){return yN(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 yN(t){return[...new Set(t)]}function bN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function _N(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(bN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function P_(){let t=y.useContext(Ho);return bm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function xN(){let t=y.useContext(bd);return bm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _m=y.createContext(void 0);_m.displayName="FrameworkContext";function U_(){let t=y.useContext(_m);return bm(t,"You must render this element inside a <HydratedRouter> element"),t}function kN(t,s){let o=y.useContext(_m),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let T=w=>{w.forEach(C=>{u(C.isIntersecting)})},j=new IntersectionObserver(T,{threshold:.5});return _.current&&j.observe(_.current),()=>{j.disconnect()}}},[t]),y.useEffect(()=>{if(r){let T=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(T)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Ir(p,k),onBlur:Ir(m,S),onMouseEnter:Ir(g,k),onMouseLeave:Ir(v,S),onTouchStart:Ir(b,k)}]:[!1,_,{}]}function Ir(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function SN({page:t,...s}){let{router:o}=P_(),r=y.useMemo(()=>N_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(jN,{page:t,matches:r,...s}):null}function TN(t){let{manifest:s,routeModules:o}=U_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return gN(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function jN({page:t,matches:s,...o}){let r=Jt(),{future:c,manifest:d,routeModules:u}=U_(),{basename:p}=P_(),{loaderData:m,matches:g}=xN(),v=y.useMemo(()=>xy(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>xy(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let T=new Set,j=!1;if(s.forEach(C=>{var A;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((A=u[C.route.id])!=null&&A.shouldRevalidate)||D.hasClientLoader?j=!0:T.add(C.route.id))}),T.size===0)return[];let w=pN(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return j&&T.size>0&&w.searchParams.set("_routes",s.filter(C=>T.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),k=y.useMemo(()=>vN(b,d),[b,d]),S=TN(b);return y.createElement(y.Fragment,null,_.map(T=>y.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...o})),k.map(T=>y.createElement("link",{key:T,rel:"modulepreload",href:T,...o})),S.map(({key:T,link:j})=>y.createElement("link",{key:T,nonce:o.nonce,...j,crossOrigin:j.crossOrigin??o.crossOrigin})))}function wN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var NN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{NN&&(window.__reactRouterVersion="7.13.2")}catch{}function CN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=ow({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{o===!1?p(g):y.startTransition(()=>p(g))},[o]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(nN,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var V_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xm=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:k,...S},T){let{basename:j,navigator:w,unstable_useTransitions:C}=y.useContext(Pn),D=typeof v=="string"&&V_.test(v),A=M_(v,j);v=A.to;let E=$w(v,{relative:c}),R=Jt(),O=null;if(p){let ae=yd(p,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);j!=="/"&&(ae.pathname=ae.pathname==="/"?j:Ds([j,ae.pathname])),O=w.createHref(ae)}let[M,$,Y]=kN(r,S),V=MN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ee(ae){s&&s(ae),ae.defaultPrevented||V(ae)}let le=!(A.isExternal||d),Z=y.createElement("a",{...S,...Y,href:(le?O:void 0)||A.absoluteURL||E,onClick:le?ee:s,ref:wN(T,$),target:g,"data-discover":!D&&o==="render"?"true":void 0});return M&&!D?y.createElement(y.Fragment,null,Z,y.createElement(SN,{page:E})):Z});xm.displayName="Link";var EN=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=cl(u,{relative:g.relative}),_=Jt(),k=y.useContext(bd),{navigator:S,basename:T}=y.useContext(Pn),j=k!=null&&LN(b)&&p===!0,w=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,w=w.toLowerCase()),D&&T&&(D=la(D,T)||D);const A=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let E=C===w||!c&&C.startsWith(w)&&C.charAt(A)==="/",R=D!=null&&(D===w||!c&&D.startsWith(w)&&D.charAt(w.length)==="/"),O={isActive:E,isPending:R,isTransitioning:j},M=E?s:void 0,$;typeof r=="function"?$=r(O):$=[r,E?"active":null,R?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(O):d;return y.createElement(xm,{...g,"aria-current":M,className:$,ref:v,style:Y,to:u,viewTransition:p},typeof m=="function"?m(O):m)});EN.displayName="NavLink";var AN=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=Zc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...k},S)=>{let{unstable_useTransitions:T}=y.useContext(Pn),j=ON(),w=BN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&V_.test(p),A=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let R=E.nativeEvent.submitter,O=(R==null?void 0:R.getAttribute("formmethod"))||u,M=()=>j(R||E.currentTarget,{fetcherKey:s,method:O,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});T&&o!==!1?y.startTransition(()=>M()):M()};return y.createElement("form",{ref:S,method:C,action:w,onSubmit:r?m:A,...k,"data-discover":!D&&t==="render"?"true":void 0})});AN.displayName="Form";function DN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function q_(t){let s=y.useContext(Ho);return kt(s,DN(t)),s}function MN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=_d(),b=Jt(),_=cl(t,{relative:u});return y.useCallback(k=>{if(lN(k,s)){k.preventDefault();let S=o!==void 0?o:Qr(b)===Qr(_),T=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>T()):T()}},[b,v,_,o,r,c,s,t,d,u,p,m,g])}function km(t){is(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=y.useRef(Lp(t)),o=y.useRef(!1),r=Jt(),c=y.useMemo(()=>cN(r.search,o.current?null:s.current),[r.search]),d=_d(),u=y.useCallback((p,m)=>{const g=Lp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var RN=0,IN=()=>`__${String(++RN)}__`;function ON(){let{router:t}=q_("useSubmit"),{basename:s}=y.useContext(Pn),o=Xw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=fN(d,s);if(u.navigate===!1){let _=u.fetcherKey||IN();await r(_,o,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function BN(t,{relative:s}={}){let{basename:o}=y.useContext(Pn),r=y.useContext(rs);kt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...cl(t||".",{relative:s})},u=Jt();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Ds([o,d.pathname])),Qr(d)}function LN(t,{relative:s}={}){let o=y.useContext(I_);kt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=q_("useViewTransitionState"),c=cl(t,{relative:s});if(!o.isTransitioning)return!1;let d=la(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=la(o.nextLocation.pathname,r)||o.nextLocation.pathname;return el(c.pathname,u)!=null||el(c.pathname,d)!=null}function vt(){const t=_d();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Sm(t){return`/sessions/${encodeURIComponent(t)}`}function ji(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function os(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Di(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 G_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Ro="/environments",zN="/environments/new";function Io(t){return`/environments/${encodeURIComponent(t)}`}function $N(t){return`/environments/${encodeURIComponent(t)}/edit`}const ki="/settings",HN="/settings/credentials",Yf="/settings/personas",PN="/settings/personas/new";function F_(t){return`/settings/personas/${encodeURIComponent(t)}`}const Jf="/settings/schedules",UN="/settings/schedules/new";function K_(t){return`/settings/schedules/${encodeURIComponent(t)}`}const VN="/settings/shortcuts",qN="/pair",GN="/chat",Z_="/coordination",Po="/",FN="/tasks",Y_="/workspaces/new",J_="/knowledge",KN=qj,ZN={task:iw};function YN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=vt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=pT(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(KN))_[k]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(os(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:bn.emptyCta,children:[i.jsx("button",{className:bn.ctaButton,onClick:()=>c(Di(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:bn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:bn.dagContainer,children:i.jsxs(k2,{nodes:u,edges:p,nodeTypes:ZN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(S2,{variant:T2.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(j2,{showInteractive:!1}),i.jsx(w2,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const JN="_breadcrumbs_17or2_1",WN="_list_17or2_11",XN="_item_17or2_21",QN="_separator_17or2_28",eC="_link_17or2_34",tC="_current_17or2_57",So={breadcrumbs:JN,list:WN,item:XN,separator:QN,link:eC,current:tC};function fa({segments:t}){return i.jsx("nav",{className:So.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:So.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:So.item,children:[o>0&&i.jsx("span",{className:So.separator,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),s.url&&!r?i.jsx(xm,{className:So.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:So.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const 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",Wf={btn:nC,sm:sC,md:aC,lg:iC,primary:oC,danger:rC,outline:lC,ghost:cC},sn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[Wf.btn,Wf[s],Wf[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),dC="_copyButton_1bqk0_1",uC={copyButton:dC},fC=2e3;function pC({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 i.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?i.jsx(Ci,{size:zt,"aria-hidden":"true"}):i.jsx(j_,{size:zt,"aria-hidden":"true"})})}const mC="_banner_bxqlh_1",hC="_label_bxqlh_15",gC="_text_bxqlh_25",vC="_link_bxqlh_29",Ic={banner:mC,label:hC,text:gC,link:vC};function yC(){return i.jsxs("div",{className:Ic.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Ic.label,children:"DEMO"}),i.jsxs("span",{className:Ic.text,children:["This is an interactive demo with mock data."," ",i.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Ic.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",TC="_lg_og0yp_34",jC="_primary_og0yp_57",wC="_danger_og0yp_70",NC="_outline_og0yp_83",CC="_ghost_og0yp_92",EC="_dropdown_og0yp_100",AC="_option_og0yp_113",DC="_optionLabel_og0yp_130",MC="_optionDesc_og0yp_135",ta={container:bC,chevronButton:_C,mainButton:xC,sm:kC,md:SC,lg:TC,primary:jC,danger:wC,outline:NC,ghost:CC,dropdown:EC,option:AC,optionLabel:DC,optionDesc:MC};function W_({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(k){m.current&&k.target instanceof Node&&!m.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=ta[r]||"",v=ta[c]||"",b=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:ta.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${ta.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${ta.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(T_,{size:zt,"aria-hidden":"true"})}),u&&i.jsx("div",{className:ta.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,k)=>i.jsxs("button",{type:"button",className:ta.option,onClick:()=>{_.onClick(),p(!1)},children:[i.jsx("span",{className:ta.optionLabel,children:_.label}),_.description&&i.jsx("span",{className:ta.optionDesc,children:_.description})]},k))})]})}function zp(){zp=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),sd(p,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&sd(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},zp.apply(this,arguments)}function sd(t,s){return sd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},sd(t,s)}function ky(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 Xf(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 ky(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)?ky(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
278
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var RC=(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){P2(r,"element",o)};function o(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,b=(function(E){for(var R,O=Xf(E.properties.className);!(R=O()).done;){var M=R.value;if(M.slice(0,9)==="language-")return M.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var _,k;k=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Ac(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(R){return R.reduce(function(O,M){if(M.type==="text"){var $=M.value,Y=($.match(/\n/g)||"").length;if(Y===0)M.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(M);else for(var V,ee=$.split(`
279
- `),le=Xf(ee.entries());!(V=le()).done;){var Z=V.value,ae=Z[0],H=Z[1];O.push({type:"text",value:ae===ee.length-1?H:H+`
280
- `,position:{start:{line:v+ae,column:1},end:{line:v+ae,column:1}}})}return v+=Y,O}if(Object.prototype.hasOwnProperty.call(M,"children")){var B=v;return M.children=E(M.children),O.push(M),M.position={start:{line:B,column:1},end:{line:v,column:1}},O}return O.push(M),O},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,T=(function(E){var R=/{([\d,-]+)}/,O=E.split(",").map(function(Y){return Y.trim()}).join();if(R.test(O)){var M=R.exec(O)[1],$=V2(M);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),j=(function(E){var R=zp(/showLineNumbers=(\d+)/i,{lines:1});if(R.test(E)){var O=R.exec(E);return Number(O.groups.lines)}return 1})(m),w=(function(E){for(var R=new Array(E),O=0;O<E;O++)R[O]={type:"element",tagName:"span",properties:{className:[]},children:[]};return R})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,R,O=S.value,M=O[0],$=O[1];$.properties.className=["code-line"];var Y=q2(g,function(V){return V.position.start.line<=M+1&&V.position.end.line>=M+1});$.children=Y.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(V){return m.toLowerCase().includes(V)})&&($.properties.line=[(M+j).toString()],$.properties.className.push("line-number")),T(M)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Ac($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&Ac($).substring(0,1)==="+"&&$.properties.className.push("inserted")},A=Xf(w.entries());!(S=A()).done;)D();w.length>0&&Ac(w[w.length-1]).trim()===""&&w.pop(),r.children=w}}}})(U2);function Oo(t){if(t>=1e6)return`${(t/1e6).toFixed(1)}M`;if(t>=1e3){const s=Number((t/1e3).toFixed(1));return s>=1e3?`${(t/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(t)}function As(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const Sy=new Set(["grackle"]);function dl(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Sy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Sy.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",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=dl(t);return IC[s.toLowerCase()]??"generic"}const BC="_card_qkm9i_2",LC="_cardBlue_qkm9i_20",zC="_cardOrange_qkm9i_24",$C="_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",KC="_fileName_qkm9i_71",ZC="_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",L={card:BC,cardBlue:LC,cardOrange:zC,cardGreen:$C,cardPurple:HC,cardNeutral:PC,cardRed:UC,cardTeal:VC,header:qC,icon:GC,toolName:FC,fileName:KC,badge:ZC,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 Qf=5;function Ty({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=uE(s),m=fE(p),g=o===void 0,v=r?L.cardRed:c?L.cardGreen:L.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?i.jsx($T,{size:zt}):i.jsx(PT,{size:zt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
281
- `))??[],T=S.length>Qf,j=d?S:S.slice(0,Qf);return i.jsxs("div",{className:`${L.card} ${v} ${g?L.inProgress:""}`,"data-testid":k,children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:_}),i.jsx("span",{className:L.toolName,style:{color:b},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,children:[S.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:j.map((w,C)=>i.jsxs("span",{className:L.diffLine,children:[i.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),w]},C))}),T&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),d?"collapse":`${S.length-Qf} more lines`]})]})]})}function pE(t){const s=t.split(`
277
+ Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Jt(),b;if(s){let w=typeof s=="string"?Ho(s):s;jt(m==="/"||((T=w.pathname)==null?void 0:T.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let _=b.pathname||"/",k=_;if(m!=="/"){let w=m.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let S=N_(t,{pathname:k});is(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),is(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=Zw(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Ms([m,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Ms([m,r.encodeLocation?r.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,o);return s&&j?y.createElement(cl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function qw(){let t=Qw(),s=Ew(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 Gw=y.createElement(qw,null),$_=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=zw(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(rs.Provider,{value:this.props.routeContext},y.createElement(gm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Fw,{error:t},s):s}};$_.contextType=Mw;var Kf=new WeakMap;function Fw({children:t,error:s}){let{basename:o}=y.useContext(Pn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Lw(s.digest);if(r){let c=Kf.get(s);if(c)throw c;let d=M_(r.location,o);if(D_&&!Kf.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 Kf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Kw({routeContext:t,match:s,children:o}){let r=y.useContext(Po);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(rs.Provider,{value:t},o)}function Zw(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);jt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,p=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:_,errors:k}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||S){o.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,g=r&&m?(v,b)=>{var _,k;m(v,{location:r.location,params:((k=(_=r.matches)==null?void 0:_[0])==null?void 0:k.params)??{},unstable_pattern:Aw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let k,S=!1,j=null,T=null;r&&(k=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||Gw,u&&(p<0&&_===0?(H_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,T=null):p===_&&(S=!0,T=b.route.hydrateFallbackElement||null)));let w=s.concat(c.slice(0,_+1)),C=()=>{let D;return k?D=j:S?D=T:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(Kw,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement($_,{location:r.location,revalidation:r.revalidation,component:j,error:k,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function vm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yw(t){let s=y.useContext(Po);return jt(s,vm(t)),s}function Jw(t){let s=y.useContext(bd);return jt(s,vm(t)),s}function Ww(t){let s=y.useContext(rs);return jt(s,vm(t)),s}function ym(t){let s=Ww(t),o=s.matches[s.matches.length-1];return jt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Xw(){return ym("useRouteId")}function Qw(){var r;let t=y.useContext(gm),s=Jw("useRouteError"),o=ym("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function eN(){let{router:t}=Yw("useNavigate"),s=ym("useNavigate"),o=y.useRef(!1);return L_(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{is(o.current,B_),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var _y={};function H_(t,s,o){!s&&!_y[t]&&(_y[t]=!0,is(!1,o))}y.memo(tN);function tN({routes:t,future:s,state:o,isStatic:r,onError:c}){return z_(t,void 0,{state:o,isStatic:r,onError:c})}function zn({to:t,replace:s,state:o,relative:r}){jt(Ei(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Pn);is(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(rs),{pathname:u}=Jt(),p=_d(),m=yd(t,hm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:o,relative:r})},[p,g,r,s,o]),null}function Ai(t){return Uw(t.context)}function Ee(t){jt(!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 nN({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){jt(!Ei(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=Ho(o));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:k="default",unstable_mask:S}=o,j=y.useMemo(()=>{let T=ca(g,p);return T==null?null:{location:{pathname:T,search:v,hash:b,state:_,key:k,unstable_mask:S},navigationType:r}},[p,g,v,b,_,k,r,S]);return is(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:y.createElement(Pn.Provider,{value:m},y.createElement(cl.Provider,{children:s,value:j}))}function sN({children:t,location:s}){return Vw(Bp(t),s)}function Bp(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,Bp(r.props.children,d));return}jt(r.type===Ee,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),jt(!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=Bp(r.props.children,d)),o.push(u)}),o}var Zc="get",Yc="application/x-www-form-urlencoded";function xd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function aN(t){return xd(t)&&t.tagName.toLowerCase()==="button"}function iN(t){return xd(t)&&t.tagName.toLowerCase()==="form"}function oN(t){return xd(t)&&t.tagName.toLowerCase()==="input"}function rN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lN(t,s){return t.button===0&&(!s||s==="_self")&&!rN(t)}function Lp(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 cN(t,s){let o=Lp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Rc=null;function dN(){if(Rc===null)try{new FormData(document.createElement("form"),0),Rc=!1}catch{Rc=!0}return Rc}var uN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Zf(t){return t!=null&&!uN.has(t)?(is(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yc}"`),null):t}function fN(t,s){let o,r,c,d,u;if(iN(t)){let p=t.getAttribute("action");r=p?ca(p,s):null,o=t.getAttribute("method")||Zc,c=Zf(t.getAttribute("enctype"))||Yc,d=new FormData(t)}else if(aN(t)||oN(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?ca(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||Zc,c=Zf(t.getAttribute("formenctype"))||Zf(p.getAttribute("enctype"))||Yc,d=new FormData(p,t),!dN()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(xd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=Zc,r=null,c=Yc,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 bm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function pN(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&&ca(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function mN(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 hN(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 gN(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await mN(d,o);return u.links?u.links():[]}return[]}));return _N(r.flat(1).filter(hN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function xy(t,s,o,r,c,d){let u=(m,g)=>o[g]?m.route.id!==o[g].route.id:!0,p=(m,g)=>{var v;return o[g].pathname!==m.pathname||((v=o[g].route.path)==null?void 0:v.endsWith("*"))&&o[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=o[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function vN(t,s,{includeHydrateFallback:o}={}){return yN(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 yN(t){return[...new Set(t)]}function bN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function _N(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(bN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function P_(){let t=y.useContext(Po);return bm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function xN(){let t=y.useContext(bd);return bm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _m=y.createContext(void 0);_m.displayName="FrameworkContext";function U_(){let t=y.useContext(_m);return bm(t,"You must render this element inside a <HydratedRouter> element"),t}function kN(t,s){let o=y.useContext(_m),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=w=>{w.forEach(C=>{u(C.isIntersecting)})},T=new IntersectionObserver(j,{threshold:.5});return _.current&&T.observe(_.current),()=>{T.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Or(p,k),onBlur:Or(m,S),onMouseEnter:Or(g,k),onMouseLeave:Or(v,S),onTouchStart:Or(b,k)}]:[!1,_,{}]}function Or(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function SN({page:t,...s}){let{router:o}=P_(),r=y.useMemo(()=>N_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(TN,{page:t,matches:r,...s}):null}function jN(t){let{manifest:s,routeModules:o}=U_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return gN(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function TN({page:t,matches:s,...o}){let r=Jt(),{future:c,manifest:d,routeModules:u}=U_(),{basename:p}=P_(),{loaderData:m,matches:g}=xN(),v=y.useMemo(()=>xy(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>xy(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,T=!1;if(s.forEach(C=>{var A;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((A=u[C.route.id])!=null&&A.shouldRevalidate)||D.hasClientLoader?T=!0:j.add(C.route.id))}),j.size===0)return[];let w=pN(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return T&&j.size>0&&w.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[w.pathname+w.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),k=y.useMemo(()=>vN(b,d),[b,d]),S=jN(b);return y.createElement(y.Fragment,null,_.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),k.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),S.map(({key:j,link:T})=>y.createElement("link",{key:j,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function wN(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var NN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{NN&&(window.__reactRouterVersion="7.13.2")}catch{}function CN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=ow({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{o===!1?p(g):y.startTransition(()=>p(g))},[o]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(nN,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var V_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xm=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:k,...S},j){let{basename:T,navigator:w,unstable_useTransitions:C}=y.useContext(Pn),D=typeof v=="string"&&V_.test(v),A=M_(v,T);v=A.to;let E=$w(v,{relative:c}),R=Jt(),O=null;if(p){let se=yd(p,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);T!=="/"&&(se.pathname=se.pathname==="/"?T:Ms([T,se.pathname])),O=w.createHref(se)}let[M,$,Y]=kN(r,S),V=MN(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ne(se){s&&s(se),se.defaultPrevented||V(se)}let le=!(A.isExternal||d),Z=y.createElement("a",{...S,...Y,href:(le?O:void 0)||A.absoluteURL||E,onClick:le?ne:s,ref:wN(j,$),target:g,"data-discover":!D&&o==="render"?"true":void 0});return M&&!D?y.createElement(y.Fragment,null,Z,y.createElement(SN,{page:E})):Z});xm.displayName="Link";var EN=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=dl(u,{relative:g.relative}),_=Jt(),k=y.useContext(bd),{navigator:S,basename:j}=y.useContext(Pn),T=k!=null&&LN(b)&&p===!0,w=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,w=w.toLowerCase()),D&&j&&(D=ca(D,j)||D);const A=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let E=C===w||!c&&C.startsWith(w)&&C.charAt(A)==="/",R=D!=null&&(D===w||!c&&D.startsWith(w)&&D.charAt(w.length)==="/"),O={isActive:E,isPending:R,isTransitioning:T},M=E?s:void 0,$;typeof r=="function"?$=r(O):$=[r,E?"active":null,R?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(O):d;return y.createElement(xm,{...g,"aria-current":M,className:$,ref:v,style:Y,to:u,viewTransition:p},typeof m=="function"?m(O):m)});EN.displayName="NavLink";var AN=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=Zc,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...k},S)=>{let{unstable_useTransitions:j}=y.useContext(Pn),T=ON(),w=BN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&V_.test(p),A=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let R=E.nativeEvent.submitter,O=(R==null?void 0:R.getAttribute("formmethod"))||u,M=()=>T(R||E.currentTarget,{fetcherKey:s,method:O,navigate:o,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});j&&o!==!1?y.startTransition(()=>M()):M()};return y.createElement("form",{ref:S,method:C,action:w,onSubmit:r?m:A,...k,"data-discover":!D&&t==="render"?"true":void 0})});AN.displayName="Form";function DN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function q_(t){let s=y.useContext(Po);return jt(s,DN(t)),s}function MN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=_d(),b=Jt(),_=dl(t,{relative:u});return y.useCallback(k=>{if(lN(k,s)){k.preventDefault();let S=o!==void 0?o:el(b)===el(_),j=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>j()):j()}},[b,v,_,o,r,c,s,t,d,u,p,m,g])}function km(t){is(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=y.useRef(Lp(t)),o=y.useRef(!1),r=Jt(),c=y.useMemo(()=>cN(r.search,o.current?null:s.current),[r.search]),d=_d(),u=y.useCallback((p,m)=>{const g=Lp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var RN=0,IN=()=>`__${String(++RN)}__`;function ON(){let{router:t}=q_("useSubmit"),{basename:s}=y.useContext(Pn),o=Xw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=fN(d,s);if(u.navigate===!1){let _=u.fetcherKey||IN();await r(_,o,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function BN(t,{relative:s}={}){let{basename:o}=y.useContext(Pn),r=y.useContext(rs);jt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...dl(t||".",{relative:s})},u=Jt();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Ms([o,d.pathname])),el(d)}function LN(t,{relative:s}={}){let o=y.useContext(I_);jt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=q_("useViewTransitionState"),c=dl(t,{relative:s});if(!o.isTransitioning)return!1;let d=ca(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ca(o.nextLocation.pathname,r)||o.nextLocation.pathname;return tl(c.pathname,u)!=null||tl(c.pathname,d)!=null}function _t(){const t=_d();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Sm(t){return`/sessions/${encodeURIComponent(t)}`}function Ti(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function os(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Di(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 G_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Io="/environments",zN="/environments/new";function Oo(t){return`/environments/${encodeURIComponent(t)}`}function $N(t){return`/environments/${encodeURIComponent(t)}/edit`}const ki="/settings",HN="/settings/credentials",Yf="/settings/personas",PN="/settings/personas/new";function F_(t){return`/settings/personas/${encodeURIComponent(t)}`}const Jf="/settings/schedules",UN="/settings/schedules/new";function K_(t){return`/settings/schedules/${encodeURIComponent(t)}`}const VN="/settings/shortcuts",qN="/pair",GN="/chat",Z_="/coordination",Uo="/",FN="/tasks",Y_="/workspaces/new",J_="/knowledge",KN=qT,ZN={task:iw};function YN({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=_t(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=pj(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(KN))_[k]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(os(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?i.jsxs("div",{className:yn.emptyCta,children:[i.jsx("button",{className:yn.ctaButton,onClick:()=>c(Di(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:yn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):i.jsx("div",{className:yn.dagContainer,children:i.jsxs(k2,{nodes:u,edges:p,nodeTypes:ZN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[i.jsx(S2,{variant:j2.Dots,gap:24,size:1,color:"var(--text-disabled)"}),i.jsx(T2,{showInteractive:!1}),i.jsx(w2,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const JN="_breadcrumbs_17or2_1",WN="_list_17or2_11",XN="_item_17or2_21",QN="_separator_17or2_28",eC="_link_17or2_34",tC="_current_17or2_57",jo={breadcrumbs:JN,list:WN,item:XN,separator:QN,link:eC,current:tC};function pa({segments:t}){return i.jsx("nav",{className:jo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:i.jsx("ol",{className:jo.list,children:t.map((s,o)=>{const r=o===t.length-1;return i.jsxs("li",{className:jo.item,children:[o>0&&i.jsx("span",{className:jo.separator,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),s.url&&!r?i.jsx(xm,{className:jo.link,to:s.url,title:s.label,children:s.label}):i.jsx("span",{className:jo.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",Wf={btn:nC,sm:sC,md:aC,lg:iC,primary:oC,danger:rC,outline:lC,ghost:cC},nn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[Wf.btn,Wf[s],Wf[o],r].filter(Boolean).join(" ");return i.jsx("button",{ref:u,className:p,...d,children:c})}),dC="_copyButton_1bqk0_1",uC={copyButton:dC},fC=2e3;function pC({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 i.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?i.jsx(Ci,{size:$t,"aria-hidden":"true"}):i.jsx(T_,{size:$t,"aria-hidden":"true"})})}const mC="_banner_bxqlh_1",hC="_label_bxqlh_15",gC="_text_bxqlh_25",vC="_link_bxqlh_29",Ic={banner:mC,label:hC,text:gC,link:vC};function yC(){return i.jsxs("div",{className:Ic.banner,"data-testid":"demo-banner",children:[i.jsx("span",{className:Ic.label,children:"DEMO"}),i.jsxs("span",{className:Ic.text,children:["This is an interactive demo with mock data."," ",i.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Ic.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",wC="_danger_og0yp_70",NC="_outline_og0yp_83",CC="_ghost_og0yp_92",EC="_dropdown_og0yp_100",AC="_option_og0yp_113",DC="_optionLabel_og0yp_130",MC="_optionDesc_og0yp_135",na={container:bC,chevronButton:_C,mainButton:xC,sm:kC,md:SC,lg:jC,primary:TC,danger:wC,outline:NC,ghost:CC,dropdown:EC,option:AC,optionLabel:DC,optionDesc:MC};function W_({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(k){m.current&&k.target instanceof Node&&!m.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=na[r]||"",v=na[c]||"",b=()=>{u&&p(!1),s()};return i.jsxs("div",{ref:m,className:na.container,"data-testid":d,children:[i.jsx("button",{type:"button",className:`${na.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),i.jsx("button",{type:"button",className:`${na.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:i.jsx(j_,{size:$t,"aria-hidden":"true"})}),u&&i.jsx("div",{className:na.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,k)=>i.jsxs("button",{type:"button",className:na.option,onClick:()=>{_.onClick(),p(!1)},children:[i.jsx("span",{className:na.optionLabel,children:_.label}),_.description&&i.jsx("span",{className:na.optionDesc,children:_.description})]},k))})]})}function zp(){zp=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),sd(p,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&sd(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},zp.apply(this,arguments)}function sd(t,s){return sd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},sd(t,s)}function ky(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 Xf(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 ky(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)?ky(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
278
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var RC=(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){P2(r,"element",o)};function o(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var g,v,b=(function(E){for(var R,O=Xf(E.properties.className);!(R=O()).done;){var M=R.value;if(M.slice(0,9)==="language-")return M.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var _,k;k=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Ac(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(R){return R.reduce(function(O,M){if(M.type==="text"){var $=M.value,Y=($.match(/\n/g)||"").length;if(Y===0)M.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(M);else for(var V,ne=$.split(`
279
+ `),le=Xf(ne.entries());!(V=le()).done;){var Z=V.value,se=Z[0],H=Z[1];O.push({type:"text",value:se===ne.length-1?H:H+`
280
+ `,position:{start:{line:v+se,column:1},end:{line:v+se,column:1}}})}return v+=Y,O}if(Object.prototype.hasOwnProperty.call(M,"children")){var B=v;return M.children=E(M.children),O.push(M),M.position={start:{line:B,column:1},end:{line:v,column:1}},O}return O.push(M),O},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,j=(function(E){var R=/{([\d,-]+)}/,O=E.split(",").map(function(Y){return Y.trim()}).join();if(R.test(O)){var M=R.exec(O)[1],$=V2(M);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),T=(function(E){var R=zp(/showLineNumbers=(\d+)/i,{lines:1});if(R.test(E)){var O=R.exec(E);return Number(O.groups.lines)}return 1})(m),w=(function(E){for(var R=new Array(E),O=0;O<E;O++)R[O]={type:"element",tagName:"span",properties:{className:[]},children:[]};return R})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,R,O=S.value,M=O[0],$=O[1];$.properties.className=["code-line"];var Y=q2(g,function(V){return V.position.start.line<=M+1&&V.position.end.line>=M+1});$.children=Y.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(V){return m.toLowerCase().includes(V)})&&($.properties.line=[(M+T).toString()],$.properties.className.push("line-number")),j(M)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Ac($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&Ac($).substring(0,1)==="+"&&$.properties.className.push("inserted")},A=Xf(w.entries());!(S=A()).done;)D();w.length>0&&Ac(w[w.length-1]).trim()===""&&w.pop(),r.children=w}}}})(U2);function Bo(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 Ds(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 Sy=new Set(["grackle"]);function ul(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Sy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Sy.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",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=ul(t);return IC[s.toLowerCase()]??"generic"}const BC="_card_qkm9i_2",LC="_cardBlue_qkm9i_20",zC="_cardOrange_qkm9i_24",$C="_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",KC="_fileName_qkm9i_71",ZC="_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",L={card:BC,cardBlue:LC,cardOrange:zC,cardGreen:$C,cardPurple:HC,cardNeutral:PC,cardRed:UC,cardTeal:VC,header:qC,icon:GC,toolName:FC,fileName:KC,badge:ZC,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 Qf=5;function jy({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=uE(s),m=fE(p),g=o===void 0,v=r?L.cardRed:c?L.cardGreen:L.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?i.jsx($j,{size:$t}):i.jsx(Pj,{size:$t}),k=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
281
+ `))??[],j=S.length>Qf,T=d?S:S.slice(0,Qf);return i.jsxs("div",{className:`${L.card} ${v} ${g?L.inProgress:""}`,"data-testid":k,children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:_}),i.jsx("span",{className:L.toolName,style:{color:b},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,children:[S.length," lines"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:T.map((w,C)=>i.jsxs("span",{className:L.diffLine,children:[i.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),w]},C))}),j&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),d?"collapse":`${S.length-Qf} more lines`]})]})]})}function pE(t){const s=t.split(`
282
282
  `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function mE(t,s){const o=t.split(`
283
283
  `),r=s.split(`
284
- `),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function 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=pE(r);if(c.length>0)return c}}const o=vE(t);if(o)return mE(o.oldStr,o.newStr)}const ep=5;function _E({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=gE(s),m=yE(p),g=o===void 0,v=bE(s,c),b=v?hE(v):null,_=((v==null?void 0:v.length)??0)>ep,k=d?v:v==null?void 0:v.slice(0,ep);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${g?L.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Tj,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&k&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-diff",children:k.map((S,T)=>{let j=L.diffContext;return S.type==="add"&&(j=L.diffAdd),S.type==="remove"&&(j=L.diffRemove),S.type==="header"&&(j=L.diffHeader),i.jsx("span",{className:`${L.diffLine} ${j}`,children:S.content},T)})}),_&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),d?"collapse":`${((v==null?void 0:v.length)??0)-ep} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:L.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 TE(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 tp=3;function jE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=SE(s),p=TE(u),m=o===void 0,g=o?kE(o):null,v=(g==null?void 0:g.output.split(`
285
- `))??[],b=v.length>tp,_=c?v:v.slice(0,tp),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return i.jsxs("div",{className:`${L.card} ${S?L.cardRed:L.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:L.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&i.jsxs("span",{className:k===0?L.exitOk:L.exitError,"data-testid":"tool-card-exit-code",children:[k===0?i.jsx(Ci,{size:Ze,"aria-hidden":"true"}):i.jsx(Is,{size:Ze,"aria-hidden":"true"})," ","exit ",k]}),m&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:i.jsx(lj,{size:Ze,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-output",children:_.join(`
286
- `)}),b&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${v.length-tp} more lines`]})]})]})}function wE(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 np=5;function NE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=wE(s),m=o===void 0,g=(o==null?void 0:o.split(`
287
- `).filter(_=>_.length>0))??[],v=g.length>np,b=c?g:g.slice(0,np);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Rp,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:L.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-results",children:b.join(`
288
- `)}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${g.length-np} more matches`]})]})]})}const CE="_progressBar_14f5c_1",EE="_progressFill_14f5c_9",AE="_activeTask_14f5c_16",DE="_activeIcon_14f5c_27",ME="_todoPulse_14f5c_1",RE="_activeText_14f5c_34",IE="_checklist_14f5c_48",OE="_item_14f5c_55",BE="_itemIcon_14f5c_65",LE="_itemText_14f5c_73",zE="_pending_14f5c_78",$E="_in_progress_14f5c_85",HE="_completed_14f5c_97",PE="_emptyMessage_14f5c_108",fs={progressBar:CE,progressFill:EE,activeTask:AE,activeIcon:DE,todoPulse:ME,activeText:RE,checklist:IE,item:OE,itemIcon:BE,itemText:LE,pending:zE,in_progress:$E,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:jy(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:jy(o.status)})):typeof s.content=="string"?qE(s.content):[]}function jy(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(`
289
- `),o=[];for(const r of s){const c=UE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),o.push({content:u,status:p})}}return o}function GE(t){switch(t){case"completed":return i.jsx(Ci,{size:Ze});case"in_progress":return i.jsx(Ti,{size:Ze,fill:"currentColor"});default:return i.jsx(Ti,{size:Ze})}}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 i.jsxs("div",{className:`${L.card} ${L.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(aj,{size:zt})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:fs.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:fs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:fs.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:fs.activeIcon,children:i.jsx(Ti,{size:Ze,fill:"currentColor"})}),i.jsx("span",{className:fs.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:fs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${fs.item} ${fs[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:fs.itemIcon,children:GE(d.status)}),i.jsx("span",{className:fs.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:fs.emptyMessage,children:"All items completed and cleared."})]})}function KE(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 ZE({tool:t,args:s}){const o=KE(t,s);return i.jsxs("div",{className:L.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:L.metadataPrefix,children:i.jsx(LT,{size:Ze})}),o]})}function YE(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 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){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function wy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function WE(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 sp=5;function XE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=dl(t),p=YE(s),m=o===void 0,{single:g,list:v,sessionId:b}=JE(o),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,style:{color:WE(k)},"data-testid":"tool-card-task-status",children:[wy(k)," ",k]})]}),v&&!k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&i.jsxs("div",{className:L.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
290
- `)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,sp)).map(S=>{const T=wy(S.status),j=S.title??S.id??"untitled";return`${T} ${j}`}).join(`
291
- `)}),v.length>sp&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-sp} more tasks`]})]})]})}function QE(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 eA(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 tA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=dl(t),p=QE(s),m=o===void 0,g=eA(o),v=g.status??p.status,b=g.summary??p.summary;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardGreen} ${m?L.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsx("span",{className:L.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&i.jsx("pre",{className:L.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function nA(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 sA(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 ap=5;function aA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=dl(t),p=nA(s),m=o===void 0,g=sA(o);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,ap)).map(v=>{var k,S,T;const b=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((T=v.node)==null?void 0:T.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
284
+ `),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function 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=pE(r);if(c.length>0)return c}}const o=vE(t);if(o)return mE(o.oldStr,o.newStr)}const ep=5;function _E({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=gE(s),m=yE(p),g=o===void 0,v=bE(s,c),b=v?hE(v):null,_=((v==null?void 0:v.length)??0)>ep,k=d?v:v==null?void 0:v.slice(0,ep);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${g?L.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(jT,{size:$t})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&i.jsx("span",{className:L.fileName,title:p,children:m}),b&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-diff-stats",children:[i.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",i.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&k&&k.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-diff",children:k.map((S,j)=>{let T=L.diffContext;return S.type==="add"&&(T=L.diffAdd),S.type==="remove"&&(T=L.diffRemove),S.type==="header"&&(T=L.diffHeader),i.jsx("span",{className:`${L.diffLine} ${T}`,children:S.content},j)})}),_&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),d?"collapse":`${((v==null?void 0:v.length)??0)-ep} more lines`]})]}),!r&&!v&&!g&&o&&i.jsx("pre",{className:L.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 tp=3;function TE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=SE(s),p=jE(u),m=o===void 0,g=o?kE(o):null,v=(g==null?void 0:g.output.split(`
285
+ `))??[],b=v.length>tp,_=c?v:v.slice(0,tp),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return i.jsxs("div",{className:`${L.card} ${S?L.cardRed:L.cardNeutral}`,"data-testid":"tool-card-shell",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),i.jsx("span",{className:L.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&i.jsxs("span",{className:k===0?L.exitOk:L.exitError,"data-testid":"tool-card-exit-code",children:[k===0?i.jsx(Ci,{size:Ye,"aria-hidden":"true"}):i.jsx(Os,{size:Ye,"aria-hidden":"true"})," ","exit ",k]}),m&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:i.jsx(lT,{size:Ye,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-output",children:_.join(`
286
+ `)}),b&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),c?"collapse":`${v.length-tp} more lines`]})]})]})}function wE(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 np=5;function NE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=wE(s),m=o===void 0,g=(o==null?void 0:o.split(`
287
+ `).filter(_=>_.length>0))??[],v=g.length>np,b=c?g:g.slice(0,np);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-search",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Rp,{size:$t})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&i.jsxs("span",{className:L.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-results",children:b.join(`
288
+ `)}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),c?"collapse":`${g.length-np} more matches`]})]})]})}const CE="_progressBar_14f5c_1",EE="_progressFill_14f5c_9",AE="_activeTask_14f5c_16",DE="_activeIcon_14f5c_27",ME="_todoPulse_14f5c_1",RE="_activeText_14f5c_34",IE="_checklist_14f5c_48",OE="_item_14f5c_55",BE="_itemIcon_14f5c_65",LE="_itemText_14f5c_73",zE="_pending_14f5c_78",$E="_in_progress_14f5c_85",HE="_completed_14f5c_97",PE="_emptyMessage_14f5c_108",fs={progressBar:CE,progressFill:EE,activeTask:AE,activeIcon:DE,todoPulse:ME,activeText:RE,checklist:IE,item:OE,itemIcon:BE,itemText:LE,pending:zE,in_progress:$E,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:Ty(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:Ty(o.status)})):typeof s.content=="string"?qE(s.content):[]}function Ty(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(`
289
+ `),o=[];for(const r of s){const c=UE.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),o.push({content:u,status:p})}}return o}function GE(t){switch(t){case"completed":return i.jsx(Ci,{size:Ye});case"in_progress":return i.jsx(ji,{size:Ye,fill:"currentColor"});default:return i.jsx(ji,{size:Ye})}}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 i.jsxs("div",{className:`${L.card} ${L.cardBlue}`,"data-testid":"tool-card-todo",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(aT,{size:$t})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&i.jsx("div",{className:fs.progressBar,"data-testid":"tool-card-todo-bar",children:i.jsx("div",{className:fs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&i.jsxs("div",{className:fs.activeTask,"data-testid":"tool-card-todo-active",children:[i.jsx("span",{className:fs.activeIcon,children:i.jsx(ji,{size:Ye,fill:"currentColor"})}),i.jsx("span",{className:fs.activeText,children:r.activeForm||r.content})]}),!c&&i.jsx("div",{className:fs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>i.jsxs("div",{className:`${fs.item} ${fs[d.status]}`,"data-testid":"tool-card-todo-item",children:[i.jsx("span",{className:fs.itemIcon,children:GE(d.status)}),i.jsx("span",{className:fs.itemText,children:d.content})]},u))}),c&&i.jsx("div",{className:fs.emptyMessage,children:"All items completed and cleared."})]})}function KE(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 ZE({tool:t,args:s}){const o=KE(t,s);return i.jsxs("div",{className:L.metadata,"data-testid":"tool-card-metadata",children:[i.jsx("span",{className:L.metadataPrefix,children:i.jsx(Lj,{size:Ye})}),o]})}function YE(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 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){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function wy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function WE(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 sp=5;function XE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ul(t),p=YE(s),m=o===void 0,{single:g,list:v,sessionId:b}=JE(o),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-task",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📋"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,style:{color:WE(k)},"data-testid":"tool-card-task-status",children:[wy(k)," ",k]})]}),v&&!k&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&i.jsxs("div",{className:L.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
290
+ `)}),!r&&v&&v.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,sp)).map(S=>{const j=wy(S.status),T=S.title??S.id??"untitled";return`${j} ${T}`}).join(`
291
+ `)}),v.length>sp&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-sp} more tasks`]})]})]})}function QE(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 eA(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 tA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ul(t),p=QE(s),m=o===void 0,g=eA(o),v=g.status??p.status,b=g.summary??p.summary;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardGreen} ${m?L.inProgress:""}`,"data-testid":"tool-card-workpad",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📓"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsx("span",{className:L.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&i.jsx("pre",{className:L.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function nA(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 sA(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 ap=5;function aA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ul(t),p=nA(s),m=o===void 0,g=sA(o);return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🧠"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,ap)).map(v=>{var k,S,j;const b=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((j=v.node)==null?void 0:j.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
292
292
  `)}),g.results.length>ap&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-ap} more results`]})]}),!r&&g.node&&!g.results&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
293
- `)})]})}function iA(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 oA(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 rA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=dl(t),p=iA(s),m=o===void 0,g=oA(o);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${m?L.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&i.jsx("span",{className:L.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsx("span",{className:L.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.jsxs("div",{className:L.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
293
+ `)})]})}function iA(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 oA(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 rA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=ul(t),p=iA(s),m=o===void 0,g=oA(o);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${m?L.inProgress:""}`,"data-testid":"tool-card-ipc",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔀"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&i.jsx("span",{className:L.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsx("span",{className:L.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&i.jsxs("div",{className:L.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
294
294
  `)}),g.fds.length>5&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function lA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const ip=8;function cA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=lA(t),u=s===void 0,p=(s==null?void 0:s.split(`
295
295
  `))??[],m=p.length>ip,g=r?s:p.slice(0,ip).join(`
296
296
  `);return i.jsxs("div",{className:`${L.card} ${o?L.cardRed:L.cardNeutral} ${u?L.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔧"}),i.jsx("span",{className:L.toolName,children:"ToolSearch"}),d&&i.jsxs("span",{className:L.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:L.spacer}),i.jsxs("span",{className:L.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${r?L.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-ip} more lines`]})]})]})}function dA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function uA(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 op=5;function fA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=dA(t),p=uA(s),m=o===void 0,g=(o==null?void 0:o.split(`
297
297
  `))??[],v=g.length>op,b=c?o:g.slice(0,op).join(`
298
- `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(RT,{size:zt,"aria-hidden":"true"})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:L.fileName,children:p})]}),m&&_&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:_}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:b}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),c?"collapse":`${g.length-op} more lines`]})]})]})}const pA="_badgePill_o7eqc_1",mA="_modelBadge_o7eqc_14",hA="_backgroundBadge_o7eqc_26",gA="_backgroundDot_o7eqc_36",vA="_backgroundDotPulsing_o7eqc_41",yA="_description_o7eqc_55",bA="_statusLine_o7eqc_62",_A="_statusCompleted_o7eqc_72",xA="_statusRunning_o7eqc_77",kA="_statusError_o7eqc_83",SA="_promptToggle_o7eqc_88",ps={badgePill:pA,modelBadge:mA,backgroundBadge:hA,backgroundDot:gA,backgroundDotPulsing:vA,description:yA,statusLine:bA,statusCompleted:_A,statusRunning:xA,statusError:kA,promptToggle:SA};function TA(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 jA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function wA(t){const s=jA.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 rp=5;function NA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=TA(t,s),g=o===void 0,v=m.isPoll&&o?wA(o):void 0,b=(v==null?void 0:v.content)??o,_=(b==null?void 0:b.split(`
298
+ `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-generic",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,children:i.jsx(Rj,{size:$t,"aria-hidden":"true"})}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&i.jsx("span",{className:L.fileName,children:p})]}),m&&_&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:_}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:b}),v&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),c?"collapse":`${g.length-op} more lines`]})]})]})}const pA="_badgePill_o7eqc_1",mA="_modelBadge_o7eqc_14",hA="_backgroundBadge_o7eqc_26",gA="_backgroundDot_o7eqc_36",vA="_backgroundDotPulsing_o7eqc_41",yA="_description_o7eqc_55",bA="_statusLine_o7eqc_62",_A="_statusCompleted_o7eqc_72",xA="_statusRunning_o7eqc_77",kA="_statusError_o7eqc_83",SA="_promptToggle_o7eqc_88",ps={badgePill:pA,modelBadge:mA,backgroundBadge:hA,backgroundDot:gA,backgroundDotPulsing:vA,description:yA,statusLine:bA,statusCompleted:_A,statusRunning:xA,statusError:kA,promptToggle:SA};function jA(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 TA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function wA(t){const s=TA.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 rp=5;function NA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=jA(t,s),g=o===void 0,v=m.isPoll&&o?wA(o):void 0,b=(v==null?void 0:v.content)??o,_=(b==null?void 0:b.split(`
299
299
  `))??[],k=_.length>rp,S=c?b:_.slice(0,rp).join(`
300
- `),T=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardTeal} ${g?L.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:T}),m.agentType&&i.jsx("span",{className:ps.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:ps.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:ps.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?ps.backgroundDotPulsing:ps.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:L.spacer}),g&&!m.isBackground&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:ps.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:ps.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?ps.statusCompleted:v.status==="running"?ps.statusRunning:ps.statusError,children:v.status}),v.metadata&&i.jsx("span",{children:v.metadata})]}),m.prompt&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:ps.promptToggle,onClick:()=>{p(j=>!j)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${L.chevron} ${u?L.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:S}),k&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-rp} more lines`]})]})]})}function lp(t){switch(OC(t.tool)){case"file-read":return i.jsx(Ty,{...t});case"file-edit":return i.jsx(_E,{...t});case"file-write":return i.jsx(Ty,{...t,writeVariant:!0});case"shell":return i.jsx(jE,{...t});case"search":return i.jsx(NE,{...t});case"todo":return i.jsx(FE,{...t});case"metadata":return i.jsx(ZE,{...t});case"task":return i.jsx(XE,{...t});case"workpad":return i.jsx(tA,{...t});case"knowledge":return i.jsx(aA,{...t});case"ipc":return i.jsx(rA,{...t});case"tool-search":return i.jsx(cA,{...t});case"agent":return i.jsx(NA,{...t});default:return i.jsx(fA,{...t})}}const CA="_systemContextEvent_1kdcc_1",EA="_systemContextHeader_1kdcc_7",AA="_systemContextBadge_1kdcc_28",DA="_systemContextToggle_1kdcc_37",MA="_systemContextPre_1kdcc_43",RA="_systemContextEllipsis_1kdcc_54",IA="_systemEvent_1kdcc_58",OA="_systemTimestamp_1kdcc_65",BA="_textEvent_1kdcc_69",LA="_codeBlockWrapper_1kdcc_156",zA="_codeBlockCopyButton_1kdcc_159",$A="_errorEvent_1kdcc_163",HA="_statusEvent_1kdcc_171",PA="_userInputEvent_1kdcc_180",UA="_userInputContent_1kdcc_186",VA="_signalEvent_1kdcc_293",qA="_signalBadge_1kdcc_304",GA="_signalContent_1kdcc_313",FA="_usageEvent_1kdcc_318",KA="_usageBadge_1kdcc_325",ZA="_defaultEvent_1kdcc_334",Lt={systemContextEvent:CA,systemContextHeader:EA,systemContextBadge:AA,systemContextToggle:DA,systemContextPre:MA,systemContextEllipsis:RA,systemEvent:IA,systemTimestamp:OA,textEvent:BA,codeBlockWrapper:LA,codeBlockCopyButton:zA,errorEvent:$A,statusEvent:HA,userInputEvent:PA,userInputContent:UA,signalEvent:VA,signalBadge:qA,signalContent:GA,usageEvent:FA,usageBadge:KA,defaultEvent:ZA},Ny=y.lazy(()=>k_(()=>import("./McpAppWidget-MdNH9jtw.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.McpAppWidget}))),Cy=3;function YA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
300
+ `),j=m.isPoll?"Subagent":"Agent";return i.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardTeal} ${g?L.inProgress:""}`,"data-testid":"tool-card-agent",children:[i.jsxs("div",{className:L.header,children:[i.jsx("span",{className:L.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),i.jsx("span",{className:L.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&i.jsx("span",{className:ps.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&i.jsx("span",{className:ps.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&i.jsxs("span",{className:ps.backgroundBadge,"data-testid":"tool-card-agent-background",children:[i.jsx("span",{className:g?ps.backgroundDotPulsing:ps.backgroundDot,children:"●"}),"BG"]}),m.agentName&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&i.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),i.jsx("span",{className:L.spacer}),g&&!m.isBackground&&i.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&i.jsx("div",{className:ps.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&i.jsxs("div",{className:ps.statusLine,"data-testid":"tool-card-agent-status",children:[i.jsx("span",{className:v.status==="completed"?ps.statusCompleted:v.status==="running"?ps.statusRunning:ps.statusError,children:v.status}),v.metadata&&i.jsx("span",{children:v.metadata})]}),m.prompt&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:ps.promptToggle,onClick:()=>{p(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[i.jsx("span",{className:`${L.chevron} ${u?L.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&i.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&i.jsxs(i.Fragment,{children:[i.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:S}),k&&i.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[i.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-rp} more lines`]})]})]})}function lp(t){switch(OC(t.tool)){case"file-read":return i.jsx(jy,{...t});case"file-edit":return i.jsx(_E,{...t});case"file-write":return i.jsx(jy,{...t,writeVariant:!0});case"shell":return i.jsx(TE,{...t});case"search":return i.jsx(NE,{...t});case"todo":return i.jsx(FE,{...t});case"metadata":return i.jsx(ZE,{...t});case"task":return i.jsx(XE,{...t});case"workpad":return i.jsx(tA,{...t});case"knowledge":return i.jsx(aA,{...t});case"ipc":return i.jsx(rA,{...t});case"tool-search":return i.jsx(cA,{...t});case"agent":return i.jsx(NA,{...t});default:return i.jsx(fA,{...t})}}const CA="_systemContextEvent_1kdcc_1",EA="_systemContextHeader_1kdcc_7",AA="_systemContextBadge_1kdcc_28",DA="_systemContextToggle_1kdcc_37",MA="_systemContextPre_1kdcc_43",RA="_systemContextEllipsis_1kdcc_54",IA="_systemEvent_1kdcc_58",OA="_systemTimestamp_1kdcc_65",BA="_textEvent_1kdcc_69",LA="_codeBlockWrapper_1kdcc_156",zA="_codeBlockCopyButton_1kdcc_159",$A="_errorEvent_1kdcc_163",HA="_statusEvent_1kdcc_171",PA="_userInputEvent_1kdcc_180",UA="_userInputContent_1kdcc_186",VA="_signalEvent_1kdcc_293",qA="_signalBadge_1kdcc_304",GA="_signalContent_1kdcc_313",FA="_usageEvent_1kdcc_318",KA="_usageBadge_1kdcc_325",ZA="_defaultEvent_1kdcc_334",zt={systemContextEvent:CA,systemContextHeader:EA,systemContextBadge:AA,systemContextToggle:DA,systemContextPre:MA,systemContextEllipsis:RA,systemEvent:IA,systemTimestamp:OA,textEvent:BA,codeBlockWrapper:LA,codeBlockCopyButton:zA,errorEvent:$A,statusEvent:HA,userInputEvent:PA,userInputContent:UA,signalEvent:VA,signalBadge:qA,signalContent:GA,usageEvent:FA,usageBadge:KA,defaultEvent:ZA},Ny=y.lazy(()=>k_(()=>import("./McpAppWidget-CTtvGo4M.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.McpAppWidget}))),Cy=3;function YA({content:t}){const[s,o]=y.useState(!1),r=t.split(`
301
301
  `),c=r.length>Cy,d=s?t:r.slice(0,Cy).join(`
302
- `);return i.jsxs("div",{className:Lt.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:Lt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:Lt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:Lt.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(T_,{size:Ze}):i.jsx(da,{size:Ze})})]}),i.jsxs("pre",{className:Lt.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:Lt.systemContextEllipsis,children:"…"})]})]})}function JA({time:t,content:s}){return i.jsxs("div",{className:Lt.systemEvent,children:[i.jsxs("span",{className:Lt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function $p(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map($p).join(""):t!=null&&typeof t=="object"&&"props"in t?$p(t.props.children):""}function WA({children:t,node:s,...o}){const r=$p(t);return i.jsxs("div",{className:Lt.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(pC,{text:r,"data-testid":"copy-code-block",className:Lt.codeBlockCopyButton})]})}const XA={pre:WA};function X_({content:t}){return i.jsx(um,{remarkPlugins:[fm],rehypePlugins:[RC],components:XA,children:t})}function QA({content:t}){return i.jsx("div",{className:Lt.textEvent,children:i.jsx(X_,{content:t})})}function eD({content:t}){return i.jsxs("div",{className:Lt.errorEvent,children:["Error: ",t]})}function tD({content:t}){return i.jsxs("div",{className:Lt.statusEvent,children:["--- ",t," ---"]})}function nD({content:t}){return i.jsx("div",{className:Lt.userInputEvent,children:i.jsx("div",{className:Lt.userInputContent,"data-testid":"user-input-content",children:i.jsx(X_,{content:t})})})}function sD({content:t}){return i.jsxs("div",{className:Lt.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:Lt.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:Lt.signalContent,children:t})]})}function aD({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Oo(r+c),u=As(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:Lt.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:Lt.usageBadge,children:s})})}function Or({content:t}){return i.jsx("div",{className:Lt.defaultEvent,children:t})}function iD({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return i.jsx(Or,{content:t.content});let d={};try{d=JSON.parse(t.content)}catch{}const u=d.rendererKind??"mcp-app-html";if(u==="grackle-react"&&d.html){const m=`<!doctype html><html><head><meta charset="utf-8"></head><body><div id="grackle-root"></div><script type="module" src="${new URL(r,window.location.href).origin}/runtime.js"><\/script></body></html>`;return i.jsx(y.Suspense,{fallback:i.jsx(Or,{content:"Loading widget..."}),children:i.jsx(Ny,{widgetHtml:m,sandboxProxyUrl:r,csp:d.csp,toolInput:{source:d.html,props:d.toolInput??{}}})})}return u!=="mcp-app-html"||!d.html?i.jsx(Or,{content:t.content}):i.jsx(y.Suspense,{fallback:i.jsx(Or,{content:"Loading widget..."}),children:i.jsx(Ny,{widgetHtml:d.html,sandboxProxyUrl:r,csp:d.csp,toolInput:d.toolInput,toolResult:d.toolResult})})}case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(YA,{content:t.content})}catch{}return i.jsx(JA,{time:c,content:t.content})}case"text":case"output":return i.jsx(QA,{content:t.content});case"tool_use":{let d="",u={};try{const p=JSON.parse(t.content);d=p.tool||"",u=p.args}catch{}return i.jsx(lp,{tool:d,args:u,result:o?"":void 0})}case"tool_result":{let d=!1;if(t.raw)try{d=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const p=JSON.parse(t.content);typeof p.content=="string"&&(u=p.content)}catch{}return s?i.jsx(lp,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult}):i.jsx(lp,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return i.jsx(eD,{content:t.content});case"status":return i.jsx(tD,{content:t.content});case"user_input":return i.jsx(nD,{content:t.content});case"signal":return i.jsx(sD,{content:t.content});case"usage":return i.jsx(aD,{content:t.content});default:return i.jsx(Or,{content:t.content})}}const Tm=y.createContext({});function jm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const kd=y.createContext(null),wm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class oD 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 rD({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(wm);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
302
+ `);return i.jsxs("div",{className:zt.systemContextEvent,"data-testid":"system-context-event",children:[i.jsxs("button",{type:"button",className:zt.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[i.jsx("span",{className:zt.systemContextBadge,children:"SYSTEM PROMPT"}),c&&i.jsx("span",{className:zt.systemContextToggle,"aria-hidden":"true",children:s?i.jsx(j_,{size:Ye}):i.jsx(ua,{size:Ye})})]}),i.jsxs("pre",{className:zt.systemContextPre,children:[d,!s&&c&&i.jsx("span",{className:zt.systemContextEllipsis,children:"…"})]})]})}function JA({time:t,content:s}){return i.jsxs("div",{className:zt.systemEvent,children:[i.jsxs("span",{className:zt.systemTimestamp,children:["[",t,"]"]})," ",s]})}function $p(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map($p).join(""):t!=null&&typeof t=="object"&&"props"in t?$p(t.props.children):""}function WA({children:t,node:s,...o}){const r=$p(t);return i.jsxs("div",{className:zt.codeBlockWrapper,children:[i.jsx("pre",{...o,children:t}),i.jsx(pC,{text:r,"data-testid":"copy-code-block",className:zt.codeBlockCopyButton})]})}const XA={pre:WA};function X_({content:t}){return i.jsx(um,{remarkPlugins:[fm],rehypePlugins:[RC],components:XA,children:t})}function QA({content:t}){return i.jsx("div",{className:zt.textEvent,children:i.jsx(X_,{content:t})})}function eD({content:t}){return i.jsxs("div",{className:zt.errorEvent,children:["Error: ",t]})}function tD({content:t}){return i.jsxs("div",{className:zt.statusEvent,children:["--- ",t," ---"]})}function nD({content:t}){return i.jsx("div",{className:zt.userInputEvent,children:i.jsx("div",{className:zt.userInputContent,"data-testid":"user-input-content",children:i.jsx(X_,{content:t})})})}function sD({content:t}){return i.jsxs("div",{className:zt.signalEvent,"data-testid":"signal-event",children:[i.jsx("span",{className:zt.signalBadge,children:"SIGNAL"}),i.jsx("span",{className:zt.signalContent,children:t})]})}function aD({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Bo(r+c),u=Ds(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return i.jsx("div",{className:zt.usageEvent,"data-testid":"usage-event",children:i.jsx("span",{className:zt.usageBadge,children:s})})}function Br({content:t}){return i.jsx("div",{className:zt.defaultEvent,children:t})}function iD({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return i.jsx(Br,{content:t.content});let d={};try{d=JSON.parse(t.content)}catch{}const u=d.rendererKind??"mcp-app-html";if(u==="grackle-react"&&d.html){const m=`<!doctype html><html><head><meta charset="utf-8"></head><body><div id="grackle-root"></div><script type="module" src="${new URL(r,window.location.href).origin}/runtime.js"><\/script></body></html>`;return i.jsx(y.Suspense,{fallback:i.jsx(Br,{content:"Loading widget..."}),children:i.jsx(Ny,{widgetHtml:m,sandboxProxyUrl:r,csp:d.csp,toolInput:{source:d.html,props:d.toolInput??{}}})})}return u!=="mcp-app-html"||!d.html?i.jsx(Br,{content:t.content}):i.jsx(y.Suspense,{fallback:i.jsx(Br,{content:"Loading widget..."}),children:i.jsx(Ny,{widgetHtml:d.html,sandboxProxyUrl:r,csp:d.csp,toolInput:d.toolInput,toolResult:d.toolResult})})}case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return i.jsx(YA,{content:t.content})}catch{}return i.jsx(JA,{time:c,content:t.content})}case"text":case"output":return i.jsx(QA,{content:t.content});case"tool_use":{let d="",u={};try{const p=JSON.parse(t.content);d=p.tool||"",u=p.args}catch{}return i.jsx(lp,{tool:d,args:u,result:o?"":void 0})}case"tool_result":{let d=!1;if(t.raw)try{d=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const p=JSON.parse(t.content);typeof p.content=="string"&&(u=p.content)}catch{}return s?i.jsx(lp,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult}):i.jsx(lp,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return i.jsx(eD,{content:t.content});case"status":return i.jsx(tD,{content:t.content});case"user_input":return i.jsx(nD,{content:t.content});case"signal":return i.jsx(sD,{content:t.content});case"usage":return i.jsx(aD,{content:t.content});default:return i.jsx(Br,{content:t.content})}}const jm=y.createContext({});function Tm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const kd=y.createContext(null),wm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class oD 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 rD({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(wm);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
303
303
  [data-motion-pop-id="${o}"] {
304
304
  position: absolute !important;
305
305
  width: ${u}px !important;
@@ -307,8 +307,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
307
307
  top: ${m}px !important;
308
308
  left: ${g}px !important;
309
309
  }
310
- `),()=>{document.head.removeChild(v)}},[s]),i.jsx(oD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const lD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=jm(cD),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[o,g]);return y.useMemo(()=>{p.forEach((b,_)=>p.set(_,!1))},[o]),y.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(rD,{isPresent:o,children:t})),i.jsx(kd.Provider,{value:v,children:t})};function cD(){return new Map}function Q_(t=!0){const s=y.useContext(kd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const Oc=t=>t.key||"";function Ey(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Nm=typeof window<"u",ex=Nm?y.useLayoutEffect:y.useEffect,as=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=Q_(u),g=y.useMemo(()=>Ey(t),[t]),v=u&&!p?[]:g.map(Oc),b=y.useRef(!0),_=y.useRef(g),k=jm(()=>new Map),[S,T]=y.useState(g),[j,w]=y.useState(g);ex(()=>{b.current=!1,_.current=g;for(let A=0;A<j.length;A++){const E=Oc(j[A]);v.includes(E)?k.delete(E):k.get(E)!==!0&&k.set(E,!1)}},[j,v.length,v.join("-")]);const C=[];if(g!==S){let A=[...g];for(let E=0;E<j.length;E++){const R=j[E],O=Oc(R);v.includes(O)||(A.splice(E,0,R),C.push(R))}d==="wait"&&C.length&&(A=C),w(Ey(A)),T(g);return}const{forceRender:D}=y.useContext(Tm);return i.jsx(i.Fragment,{children:j.map(A=>{const E=Oc(A),R=u&&!p?!1:g===j||v.includes(E),O=()=>{if(k.has(E))k.set(E,!0);else return;let M=!0;k.forEach($=>{$||(M=!1)}),M&&(D==null||D(),w(_.current),u&&(m==null||m()),r&&r())};return i.jsx(lD,{isPresent:R,initial:!b.current||o?void 0:!1,custom:R?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:R?void 0:O,children:A},E)})})},$n=t=>t;let tx=$n;const dD={useManualTiming:!1};function uD(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const k=b&&r?s:o;return v&&d.add(g),k.has(g)||k.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Bc=["read","resolveKeyframes","update","preRender","render","postRender"],fD=40;function nx(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Bc.reduce((w,C)=>(w[C]=uD(d),w),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,k=()=>{const w=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(w-c.timestamp,fD),1),c.timestamp=w,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(k))},S=()=>{o=!0,r=!0,c.isProcessing||t(k)};return{schedule:Bc.reduce((w,C)=>{const D=u[C];return w[C]=(A,E=!1,R=!1)=>(o||S(),D.schedule(A,E,R)),w},{}),cancel:w=>{for(let C=0;C<Bc.length;C++)u[Bc[C]].cancel(w)},state:c,steps:u}}const{schedule:St,cancel:Za,state:fn,steps:cp}=nx(typeof requestAnimationFrame<"u"?requestAnimationFrame:$n,!0),sx=y.createContext({strict:!1}),Ay={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"]},Bo={};for(const t in Ay)Bo[t]={isEnabled:s=>Ay[t].some(o=>!!s[o])};function pD(t){for(const s in t)Bo[s]={...Bo[s],...t[s]}}const mD=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 ad(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||mD.has(t)}let ax=t=>!ad(t);function hD(t){t&&(ax=s=>s.startsWith("on")?!ad(s):t(s))}try{hD(require("@emotion/is-prop-valid").default)}catch{}function gD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(ax(c)||o===!0&&ad(c)||!s&&!ad(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function vD(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Sd=y.createContext({});function tl(t){return typeof t=="string"||Array.isArray(t)}function Td(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Cm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Em=["initial",...Cm];function jd(t){return Td(t.animate)||Em.some(s=>tl(t[s]))}function ix(t){return!!(jd(t)||t.variants)}function yD(t,s){if(jd(t)){const{initial:o,animate:r}=t;return{initial:o===!1||tl(o)?o:void 0,animate:tl(r)?r:void 0}}return t.inherit!==!1?s:{}}function bD(t){const{initial:s,animate:o}=yD(t,y.useContext(Sd));return y.useMemo(()=>({initial:s,animate:o}),[Dy(s),Dy(o)])}function Dy(t){return Array.isArray(t)?t.join(" "):t}const _D=Symbol.for("motionComponentSymbol");function Co(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function xD(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):Co(o)&&(o.current=r))},[s])}const Am=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),kD="framerAppearId",ox="data-"+Am(kD),{schedule:Dm}=nx(queueMicrotask,!1),rx=y.createContext({});function SD(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Sd),m=y.useContext(sx),g=y.useContext(kd),v=y.useContext(wm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,k=y.useContext(rx);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&TD(b.current,o,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,g)});const T=o[ox],j=y.useRef(!!T&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,T))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,T)));return ex(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Dm.render(_.render),j.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!j.current&&_.animationState&&_.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,T)}),j.current=!1))}),_}function TD(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:lx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Co(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function lx(t){if(t)return t.options.allowProjection!==!1?t.projection:lx(t.parent)}function jD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&pD(t);function p(g,v){let b;const _={...y.useContext(wm),...g,layoutId:wD(g)},{isStatic:k}=_,S=bD(g),T=r(g,k);if(!k&&Nm){ND();const j=CD(_);b=j.MeasureLayout,S.visualElement=SD(c,T,_,s,j.ProjectionNode)}return i.jsxs(Sd.Provider,{value:S,children:[b&&S.visualElement?i.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,g,xD(T,S.visualElement,v),T,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=y.forwardRef(p);return m[_D]=c,m}function wD({layoutId:t}){const s=y.useContext(Tm).id;return s&&t!==void 0?s+"-"+t:t}function ND(t,s){y.useContext(sx).strict}function CD(t){const{drag:s,layout:o}=Bo;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 ED=["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 Mm(t){return typeof t!="string"||t.includes("-")?!1:!!(ED.indexOf(t)>-1||/[A-Z]/u.test(t))}function My(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Rm(t,s,o,r){if(typeof s=="function"){const[c,d]=My(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]=My(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Hp=t=>Array.isArray(t),AD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),DD=t=>Hp(t)?t[t.length-1]||0:t,gn=t=>!!(t&&t.getVelocity);function Jc(t){const s=gn(t)?t.get():t;return AD(s)?s.toValue():s}function MD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:RD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const cx=t=>(s,o)=>{const r=y.useContext(Sd),c=y.useContext(kd),d=()=>MD(t,s,r,c);return o?d():jm(d)};function RD(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=Jc(d[_]);let{initial:u,animate:p}=t;const m=jd(t),g=ix(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!Td(b)){const _=Array.isArray(b)?b:[b];for(let k=0;k<_.length;k++){const S=Rm(t,_[k]);if(S){const{transitionEnd:T,transition:j,...w}=S;for(const C in w){let D=w[C];if(Array.isArray(D)){const A=v?D.length-1:0;D=D[A]}D!==null&&(c[C]=D)}for(const C in T)c[C]=T[C]}}}return c}const Uo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Mi=new Set(Uo),dx=t=>s=>typeof s=="string"&&s.startsWith(t),ux=dx("--"),ID=dx("var(--"),Im=t=>ID(t)?OD.test(t.split("/*")[0].trim()):!1,OD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,fx=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ca=(t,s,o)=>o>s?s:o<t?t:o,Vo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},nl={...Vo,transform:t=>ca(0,1,t)},Lc={...Vo,default:1},ul=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ga=ul("deg"),Ms=ul("%"),Ae=ul("px"),BD=ul("vh"),LD=ul("vw"),Ry={...Ms,parse:t=>Ms.parse(t)/100,transform:t=>Ms.transform(t*100)},zD={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,radius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae},$D={rotate:Ga,rotateX:Ga,rotateY:Ga,rotateZ:Ga,scale:Lc,scaleX:Lc,scaleY:Lc,scaleZ:Lc,skew:Ga,skewX:Ga,skewY:Ga,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:nl,originX:Ry,originY:Ry,originZ:Ae},Iy={...Vo,transform:Math.round},Om={...zD,...$D,zIndex:Iy,size:Ae,fillOpacity:nl,strokeOpacity:nl,numOctaves:Iy},HD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},PD=Uo.length;function UD(t,s,o){let r="",c=!0;for(let d=0;d<PD;d++){const u=Uo[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||o){const g=fx(p,Om[u]);if(!m){c=!1;const v=HD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Bm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Mi.has(m)){u=!0;continue}else if(ux(m)){c[m]=g;continue}else{const v=fx(g,Om[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=UD(s,t.transform,o):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const VD={offset:"stroke-dashoffset",array:"stroke-dasharray"},qD={offset:"strokeDashoffset",array:"strokeDasharray"};function GD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?VD:qD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function Oy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function FD(t,s,o){const r=Oy(s,t.x,t.width),c=Oy(o,t.y,t.height);return`${r} ${c}`}function Lm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Bm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:k,dimensions:S}=t;_.transform&&(S&&(k.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=FD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),o!==void 0&&(_.y=o),r!==void 0&&(_.scale=r),u!==void 0&&GD(_,u,p,m,!1)}const zm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),px=()=>({...zm(),attrs:{}}),$m=t=>typeof t=="string"&&t.toLowerCase()==="svg";function mx(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 hx=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 gx(t,s,o,r){mx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(hx.has(c)?c:Am(c),s.attrs[c])}const id={};function KD(t){Object.assign(id,t)}function vx(t,{layout:s,layoutId:o}){return Mi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!id[t]||t==="opacity")}function Hm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(gn(c[u])||s.style&&gn(s.style[u])||vx(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 yx(t,s,o){const r=Hm(t,s,o);for(const c in t)if(gn(t[c])||gn(s[c])){const d=Uo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function ZD(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 By=["x","y","width","height","cx","cy","r"],YD={useVisualState:cx({scrapeMotionValuesFromProps:yx,createRenderState:px,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Mi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<By.length;p++){const m=By[p];t[m]!==s[m]&&(u=!0)}u&&St.read(()=>{ZD(o,r),St.render(()=>{Lm(r,c,$m(o.tagName),t.transformTemplate),gx(o,r)})})}})},JD={useVisualState:cx({scrapeMotionValuesFromProps:Hm,createRenderState:zm})};function bx(t,s,o){for(const r in s)!gn(s[r])&&!vx(r,o)&&(t[r]=s[r])}function WD({transformTemplate:t},s){return y.useMemo(()=>{const o=zm();return Bm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function XD(t,s){const o=t.style||{},r={};return bx(r,o,t),Object.assign(r,WD(t,s)),r}function QD(t,s){const o={},r=XD(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 eM(t,s,o,r){const c=y.useMemo(()=>{const d=px();return Lm(d,s,$m(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};bx(d,t.style,t),c.style={...d,...c.style}}return c}function tM(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Mm(o)?eM:QD)(r,d,u,o),g=gD(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>gn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:_})}}function nM(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Mm(r)?YD:JD,preloadedFeatures:t,useRender:tM(c),createVisualElement:s,Component:r};return jD(u)}}function _x(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 wd(t,s,o){const r=t.getProps();return Rm(r,s,o!==void 0?o:r.custom,t)}function Pm(t,s){return t?t[s]||t.default||t:void 0}const xx=new Set(["width","height","top","left","right","bottom",...Uo]);let Wc;function sM(){Wc=void 0}const Rs={now:()=>(Wc===void 0&&Rs.set(fn.isProcessing||dD.useManualTiming?fn.timestamp:performance.now()),Wc),set:t=>{Wc=t,queueMicrotask(sM)}};function Um(t,s){t.indexOf(s)===-1&&t.push(s)}function Vm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class qm{constructor(){this.subscriptions=[]}add(s){return Um(this.subscriptions,s),()=>Vm(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 kx(t,s){return s?t*(1e3/s):0}const Ly=30,aM=t=>!isNaN(parseFloat(t));class iM{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Rs.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Rs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=aM(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 qm);const r=this.events[s].add(o);return s==="change"?()=>{r(),St.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Rs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Ly)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Ly);return kx(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 sl(t,s){return new iM(t,s)}function oM(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,sl(o))}function rM(t,s){const o=wd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=DD(d[u]);oM(t,u,p)}}function lM(t){return!!(gn(t)&&t.add)}function Pp(t,s){const o=t.getValue("willChange");if(lM(o))return o.add(s)}function Sx(t){return t.props[ox]}function Gm(t){let s;return()=>(s===void 0&&(s=t()),s)}const cM=Gm(()=>window.ScrollTimeline!==void 0);class dM{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(cM()&&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 uM extends dM{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const ia=t=>t*1e3,oa=t=>t/1e3;function Fm(t){return typeof t=="function"}function zy(t,s){t.timeline=s,t.onfinish=null}const Km=t=>Array.isArray(t)&&typeof t[0]=="number",fM={linearEasing:void 0};function pM(t,s){const o=Gm(t);return()=>{var r;return(r=fM[s])!==null&&r!==void 0?r:o()}}const od=pM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Lo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},Tx=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Lo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function jx(t){return!!(typeof t=="function"&&od()||!t||typeof t=="string"&&(t in Up||od())||Km(t)||Array.isArray(t)&&t.every(jx))}const Ur=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Up={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ur([0,.65,.55,1]),circOut:Ur([.55,0,1,.45]),backIn:Ur([.31,.01,.66,-.59]),backOut:Ur([.33,1.53,.69,.99])};function wx(t,s){if(t)return typeof t=="function"&&od()?Tx(t,s):Km(t)?Ur(t):Array.isArray(t)?t.map(o=>wx(o,s)||Up.easeOut):Up[t]}const Nx=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,mM=1e-7,hM=12;function gM(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=Nx(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>mM&&++p<hM);return u}function fl(t,s,o,r){if(t===s&&o===r)return $n;const c=d=>gM(d,0,1,t,o);return d=>d===0||d===1?d:Nx(c(d),s,r)}const Cx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,Ex=t=>s=>1-t(1-s),Ax=fl(.33,1.53,.69,.99),Zm=Ex(Ax),Dx=Cx(Zm),Mx=t=>(t*=2)<1?.5*Zm(t):.5*(2-Math.pow(2,-10*(t-1))),Ym=t=>1-Math.sin(Math.acos(t)),Rx=Ex(Ym),Ix=Cx(Ym),Ox=t=>/^0[^.\s]+$/u.test(t);function vM(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Ox(t):!0}const Kr=t=>Math.round(t*1e5)/1e5,Jm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function yM(t){return t==null}const bM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wm=(t,s)=>o=>!!(typeof o=="string"&&bM.test(o)&&o.startsWith(t)||s&&!yM(o)&&Object.prototype.hasOwnProperty.call(o,s)),Bx=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Jm);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},_M=t=>ca(0,255,t),dp={...Vo,transform:t=>Math.round(_M(t))},xi={test:Wm("rgb","red"),parse:Bx("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+dp.transform(t)+", "+dp.transform(s)+", "+dp.transform(o)+", "+Kr(nl.transform(r))+")"};function xM(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 Vp={test:Wm("#"),parse:xM,transform:xi.transform},Eo={test:Wm("hsl","hue"),parse:Bx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ms.transform(Kr(s))+", "+Ms.transform(Kr(o))+", "+Kr(nl.transform(r))+")"},hn={test:t=>xi.test(t)||Vp.test(t)||Eo.test(t),parse:t=>xi.test(t)?xi.parse(t):Eo.test(t)?Eo.parse(t):Vp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?xi.transform(t):Eo.transform(t)},kM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function SM(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Jm))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(kM))===null||o===void 0?void 0:o.length)||0)>0}const Lx="number",zx="color",TM="var",jM="var(",$y="${}",wM=/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 al(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(wM,m=>(hn.test(m)?(r.color.push(d),c.push(zx),o.push(hn.parse(m))):m.startsWith(jM)?(r.var.push(d),c.push(TM),o.push(m)):(r.number.push(d),c.push(Lx),o.push(parseFloat(m))),++d,$y)).split($y);return{values:o,split:p,indexes:r,types:c}}function $x(t){return al(t).values}function Hx(t){const{split:s,types:o}=al(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=o[u];p===Lx?d+=Kr(c[u]):p===zx?d+=hn.transform(c[u]):d+=c[u]}return d}}const NM=t=>typeof t=="number"?0:t;function CM(t){const s=$x(t);return Hx(t)(s.map(NM))}const Ya={test:SM,parse:$x,createTransformer:Hx,getAnimatableNone:CM},EM=new Set(["brightness","contrast","saturate","opacity"]);function AM(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(Jm)||[];if(!r)return t;const c=o.replace(r,"");let d=EM.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const DM=/\b([a-z-]*)\(.*?\)/gu,qp={...Ya,getAnimatableNone:t=>{const s=t.match(DM);return s?s.map(AM).join(" "):t}},MM={...Om,color:hn,backgroundColor:hn,outlineColor:hn,fill:hn,stroke:hn,borderColor:hn,borderTopColor:hn,borderRightColor:hn,borderBottomColor:hn,borderLeftColor:hn,filter:qp,WebkitFilter:qp},Xm=t=>MM[t];function Px(t,s){let o=Xm(t);return o!==qp&&(o=Ya),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const RM=new Set(["auto","none","0"]);function IM(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!RM.has(d)&&al(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=Px(o,c)}const Hy=t=>t===Vo||t===Ae,Py=(t,s)=>parseFloat(t.split(", ")[s]),Uy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Py(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Py(d[1],t):0}},OM=new Set(["x","y","z"]),BM=Uo.filter(t=>!OM.has(t));function LM(t){const s=[];return BM.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const zo={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:Uy(4,13),y:Uy(5,14)};zo.translateX=zo.x;zo.translateY=zo.y;const Si=new Set;let Gp=!1,Fp=!1;function Ux(){if(Fp){const t=Array.from(Si).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=LM(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fp=!1,Gp=!1,Si.forEach(t=>t.complete()),Si.clear()}function Vx(){Si.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Fp=!0)})}function zM(){Vx(),Ux()}class Qm{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?(Si.add(this),Gp||(Gp=!0,St.read(Vx),St.resolveKeyframes(Ux))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Si.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Si.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const qx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),$M=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function HM(t){const s=$M.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function Gx(t,s,o=1){const[r,c]=HM(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return qx(u)?parseFloat(u):u}return Im(c)?Gx(c,s,o+1):c}const Fx=t=>s=>s.test(t),PM={test:t=>t==="auto",parse:t=>t},Kx=[Vo,Ae,Ms,Ga,LD,BD,PM],Vy=t=>Kx.find(Fx(t));class Zx extends Qm{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),Im(g))){const v=Gx(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!xx.has(r)||s.length!==2)return;const[c,d]=s,u=Vy(c),p=Vy(d);if(u!==p)if(Hy(u)&&Hy(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)vM(s[c])&&r.push(c);r.length&&IM(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=zo[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=zo[r](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{o.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const qy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ya.test(t)||t==="0")&&!t.startsWith("url("));function UM(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 VM(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=qy(c,s),p=qy(d,s);return!u||!p?!1:UM(t)||(o==="spring"||Fm(o))&&r}const qM=t=>t!==null;function Nd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(qM),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const GM=40;class Yx{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Rs.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>GM?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&zM(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Rs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!VM(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Nd(s,this.options,o)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Kp=2e4;function Jx(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<Kp;)s+=o,r=t.next(s);return s>=Kp?1/0:s}const Ct=(t,s,o)=>t+(s-t)*o;function up(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 FM({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const p=o<.5?o*(1+s):o+s-o*s,m=2*o-p;c=up(m,p,t+1/3),d=up(m,p,t),u=up(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function rd(t,s){return o=>o>0?s:t}const fp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},KM=[Vp,xi,Eo],ZM=t=>KM.find(s=>s.test(t));function Gy(t){const s=ZM(t);if(!s)return!1;let o=s.parse(t);return s===Eo&&(o=FM(o)),o}const Fy=(t,s)=>{const o=Gy(t),r=Gy(s);if(!o||!r)return rd(t,s);const c={...o};return d=>(c.red=fp(o.red,r.red,d),c.green=fp(o.green,r.green,d),c.blue=fp(o.blue,r.blue,d),c.alpha=Ct(o.alpha,r.alpha,d),xi.transform(c))},YM=(t,s)=>o=>s(t(o)),pl=(...t)=>t.reduce(YM),Zp=new Set(["none","hidden"]);function JM(t,s){return Zp.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function WM(t,s){return o=>Ct(t,s,o)}function eh(t){return typeof t=="number"?WM:typeof t=="string"?Im(t)?rd:hn.test(t)?Fy:eR:Array.isArray(t)?Wx:typeof t=="object"?hn.test(t)?Fy:XM:rd}function Wx(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>eh(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function XM(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=eh(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function QM(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(o=t.values[p])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const eR=(t,s)=>{const o=Ya.createTransformer(s),r=al(t),c=al(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?Zp.has(t)&&!c.values.length||Zp.has(s)&&!r.values.length?JM(t,s):pl(Wx(QM(r,c),c.values),o):rd(t,s)};function Xx(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Ct(t,s,o):eh(t)(t,s)}const tR=5;function Qx(t,s,o){const r=Math.max(s-tR,0);return kx(o-t(r),s-r)}const Mt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},pp=.001;function nR({duration:t=Mt.duration,bounce:s=Mt.bounce,velocity:o=Mt.velocity,mass:r=Mt.mass}){let c,d,u=1-s;u=ca(Mt.minDamping,Mt.maxDamping,u),t=ca(Mt.minDuration,Mt.maxDuration,oa(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-o,k=Yp(g,u),S=Math.exp(-b);return pp-_/k*S},d=g=>{const b=g*u*t,_=b*o+o,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-b),T=Yp(Math.pow(g,2),u);return(-c(g)+pp>0?-1:1)*((_-k)*S)/T}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-pp+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=aR(c,d,p);if(t=ia(t),isNaN(m))return{stiffness:Mt.stiffness,damping:Mt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const sR=12;function aR(t,s,o){let r=o;for(let c=1;c<sR;c++)r=r-t(r)/s(r);return r}function Yp(t,s){return t*Math.sqrt(1-s*s)}const iR=["duration","bounce"],oR=["stiffness","damping","mass"];function Ky(t,s){return s.some(o=>t[o]!==void 0)}function rR(t){let s={velocity:Mt.velocity,stiffness:Mt.stiffness,damping:Mt.damping,mass:Mt.mass,isResolvedFromDuration:!1,...t};if(!Ky(t,oR)&&Ky(t,iR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ca(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Mt.mass,stiffness:c,damping:d}}else{const o=nR(t);s={...s,...o,mass:Mt.mass},s.isResolvedFromDuration=!0}return s}function e1(t=Mt.visualDuration,s=Mt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:k}=rR({...o,velocity:-oa(o.velocity||0)}),S=_||0,T=g/(2*Math.sqrt(m*v)),j=u-d,w=oa(Math.sqrt(m/v)),C=Math.abs(j)<5;r||(r=C?Mt.restSpeed.granular:Mt.restSpeed.default),c||(c=C?Mt.restDelta.granular:Mt.restDelta.default);let D;if(T<1){const E=Yp(w,T);D=R=>{const O=Math.exp(-T*w*R);return u-O*((S+T*w*j)/E*Math.sin(E*R)+j*Math.cos(E*R))}}else if(T===1)D=E=>u-Math.exp(-w*E)*(j+(S+w*j)*E);else{const E=w*Math.sqrt(T*T-1);D=R=>{const O=Math.exp(-T*w*R),M=Math.min(E*R,300);return u-O*((S+T*w*j)*Math.sinh(M)+E*j*Math.cosh(M))/E}}const A={calculatedDuration:k&&b||null,next:E=>{const R=D(E);if(k)p.done=E>=b;else{let O=0;T<1&&(O=E===0?ia(S):Qx(D,E,R));const M=Math.abs(O)<=r,$=Math.abs(u-R)<=c;p.done=M&&$}return p.value=p.done?u:R,p},toString:()=>{const E=Math.min(Jx(A),Kp),R=Tx(O=>A.next(E*O).value,E,30);return E+"ms "+R}};return A}function Zy({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},k=M=>p!==void 0&&M<p||m!==void 0&&M>m,S=M=>p===void 0?m:m===void 0||Math.abs(p-M)<Math.abs(m-M)?p:m;let T=o*s;const j=b+T,w=u===void 0?j:u(j);w!==j&&(T=w-b);const C=M=>-T*Math.exp(-M/r),D=M=>w+C(M),A=M=>{const $=C(M),Y=D(M);_.done=Math.abs($)<=g,_.value=_.done?w:Y};let E,R;const O=M=>{k(_.value)&&(E=M,R=e1({keyframes:[_.value,S(_.value)],velocity:Qx(D,M,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:M=>{let $=!1;return!R&&E===void 0&&($=!0,A(M),O(M)),E!==void 0&&M>=E?R.next(M-E):(!$&&A(M),_)}}}const lR=fl(.42,0,1,1),cR=fl(0,0,.58,1),t1=fl(.42,0,.58,1),dR=t=>Array.isArray(t)&&typeof t[0]!="number",uR={linear:$n,easeIn:lR,easeInOut:t1,easeOut:cR,circIn:Ym,circInOut:Ix,circOut:Rx,backIn:Zm,backInOut:Dx,backOut:Ax,anticipate:Mx},Yy=t=>{if(Km(t)){tx(t.length===4);const[s,o,r,c]=t;return fl(s,o,r,c)}else if(typeof t=="string")return uR[t];return t};function fR(t,s,o){const r=[],c=o||Xx,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||$n:s;p=pl(m,p)}r.push(p)}return r}function pR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(tx(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=fR(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const _=Lo(t[b],t[b+1],v);return p[b](_)};return o?v=>g(ca(t[0],t[d-1],v)):g}function mR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Lo(0,s,r);t.push(Ct(o,1,c))}}function hR(t){const s=[0];return mR(s,t.length-1),s}function gR(t,s){return t.map(o=>o*s)}function vR(t,s){return t.map(()=>s||t1).splice(0,t.length-1)}function ld({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=dR(r)?r.map(Yy):Yy(r),d={done:!1,value:s[0]},u=gR(o&&o.length===s.length?o:hR(s),t),p=pR(u,s,{ease:Array.isArray(c)?c:vR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const yR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>St.update(s,!0),stop:()=>Za(s),now:()=>fn.isProcessing?fn.timestamp:Rs.now()}},bR={decay:Zy,inertia:Zy,tween:ld,keyframes:ld,spring:e1},_R=t=>t/100;class th extends Yx{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||Qm,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Fm(o)?o:bR[o]||ld;let m,g;p!==ld&&typeof s[0]!="number"&&(m=pl(_R,Xx(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});d==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=Jx(v));const{calculatedDuration:b}=v,_=b+c,k=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:k,repeatType:S,repeatDelay:T,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const w=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,A=d;if(k){const M=Math.min(this.currentTime,v)/b;let $=Math.floor(M),Y=M%1;!Y&&M>=1&&(Y=1),Y===1&&$--,$=Math.min($,k+1),!!($%2)&&(S==="reverse"?(Y=1-Y,T&&(Y-=T/b)):S==="mirror"&&(A=u)),D=ca(0,1,Y)*b}const E=C?{done:!1,value:m[0]}:A.next(D);p&&(E.value=p(E.value));let{done:R}=E;!C&&g!==null&&(R=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return O&&c!==void 0&&(E.value=Nd(m,this.options,c)),j&&j(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?oa(s.calculatedDuration):0}get time(){return oa(this.currentTime)}set time(s){s=ia(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=oa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=yR,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 xR=new Set(["opacity","clipPath","filter","transform"]);function kR(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:o};m&&(g.offset=m);const v=wx(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const SR=Gm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),cd=10,TR=2e4;function jR(t){return Fm(t.type)||t.type==="spring"||!jx(t.ease)}function wR(t,s){const o=new th({...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<TR;)r=o.sample(d),c.push(r.value),d+=cd;return{times:void 0,keyframes:c,duration:d-cd,ease:"linear"}}const n1={anticipate:Mx,backInOut:Dx,circInOut:Ix};function NR(t){return t in n1}class Jy extends Yx{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Zx(d,(u,p)=>this.onKeyframesResolved(u,p),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&od()&&NR(d)&&(d=n1[d]),jR(this.options)){const{onComplete:b,onUpdate:_,motionValue:k,element:S,...T}=this.options,j=wR(s,T);s=j.keyframes,s.length===1&&(s[1]=s[0]),r=j.duration,c=j.times,d=j.ease,u="keyframes"}const v=kR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(zy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Nd(s,this.options,o)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return oa(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return oa(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=ia(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return $n;const{animation:r}=o;zy(r,s)}return $n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...k}=this.options,S=new th({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),T=ia(this.time);g.setWithVelocity(S.sample(T-cd).value,S.sample(T).value,cd)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=o.owner.getProps();return SR()&&r&&xR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const CR={type:"spring",stiffness:500,damping:25,restSpeed:10},ER=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),AR={type:"keyframes",duration:.8},DR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MR=(t,{keyframes:s})=>s.length>2?AR:Mi.has(t)?t.startsWith("scale")?ER(s[1]):CR:DR;function RR({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const nh=(t,s,o,r={},c,d)=>u=>{const p=Pm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-ia(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};RR(p)||(v={...v,...MR(t,v)}),v.duration&&(v.duration=ia(v.duration)),v.repeatDelay&&(v.repeatDelay=ia(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const _=Nd(v.keyframes,p);if(_!==void 0)return St.update(()=>{v.onUpdate(_),v.onComplete()}),new uM([])}return!d&&Jy.supports(v)?new Jy(v):new th(v)};function IR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function s1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),k=m[b];if(k===void 0||v&&IR(v,b))continue;const S={delay:o,...Pm(u||{},b)};let T=!1;if(window.MotionHandoffAnimation){const w=Sx(t);if(w){const C=window.MotionHandoffAnimation(w,b,St);C!==null&&(S.startTime=C,T=!0)}}Pp(t,b),_.start(nh(b,_,k,t.shouldReduceMotion&&xx.has(b)?{type:!1}:S,t,T));const j=_.animation;j&&g.push(j)}return p&&Promise.all(g).then(()=>{St.update(()=>{p&&rM(t,p)})}),g}function Jp(t,s,o={}){var r;const c=wd(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(s1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return OR(t,s,v+g,b,_,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function OR(t,s,o=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(BR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Jp(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function BR(t,s){return t.sortNodePosition(s)}function LR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Jp(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=Jp(t,s,o);else{const c=typeof s=="function"?wd(t,s,o.custom):s;r=Promise.all(s1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const zR=Em.length;function a1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?a1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<zR;o++){const r=Em[o],c=t.props[r];(tl(c)||c===!1)&&(s[r]=c)}return s}const $R=[...Cm].reverse(),HR=Cm.length;function PR(t){return s=>Promise.all(s.map(({animation:o,options:r})=>LR(t,o,r)))}function UR(t){let s=PR(t),o=Wy(),r=!0;const c=m=>(g,v)=>{var b;const _=wd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:k,transitionEnd:S,...T}=_;g={...g,...T,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=a1(t.parent)||{},b=[],_=new Set;let k={},S=1/0;for(let j=0;j<HR;j++){const w=$R[j],C=o[w],D=g[w]!==void 0?g[w]:v[w],A=tl(D),E=w===m?C.isActive:null;E===!1&&(S=j);let R=D===v[w]&&D!==g[w]&&A;if(R&&r&&t.manuallyAnimateOnMount&&(R=!1),C.protectedKeys={...k},!C.isActive&&E===null||!D&&!C.prevProp||Td(D)||typeof D=="boolean")continue;const O=VR(C.prevProp,D);let M=O||w===m&&C.isActive&&!R&&A||j>S&&A,$=!1;const Y=Array.isArray(D)?D:[D];let V=Y.reduce(c(w),{});E===!1&&(V={});const{prevResolvedValues:ee={}}=C,le={...ee,...V},Z=B=>{M=!0,_.has(B)&&($=!0,_.delete(B)),C.needsAnimating[B]=!0;const F=t.getValue(B);F&&(F.liveStyle=!1)};for(const B in le){const F=V[B],ge=ee[B];if(k.hasOwnProperty(B))continue;let ne=!1;Hp(F)&&Hp(ge)?ne=!_x(F,ge):ne=F!==ge,ne?F!=null?Z(B):_.add(B):F!==void 0&&_.has(B)?Z(B):C.protectedKeys[B]=!0}C.prevProp=D,C.prevResolvedValues=V,C.isActive&&(k={...k,...V}),r&&t.blockInitialAnimation&&(M=!1),M&&(!(R&&O)||$)&&b.push(...Y.map(B=>({animation:B,options:{type:w}})))}if(_.size){const j={};_.forEach(w=>{const C=t.getBaseTarget(w),D=t.getValue(w);D&&(D.liveStyle=!0),j[w]=C??null}),b.push({animation:j})}let T=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?s(b):Promise.resolve()}function p(m,g){var v;if(o[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var k;return(k=_.animationState)===null||k===void 0?void 0:k.setActive(m,g)}),o[m].isActive=g;const b=u(m);for(const _ in o)o[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=Wy(),r=!0}}}function VR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!_x(s,t):!1}function gi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wy(){return{animate:gi(!0),whileInView:gi(),whileHover:gi(),whileTap:gi(),whileDrag:gi(),whileFocus:gi(),exit:gi()}}class Ja{constructor(s){this.isMounted=!1,this.node=s}update(){}}class qR extends Ja{constructor(s){super(s),s.animationState||(s.animationState=UR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Td(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let GR=0;class FR extends Ja{constructor(){super(...arguments),this.id=GR++}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 KR={animation:{Feature:qR},exit:{Feature:FR}},gs={x:!1,y:!1};function i1(){return gs.x||gs.y}function ZR(t){return t==="x"||t==="y"?gs[t]?null:(gs[t]=!0,()=>{gs[t]=!1}):gs.x||gs.y?null:(gs.x=gs.y=!0,()=>{gs.x=gs.y=!1})}const sh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function il(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function ml(t){return{point:{x:t.pageX,y:t.pageY}}}const YR=t=>s=>sh(s)&&t(s,ml(s));function Zr(t,s,o,r){return il(t,s,YR(o),r)}const Xy=(t,s)=>Math.abs(t-s);function JR(t,s){const o=Xy(t.x,s.x),r=Xy(t.y,s.y);return Math.sqrt(o**2+r**2)}class o1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=hp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=JR(b.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=b,{timestamp:T}=fn;this.history.push({...S,timestamp:T});const{onStart:j,onMove:w}=this.handlers;_||(j&&j(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=mp(_,this.transformPagePoint),St.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:T}=this.handlers;if(this.dragSnapToOrigin&&T&&T(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=hp(b.type==="pointercancel"?this.lastMoveEventInfo:mp(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,j),S&&S(b,j)},!sh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=ml(s),p=mp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=fn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,hp(p,this.history)),this.removeListeners=pl(Zr(this.contextWindow,"pointermove",this.handlePointerMove),Zr(this.contextWindow,"pointerup",this.handlePointerUp),Zr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Za(this.updatePoint)}}function mp(t,s){return s?{point:s(t.point)}:t}function Qy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function hp({point:t},s){return{point:t,delta:Qy(t,r1(s)),offset:Qy(t,WR(s)),velocity:XR(s,.1)}}function WR(t){return t[0]}function r1(t){return t[t.length-1]}function XR(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=r1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>ia(s)));)o--;if(!r)return{x:0,y:0};const d=oa(c.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const u={x:(c.x-r.x)/d,y:(c.y-r.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const l1=1e-4,QR=1-l1,e4=1+l1,c1=.01,t4=0-c1,n4=0+c1;function Hn(t){return t.max-t.min}function s4(t,s,o){return Math.abs(t-s)<=o}function eb(t,s,o,r=.5){t.origin=r,t.originPoint=Ct(s.min,s.max,t.origin),t.scale=Hn(o)/Hn(s),t.translate=Ct(o.min,o.max,t.origin)-t.originPoint,(t.scale>=QR&&t.scale<=e4||isNaN(t.scale))&&(t.scale=1),(t.translate>=t4&&t.translate<=n4||isNaN(t.translate))&&(t.translate=0)}function Yr(t,s,o,r){eb(t.x,s.x,o.x,r?r.originX:void 0),eb(t.y,s.y,o.y,r?r.originY:void 0)}function tb(t,s,o){t.min=o.min+s.min,t.max=t.min+Hn(s)}function a4(t,s,o){tb(t.x,s.x,o.x),tb(t.y,s.y,o.y)}function nb(t,s,o){t.min=s.min-o.min,t.max=t.min+Hn(s)}function Jr(t,s,o){nb(t.x,s.x,o.x),nb(t.y,s.y,o.y)}function i4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Ct(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Ct(o,t,r.max):Math.min(t,o)),t}function sb(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 o4(t,{top:s,left:o,bottom:r,right:c}){return{x:sb(t.x,o,c),y:sb(t.y,s,r)}}function ab(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 r4(t,s){return{x:ab(t.x,s.x),y:ab(t.y,s.y)}}function l4(t,s){let o=.5;const r=Hn(t),c=Hn(s);return c>r?o=Lo(s.min,s.max-r,t.min):r>c&&(o=Lo(t.min,t.max-c,s.min)),ca(0,1,o)}function c4(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 Wp=.35;function d4(t=Wp){return t===!1?t=0:t===!0&&(t=Wp),{x:ib(t,"left","right"),y:ib(t,"top","bottom")}}function ib(t,s,o){return{min:ob(t,s),max:ob(t,o)}}function ob(t,s){return typeof t=="number"?t:t[s]||0}const rb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ao=()=>({x:rb(),y:rb()}),lb=()=>({min:0,max:0}),Ot=()=>({x:lb(),y:lb()});function ss(t){return[t("x"),t("y")]}function d1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function u4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function f4(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 gp(t){return t===void 0||t===1}function Xp({scale:t,scaleX:s,scaleY:o}){return!gp(t)||!gp(s)||!gp(o)}function bi(t){return Xp(t)||u1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function u1(t){return cb(t.x)||cb(t.y)}function cb(t){return t&&t!=="0%"}function dd(t,s,o){const r=t-o,c=s*r;return o+c}function db(t,s,o,r,c){return c!==void 0&&(t=dd(t,c,r)),dd(t,o,r)+s}function Qp(t,s=0,o=1,r,c){t.min=db(t.min,s,o,r,c),t.max=db(t.max,s,o,r,c)}function f1(t,{x:s,y:o}){Qp(t.x,s.translate,s.scale,s.originPoint),Qp(t.y,o.translate,o.scale,o.originPoint)}const ub=.999999999999,fb=1.0000000000001;function p4(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=o[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Mo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,f1(t,u)),r&&bi(d.latestValues)&&Mo(t,d.latestValues))}s.x<fb&&s.x>ub&&(s.x=1),s.y<fb&&s.y>ub&&(s.y=1)}function Do(t,s){t.min=t.min+s,t.max=t.max+s}function pb(t,s,o,r,c=.5){const d=Ct(t.min,t.max,c);Qp(t,s,o,d,r)}function Mo(t,s){pb(t.x,s.x,s.scaleX,s.scale,s.originX),pb(t.y,s.y,s.scaleY,s.scale,s.originY)}function p1(t,s){return d1(f4(t.getBoundingClientRect(),s))}function m4(t,s,o){const r=p1(t,o),{scroll:c}=s;return c&&(Do(r.x,c.offset.x),Do(r.y,c.offset.y)),r}const m1=({current:t})=>t?t.ownerDocument.defaultView:null,h4=new WeakMap;class g4{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ot(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(ml(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ZR(_),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ss(j=>{let w=this.getAxisMotionValue(j).get()||0;if(Ms.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[j];D&&(w=Hn(D)*(parseFloat(w)/100))}}this.originPoint[j]=w}),S&&St.postRender(()=>S(v,b)),Pp(this.visualElement,"transform");const{animationState:T}=this.visualElement;T&&T.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:k,onDirectionLock:S,onDrag:T}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:j}=b;if(k&&this.currentDirection===null){this.currentDirection=v4(j),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,j),this.updateAxis("y",b.point,j),this.visualElement.render(),T&&T(v,b)},p=(v,b)=>this.stop(v,b),m=()=>ss(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new o1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:m1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&St.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!zc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=i4(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&&Co(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=o4(c.layoutBox,o):this.constraints=!1,this.elastic=d4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&ss(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=c4(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Co(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=m4(r,c.root,this.visualElement.getTransformPagePoint());let u=r4(c.layout.layoutBox,d);if(o){const p=o(u4(u));this.hasMutatedConstraints=!!p,p&&(u=d1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=ss(v=>{if(!zc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Pp(this.visualElement,s),r.start(nh(s,r,0,o,this.visualElement,!1))}stopAnimation(){ss(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){ss(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){ss(o=>{const{drag:r}=this.getProps();if(!zc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Ct(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Co(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};ss(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=l4({min:m,max:m},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ss(u=>{if(!zc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Ct(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;h4.set(this.visualElement,this);const s=this.visualElement.current,o=Zr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Co(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),St.read(r);const u=il(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(ss(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Wp,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function zc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function v4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class y4 extends Ja{constructor(s){super(s),this.removeGroupControls=$n,this.removeListeners=$n,this.controls=new g4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$n}unmount(){this.removeGroupControls(),this.removeListeners()}}const mb=t=>(s,o)=>{t&&St.postRender(()=>t(s,o))};class b4 extends Ja{constructor(){super(...arguments),this.removePointerDownListener=$n}onPointerDown(s){this.session=new o1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:m1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:mb(s),onStart:mb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&St.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Zr(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 Xc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function hb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Br={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=hb(t,s.target.x),r=hb(t,s.target.y);return`${o}% ${r}%`}},_4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Ya.parse(t);if(c.length>5)return r;const d=Ya.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Ct(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class x4 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;KD(k4),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()})),Xc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||St.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Dm.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 h1(t){const[s,o]=Q_(),r=y.useContext(Tm);return i.jsx(x4,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(rx),isPresent:s,safeToRemove:o})}const k4={borderRadius:{...Br,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Br,borderTopRightRadius:Br,borderBottomLeftRadius:Br,borderBottomRightRadius:Br,boxShadow:_4};function S4(t,s,o){const r=gn(t)?t:sl(t);return r.start(nh("",r,s,o)),r.animation}function T4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const j4=(t,s)=>t.depth-s.depth;class w4{constructor(){this.children=[],this.isDirty=!1}add(s){Um(this.children,s),this.isDirty=!0}remove(s){Vm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(j4),this.isDirty=!1,this.children.forEach(s)}}function N4(t,s){const o=Rs.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Za(r),t(d-s))};return St.read(r,!0),()=>Za(r)}const g1=["TopLeft","TopRight","BottomLeft","BottomRight"],C4=g1.length,gb=t=>typeof t=="string"?parseFloat(t):t,vb=t=>typeof t=="number"||Ae.test(t);function E4(t,s,o,r,c,d){c?(t.opacity=Ct(0,o.opacity!==void 0?o.opacity:1,A4(r)),t.opacityExit=Ct(s.opacity!==void 0?s.opacity:1,0,D4(r))):d&&(t.opacity=Ct(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<C4;u++){const p=`border${g1[u]}Radius`;let m=yb(s,p),g=yb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||vb(m)===vb(g)?(t[p]=Math.max(Ct(gb(m),gb(g),r),0),(Ms.test(g)||Ms.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Ct(s.rotate||0,o.rotate||0,r))}function yb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const A4=v1(0,.5,Rx),D4=v1(.5,.95,$n);function v1(t,s,o){return r=>r<t?0:r>s?1:o(Lo(t,s,r))}function bb(t,s){t.min=s.min,t.max=s.max}function Xn(t,s){bb(t.x,s.x),bb(t.y,s.y)}function _b(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function xb(t,s,o,r,c){return t-=s,t=dd(t,1/o,r),c!==void 0&&(t=dd(t,1/c,r)),t}function M4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Ms.test(s)&&(s=parseFloat(s),s=Ct(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Ct(d.min,d.max,r);t===d&&(p-=s),t.min=xb(t.min,s,o,p,c),t.max=xb(t.max,s,o,p,c)}function kb(t,s,[o,r,c],d,u){M4(t,s[o],s[r],s[c],s.scale,d,u)}const R4=["x","scaleX","originX"],I4=["y","scaleY","originY"];function Sb(t,s,o,r){kb(t.x,s,R4,o?o.x:void 0,r?r.x:void 0),kb(t.y,s,I4,o?o.y:void 0,r?r.y:void 0)}function Tb(t){return t.translate===0&&t.scale===1}function y1(t){return Tb(t.x)&&Tb(t.y)}function jb(t,s){return t.min===s.min&&t.max===s.max}function O4(t,s){return jb(t.x,s.x)&&jb(t.y,s.y)}function wb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function b1(t,s){return wb(t.x,s.x)&&wb(t.y,s.y)}function Nb(t){return Hn(t.x)/Hn(t.y)}function Cb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class B4{constructor(){this.members=[]}add(s){Um(this.members,s),s.scheduleRender()}remove(s){if(Vm(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 L4(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:k,skewY:S}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const _i={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Vr=typeof window<"u"&&window.MotionDebug!==void 0,vp=["","X","Y","Z"],z4={visibility:"hidden"},Eb=1e3;let $4=0;function yp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function _1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Sx(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",St,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&_1(r)}function x1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=$4++,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,Vr&&(_i.totalNodes=_i.resolvedTargetDeltas=_i.recalculatedProjection=0),this.nodes.forEach(U4),this.nodes.forEach(K4),this.nodes.forEach(Z4),this.nodes.forEach(V4),Vr&&window.MotionDebug.record(_i)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new w4)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new qm),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const m=this.eventHandlers.get(u);m&&m.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=T4(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=N4(_,250),Xc.hasAnimatedSinceResize&&(Xc.hasAnimatedSinceResize=!1,this.nodes.forEach(Db))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const T=this.options.transition||v.getDefaultTransition()||Q4,{onLayoutAnimationStart:j,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!b1(this.targetLayout,S)||k,D=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const A={...Pm(T,"layout"),onPlay:j,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else _||Db(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Za(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(Y4),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&&_1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ab);return}this.isUpdating||this.nodes.forEach(G4),this.isUpdating=!1,this.nodes.forEach(F4),this.nodes.forEach(H4),this.nodes.forEach(P4),this.clearAllSnapshots();const p=Rs.now();fn.delta=ca(0,1e3/60,p-fn.timestamp),fn.timestamp=p,fn.isProcessing=!0,cp.update.process(fn),cp.preRender.process(fn),cp.render.process(fn),fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Dm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q4),this.sharedNodes.forEach(J4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,St.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){St.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Ot(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!y1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||bi(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return u&&(m=this.removeTransform(m)),e3(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Ot();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(t3))){const{scroll:v}=this.root;v&&(Do(m.x,v.offset.x),Do(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Ot();if(Xn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Xn(m,u),Do(m.x,b.offset.x),Do(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Ot();Xn(m,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Mo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),bi(v.latestValues)&&Mo(m,v.latestValues)}return bi(this.latestValues)&&Mo(m,this.latestValues),m}removeTransform(u){const p=Ot();Xn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!bi(g.latestValues))continue;Xp(g.latestValues)&&g.updateSnapshot();const v=Ot(),b=g.measurePageBox();Xn(v,b),Sb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return bi(this.latestValues)&&Sb(p,this.latestValues),p}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==fn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=fn.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ot(),this.relativeTargetOrigin=Ot(),Jr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Ot(),this.targetWithTransforms=Ot()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Xn(this.target,this.layout.layoutBox),f1(this.target,this.targetDelta)):Xn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Ot(),this.relativeTargetOrigin=Ot(),Jr(this.relativeTargetOrigin,this.target,k.target),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Vr&&_i.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Xp(this.parent.latestValues)||u1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const p=this.getLead(),m=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===fn.timestamp&&(g=!1),g)return;const{layout:v,layoutId:b}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||b))return;Xn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;p4(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Ot());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_b(this.prevProjectionDelta.x,this.projectionDelta.x),_b(this.prevProjectionDelta.y,this.projectionDelta.y)),Yr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!Cb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Cb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Vr&&_i.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Ao(),this.projectionDelta=Ao(),this.projectionDeltaWithTransform=Ao()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Ao();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Ot(),k=m?m.source:void 0,S=this.layout?this.layout.source:void 0,T=k!==S,j=this.getStack(),w=!j||j.members.length<=1,C=!!(T&&!w&&this.options.crossfade===!0&&!this.path.some(X4));this.animationProgress=0;let D;this.mixTargetDelta=A=>{const E=A/1e3;Mb(b.x,u.x,E),Mb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Jr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),W4(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&O4(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Ot()),Xn(D,this.relativeTarget)),T&&(this.animationValues=v,E4(v,g,this.latestValues,E,C,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Za(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=St.update(()=>{Xc.hasAnimatedSinceResize=!0,this.currentAnimation=S4(0,Eb,{...u,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Eb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:v}=u;if(!(!p||!m||!g)){if(this!==u&&this.layout&&g&&k1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Ot();const b=Hn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Hn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Xn(p,m),Mo(p,v),Yr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new B4),this.sharedNodes.get(u).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:p}=this.options;return p?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:p}=this.options;return p?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let p=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&yp("z",u,g,this.animationValues);for(let v=0;v<vp.length;v++)yp(`rotate${vp[v]}`,u,g,this.animationValues),yp(`skew${vp[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var p,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return z4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Jc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const T={};return this.options.layoutId&&(T.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,T.pointerEvents=Jc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!bi(this.latestValues)&&(T.transform=v?v({},""):"none",this.hasProjected=!1),T}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=L4(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const T in id){if(_[T]===void 0)continue;const{correct:j,applyTo:w}=id[T],C=g.transform==="none"?_[T]:j(_[T],b);if(w){const D=w.length;for(let A=0;A<D;A++)g[w[A]]=C}else g[T]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Jc(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var p;return(p=u.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(Ab),this.root.sharedNodes.clear()}}}function H4(t){t.updateLayout()}function P4(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(_);_.min=r[b].min,_.max=_.min+k}):k1(d,o.layoutBox,r)&&ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(r[b]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=Ao();Yr(p,r,o.layoutBox);const m=Ao();u?Yr(m,t.applyTransform(c,!0),o.measuredBox):Yr(m,r,o.layoutBox);const g=!y1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:k}=b;if(_&&k){const S=Ot();Jr(S,o.layoutBox,_.layoutBox);const T=Ot();Jr(T,r,k.layoutBox),b1(S,T)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=T,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function U4(t){Vr&&_i.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 V4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q4(t){t.clearSnapshot()}function Ab(t){t.clearMeasurements()}function G4(t){t.isLayoutDirty=!1}function F4(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Db(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function K4(t){t.resolveTargetDelta()}function Z4(t){t.calcProjection()}function Y4(t){t.resetSkewAndRotation()}function J4(t){t.removeLeadSnapshot()}function Mb(t,s,o){t.translate=Ct(s.translate,0,o),t.scale=Ct(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Rb(t,s,o,r){t.min=Ct(s.min,o.min,r),t.max=Ct(s.max,o.max,r)}function W4(t,s,o,r){Rb(t.x,s.x,o.x,r),Rb(t.y,s.y,o.y,r)}function X4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Q4={duration:.45,ease:[.4,0,.1,1]},Ib=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ob=Ib("applewebkit/")&&!Ib("chrome/")?Math.round:$n;function Bb(t){t.min=Ob(t.min),t.max=Ob(t.max)}function e3(t){Bb(t.x),Bb(t.y)}function k1(t,s,o){return t==="position"||t==="preserve-aspect"&&!s4(Nb(s),Nb(o),.2)}function t3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const n3=x1({attachResizeListener:(t,s)=>il(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bp={current:void 0},S1=x1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!bp.current){const t=new n3({});t.mount(window),t.setOptions({layoutScroll:!0}),bp.current=t}return bp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),s3={pan:{Feature:b4},drag:{Feature:y4,ProjectionNode:S1,MeasureLayout:h1}};function a3(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 T1(t,s){const o=a3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Lb(t){return s=>{s.pointerType==="touch"||i1()||t(s)}}function i3(t,s,o={}){const[r,c,d]=T1(t,o),u=Lb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Lb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function zb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&St.postRender(()=>d(s,ml(s)))}class o3 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=i3(s,o=>(zb(this.node,o,"Start"),r=>zb(this.node,r,"End"))))}unmount(){}}class r3 extends Ja{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=pl(il(this.node.current,"focus",()=>this.onFocus()),il(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const j1=(t,s)=>s?t===s?!0:j1(t,s.parentElement):!1,l3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function c3(t){return l3.has(t.tagName)||t.tabIndex!==-1}const qr=new WeakSet;function $b(t){return s=>{s.key==="Enter"&&t(s)}}function _p(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const d3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=$b(()=>{if(qr.has(o))return;_p(o,"down");const c=$b(()=>{_p(o,"up")}),d=()=>_p(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 Hb(t){return sh(t)&&!i1()}function u3(t,s,o={}){const[r,c,d]=T1(t,o),u=p=>{const m=p.currentTarget;if(!Hb(p)||qr.has(m))return;qr.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Hb(k)||!qr.has(m))&&(qr.delete(m),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,o.useGlobalTarget||j1(m,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!c3(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>d3(g,c),c)}),d}function Pb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&St.postRender(()=>d(s,ml(s)))}class f3 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=u3(s,o=>(Pb(this.node,o,"Start"),(r,{success:c})=>Pb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const em=new WeakMap,xp=new WeakMap,p3=t=>{const s=em.get(t.target);s&&s(t)},m3=t=>{t.forEach(p3)};function h3({root:t,...s}){const o=t||document;xp.has(o)||xp.set(o,{});const r=xp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(m3,{root:t,...s})),r[c]}function g3(t,s,o){const r=h3(s);return em.set(t,o),r.observe(t),()=>{em.delete(t),r.unobserve(t)}}const v3={some:0,all:1};class y3 extends Ja{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:v3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return g3(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(b3(s,o))&&this.startObserver()}unmount(){}}function b3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const _3={inView:{Feature:y3},tap:{Feature:f3},focus:{Feature:r3},hover:{Feature:o3}},x3={layout:{ProjectionNode:S1,MeasureLayout:h1}},ud={current:null},ah={current:!1};function w1(){if(ah.current=!0,!!Nm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>ud.current=t.matches;t.addListener(s),s()}else ud.current=!1}const k3=[...Kx,hn,Ya],S3=t=>k3.find(Fx(t)),Ub=new WeakMap;function T3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(gn(c))t.addValue(r,c);else if(gn(d))t.addValue(r,sl(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,sl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Vb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class j3{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Qm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=Rs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,St.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=o.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=jd(o),this.isVariantNode=ix(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(o,{},this);for(const k in _){const S=_[k];m[k]!==void 0&&gn(S)&&S.set(m[k],!1)}}mount(s){this.current=s,Ub.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)),ah.current||w1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ud.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ub.delete(this.current),this.projection&&this.projection.unmount(),Za(this.notifyUpdate),Za(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Mi.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&St.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Bo){const o=Bo[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ot()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Vb.length;r++){const c=Vb[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=T3(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=sl(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"&&(qx(c)||Ox(c))?c=parseFloat(c):!S3(c)&&Ya.test(o)&&(c=Px(s,o)),this.setBaseTarget(s,gn(c)?c.get():c)),gn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=Rm(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!gn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new qm),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class N1 extends j3{constructor(){super(...arguments),this.KeyframeResolver=Zx}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;gn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function w3(t){return window.getComputedStyle(t)}class N3 extends N1{constructor(){super(...arguments),this.type="html",this.renderInstance=mx}readValueFromInstance(s,o){if(Mi.has(o)){const r=Xm(o);return r&&r.default||0}else{const r=w3(s),c=(ux(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return p1(s,o)}build(s,o,r){Bm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Hm(s,o,r)}}class C3 extends N1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ot}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Mi.has(o)){const r=Xm(o);return r&&r.default||0}return o=hx.has(o)?o:Am(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return yx(s,o,r)}build(s,o,r){Lm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){gx(s,o,r,c)}mount(s){this.isSVGTag=$m(s.tagName),super.mount(s)}}const E3=(t,s)=>Mm(t)?new C3(s):new N3(s,{allowProjection:t!==y.Fragment}),A3=nM({...KR,..._3,...s3,...x3},E3),$t=vD(A3);function D3(){!ah.current&&w1();const[t]=y.useState(ud.current);return t}const M3="_overlay_cmicx_1",R3="_dialog_cmicx_11",I3="_title_cmicx_30",O3="_description_cmicx_38",B3="_actions_cmicx_45",L3="_cancelButton_cmicx_52",z3="_confirmButton_cmicx_79",vi={overlay:M3,dialog:R3,title:I3,description:O3,actions:B3,cancelButton:L3,confirmButton:z3};function ys({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return i.jsx(as,{children:t&&i.jsx($t.div,{className:vi.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?p:void 0,children:i.jsxs($t.div,{className:vi.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[i.jsx("h3",{id:u,className:vi.title,children:s}),o&&i.jsx("p",{id:p,className:vi.description,children:o}),i.jsxs("div",{className:vi.actions,children:[i.jsx("button",{type:"button",className:vi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:vi.confirmButton,onClick:c,children:r})]})]})})})}const $3="_skeleton_1gqp4_9",H3="_circular_1gqp4_17",P3="_textContainer_1gqp4_26",U3="_card_1gqp4_31",fd={skeleton:$3,circular:H3,textContainer:P3,card:U3};function je({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[fd.skeleton,r==="circular"?fd.circular:"",c??""].filter(Boolean).join(" ");return i.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function tm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${fd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(je,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function nm({lines:t=2,className:s}){return i.jsxs("div",{className:`${fd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(je,{width:"40%",height:"1.25rem"}),i.jsx(tm,{lines:t})]})}const V3="_spinner_1uyt1_1",q3="_spin_1uyt1_1",G3="_sm_1uyt1_14",F3="_md_1uyt1_20",K3="_lg_1uyt1_26",Z3="_xl_1uyt1_32",qb={spinner:V3,spin:q3,sm:G3,md:F3,lg:K3,xl:Z3};function C1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${qb.spinner} ${qb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function Cd(t){return`/${t.replace(/^\//,"")}`}const Y3="_splash_1bn1g_1",J3="_logo_1bn1g_11",Gb={splash:Y3,logo:J3};function E1(){return i.jsxs("div",{className:Gb.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:Cd("grackle-logo.png"),alt:"Grackle",className:Gb.logo}),i.jsx(C1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const W3="_wrapper_4e5yt_1",X3="_wrapperBlock_4e5yt_6",Q3="_tooltip_4e5yt_11",e6="_visible_4e5yt_31",t6="_top_4e5yt_41",n6="_bottom_4e5yt_48",s6="_left_4e5yt_55",a6="_right_4e5yt_62",Lr={wrapper:W3,wrapperBlock:X3,tooltip:Q3,visible:e6,top:t6,bottom:n6,left:s6,right:a6},i6=300,$c=6;function wi({text:t,placement:s="top",delayMs:o=i6,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),k=y.useRef(void 0),S=y.useId(),T=typeof document<"u",j=y.useCallback(()=>{if(!b.current||!_.current)return;const $=b.current.getBoundingClientRect(),Y=_.current.getBoundingClientRect();let V=0,ee=0;switch(s){case"top":V=$.top-Y.height-$c,ee=$.left+$.width/2-Y.width/2;break;case"bottom":V=$.bottom+$c,ee=$.left+$.width/2-Y.width/2;break;case"left":V=$.top+$.height/2-Y.height/2,ee=$.left-Y.width-$c;break;case"right":V=$.top+$.height/2-Y.height/2,ee=$.right+$c;break}v({top:V,left:ee})},[s]),w=y.useCallback($=>{k.current!==void 0&&clearTimeout(k.current),k.current=setTimeout(()=>{j(),m(!0),k.current=void 0},$)},[j]),C=y.useCallback(()=>{w(o)},[o,w]),D=y.useCallback(()=>{w(0)},[w]),A=y.useCallback(()=>{k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const $=Y=>{Y.key==="Escape"&&A()};return document.addEventListener("keydown",$),window.addEventListener("scroll",j,!0),window.addEventListener("resize",j),()=>{document.removeEventListener("keydown",$),window.removeEventListener("scroll",j,!0),window.removeEventListener("resize",j)}},[p,A,j]),y.useEffect(()=>()=>{k.current!==void 0&&clearTimeout(k.current)},[]);const E=r?"span":"div",R=[r?Lr.wrapper:Lr.wrapperBlock,d].filter(Boolean).join(" ");let O=c;if(y.isValidElement(c)){const $=c,Y=$.props["aria-describedby"],V=p?Y?`${Y} ${S}`:S:Y;O=y.cloneElement($,{"aria-describedby":V})}const M=i.jsx("div",{ref:_,id:S,role:"tooltip",className:`${Lr.tooltip} ${Lr[s]} ${p?Lr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:b,className:R,onMouseEnter:C,onMouseLeave:A,onFocus:D,onBlur:A,children:[O,T?N2.createPortal(M,document.body):null]})}const o6="_attemptSelector_ggigl_1",r6="_attemptLabel_ggigl_17",l6="_attemptButton_ggigl_21",c6="_attemptActive_ggigl_38",d6="_attemptStatus_ggigl_44",zr={attemptSelector:o6,attemptLabel:r6,attemptButton:l6,attemptActive:c6,attemptStatus:d6};function u6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:zr.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:zr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return i.jsxs("button",{className:`${zr.attemptButton} ${d?zr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&i.jsx("span",{className:zr.attemptStatus,children:u})]},r.id)})]})}const f6="_row_ldkru_1",p6="_hoverActions_ldkru_5",m6="_hoverButton_ldkru_31",h6="_selectingRow_ldkru_72",g6="_selected_ldkru_83",v6="_checkboxArea_ldkru_90",y6="_checkbox_ldkru_90",b6="_contentArea_ldkru_106",ms={row:f6,hoverActions:p6,hoverButton:m6,selectingRow:h6,selected:g6,checkboxArea:v6,checkbox:y6,contentArea:b6};function _6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=y.useState(!1),b=y.useRef(void 0);y.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const _=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),k=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${ms.row} ${ms.selectingRow} ${r?ms.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:ms.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:ms.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:ms.contentArea,children:m})]}):i.jsxs("div",{className:ms.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:ms.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:ms.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Ci,{size:Ze,"aria-hidden":"true"}):i.jsx(j_,{size:Ze,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:ms.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(Rj,{size:Ze,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:ms.row,children:m})}const x6="_bar_lagql_1",k6="_left_lagql_21",S6="_right_lagql_27",T6="_count_lagql_33",j6="_toggleButton_lagql_40",w6="_copyButton_lagql_68",N6="_forwardButton_lagql_108",C6="_cancelButton_lagql_148",$a={bar:x6,left:k6,right:S6,count:T6,toggleButton:j6,copyButton:w6,forwardButton:N6,cancelButton:C6};function E6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:p}){const m=t>0&&t>=s;return i.jsxs($t.div,{className:$a.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[i.jsxs("div",{className:$a.left,children:[i.jsxs("span",{className:$a.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:$a.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),i.jsxs("div",{className:$a.right,children:[i.jsxs("button",{type:"button",className:$a.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(OT,{size:Ze,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&i.jsx(wi,{text:u?"No active sessions to forward to":"Forward to another session",children:i.jsxs("button",{type:"button",className:$a.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[i.jsx(VT,{size:Ze,"aria-hidden":"true"}),"Forward"]})}),i.jsx("button",{type:"button",className:$a.cancelButton,onClick:p,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Is,{size:Ze,"aria-hidden":"true"})})]})]})}const A6="_overlay_1hra6_1",D6="_dialog_1hra6_11",M6="_header_1hra6_27",R6="_title_1hra6_35",I6="_closeButton_1hra6_42",O6="_filterRow_1hra6_78",B6="_searchIcon_1hra6_86",L6="_filterInput_1hra6_91",z6="_list_1hra6_108",$6="_emptyItem_1hra6_116",H6="_sessionRow_1hra6_123",P6="_sessionMain_1hra6_158",U6="_envName_1hra6_165",V6="_personaName_1hra6_175",q6="_statusBadge_1hra6_189",G6="_status_running_1hra6_198",F6="_status_idle_1hra6_202",K6="_status_other_1hra6_206",Z6="_sessionPrompt_1hra6_211",Y6="_noSessions_1hra6_220",Kt={overlay:A6,dialog:D6,header:M6,title:R6,closeButton:I6,filterRow:O6,searchIcon:B6,filterInput:L6,list:z6,emptyItem:$6,sessionRow:H6,sessionMain:P6,envName:U6,personaName:V6,statusBadge:q6,status_running:G6,status_idle:F6,status_other:K6,sessionPrompt:Z6,noSessions:Y6};function J6(t){return t==="running"?"running":t==="idle"?"idle":t}function W6({isOpen:t,sessions:s,environments:o,personas:r,onSelect:c,onCancel:d}){const[u,p]=y.useState(""),m=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{var T;t&&s.length<=4&&((T=g.current)==null||T.focus())},[t,s.length]);const v=new Map(o.map(T=>[T.id,T.displayName])),b=new Map((r??[]).map(T=>[T.id,T.name])),_=s.map(T=>({session:T,environmentName:v.get(T.environmentId)??T.environmentId})),k=s.length>4,S=u.trim()?_.filter(({session:T,environmentName:j})=>j.toLowerCase().includes(u.toLowerCase())||T.prompt.toLowerCase().includes(u.toLowerCase())):_;return i.jsx(as,{children:t&&i.jsx($t.div,{className:Kt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:T=>{T.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:i.jsxs($t.div,{ref:m,className:Kt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:T=>{T.stopPropagation()},"data-testid":"session-picker-dialog",children:[i.jsxs("div",{className:Kt.header,children:[i.jsx("h3",{className:Kt.title,children:"Forward to session"}),i.jsx("button",{ref:g,type:"button",className:Kt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:i.jsx(Is,{size:Ze,"aria-hidden":"true"})})]}),k&&i.jsxs("div",{className:Kt.filterRow,children:[i.jsx(Rp,{size:Ze,className:Kt.searchIcon,"aria-hidden":"true"}),i.jsx("input",{type:"text",className:Kt.filterInput,placeholder:"Filter sessions...",value:u,onChange:T=>{p(T.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?i.jsxs("div",{className:Kt.noSessions,"data-testid":"session-picker-no-sessions",children:[i.jsx(Rp,{size:zt,"aria-hidden":"true"}),i.jsx("p",{children:"No active sessions to forward to."})]}):i.jsx("ul",{className:Kt.list,"data-testid":"session-picker-list",children:S.length===0?i.jsx("li",{className:Kt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):S.map(({session:T,environmentName:j})=>{const w=T.personaId?b.get(T.personaId)??void 0:void 0;return i.jsx("li",{children:i.jsxs("button",{type:"button",className:Kt.sessionRow,onClick:()=>{c(T.id)},"data-testid":`session-picker-item-${T.id}`,children:[i.jsxs("div",{className:Kt.sessionMain,children:[i.jsx("span",{className:Kt.envName,children:j}),w!==void 0&&i.jsx("span",{className:Kt.personaName,"data-testid":`session-picker-persona-${T.id}`,children:w}),i.jsx("span",{className:`${Kt.statusBadge} ${Kt[`status_${T.status}`]??Kt.status_other}`,"data-testid":`session-picker-status-${T.id}`,children:J6(T.status)})]}),i.jsx("div",{className:Kt.sessionPrompt,children:T.prompt.length>80?`${T.prompt.slice(0,80)}...`:T.prompt})]})},T.id)})})]})})})}const A1=50;function X6(t,s,o,r,c=A1){return r?t<c:s-t-o<c}function Q6(t,s){const o=s-t;return o>0?o:0}function e5({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const k=X6(v.scrollTop,v.scrollHeight,v.clientHeight,o,A1);k!==b&&(b=k,d(k))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const b=Q6(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=o?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const t5=new Set(["text","output","user_input","tool_use","tool_result","error"]);function ol(t){return t5.has(t.eventType)}function n5(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
311
- ${c}`}catch{return t.content}default:return t.content}}function Fb(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 D1(t){var o;const s=[];for(const r of t){if(!ol(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
310
+ `),()=>{document.head.removeChild(v)}},[s]),i.jsx(oD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const lD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Tm(cD),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[o,g]);return y.useMemo(()=>{p.forEach((b,_)=>p.set(_,!1))},[o]),y.useEffect(()=>{!o&&!p.size&&r&&r()},[o]),u==="popLayout"&&(t=i.jsx(rD,{isPresent:o,children:t})),i.jsx(kd.Provider,{value:v,children:t})};function cD(){return new Map}function Q_(t=!0){const s=y.useContext(kd);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const Oc=t=>t.key||"";function Ey(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Nm=typeof window<"u",ex=Nm?y.useLayoutEffect:y.useEffect,as=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=Q_(u),g=y.useMemo(()=>Ey(t),[t]),v=u&&!p?[]:g.map(Oc),b=y.useRef(!0),_=y.useRef(g),k=Tm(()=>new Map),[S,j]=y.useState(g),[T,w]=y.useState(g);ex(()=>{b.current=!1,_.current=g;for(let A=0;A<T.length;A++){const E=Oc(T[A]);v.includes(E)?k.delete(E):k.get(E)!==!0&&k.set(E,!1)}},[T,v.length,v.join("-")]);const C=[];if(g!==S){let A=[...g];for(let E=0;E<T.length;E++){const R=T[E],O=Oc(R);v.includes(O)||(A.splice(E,0,R),C.push(R))}d==="wait"&&C.length&&(A=C),w(Ey(A)),j(g);return}const{forceRender:D}=y.useContext(jm);return i.jsx(i.Fragment,{children:T.map(A=>{const E=Oc(A),R=u&&!p?!1:g===T||v.includes(E),O=()=>{if(k.has(E))k.set(E,!0);else return;let M=!0;k.forEach($=>{$||(M=!1)}),M&&(D==null||D(),w(_.current),u&&(m==null||m()),r&&r())};return i.jsx(lD,{isPresent:R,initial:!b.current||o?void 0:!1,custom:R?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:R?void 0:O,children:A},E)})})},$n=t=>t;let tx=$n;const dD={useManualTiming:!1};function uD(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const k=b&&r?s:o;return v&&d.add(g),k.has(g)||k.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Bc=["read","resolveKeyframes","update","preRender","render","postRender"],fD=40;function nx(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Bc.reduce((w,C)=>(w[C]=uD(d),w),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,k=()=>{const w=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(w-c.timestamp,fD),1),c.timestamp=w,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(k))},S=()=>{o=!0,r=!0,c.isProcessing||t(k)};return{schedule:Bc.reduce((w,C)=>{const D=u[C];return w[C]=(A,E=!1,R=!1)=>(o||S(),D.schedule(A,E,R)),w},{}),cancel:w=>{for(let C=0;C<Bc.length;C++)u[Bc[C]].cancel(w)},state:c,steps:u}}const{schedule:Tt,cancel:Za,state:un,steps:cp}=nx(typeof requestAnimationFrame<"u"?requestAnimationFrame:$n,!0),sx=y.createContext({strict:!1}),Ay={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"]},Lo={};for(const t in Ay)Lo[t]={isEnabled:s=>Ay[t].some(o=>!!s[o])};function pD(t){for(const s in t)Lo[s]={...Lo[s],...t[s]}}const mD=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 ad(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||mD.has(t)}let ax=t=>!ad(t);function hD(t){t&&(ax=s=>s.startsWith("on")?!ad(s):t(s))}try{hD(require("@emotion/is-prop-valid").default)}catch{}function gD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(ax(c)||o===!0&&ad(c)||!s&&!ad(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function vD(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Sd=y.createContext({});function nl(t){return typeof t=="string"||Array.isArray(t)}function jd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Cm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Em=["initial",...Cm];function Td(t){return jd(t.animate)||Em.some(s=>nl(t[s]))}function ix(t){return!!(Td(t)||t.variants)}function yD(t,s){if(Td(t)){const{initial:o,animate:r}=t;return{initial:o===!1||nl(o)?o:void 0,animate:nl(r)?r:void 0}}return t.inherit!==!1?s:{}}function bD(t){const{initial:s,animate:o}=yD(t,y.useContext(Sd));return y.useMemo(()=>({initial:s,animate:o}),[Dy(s),Dy(o)])}function Dy(t){return Array.isArray(t)?t.join(" "):t}const _D=Symbol.for("motionComponentSymbol");function Eo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function xD(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):Eo(o)&&(o.current=r))},[s])}const Am=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),kD="framerAppearId",ox="data-"+Am(kD),{schedule:Dm}=nx(queueMicrotask,!1),rx=y.createContext({});function SD(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Sd),m=y.useContext(sx),g=y.useContext(kd),v=y.useContext(wm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:o,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,k=y.useContext(rx);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&jD(b.current,o,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,g)});const j=o[ox],T=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return ex(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Dm.render(_.render),T.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var w;(w=window.MotionHandoffMarkAsComplete)===null||w===void 0||w.call(window,j)}),T.current=!1))}),_}function jD(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:lx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Eo(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function lx(t){if(t)return t.options.allowProjection!==!1?t.projection:lx(t.parent)}function TD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&pD(t);function p(g,v){let b;const _={...y.useContext(wm),...g,layoutId:wD(g)},{isStatic:k}=_,S=bD(g),j=r(g,k);if(!k&&Nm){ND();const T=CD(_);b=T.MeasureLayout,S.visualElement=SD(c,j,_,s,T.ProjectionNode)}return i.jsxs(Sd.Provider,{value:S,children:[b&&S.visualElement?i.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,g,xD(j,S.visualElement,v),j,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=y.forwardRef(p);return m[_D]=c,m}function wD({layoutId:t}){const s=y.useContext(jm).id;return s&&t!==void 0?s+"-"+t:t}function ND(t,s){y.useContext(sx).strict}function CD(t){const{drag:s,layout:o}=Lo;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 ED=["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 Mm(t){return typeof t!="string"||t.includes("-")?!1:!!(ED.indexOf(t)>-1||/[A-Z]/u.test(t))}function My(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Rm(t,s,o,r){if(typeof s=="function"){const[c,d]=My(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]=My(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Hp=t=>Array.isArray(t),AD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),DD=t=>Hp(t)?t[t.length-1]||0:t,hn=t=>!!(t&&t.getVelocity);function Jc(t){const s=hn(t)?t.get():t;return AD(s)?s.toValue():s}function MD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:RD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const cx=t=>(s,o)=>{const r=y.useContext(Sd),c=y.useContext(kd),d=()=>MD(t,s,r,c);return o?d():Tm(d)};function RD(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=Jc(d[_]);let{initial:u,animate:p}=t;const m=Td(t),g=ix(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!jd(b)){const _=Array.isArray(b)?b:[b];for(let k=0;k<_.length;k++){const S=Rm(t,_[k]);if(S){const{transitionEnd:j,transition:T,...w}=S;for(const C in w){let D=w[C];if(Array.isArray(D)){const A=v?D.length-1:0;D=D[A]}D!==null&&(c[C]=D)}for(const C in j)c[C]=j[C]}}}return c}const Vo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Mi=new Set(Vo),dx=t=>s=>typeof s=="string"&&s.startsWith(t),ux=dx("--"),ID=dx("var(--"),Im=t=>ID(t)?OD.test(t.split("/*")[0].trim()):!1,OD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,fx=(t,s)=>s&&typeof t=="number"?s.transform(t):t,da=(t,s,o)=>o>s?s:o<t?t:o,qo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},sl={...qo,transform:t=>da(0,1,t)},Lc={...qo,default:1},fl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ga=fl("deg"),Rs=fl("%"),Ae=fl("px"),BD=fl("vh"),LD=fl("vw"),Ry={...Rs,parse:t=>Rs.parse(t)/100,transform:t=>Rs.transform(t*100)},zD={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,radius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae},$D={rotate:Ga,rotateX:Ga,rotateY:Ga,rotateZ:Ga,scale:Lc,scaleX:Lc,scaleY:Lc,scaleZ:Lc,skew:Ga,skewX:Ga,skewY:Ga,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:sl,originX:Ry,originY:Ry,originZ:Ae},Iy={...qo,transform:Math.round},Om={...zD,...$D,zIndex:Iy,size:Ae,fillOpacity:sl,strokeOpacity:sl,numOctaves:Iy},HD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},PD=Vo.length;function UD(t,s,o){let r="",c=!0;for(let d=0;d<PD;d++){const u=Vo[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||o){const g=fx(p,Om[u]);if(!m){c=!1;const v=HD[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Bm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Mi.has(m)){u=!0;continue}else if(ux(m)){c[m]=g;continue}else{const v=fx(g,Om[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=UD(s,t.transform,o):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const VD={offset:"stroke-dashoffset",array:"stroke-dasharray"},qD={offset:"strokeDashoffset",array:"strokeDasharray"};function GD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?VD:qD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function Oy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function FD(t,s,o){const r=Oy(s,t.x,t.width),c=Oy(o,t.y,t.height);return`${r} ${c}`}function Lm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Bm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:k,dimensions:S}=t;_.transform&&(S&&(k.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=FD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),o!==void 0&&(_.y=o),r!==void 0&&(_.scale=r),u!==void 0&&GD(_,u,p,m,!1)}const zm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),px=()=>({...zm(),attrs:{}}),$m=t=>typeof t=="string"&&t.toLowerCase()==="svg";function mx(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 hx=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 gx(t,s,o,r){mx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(hx.has(c)?c:Am(c),s.attrs[c])}const id={};function KD(t){Object.assign(id,t)}function vx(t,{layout:s,layoutId:o}){return Mi.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!id[t]||t==="opacity")}function Hm(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(hn(c[u])||s.style&&hn(s.style[u])||vx(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 yx(t,s,o){const r=Hm(t,s,o);for(const c in t)if(hn(t[c])||hn(s[c])){const d=Vo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function ZD(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 By=["x","y","width","height","cx","cy","r"],YD={useVisualState:cx({scrapeMotionValuesFromProps:yx,createRenderState:px,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Mi.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<By.length;p++){const m=By[p];t[m]!==s[m]&&(u=!0)}u&&Tt.read(()=>{ZD(o,r),Tt.render(()=>{Lm(r,c,$m(o.tagName),t.transformTemplate),gx(o,r)})})}})},JD={useVisualState:cx({scrapeMotionValuesFromProps:Hm,createRenderState:zm})};function bx(t,s,o){for(const r in s)!hn(s[r])&&!vx(r,o)&&(t[r]=s[r])}function WD({transformTemplate:t},s){return y.useMemo(()=>{const o=zm();return Bm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function XD(t,s){const o=t.style||{},r={};return bx(r,o,t),Object.assign(r,WD(t,s)),r}function QD(t,s){const o={},r=XD(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 eM(t,s,o,r){const c=y.useMemo(()=>{const d=px();return Lm(d,s,$m(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};bx(d,t.style,t),c.style={...d,...c.style}}return c}function tM(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Mm(o)?eM:QD)(r,d,u,o),g=gD(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>hn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:_})}}function nM(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Mm(r)?YD:JD,preloadedFeatures:t,useRender:tM(c),createVisualElement:s,Component:r};return TD(u)}}function _x(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 wd(t,s,o){const r=t.getProps();return Rm(r,s,o!==void 0?o:r.custom,t)}function Pm(t,s){return t?t[s]||t.default||t:void 0}const xx=new Set(["width","height","top","left","right","bottom",...Vo]);let Wc;function sM(){Wc=void 0}const Is={now:()=>(Wc===void 0&&Is.set(un.isProcessing||dD.useManualTiming?un.timestamp:performance.now()),Wc),set:t=>{Wc=t,queueMicrotask(sM)}};function Um(t,s){t.indexOf(s)===-1&&t.push(s)}function Vm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class qm{constructor(){this.subscriptions=[]}add(s){return Um(this.subscriptions,s),()=>Vm(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 kx(t,s){return s?t*(1e3/s):0}const Ly=30,aM=t=>!isNaN(parseFloat(t));class iM{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Is.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=Is.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=aM(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 qm);const r=this.events[s].add(o);return s==="change"?()=>{r(),Tt.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=Is.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Ly)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Ly);return kx(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 al(t,s){return new iM(t,s)}function oM(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,al(o))}function rM(t,s){const o=wd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=DD(d[u]);oM(t,u,p)}}function lM(t){return!!(hn(t)&&t.add)}function Pp(t,s){const o=t.getValue("willChange");if(lM(o))return o.add(s)}function Sx(t){return t.props[ox]}function Gm(t){let s;return()=>(s===void 0&&(s=t()),s)}const cM=Gm(()=>window.ScrollTimeline!==void 0);class dM{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(cM()&&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 uM extends dM{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const oa=t=>t*1e3,ra=t=>t/1e3;function Fm(t){return typeof t=="function"}function zy(t,s){t.timeline=s,t.onfinish=null}const Km=t=>Array.isArray(t)&&typeof t[0]=="number",fM={linearEasing:void 0};function pM(t,s){const o=Gm(t);return()=>{var r;return(r=fM[s])!==null&&r!==void 0?r:o()}}const od=pM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),zo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},jx=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(zo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function Tx(t){return!!(typeof t=="function"&&od()||!t||typeof t=="string"&&(t in Up||od())||Km(t)||Array.isArray(t)&&t.every(Tx))}const Vr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Up={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Vr([0,.65,.55,1]),circOut:Vr([.55,0,1,.45]),backIn:Vr([.31,.01,.66,-.59]),backOut:Vr([.33,1.53,.69,.99])};function wx(t,s){if(t)return typeof t=="function"&&od()?jx(t,s):Km(t)?Vr(t):Array.isArray(t)?t.map(o=>wx(o,s)||Up.easeOut):Up[t]}const Nx=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,mM=1e-7,hM=12;function gM(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=Nx(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>mM&&++p<hM);return u}function pl(t,s,o,r){if(t===s&&o===r)return $n;const c=d=>gM(d,0,1,t,o);return d=>d===0||d===1?d:Nx(c(d),s,r)}const Cx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,Ex=t=>s=>1-t(1-s),Ax=pl(.33,1.53,.69,.99),Zm=Ex(Ax),Dx=Cx(Zm),Mx=t=>(t*=2)<1?.5*Zm(t):.5*(2-Math.pow(2,-10*(t-1))),Ym=t=>1-Math.sin(Math.acos(t)),Rx=Ex(Ym),Ix=Cx(Ym),Ox=t=>/^0[^.\s]+$/u.test(t);function vM(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Ox(t):!0}const Zr=t=>Math.round(t*1e5)/1e5,Jm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function yM(t){return t==null}const bM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Wm=(t,s)=>o=>!!(typeof o=="string"&&bM.test(o)&&o.startsWith(t)||s&&!yM(o)&&Object.prototype.hasOwnProperty.call(o,s)),Bx=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Jm);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},_M=t=>da(0,255,t),dp={...qo,transform:t=>Math.round(_M(t))},xi={test:Wm("rgb","red"),parse:Bx("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+dp.transform(t)+", "+dp.transform(s)+", "+dp.transform(o)+", "+Zr(sl.transform(r))+")"};function xM(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 Vp={test:Wm("#"),parse:xM,transform:xi.transform},Ao={test:Wm("hsl","hue"),parse:Bx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Rs.transform(Zr(s))+", "+Rs.transform(Zr(o))+", "+Zr(sl.transform(r))+")"},mn={test:t=>xi.test(t)||Vp.test(t)||Ao.test(t),parse:t=>xi.test(t)?xi.parse(t):Ao.test(t)?Ao.parse(t):Vp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?xi.transform(t):Ao.transform(t)},kM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function SM(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Jm))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(kM))===null||o===void 0?void 0:o.length)||0)>0}const Lx="number",zx="color",jM="var",TM="var(",$y="${}",wM=/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 il(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(wM,m=>(mn.test(m)?(r.color.push(d),c.push(zx),o.push(mn.parse(m))):m.startsWith(TM)?(r.var.push(d),c.push(jM),o.push(m)):(r.number.push(d),c.push(Lx),o.push(parseFloat(m))),++d,$y)).split($y);return{values:o,split:p,indexes:r,types:c}}function $x(t){return il(t).values}function Hx(t){const{split:s,types:o}=il(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=o[u];p===Lx?d+=Zr(c[u]):p===zx?d+=mn.transform(c[u]):d+=c[u]}return d}}const NM=t=>typeof t=="number"?0:t;function CM(t){const s=$x(t);return Hx(t)(s.map(NM))}const Ya={test:SM,parse:$x,createTransformer:Hx,getAnimatableNone:CM},EM=new Set(["brightness","contrast","saturate","opacity"]);function AM(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(Jm)||[];if(!r)return t;const c=o.replace(r,"");let d=EM.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const DM=/\b([a-z-]*)\(.*?\)/gu,qp={...Ya,getAnimatableNone:t=>{const s=t.match(DM);return s?s.map(AM).join(" "):t}},MM={...Om,color:mn,backgroundColor:mn,outlineColor:mn,fill:mn,stroke:mn,borderColor:mn,borderTopColor:mn,borderRightColor:mn,borderBottomColor:mn,borderLeftColor:mn,filter:qp,WebkitFilter:qp},Xm=t=>MM[t];function Px(t,s){let o=Xm(t);return o!==qp&&(o=Ya),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const RM=new Set(["auto","none","0"]);function IM(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!RM.has(d)&&il(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=Px(o,c)}const Hy=t=>t===qo||t===Ae,Py=(t,s)=>parseFloat(t.split(", ")[s]),Uy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Py(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Py(d[1],t):0}},OM=new Set(["x","y","z"]),BM=Vo.filter(t=>!OM.has(t));function LM(t){const s=[];return BM.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const $o={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:Uy(4,13),y:Uy(5,14)};$o.translateX=$o.x;$o.translateY=$o.y;const Si=new Set;let Gp=!1,Fp=!1;function Ux(){if(Fp){const t=Array.from(Si).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=LM(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fp=!1,Gp=!1,Si.forEach(t=>t.complete()),Si.clear()}function Vx(){Si.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Fp=!0)})}function zM(){Vx(),Ux()}class Qm{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?(Si.add(this),Gp||(Gp=!0,Tt.read(Vx),Tt.resolveKeyframes(Ux))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Si.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Si.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const qx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),$M=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function HM(t){const s=$M.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function Gx(t,s,o=1){const[r,c]=HM(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return qx(u)?parseFloat(u):u}return Im(c)?Gx(c,s,o+1):c}const Fx=t=>s=>s.test(t),PM={test:t=>t==="auto",parse:t=>t},Kx=[qo,Ae,Rs,Ga,LD,BD,PM],Vy=t=>Kx.find(Fx(t));class Zx extends Qm{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),Im(g))){const v=Gx(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!xx.has(r)||s.length!==2)return;const[c,d]=s,u=Vy(c),p=Vy(d);if(u!==p)if(Hy(u)&&Hy(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)vM(s[c])&&r.push(c);r.length&&IM(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=$o[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=$o[r](o.measureViewportBox(),window.getComputedStyle(o.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{o.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const qy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ya.test(t)||t==="0")&&!t.startsWith("url("));function UM(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 VM(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=qy(c,s),p=qy(d,s);return!u||!p?!1:UM(t)||(o==="spring"||Fm(o))&&r}const qM=t=>t!==null;function Nd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(qM),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const GM=40;class Yx{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Is.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>GM?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&zM(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Is.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!VM(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Nd(s,this.options,o)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const Kp=2e4;function Jx(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<Kp;)s+=o,r=t.next(s);return s>=Kp?1/0:s}const Et=(t,s,o)=>t+(s-t)*o;function up(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 FM({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const p=o<.5?o*(1+s):o+s-o*s,m=2*o-p;c=up(m,p,t+1/3),d=up(m,p,t),u=up(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function rd(t,s){return o=>o>0?s:t}const fp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},KM=[Vp,xi,Ao],ZM=t=>KM.find(s=>s.test(t));function Gy(t){const s=ZM(t);if(!s)return!1;let o=s.parse(t);return s===Ao&&(o=FM(o)),o}const Fy=(t,s)=>{const o=Gy(t),r=Gy(s);if(!o||!r)return rd(t,s);const c={...o};return d=>(c.red=fp(o.red,r.red,d),c.green=fp(o.green,r.green,d),c.blue=fp(o.blue,r.blue,d),c.alpha=Et(o.alpha,r.alpha,d),xi.transform(c))},YM=(t,s)=>o=>s(t(o)),ml=(...t)=>t.reduce(YM),Zp=new Set(["none","hidden"]);function JM(t,s){return Zp.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function WM(t,s){return o=>Et(t,s,o)}function eh(t){return typeof t=="number"?WM:typeof t=="string"?Im(t)?rd:mn.test(t)?Fy:eR:Array.isArray(t)?Wx:typeof t=="object"?mn.test(t)?Fy:XM:rd}function Wx(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>eh(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function XM(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=eh(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function QM(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(o=t.values[p])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const eR=(t,s)=>{const o=Ya.createTransformer(s),r=il(t),c=il(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?Zp.has(t)&&!c.values.length||Zp.has(s)&&!r.values.length?JM(t,s):ml(Wx(QM(r,c),c.values),o):rd(t,s)};function Xx(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Et(t,s,o):eh(t)(t,s)}const tR=5;function Qx(t,s,o){const r=Math.max(s-tR,0);return kx(o-t(r),s-r)}const Rt={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},pp=.001;function nR({duration:t=Rt.duration,bounce:s=Rt.bounce,velocity:o=Rt.velocity,mass:r=Rt.mass}){let c,d,u=1-s;u=da(Rt.minDamping,Rt.maxDamping,u),t=da(Rt.minDuration,Rt.maxDuration,ra(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-o,k=Yp(g,u),S=Math.exp(-b);return pp-_/k*S},d=g=>{const b=g*u*t,_=b*o+o,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-b),j=Yp(Math.pow(g,2),u);return(-c(g)+pp>0?-1:1)*((_-k)*S)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-pp+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=aR(c,d,p);if(t=oa(t),isNaN(m))return{stiffness:Rt.stiffness,damping:Rt.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const sR=12;function aR(t,s,o){let r=o;for(let c=1;c<sR;c++)r=r-t(r)/s(r);return r}function Yp(t,s){return t*Math.sqrt(1-s*s)}const iR=["duration","bounce"],oR=["stiffness","damping","mass"];function Ky(t,s){return s.some(o=>t[o]!==void 0)}function rR(t){let s={velocity:Rt.velocity,stiffness:Rt.stiffness,damping:Rt.damping,mass:Rt.mass,isResolvedFromDuration:!1,...t};if(!Ky(t,oR)&&Ky(t,iR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*da(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Rt.mass,stiffness:c,damping:d}}else{const o=nR(t);s={...s,...o,mass:Rt.mass},s.isResolvedFromDuration=!0}return s}function e1(t=Rt.visualDuration,s=Rt.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:k}=rR({...o,velocity:-ra(o.velocity||0)}),S=_||0,j=g/(2*Math.sqrt(m*v)),T=u-d,w=ra(Math.sqrt(m/v)),C=Math.abs(T)<5;r||(r=C?Rt.restSpeed.granular:Rt.restSpeed.default),c||(c=C?Rt.restDelta.granular:Rt.restDelta.default);let D;if(j<1){const E=Yp(w,j);D=R=>{const O=Math.exp(-j*w*R);return u-O*((S+j*w*T)/E*Math.sin(E*R)+T*Math.cos(E*R))}}else if(j===1)D=E=>u-Math.exp(-w*E)*(T+(S+w*T)*E);else{const E=w*Math.sqrt(j*j-1);D=R=>{const O=Math.exp(-j*w*R),M=Math.min(E*R,300);return u-O*((S+j*w*T)*Math.sinh(M)+E*T*Math.cosh(M))/E}}const A={calculatedDuration:k&&b||null,next:E=>{const R=D(E);if(k)p.done=E>=b;else{let O=0;j<1&&(O=E===0?oa(S):Qx(D,E,R));const M=Math.abs(O)<=r,$=Math.abs(u-R)<=c;p.done=M&&$}return p.value=p.done?u:R,p},toString:()=>{const E=Math.min(Jx(A),Kp),R=jx(O=>A.next(E*O).value,E,30);return E+"ms "+R}};return A}function Zy({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},k=M=>p!==void 0&&M<p||m!==void 0&&M>m,S=M=>p===void 0?m:m===void 0||Math.abs(p-M)<Math.abs(m-M)?p:m;let j=o*s;const T=b+j,w=u===void 0?T:u(T);w!==T&&(j=w-b);const C=M=>-j*Math.exp(-M/r),D=M=>w+C(M),A=M=>{const $=C(M),Y=D(M);_.done=Math.abs($)<=g,_.value=_.done?w:Y};let E,R;const O=M=>{k(_.value)&&(E=M,R=e1({keyframes:[_.value,S(_.value)],velocity:Qx(D,M,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:M=>{let $=!1;return!R&&E===void 0&&($=!0,A(M),O(M)),E!==void 0&&M>=E?R.next(M-E):(!$&&A(M),_)}}}const lR=pl(.42,0,1,1),cR=pl(0,0,.58,1),t1=pl(.42,0,.58,1),dR=t=>Array.isArray(t)&&typeof t[0]!="number",uR={linear:$n,easeIn:lR,easeInOut:t1,easeOut:cR,circIn:Ym,circInOut:Ix,circOut:Rx,backIn:Zm,backInOut:Dx,backOut:Ax,anticipate:Mx},Yy=t=>{if(Km(t)){tx(t.length===4);const[s,o,r,c]=t;return pl(s,o,r,c)}else if(typeof t=="string")return uR[t];return t};function fR(t,s,o){const r=[],c=o||Xx,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||$n:s;p=ml(m,p)}r.push(p)}return r}function pR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(tx(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=fR(s,r,c),m=p.length,g=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const _=zo(t[b],t[b+1],v);return p[b](_)};return o?v=>g(da(t[0],t[d-1],v)):g}function mR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=zo(0,s,r);t.push(Et(o,1,c))}}function hR(t){const s=[0];return mR(s,t.length-1),s}function gR(t,s){return t.map(o=>o*s)}function vR(t,s){return t.map(()=>s||t1).splice(0,t.length-1)}function ld({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=dR(r)?r.map(Yy):Yy(r),d={done:!1,value:s[0]},u=gR(o&&o.length===s.length?o:hR(s),t),p=pR(u,s,{ease:Array.isArray(c)?c:vR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const yR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>Tt.update(s,!0),stop:()=>Za(s),now:()=>un.isProcessing?un.timestamp:Is.now()}},bR={decay:Zy,inertia:Zy,tween:ld,keyframes:ld,spring:e1},_R=t=>t/100;class th extends Yx{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||Qm,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Fm(o)?o:bR[o]||ld;let m,g;p!==ld&&typeof s[0]!="number"&&(m=ml(_R,Xx(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});d==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=Jx(v));const{calculatedDuration:b}=v,_=b+c,k=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:k,repeatType:S,repeatDelay:j,onUpdate:T}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const w=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?w<0:w>v;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,A=d;if(k){const M=Math.min(this.currentTime,v)/b;let $=Math.floor(M),Y=M%1;!Y&&M>=1&&(Y=1),Y===1&&$--,$=Math.min($,k+1),!!($%2)&&(S==="reverse"?(Y=1-Y,j&&(Y-=j/b)):S==="mirror"&&(A=u)),D=da(0,1,Y)*b}const E=C?{done:!1,value:m[0]}:A.next(D);p&&(E.value=p(E.value));let{done:R}=E;!C&&g!==null&&(R=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return O&&c!==void 0&&(E.value=Nd(m,this.options,c)),T&&T(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?ra(s.calculatedDuration):0}get time(){return ra(this.currentTime)}set time(s){s=oa(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=ra(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=yR,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 xR=new Set(["opacity","clipPath","filter","transform"]);function kR(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:o};m&&(g.offset=m);const v=wx(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const SR=Gm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),cd=10,jR=2e4;function TR(t){return Fm(t.type)||t.type==="spring"||!Tx(t.ease)}function wR(t,s){const o=new th({...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<jR;)r=o.sample(d),c.push(r.value),d+=cd;return{times:void 0,keyframes:c,duration:d-cd,ease:"linear"}}const n1={anticipate:Mx,backInOut:Dx,circInOut:Ix};function NR(t){return t in n1}class Jy extends Yx{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Zx(d,(u,p)=>this.onKeyframesResolved(u,p),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&od()&&NR(d)&&(d=n1[d]),TR(this.options)){const{onComplete:b,onUpdate:_,motionValue:k,element:S,...j}=this.options,T=wR(s,j);s=T.keyframes,s.length===1&&(s[1]=s[0]),r=T.duration,c=T.times,d=T.ease,u="keyframes"}const v=kR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(zy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Nd(s,this.options,o)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return ra(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return ra(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=oa(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return $n;const{animation:r}=o;zy(r,s)}return $n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...k}=this.options,S=new th({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=oa(this.time);g.setWithVelocity(S.sample(j-cd).value,S.sample(j).value,cd)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=o.owner.getProps();return SR()&&r&&xR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const CR={type:"spring",stiffness:500,damping:25,restSpeed:10},ER=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),AR={type:"keyframes",duration:.8},DR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},MR=(t,{keyframes:s})=>s.length>2?AR:Mi.has(t)?t.startsWith("scale")?ER(s[1]):CR:DR;function RR({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const nh=(t,s,o,r={},c,d)=>u=>{const p=Pm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-oa(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};RR(p)||(v={...v,...MR(t,v)}),v.duration&&(v.duration=oa(v.duration)),v.repeatDelay&&(v.repeatDelay=oa(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const _=Nd(v.keyframes,p);if(_!==void 0)return Tt.update(()=>{v.onUpdate(_),v.onComplete()}),new uM([])}return!d&&Jy.supports(v)?new Jy(v):new th(v)};function IR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function s1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),k=m[b];if(k===void 0||v&&IR(v,b))continue;const S={delay:o,...Pm(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const w=Sx(t);if(w){const C=window.MotionHandoffAnimation(w,b,Tt);C!==null&&(S.startTime=C,j=!0)}}Pp(t,b),_.start(nh(b,_,k,t.shouldReduceMotion&&xx.has(b)?{type:!1}:S,t,j));const T=_.animation;T&&g.push(T)}return p&&Promise.all(g).then(()=>{Tt.update(()=>{p&&rM(t,p)})}),g}function Jp(t,s,o={}){var r;const c=wd(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(s1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return OR(t,s,v+g,b,_,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(o.delay)])}function OR(t,s,o=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(BR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Jp(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function BR(t,s){return t.sortNodePosition(s)}function LR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Jp(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=Jp(t,s,o);else{const c=typeof s=="function"?wd(t,s,o.custom):s;r=Promise.all(s1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const zR=Em.length;function a1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?a1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<zR;o++){const r=Em[o],c=t.props[r];(nl(c)||c===!1)&&(s[r]=c)}return s}const $R=[...Cm].reverse(),HR=Cm.length;function PR(t){return s=>Promise.all(s.map(({animation:o,options:r})=>LR(t,o,r)))}function UR(t){let s=PR(t),o=Wy(),r=!0;const c=m=>(g,v)=>{var b;const _=wd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:k,transitionEnd:S,...j}=_;g={...g,...j,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=a1(t.parent)||{},b=[],_=new Set;let k={},S=1/0;for(let T=0;T<HR;T++){const w=$R[T],C=o[w],D=g[w]!==void 0?g[w]:v[w],A=nl(D),E=w===m?C.isActive:null;E===!1&&(S=T);let R=D===v[w]&&D!==g[w]&&A;if(R&&r&&t.manuallyAnimateOnMount&&(R=!1),C.protectedKeys={...k},!C.isActive&&E===null||!D&&!C.prevProp||jd(D)||typeof D=="boolean")continue;const O=VR(C.prevProp,D);let M=O||w===m&&C.isActive&&!R&&A||T>S&&A,$=!1;const Y=Array.isArray(D)?D:[D];let V=Y.reduce(c(w),{});E===!1&&(V={});const{prevResolvedValues:ne={}}=C,le={...ne,...V},Z=B=>{M=!0,_.has(B)&&($=!0,_.delete(B)),C.needsAnimating[B]=!0;const F=t.getValue(B);F&&(F.liveStyle=!1)};for(const B in le){const F=V[B],ge=ne[B];if(k.hasOwnProperty(B))continue;let ee=!1;Hp(F)&&Hp(ge)?ee=!_x(F,ge):ee=F!==ge,ee?F!=null?Z(B):_.add(B):F!==void 0&&_.has(B)?Z(B):C.protectedKeys[B]=!0}C.prevProp=D,C.prevResolvedValues=V,C.isActive&&(k={...k,...V}),r&&t.blockInitialAnimation&&(M=!1),M&&(!(R&&O)||$)&&b.push(...Y.map(B=>({animation:B,options:{type:w}})))}if(_.size){const T={};_.forEach(w=>{const C=t.getBaseTarget(w),D=t.getValue(w);D&&(D.liveStyle=!0),T[w]=C??null}),b.push({animation:T})}let j=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(b):Promise.resolve()}function p(m,g){var v;if(o[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var k;return(k=_.animationState)===null||k===void 0?void 0:k.setActive(m,g)}),o[m].isActive=g;const b=u(m);for(const _ in o)o[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>o,reset:()=>{o=Wy(),r=!0}}}function VR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!_x(s,t):!1}function gi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Wy(){return{animate:gi(!0),whileInView:gi(),whileHover:gi(),whileTap:gi(),whileDrag:gi(),whileFocus:gi(),exit:gi()}}class Ja{constructor(s){this.isMounted=!1,this.node=s}update(){}}class qR extends Ja{constructor(s){super(s),s.animationState||(s.animationState=UR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();jd(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 GR=0;class FR extends Ja{constructor(){super(...arguments),this.id=GR++}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 KR={animation:{Feature:qR},exit:{Feature:FR}},gs={x:!1,y:!1};function i1(){return gs.x||gs.y}function ZR(t){return t==="x"||t==="y"?gs[t]?null:(gs[t]=!0,()=>{gs[t]=!1}):gs.x||gs.y?null:(gs.x=gs.y=!0,()=>{gs.x=gs.y=!1})}const sh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ol(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function hl(t){return{point:{x:t.pageX,y:t.pageY}}}const YR=t=>s=>sh(s)&&t(s,hl(s));function Yr(t,s,o,r){return ol(t,s,YR(o),r)}const Xy=(t,s)=>Math.abs(t-s);function JR(t,s){const o=Xy(t.x,s.x),r=Xy(t.y,s.y);return Math.sqrt(o**2+r**2)}class o1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=hp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=JR(b.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=b,{timestamp:j}=un;this.history.push({...S,timestamp:j});const{onStart:T,onMove:w}=this.handlers;_||(T&&T(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=mp(_,this.transformPagePoint),Tt.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=hp(b.type==="pointercancel"?this.lastMoveEventInfo:mp(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,T),S&&S(b,T)},!sh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=hl(s),p=mp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=un;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,hp(p,this.history)),this.removeListeners=ml(Yr(this.contextWindow,"pointermove",this.handlePointerMove),Yr(this.contextWindow,"pointerup",this.handlePointerUp),Yr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Za(this.updatePoint)}}function mp(t,s){return s?{point:s(t.point)}:t}function Qy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function hp({point:t},s){return{point:t,delta:Qy(t,r1(s)),offset:Qy(t,WR(s)),velocity:XR(s,.1)}}function WR(t){return t[0]}function r1(t){return t[t.length-1]}function XR(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=r1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>oa(s)));)o--;if(!r)return{x:0,y:0};const d=ra(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 l1=1e-4,QR=1-l1,e4=1+l1,c1=.01,t4=0-c1,n4=0+c1;function Hn(t){return t.max-t.min}function s4(t,s,o){return Math.abs(t-s)<=o}function eb(t,s,o,r=.5){t.origin=r,t.originPoint=Et(s.min,s.max,t.origin),t.scale=Hn(o)/Hn(s),t.translate=Et(o.min,o.max,t.origin)-t.originPoint,(t.scale>=QR&&t.scale<=e4||isNaN(t.scale))&&(t.scale=1),(t.translate>=t4&&t.translate<=n4||isNaN(t.translate))&&(t.translate=0)}function Jr(t,s,o,r){eb(t.x,s.x,o.x,r?r.originX:void 0),eb(t.y,s.y,o.y,r?r.originY:void 0)}function tb(t,s,o){t.min=o.min+s.min,t.max=t.min+Hn(s)}function a4(t,s,o){tb(t.x,s.x,o.x),tb(t.y,s.y,o.y)}function nb(t,s,o){t.min=s.min-o.min,t.max=t.min+Hn(s)}function Wr(t,s,o){nb(t.x,s.x,o.x),nb(t.y,s.y,o.y)}function i4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Et(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Et(o,t,r.max):Math.min(t,o)),t}function sb(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 o4(t,{top:s,left:o,bottom:r,right:c}){return{x:sb(t.x,o,c),y:sb(t.y,s,r)}}function ab(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 r4(t,s){return{x:ab(t.x,s.x),y:ab(t.y,s.y)}}function l4(t,s){let o=.5;const r=Hn(t),c=Hn(s);return c>r?o=zo(s.min,s.max-r,t.min):r>c&&(o=zo(t.min,t.max-c,s.min)),da(0,1,o)}function c4(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 Wp=.35;function d4(t=Wp){return t===!1?t=0:t===!0&&(t=Wp),{x:ib(t,"left","right"),y:ib(t,"top","bottom")}}function ib(t,s,o){return{min:ob(t,s),max:ob(t,o)}}function ob(t,s){return typeof t=="number"?t:t[s]||0}const rb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Do=()=>({x:rb(),y:rb()}),lb=()=>({min:0,max:0}),Bt=()=>({x:lb(),y:lb()});function ss(t){return[t("x"),t("y")]}function d1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function u4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function f4(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 gp(t){return t===void 0||t===1}function Xp({scale:t,scaleX:s,scaleY:o}){return!gp(t)||!gp(s)||!gp(o)}function bi(t){return Xp(t)||u1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function u1(t){return cb(t.x)||cb(t.y)}function cb(t){return t&&t!=="0%"}function dd(t,s,o){const r=t-o,c=s*r;return o+c}function db(t,s,o,r,c){return c!==void 0&&(t=dd(t,c,r)),dd(t,o,r)+s}function Qp(t,s=0,o=1,r,c){t.min=db(t.min,s,o,r,c),t.max=db(t.max,s,o,r,c)}function f1(t,{x:s,y:o}){Qp(t.x,s.translate,s.scale,s.originPoint),Qp(t.y,o.translate,o.scale,o.originPoint)}const ub=.999999999999,fb=1.0000000000001;function p4(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=o[p],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Ro(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,f1(t,u)),r&&bi(d.latestValues)&&Ro(t,d.latestValues))}s.x<fb&&s.x>ub&&(s.x=1),s.y<fb&&s.y>ub&&(s.y=1)}function Mo(t,s){t.min=t.min+s,t.max=t.max+s}function pb(t,s,o,r,c=.5){const d=Et(t.min,t.max,c);Qp(t,s,o,d,r)}function Ro(t,s){pb(t.x,s.x,s.scaleX,s.scale,s.originX),pb(t.y,s.y,s.scaleY,s.scale,s.originY)}function p1(t,s){return d1(f4(t.getBoundingClientRect(),s))}function m4(t,s,o){const r=p1(t,o),{scroll:c}=s;return c&&(Mo(r.x,c.offset.x),Mo(r.y,c.offset.y)),r}const m1=({current:t})=>t?t.ownerDocument.defaultView:null,h4=new WeakMap;class g4{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=Bt(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(hl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ZR(_),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ss(T=>{let w=this.getAxisMotionValue(T).get()||0;if(Rs.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[T];D&&(w=Hn(D)*(parseFloat(w)/100))}}this.originPoint[T]=w}),S&&Tt.postRender(()=>S(v,b)),Pp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:k,onDirectionLock:S,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=b;if(k&&this.currentDirection===null){this.currentDirection=v4(T),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,T),this.updateAxis("y",b.point,T),this.visualElement.render(),j&&j(v,b)},p=(v,b)=>this.stop(v,b),m=()=>ss(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new o1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:m1(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&&Tt.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=i4(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&&Eo(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=o4(c.layoutBox,o):this.constraints=!1,this.elastic=d4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&ss(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=c4(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Eo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=m4(r,c.root,this.visualElement.getTransformPagePoint());let u=r4(c.layout.layoutBox,d);if(o){const p=o(u4(u));this.hasMutatedConstraints=!!p,p&&(u=d1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=ss(v=>{if(!zc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Pp(this.visualElement,s),r.start(nh(s,r,0,o,this.visualElement,!1))}stopAnimation(){ss(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){ss(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){ss(o=>{const{drag:r}=this.getProps();if(!zc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[o];d.set(s[o]-Et(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Eo(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};ss(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=l4({min:m,max:m},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ss(u=>{if(!zc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Et(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;h4.set(this.visualElement,this);const s=this.visualElement.current,o=Yr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Eo(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),Tt.read(r);const u=ol(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(ss(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Wp,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function zc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function v4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class y4 extends Ja{constructor(s){super(s),this.removeGroupControls=$n,this.removeListeners=$n,this.controls=new g4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$n}unmount(){this.removeGroupControls(),this.removeListeners()}}const mb=t=>(s,o)=>{t&&Tt.postRender(()=>t(s,o))};class b4 extends Ja{constructor(){super(...arguments),this.removePointerDownListener=$n}onPointerDown(s){this.session=new o1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:m1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:mb(s),onStart:mb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&Tt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Yr(this.node.current,"pointerdown",s=>this.onPointerDown(s))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Xc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function hb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Lr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=hb(t,s.target.x),r=hb(t,s.target.y);return`${o}% ${r}%`}},_4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Ya.parse(t);if(c.length>5)return r;const d=Ya.createTransformer(t),u=typeof c[0]!="number"?1:0,p=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Et(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class x4 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;KD(k4),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()})),Xc.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()||Tt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Dm.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 h1(t){const[s,o]=Q_(),r=y.useContext(jm);return i.jsx(x4,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(rx),isPresent:s,safeToRemove:o})}const k4={borderRadius:{...Lr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Lr,borderTopRightRadius:Lr,borderBottomLeftRadius:Lr,borderBottomRightRadius:Lr,boxShadow:_4};function S4(t,s,o){const r=hn(t)?t:al(t);return r.start(nh("",r,s,o)),r.animation}function j4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const T4=(t,s)=>t.depth-s.depth;class w4{constructor(){this.children=[],this.isDirty=!1}add(s){Um(this.children,s),this.isDirty=!0}remove(s){Vm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(T4),this.isDirty=!1,this.children.forEach(s)}}function N4(t,s){const o=Is.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Za(r),t(d-s))};return Tt.read(r,!0),()=>Za(r)}const g1=["TopLeft","TopRight","BottomLeft","BottomRight"],C4=g1.length,gb=t=>typeof t=="string"?parseFloat(t):t,vb=t=>typeof t=="number"||Ae.test(t);function E4(t,s,o,r,c,d){c?(t.opacity=Et(0,o.opacity!==void 0?o.opacity:1,A4(r)),t.opacityExit=Et(s.opacity!==void 0?s.opacity:1,0,D4(r))):d&&(t.opacity=Et(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<C4;u++){const p=`border${g1[u]}Radius`;let m=yb(s,p),g=yb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||vb(m)===vb(g)?(t[p]=Math.max(Et(gb(m),gb(g),r),0),(Rs.test(g)||Rs.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=Et(s.rotate||0,o.rotate||0,r))}function yb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const A4=v1(0,.5,Rx),D4=v1(.5,.95,$n);function v1(t,s,o){return r=>r<t?0:r>s?1:o(zo(t,s,r))}function bb(t,s){t.min=s.min,t.max=s.max}function Xn(t,s){bb(t.x,s.x),bb(t.y,s.y)}function _b(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function xb(t,s,o,r,c){return t-=s,t=dd(t,1/o,r),c!==void 0&&(t=dd(t,1/c,r)),t}function M4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Rs.test(s)&&(s=parseFloat(s),s=Et(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Et(d.min,d.max,r);t===d&&(p-=s),t.min=xb(t.min,s,o,p,c),t.max=xb(t.max,s,o,p,c)}function kb(t,s,[o,r,c],d,u){M4(t,s[o],s[r],s[c],s.scale,d,u)}const R4=["x","scaleX","originX"],I4=["y","scaleY","originY"];function Sb(t,s,o,r){kb(t.x,s,R4,o?o.x:void 0,r?r.x:void 0),kb(t.y,s,I4,o?o.y:void 0,r?r.y:void 0)}function jb(t){return t.translate===0&&t.scale===1}function y1(t){return jb(t.x)&&jb(t.y)}function Tb(t,s){return t.min===s.min&&t.max===s.max}function O4(t,s){return Tb(t.x,s.x)&&Tb(t.y,s.y)}function wb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function b1(t,s){return wb(t.x,s.x)&&wb(t.y,s.y)}function Nb(t){return Hn(t.x)/Hn(t.y)}function Cb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class B4{constructor(){this.members=[]}add(s){Um(this.members,s),s.scheduleRender()}remove(s){if(Vm(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 L4(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:k,skewY:S}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const _i={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},qr=typeof window<"u"&&window.MotionDebug!==void 0,vp=["","X","Y","Z"],z4={visibility:"hidden"},Eb=1e3;let $4=0;function yp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function _1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Sx(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",Tt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&_1(r)}function x1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=$4++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,qr&&(_i.totalNodes=_i.resolvedTargetDeltas=_i.recalculatedProjection=0),this.nodes.forEach(U4),this.nodes.forEach(K4),this.nodes.forEach(Z4),this.nodes.forEach(V4),qr&&window.MotionDebug.record(_i)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new w4)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new qm),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const m=this.eventHandlers.get(u);m&&m.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=j4(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=N4(_,250),Xc.hasAnimatedSinceResize&&(Xc.hasAnimatedSinceResize=!1,this.nodes.forEach(Db))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||Q4,{onLayoutAnimationStart:T,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!b1(this.targetLayout,S)||k,D=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const A={...Pm(j,"layout"),onPlay:T,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else _||Db(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Za(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(Y4),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&&_1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Ab);return}this.isUpdating||this.nodes.forEach(G4),this.isUpdating=!1,this.nodes.forEach(F4),this.nodes.forEach(H4),this.nodes.forEach(P4),this.clearAllSnapshots();const p=Is.now();un.delta=da(0,1e3/60,p-un.timestamp),un.timestamp=p,un.isProcessing=!0,cp.update.process(un),cp.preRender.process(un),cp.render.process(un),un.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Dm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(q4),this.sharedNodes.forEach(J4)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Tt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Tt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Bt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!y1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||bi(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return u&&(m=this.removeTransform(m)),e3(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Bt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(t3))){const{scroll:v}=this.root;v&&(Mo(m.x,v.offset.x),Mo(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Bt();if(Xn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Xn(m,u),Mo(m.x,b.offset.x),Mo(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Bt();Xn(m,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Ro(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),bi(v.latestValues)&&Ro(m,v.latestValues)}return bi(this.latestValues)&&Ro(m,this.latestValues),m}removeTransform(u){const p=Bt();Xn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!bi(g.latestValues))continue;Xp(g.latestValues)&&g.updateSnapshot();const v=Bt(),b=g.measurePageBox();Xn(v,b),Sb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return bi(this.latestValues)&&Sb(p,this.latestValues),p}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==un.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=un.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Bt(),this.relativeTargetOrigin=Bt(),Wr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Bt(),this.targetWithTransforms=Bt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),a4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Xn(this.target,this.layout.layoutBox),f1(this.target,this.targetDelta)):Xn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Bt(),this.relativeTargetOrigin=Bt(),Wr(this.relativeTargetOrigin,this.target,k.target),Xn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}qr&&_i.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Xp(this.parent.latestValues)||u1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const p=this.getLead(),m=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===un.timestamp&&(g=!1),g)return;const{layout:v,layoutId:b}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||b))return;Xn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;p4(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Bt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_b(this.prevProjectionDelta.x,this.projectionDelta.x),_b(this.prevProjectionDelta.y,this.projectionDelta.y)),Jr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!Cb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Cb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),qr&&_i.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Do(),this.projectionDelta=Do(),this.projectionDeltaWithTransform=Do()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Do();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Bt(),k=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=k!==S,T=this.getStack(),w=!T||T.members.length<=1,C=!!(j&&!w&&this.options.crossfade===!0&&!this.path.some(X4));this.animationProgress=0;let D;this.mixTargetDelta=A=>{const E=A/1e3;Mb(b.x,u.x,E),Mb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Wr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),W4(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&O4(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Bt()),Xn(D,this.relativeTarget)),j&&(this.animationValues=v,E4(v,g,this.latestValues,E,C,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Za(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Tt.update(()=>{Xc.hasAnimatedSinceResize=!0,this.currentAnimation=S4(0,Eb,{...u,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Eb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:v}=u;if(!(!p||!m||!g)){if(this!==u&&this.layout&&g&&k1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Bt();const b=Hn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Hn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Xn(p,m),Ro(p,v),Jr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new B4),this.sharedNodes.get(u).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:p}=this.options;return p?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:p}=this.options;return p?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let p=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&yp("z",u,g,this.animationValues);for(let v=0;v<vp.length;v++)yp(`rotate${vp[v]}`,u,g,this.animationValues),yp(`skew${vp[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var p,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return z4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Jc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=Jc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!bi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=L4(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const j in id){if(_[j]===void 0)continue;const{correct:T,applyTo:w}=id[j],C=g.transform==="none"?_[j]:T(_[j],b);if(w){const D=w.length;for(let A=0;A<D;A++)g[w[A]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Jc(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var p;return(p=u.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(Ab),this.root.sharedNodes.clear()}}}function H4(t){t.updateLayout()}function P4(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(_);_.min=r[b].min,_.max=_.min+k}):k1(d,o.layoutBox,r)&&ss(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Hn(r[b]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=Do();Jr(p,r,o.layoutBox);const m=Do();u?Jr(m,t.applyTransform(c,!0),o.measuredBox):Jr(m,r,o.layoutBox);const g=!y1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:k}=b;if(_&&k){const S=Bt();Wr(S,o.layoutBox,_.layoutBox);const j=Bt();Wr(j,r,k.layoutBox),b1(S,j)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function U4(t){qr&&_i.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 V4(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function q4(t){t.clearSnapshot()}function Ab(t){t.clearMeasurements()}function G4(t){t.isLayoutDirty=!1}function F4(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Db(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function K4(t){t.resolveTargetDelta()}function Z4(t){t.calcProjection()}function Y4(t){t.resetSkewAndRotation()}function J4(t){t.removeLeadSnapshot()}function Mb(t,s,o){t.translate=Et(s.translate,0,o),t.scale=Et(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Rb(t,s,o,r){t.min=Et(s.min,o.min,r),t.max=Et(s.max,o.max,r)}function W4(t,s,o,r){Rb(t.x,s.x,o.x,r),Rb(t.y,s.y,o.y,r)}function X4(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Q4={duration:.45,ease:[.4,0,.1,1]},Ib=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Ob=Ib("applewebkit/")&&!Ib("chrome/")?Math.round:$n;function Bb(t){t.min=Ob(t.min),t.max=Ob(t.max)}function e3(t){Bb(t.x),Bb(t.y)}function k1(t,s,o){return t==="position"||t==="preserve-aspect"&&!s4(Nb(s),Nb(o),.2)}function t3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const n3=x1({attachResizeListener:(t,s)=>ol(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),bp={current:void 0},S1=x1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!bp.current){const t=new n3({});t.mount(window),t.setOptions({layoutScroll:!0}),bp.current=t}return bp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),s3={pan:{Feature:b4},drag:{Feature:y4,ProjectionNode:S1,MeasureLayout:h1}};function a3(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 j1(t,s){const o=a3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Lb(t){return s=>{s.pointerType==="touch"||i1()||t(s)}}function i3(t,s,o={}){const[r,c,d]=j1(t,o),u=Lb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Lb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function zb(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&&Tt.postRender(()=>d(s,hl(s)))}class o3 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=i3(s,o=>(zb(this.node,o,"Start"),r=>zb(this.node,r,"End"))))}unmount(){}}class r3 extends Ja{constructor(){super(...arguments),this.isActive=!1}onFocus(){let s=!1;try{s=this.node.current.matches(":focus-visible")}catch{s=!0}!s||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ml(ol(this.node.current,"focus",()=>this.onFocus()),ol(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const T1=(t,s)=>s?t===s?!0:T1(t,s.parentElement):!1,l3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function c3(t){return l3.has(t.tagName)||t.tabIndex!==-1}const Gr=new WeakSet;function $b(t){return s=>{s.key==="Enter"&&t(s)}}function _p(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const d3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=$b(()=>{if(Gr.has(o))return;_p(o,"down");const c=$b(()=>{_p(o,"up")}),d=()=>_p(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 Hb(t){return sh(t)&&!i1()}function u3(t,s,o={}){const[r,c,d]=j1(t,o),u=p=>{const m=p.currentTarget;if(!Hb(p)||Gr.has(m))return;Gr.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Hb(k)||!Gr.has(m))&&(Gr.delete(m),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,o.useGlobalTarget||T1(m,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!c3(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>d3(g,c),c)}),d}function Pb(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&&Tt.postRender(()=>d(s,hl(s)))}class f3 extends Ja{mount(){const{current:s}=this.node;s&&(this.unmount=u3(s,o=>(Pb(this.node,o,"Start"),(r,{success:c})=>Pb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const em=new WeakMap,xp=new WeakMap,p3=t=>{const s=em.get(t.target);s&&s(t)},m3=t=>{t.forEach(p3)};function h3({root:t,...s}){const o=t||document;xp.has(o)||xp.set(o,{});const r=xp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(m3,{root:t,...s})),r[c]}function g3(t,s,o){const r=h3(s);return em.set(t,o),r.observe(t),()=>{em.delete(t),r.unobserve(t)}}const v3={some:0,all:1};class y3 extends Ja{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:v3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return g3(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(b3(s,o))&&this.startObserver()}unmount(){}}function b3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const _3={inView:{Feature:y3},tap:{Feature:f3},focus:{Feature:r3},hover:{Feature:o3}},x3={layout:{ProjectionNode:S1,MeasureLayout:h1}},ud={current:null},ah={current:!1};function w1(){if(ah.current=!0,!!Nm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>ud.current=t.matches;t.addListener(s),s()}else ud.current=!1}const k3=[...Kx,mn,Ya],S3=t=>k3.find(Fx(t)),Ub=new WeakMap;function j3(t,s,o){for(const r in s){const c=s[r],d=o[r];if(hn(c))t.addValue(r,c);else if(hn(d))t.addValue(r,al(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,al(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Vb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class T3{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Qm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=Is.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,Tt.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=o.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=Td(o),this.isVariantNode=ix(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(o,{},this);for(const k in _){const S=_[k];m[k]!==void 0&&hn(S)&&S.set(m[k],!1)}}mount(s){this.current=s,Ub.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)),ah.current||w1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ud.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ub.delete(this.current),this.projection&&this.projection.unmount(),Za(this.notifyUpdate),Za(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Mi.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&Tt.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 Lo){const o=Lo[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):Bt()}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<Vb.length;r++){const c=Vb[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=j3(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=al(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"&&(qx(c)||Ox(c))?c=parseFloat(c):!S3(c)&&Ya.test(o)&&(c=Px(s,o)),this.setBaseTarget(s,hn(c)?c.get():c)),hn(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=Rm(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&&!hn(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 qm),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class N1 extends T3{constructor(){super(...arguments),this.KeyframeResolver=Zx}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;hn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function w3(t){return window.getComputedStyle(t)}class N3 extends N1{constructor(){super(...arguments),this.type="html",this.renderInstance=mx}readValueFromInstance(s,o){if(Mi.has(o)){const r=Xm(o);return r&&r.default||0}else{const r=w3(s),c=(ux(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return p1(s,o)}build(s,o,r){Bm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Hm(s,o,r)}}class C3 extends N1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Bt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Mi.has(o)){const r=Xm(o);return r&&r.default||0}return o=hx.has(o)?o:Am(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return yx(s,o,r)}build(s,o,r){Lm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){gx(s,o,r,c)}mount(s){this.isSVGTag=$m(s.tagName),super.mount(s)}}const E3=(t,s)=>Mm(t)?new C3(s):new N3(s,{allowProjection:t!==y.Fragment}),A3=nM({...KR,..._3,...s3,...x3},E3),Ht=vD(A3);function D3(){!ah.current&&w1();const[t]=y.useState(ud.current);return t}const M3="_overlay_cmicx_1",R3="_dialog_cmicx_11",I3="_title_cmicx_30",O3="_description_cmicx_38",B3="_actions_cmicx_45",L3="_cancelButton_cmicx_52",z3="_confirmButton_cmicx_79",vi={overlay:M3,dialog:R3,title:I3,description:O3,actions:B3,cancelButton:L3,confirmButton:z3};function ys({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return i.jsx(as,{children:t&&i.jsx(Ht.div,{className:vi.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?p:void 0,children:i.jsxs(Ht.div,{className:vi.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[i.jsx("h3",{id:u,className:vi.title,children:s}),o&&i.jsx("p",{id:p,className:vi.description,children:o}),i.jsxs("div",{className:vi.actions,children:[i.jsx("button",{type:"button",className:vi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),i.jsx("button",{type:"button",className:vi.confirmButton,onClick:c,children:r})]})]})})})}const $3="_skeleton_1gqp4_9",H3="_circular_1gqp4_17",P3="_textContainer_1gqp4_26",U3="_card_1gqp4_31",fd={skeleton:$3,circular:H3,textContainer:P3,card:U3};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[fd.skeleton,r==="circular"?fd.circular:"",c??""].filter(Boolean).join(" ");return i.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function tm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return i.jsx("div",{className:`${fd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>i.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function nm({lines:t=2,className:s}){return i.jsxs("div",{className:`${fd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[i.jsx(Te,{width:"40%",height:"1.25rem"}),i.jsx(tm,{lines:t})]})}const V3="_spinner_1uyt1_1",q3="_spin_1uyt1_1",G3="_sm_1uyt1_14",F3="_md_1uyt1_20",K3="_lg_1uyt1_26",Z3="_xl_1uyt1_32",qb={spinner:V3,spin:q3,sm:G3,md:F3,lg:K3,xl:Z3};function C1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return i.jsx("span",{className:`${qb.spinner} ${qb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function Cd(t){return`/${t.replace(/^\//,"")}`}const Y3="_splash_1bn1g_1",J3="_logo_1bn1g_11",Gb={splash:Y3,logo:J3};function E1(){return i.jsxs("div",{className:Gb.splash,"data-testid":"splash-screen",children:[i.jsx("img",{src:Cd("grackle-logo.png"),alt:"Grackle",className:Gb.logo}),i.jsx(C1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const W3="_wrapper_4e5yt_1",X3="_wrapperBlock_4e5yt_6",Q3="_tooltip_4e5yt_11",e6="_visible_4e5yt_31",t6="_top_4e5yt_41",n6="_bottom_4e5yt_48",s6="_left_4e5yt_55",a6="_right_4e5yt_62",zr={wrapper:W3,wrapperBlock:X3,tooltip:Q3,visible:e6,top:t6,bottom:n6,left:s6,right:a6},i6=300,$c=6;function wi({text:t,placement:s="top",delayMs:o=i6,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),k=y.useRef(void 0),S=y.useId(),j=typeof document<"u",T=y.useCallback(()=>{if(!b.current||!_.current)return;const $=b.current.getBoundingClientRect(),Y=_.current.getBoundingClientRect();let V=0,ne=0;switch(s){case"top":V=$.top-Y.height-$c,ne=$.left+$.width/2-Y.width/2;break;case"bottom":V=$.bottom+$c,ne=$.left+$.width/2-Y.width/2;break;case"left":V=$.top+$.height/2-Y.height/2,ne=$.left-Y.width-$c;break;case"right":V=$.top+$.height/2-Y.height/2,ne=$.right+$c;break}v({top:V,left:ne})},[s]),w=y.useCallback($=>{k.current!==void 0&&clearTimeout(k.current),k.current=setTimeout(()=>{T(),m(!0),k.current=void 0},$)},[T]),C=y.useCallback(()=>{w(o)},[o,w]),D=y.useCallback(()=>{w(0)},[w]),A=y.useCallback(()=>{k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const $=Y=>{Y.key==="Escape"&&A()};return document.addEventListener("keydown",$),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{document.removeEventListener("keydown",$),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[p,A,T]),y.useEffect(()=>()=>{k.current!==void 0&&clearTimeout(k.current)},[]);const E=r?"span":"div",R=[r?zr.wrapper:zr.wrapperBlock,d].filter(Boolean).join(" ");let O=c;if(y.isValidElement(c)){const $=c,Y=$.props["aria-describedby"],V=p?Y?`${Y} ${S}`:S:Y;O=y.cloneElement($,{"aria-describedby":V})}const M=i.jsx("div",{ref:_,id:S,role:"tooltip",className:`${zr.tooltip} ${zr[s]} ${p?zr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return i.jsxs(E,{ref:b,className:R,onMouseEnter:C,onMouseLeave:A,onFocus:D,onBlur:A,children:[O,j?N2.createPortal(M,document.body):null]})}const o6="_attemptSelector_ggigl_1",r6="_attemptLabel_ggigl_17",l6="_attemptButton_ggigl_21",c6="_attemptActive_ggigl_38",d6="_attemptStatus_ggigl_44",$r={attemptSelector:o6,attemptLabel:r6,attemptButton:l6,attemptActive:c6,attemptStatus:d6};function u6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return i.jsxs("div",{className:$r.attemptSelector,"data-testid":"attempt-selector",children:[i.jsx("span",{className:$r.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return i.jsxs("button",{className:`${$r.attemptButton} ${d?$r.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&i.jsx("span",{className:$r.attemptStatus,children:u})]},r.id)})]})}const f6="_row_ldkru_1",p6="_hoverActions_ldkru_5",m6="_hoverButton_ldkru_31",h6="_selectingRow_ldkru_72",g6="_selected_ldkru_83",v6="_checkboxArea_ldkru_90",y6="_checkbox_ldkru_90",b6="_contentArea_ldkru_106",ms={row:f6,hoverActions:p6,hoverButton:m6,selectingRow:h6,selected:g6,checkboxArea:v6,checkbox:y6,contentArea:b6};function _6({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,v]=y.useState(!1),b=y.useRef(void 0);y.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const _=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),k=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?i.jsxs("div",{className:`${ms.row} ${ms.selectingRow} ${r?ms.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[i.jsx("div",{className:ms.checkboxArea,children:i.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:ms.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),i.jsx("div",{className:ms.contentArea,children:m})]}):i.jsxs("div",{className:ms.row,"data-testid":"event-hover-row",children:[i.jsxs("div",{className:ms.hoverActions,"data-testid":"event-hover-actions",children:[i.jsx("button",{type:"button",className:ms.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?i.jsx(Ci,{size:Ye,"aria-hidden":"true"}):i.jsx(T_,{size:Ye,"aria-hidden":"true"})}),i.jsx("button",{type:"button",className:ms.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:i.jsx(RT,{size:Ye,"aria-hidden":"true"})})]}),m]}):i.jsx("div",{className:ms.row,children:m})}const x6="_bar_lagql_1",k6="_left_lagql_21",S6="_right_lagql_27",j6="_count_lagql_33",T6="_toggleButton_lagql_40",w6="_copyButton_lagql_68",N6="_forwardButton_lagql_108",C6="_cancelButton_lagql_148",$a={bar:x6,left:k6,right:S6,count:j6,toggleButton:T6,copyButton:w6,forwardButton:N6,cancelButton:C6};function E6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:p}){const m=t>0&&t>=s;return i.jsxs(Ht.div,{className:$a.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[i.jsxs("div",{className:$a.left,children:[i.jsxs("span",{className:$a.count,"data-testid":"floating-bar-count",children:[t," selected"]}),i.jsx("button",{type:"button",className:$a.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),i.jsxs("div",{className:$a.right,children:[i.jsxs("button",{type:"button",className:$a.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[i.jsx(Oj,{size:Ye,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&i.jsx(wi,{text:u?"No active sessions to forward to":"Forward to another session",children:i.jsxs("button",{type:"button",className:$a.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[i.jsx(Vj,{size:Ye,"aria-hidden":"true"}),"Forward"]})}),i.jsx("button",{type:"button",className:$a.cancelButton,onClick:p,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:i.jsx(Os,{size:Ye,"aria-hidden":"true"})})]})]})}const A6="_overlay_1hra6_1",D6="_dialog_1hra6_11",M6="_header_1hra6_27",R6="_title_1hra6_35",I6="_closeButton_1hra6_42",O6="_filterRow_1hra6_78",B6="_searchIcon_1hra6_86",L6="_filterInput_1hra6_91",z6="_list_1hra6_108",$6="_emptyItem_1hra6_116",H6="_sessionRow_1hra6_123",P6="_sessionMain_1hra6_158",U6="_envName_1hra6_165",V6="_personaName_1hra6_175",q6="_statusBadge_1hra6_189",G6="_status_running_1hra6_198",F6="_status_idle_1hra6_202",K6="_status_other_1hra6_206",Z6="_sessionPrompt_1hra6_211",Y6="_noSessions_1hra6_220",Kt={overlay:A6,dialog:D6,header:M6,title:R6,closeButton:I6,filterRow:O6,searchIcon:B6,filterInput:L6,list:z6,emptyItem:$6,sessionRow:H6,sessionMain:P6,envName:U6,personaName:V6,statusBadge:q6,status_running:G6,status_idle:F6,status_other:K6,sessionPrompt:Z6,noSessions:Y6};function J6(t){return t==="running"?"running":t==="idle"?"idle":t}function W6({isOpen:t,sessions:s,environments:o,personas:r,onSelect:c,onCancel:d}){const[u,p]=y.useState(""),m=y.useRef(null),g=y.useRef(null);y.useEffect(()=>{var j;t&&s.length<=4&&((j=g.current)==null||j.focus())},[t,s.length]);const v=new Map(o.map(j=>[j.id,j.displayName])),b=new Map((r??[]).map(j=>[j.id,j.name])),_=s.map(j=>({session:j,environmentName:v.get(j.environmentId)??j.environmentId})),k=s.length>4,S=u.trim()?_.filter(({session:j,environmentName:T})=>T.toLowerCase().includes(u.toLowerCase())||j.prompt.toLowerCase().includes(u.toLowerCase())):_;return i.jsx(as,{children:t&&i.jsx(Ht.div,{className:Kt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:i.jsxs(Ht.div,{ref:m,className:Kt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[i.jsxs("div",{className:Kt.header,children:[i.jsx("h3",{className:Kt.title,children:"Forward to session"}),i.jsx("button",{ref:g,type:"button",className:Kt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:i.jsx(Os,{size:Ye,"aria-hidden":"true"})})]}),k&&i.jsxs("div",{className:Kt.filterRow,children:[i.jsx(Rp,{size:Ye,className:Kt.searchIcon,"aria-hidden":"true"}),i.jsx("input",{type:"text",className:Kt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{p(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?i.jsxs("div",{className:Kt.noSessions,"data-testid":"session-picker-no-sessions",children:[i.jsx(Rp,{size:$t,"aria-hidden":"true"}),i.jsx("p",{children:"No active sessions to forward to."})]}):i.jsx("ul",{className:Kt.list,"data-testid":"session-picker-list",children:S.length===0?i.jsx("li",{className:Kt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):S.map(({session:j,environmentName:T})=>{const w=j.personaId?b.get(j.personaId)??void 0:void 0;return i.jsx("li",{children:i.jsxs("button",{type:"button",className:Kt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[i.jsxs("div",{className:Kt.sessionMain,children:[i.jsx("span",{className:Kt.envName,children:T}),w!==void 0&&i.jsx("span",{className:Kt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:w}),i.jsx("span",{className:`${Kt.statusBadge} ${Kt[`status_${j.status}`]??Kt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:J6(j.status)})]}),i.jsx("div",{className:Kt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const A1=50;function X6(t,s,o,r,c=A1){return r?t<c:s-t-o<c}function Q6(t,s){const o=s-t;return o>0?o:0}function e5({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const k=X6(v.scrollTop,v.scrollHeight,v.clientHeight,o,A1);k!==b&&(b=k,d(k))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const b=Q6(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=o?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:g}}const t5=new Set(["text","output","user_input","tool_use","tool_result","error"]);function rl(t){return t5.has(t.eventType)}function n5(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
311
+ ${c}`}catch{return t.content}default:return t.content}}function Fb(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 D1(t){var o;const s=[];for(const r of t){if(!rl(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
312
312
  ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
313
313
  ${r.content}`);break}case"tool_result":{let d=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=Fb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
314
314
  ${d}`)}else s.push(`**Tool output** (${c}):
@@ -322,7 +322,7 @@ ${r.content}`);break}}}return s.join(`
322
322
 
323
323
  ${r}
324
324
 
325
- --- End forwarded ---`}function a5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function i5({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(S=>{r(!0),S!==void 0?(d(new Set([S])),u.current=S):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,T)=>{if(T&&u.current!==void 0){const j=Math.min(u.current,S),w=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let A=j;A<=w;A++)A<t.length&&ol(t[A])&&D.add(A);return D})}else d(j=>{const w=new Set(j);return w.has(S)?w.delete(S):w.add(S),w.size===0?(r(!1),u.current=void 0):u.current=S,w})},[t]),b=y.useCallback(()=>{const S=new Set;for(let T=0;T<t.length;T++)ol(t[T])&&S.add(T);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const T=[...c].sort((w,C)=>w-C).filter(w=>w<t.length).map(w=>t[w]);if(T.length===0)return!1;const j=s(T);try{return await navigator.clipboard.writeText(j),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:k}}const o5="_wrapper_1cdza_1",r5="_scrollContainer_1cdza_9",l5="_selectingPadding_1cdza_16",c5="_toolbar_1cdza_20",d5="_directionToggle_1cdza_27",u5="_scrollToAnchor_1cdza_65",f5="_scrollToAnchorBottom_1cdza_89",p5="_scrollToAnchorTop_1cdza_93",m5="_eventOverflowWarning_1cdza_97",sa={wrapper:o5,scrollContainer:r5,selectingPadding:l5,toolbar:c5,directionToggle:d5,scrollToAnchor:u5,scrollToAnchorBottom:f5,scrollToAnchorTop:p5,eventOverflowWarning:m5},h5=10*1024,g5=new Set(["running","idle"]);function v5(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 M1="grackle-stream-direction";function y5(){try{return localStorage.getItem(M1)==="reversed"}catch{return!1}}function b5({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:sa.eventOverflowWarning,role:"alert",children:[i.jsx(mm,{size:zt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function ih({events:t,eventsDropped:s,emptyState:o,onShowToast:r,sessions:c,currentSessionId:d,environments:u,personas:p,onForward:m,sandboxProxyUrl:g}){const v=y.useRef(null),[b,_]=y.useState(y5),k=D3(),[S,T]=y.useState(!1),[j,w]=y.useState(!1),[C,D]=y.useState(void 0),A=i5({events:t,formatForClipboard:D1}),E=y.useMemo(()=>t.filter(ol).length,[t]),R=y.useMemo(()=>c?c.filter(ce=>g5.has(ce.status)&&ce.id!==d):[],[c,d]),O=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:M,scrollToAnchor:$}=e5({scrollRef:v,contentLength:t.length,isReversed:b,paused:A.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(M1,ce?"reversed":"default")}catch{}};y.useEffect(()=>{if(!A.isSelecting)return;const ce=me=>{me.key==="Escape"&&!S&&!j&&A.cancelSelection()};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce)}},[A.isSelecting,A.cancelSelection,S,j]);const V=y.useCallback(async()=>{await A.copySelected()&&(r==null||r(`Copied ${A.selectedCount} message${A.selectedCount===1?"":"s"} to clipboard`,"success"))},[A,r]),ee=y.useCallback(()=>[...A.selectedIndices].sort((me,ke)=>me-ke).filter(me=>me<t.length).map(me=>t[me]),[A.selectedIndices,t]),le=y.useCallback(ce=>{if(!ce)return"this session";const me=c==null?void 0:c.find(De=>De.id===ce);if(!me)return ce.slice(0,8);const ke=u==null?void 0:u.find(De=>De.id===me.environmentId);return(ke==null?void 0:ke.displayName)??me.environmentId.slice(0,8)},[c,u]),Z=y.useCallback(async(ce,me)=>{if(!m)return;const ke=le(ce);try{await m(ce,me);const De=A.selectedCount;r==null||r(`Forwarded ${De} message${De===1?"":"s"} to ${ke}`,"success"),A.cancelSelection()}catch{r==null||r("Failed to forward messages","error")}},[m,le,r,A]),ae=y.useCallback(ce=>{T(!1);const me=ee(),ke=le(d),De=s5(ke,me);if(new TextEncoder().encode(De).length>h5){D({sessionId:ce,text:De}),w(!0);return}Z(ce,De).catch(()=>{})},[ee,le,d,Z]),H=y.useCallback(()=>{w(!1),C&&(Z(C.sessionId,C.text).catch(()=>{}),D(void 0))},[C,Z]),B=y.useCallback(()=>{w(!1),D(void 0)},[]),F=k?0:.2,ge=b?-8:8,ne=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return i.jsxs("div",{className:sa.wrapper,children:[i.jsx("div",{className:sa.toolbar,children:i.jsx(wi,{text:b?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:sa.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?i.jsx(fy,{size:zt,"aria-hidden":"true"}):i.jsx(py,{size:zt,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:v,className:`${sa.scrollContainer} ${A.isSelecting?sa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(b5,{eventsDropped:s}),i.jsx(as,{initial:!1,children:O.map((ce,me)=>{const ke=b?t.length-1-me:me;return i.jsx($t.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:F,ease:"easeOut"},children:i.jsx(_6,{copyText:n5(ce),isContentBearing:ol(ce),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(ke),checkboxLabel:v5(ce),onSelect:()=>{A.enterSelectionMode(ke)},onToggle:De=>{A.toggleEvent(ke,De)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(iD,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:g})})},`${ce.sessionId}-${ce.timestamp}-${ke}`)})})]}),i.jsx(as,{children:A.isSelecting&&i.jsx(E6,{selectedCount:A.selectedCount,totalSelectable:E,onSelectAll:A.selectAll,onDeselectAll:A.deselectAll,onCopy:()=>{V().catch(()=>{})},onForward:m!==void 0?()=>{T(!0)}:void 0,forwardDisabled:R.length===0,onCancel:A.cancelSelection})}),i.jsx(W6,{isOpen:S,sessions:R,environments:u??[],personas:p,onSelect:ae,onCancel:()=>{T(!1)}}),i.jsx(ys,{isOpen:j,title:"Send large message?",description:`This will forward a large message (${ne} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:B}),i.jsx(as,{children:!M&&i.jsxs($t.button,{className:`${sa.scrollToAnchor} ${b?sa.scrollToAnchorTop:sa.scrollToAnchorBottom}`,onClick:$,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[b?i.jsx(py,{size:zt,"aria-hidden":"true"}):i.jsx(fy,{size:zt,"aria-hidden":"true"})," New events"]})})]})}function oh(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,_]=y.useState(""),k=y.useRef(!1),S=d===c,T=y.useCallback(O=>{v(O),_("")},[]),j=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const O=m?g.trim():g;if(r){const $=r(g);if($){_($);return}}const M=m?s.trim():s;if(O===M){w();return}o(O),w()},[g,s,m,r,o,w]),D=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),A=y.useCallback(O=>{if(k.current){k.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(O=>{O.key==="Escape"?w():O.key==="Enter"&&p&&C()},[w,p,C]),R=(()=>{if(!S)return!1;const O=m?s.trim():s;return(m?g.trim():g)!==O})();return y.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),_(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:R,startEdit:D,cancelEdit:w,save:C,setDraft:T,clearError:j,handleBlur:A,handleKeyDown:E,ignoreInitialBlurRef:k}}const _5="_editFieldWrapper_yuzty_1",x5="_editInput_yuzty_10",k5="_editTextarea_yuzty_42",S5="_editSelect_yuzty_78",T5="_editError_yuzty_111",j5="_editInputInvalid_yuzty_118",w5="_editHint_yuzty_123",N5="_unsavedDot_yuzty_132",C5="_metaValueClickable_yuzty_140",E5="_editButton_yuzty_159",A5="_metaPlaceholder_yuzty_175",D5="_worktreeToggle_yuzty_180",it={editFieldWrapper:_5,editInput:x5,editTextarea:k5,editSelect:S5,editError:T5,editInputInvalid:j5,editHint:w5,unsavedDot:N5,metaValueClickable:C5,editButton:E5,metaPlaceholder:A5,worktreeToggle:D5};function Bt(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":k}=t,S=y.useRef(null),T=oh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(T.isEditing){const w=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(w)}},[T.isEditing]),c==="create"){const w=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{className:`${it.editInput} ${C?it.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),C&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(T.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{ref:S,className:`${it.editInput} ${T.error?it.editInputInvalid:""}`,value:T.draft,onChange:w=>T.setDraft(w.target.value),onBlur:T.handleBlur,onKeyDown:T.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),T.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),T.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:T.error}),i.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>T.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),T.startEdit())},title:"Click to edit","aria-label":_,"data-testid":k?`${k}-button`:void 0,children:[j!==void 0?j:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function sm(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=oh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const j=window.setTimeout(()=>{var w;(w=k.current)==null||w.focus()},0);return()=>window.clearTimeout(j)}},[S.isEditing]),c==="create"){const j=C=>{m==null||m(C.target.value)},w=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{className:`${it.editTextarea} ${w?it.editInputInvalid:""}`,value:s,onChange:j,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:w})]})}if(S.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{ref:k,className:`${it.editTextarea} ${S.error?it.editInputInvalid:""}`,value:S.draft,onChange:j=>S.setDraft(j.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),i.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const T=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[T!==void 0?T:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function pd(t){var D;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=oh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const A=window.setTimeout(()=>{var E;(E=k.current)==null||E.focus()},0);return()=>window.clearTimeout(A)}},[S.isEditing]);const T=y.useCallback(A=>{const E=A.target.value;S.ignoreInitialBlurRef.current=!1,E!==s&&o(E),S.cancelEdit()},[s,o,S]),j=y.useCallback(A=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}A.relatedTarget instanceof HTMLElement&&A.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return i.jsx("select",{className:it.editSelect,value:s,onChange:A=>m==null?void 0:m(A.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>i.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return i.jsx("select",{ref:k,className:it.editSelect,value:S.draft,onChange:T,onBlur:j,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>i.jsx("option",{value:A.value,children:A.label},A.value))});const w=g==null?void 0:g(s),C=(D=c.find(A=>A.value===s))==null?void 0:D.label;return i.jsxs("button",{type:"button",className:it.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:C?i.jsx("span",{children:C}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function M5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:it.worktreeToggle,"data-testid":d,children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),i.jsx("span",{children:r})]})}const R5="_nav_1snmp_1",I5="_searchForm_1snmp_8",O5="_searchInput_1snmp_15",B5="_searchButton_1snmp_33",L5="_clearButton_1snmp_68",z5="_workspaceSelect_1snmp_85",$5="_listHeader_1snmp_99",H5="_nodeList_1snmp_108",P5="_nodeItem_1snmp_116",U5="_indicator_1snmp_129",V5="_label_1snmp_136",q5="_badge_1snmp_145",Qn={nav:R5,searchForm:I5,searchInput:O5,searchButton:B5,clearButton:L5,workspaceSelect:z5,listHeader:$5,nodeList:H5,nodeItem:P5,indicator:U5,label:V5,badge:q5};function G5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return i.jsxs("div",{className:Qn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Qn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Qn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Qn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Qn.clearButton,onClick:b,children:"Clear search"}),i.jsxs("select",{className:Qn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>i.jsx("option",{value:S.id,children:S.name},S.id))]}),i.jsxs("div",{className:Qn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Qn.nodeList,children:t.map(S=>i.jsxs("li",{className:Qn.nodeItem,onClick:()=>{_(S.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Qn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Qn.label,children:S.label}),i.jsx("span",{className:Qn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const F5="_container_bwu10_1",K5="_hamburger_bwu10_33",Z5="_brand_bwu10_49",Y5="_brandLogo_bwu10_68",J5="_info_bwu10_75",W5="_connectionLabel_bwu10_90",X5="_connectionDot_bwu10_103",Q5="_connected_bwu10_106",eI="_disconnected_bwu10_110",tI="_connecting_bwu10_113",Es={container:F5,hamburger:K5,brand:Z5,brandLogo:Y5,info:J5,connectionLabel:W5,connectionDot:X5,connected:Q5,disconnected:eI,connecting:tI},nI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},sI={connected:Es.connected,connecting:Es.connecting,disconnected:Es.disconnected};function aI({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=vt(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=nI[t];return i.jsxs("div",{className:Es.container,children:[r&&i.jsx("button",{type:"button",className:Es.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(dj,{size:wt,"aria-hidden":"true"})}),i.jsx(wi,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:Es.brand,onClick:()=>d(Po),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:Cd("icon-192x192.png"),alt:"",className:Es.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:Es.info,children:[i.jsxs("span",{"aria-label":g,children:[i.jsx("span",{className:`${Es.connectionDot} ${sI[t]}`,"aria-hidden":"true",children:i.jsx(Ti,{size:w_,fill:"currentColor"})})," ",i.jsx("span",{className:Es.connectionLabel,"aria-hidden":"true",children:g})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const iI="_nav_gx5h3_1",oI="_tab_gx5h3_35",rI="_tabIcon_gx5h3_68",lI="_tabLabel_gx5h3_79",cI="_tabActive_gx5h3_84",dI="_tabEnd_gx5h3_90",To={nav:iI,tab:oI,tabIcon:rI,tabLabel:lI,tabActive:cI,tabEnd:dI},Qc=[{view:"dashboard",label:"Dashboard",icon:i.jsx(WT,{size:wt}),route:Po,testId:"sidebar-tab-dashboard",order:0},{view:"tasks",label:"Tasks",icon:i.jsx(AT,{size:wt}),route:FN,testId:"sidebar-tab-tasks",order:1},{view:"environments",label:"Environments",icon:i.jsx(gj,{size:wt}),route:Ro,testId:"sidebar-tab-environments",order:2},{view:"chat",label:"Root",icon:i.jsx(fj,{size:wt}),route:GN,testId:"sidebar-tab-chat",order:3},{view:"knowledge",label:"Knowledge",icon:i.jsx(kT,{size:wt}),route:J_,testId:"sidebar-tab-knowledge",order:5},{view:"coordination",label:"Coordination",icon:i.jsx(yj,{size:wt}),route:Z_,testId:"sidebar-tab-coordination",order:6},{view:"settings",label:"Settings",icon:i.jsx(Dj,{size:wt}),route:HN,testId:"sidebar-tab-settings",align:"end"}];function uI(t){return t===Po||t==="/"?"dashboard":t.startsWith(Z_)?"coordination":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(J_)?"knowledge":t.startsWith(ki)?"settings":"tasks"}function fI({tabs:t=Qc}){var g;const s=Jt(),o=vt(),r=y.useRef(null),c=uI(s.pathname),d=y.useMemo(()=>{const v=(b,_)=>(b.order??Number.MAX_SAFE_INTEGER)-(_.order??Number.MAX_SAFE_INTEGER);return[...t.filter(b=>b.align!=="end").sort(v),...t.filter(b=>b.align==="end")]},[t]),u=(g=d.find(v=>v.align==="end"))==null?void 0:g.view,p=y.useCallback(v=>{o(v.route)},[o]),m=y.useCallback(v=>{var T,j;const b=(T=r.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!b)return;const _=Array.from(b).findIndex(w=>w===document.activeElement),k=_>=0?_:d.findIndex(w=>w.view===c);let S=k;if(v.key==="ArrowRight"||v.key==="j"||v.key==="J")v.preventDefault(),S=(k+1)%d.length;else if(v.key==="ArrowLeft"||v.key==="k"||v.key==="K")v.preventDefault(),S=(k-1+d.length)%d.length;else if(v.key==="Home")v.preventDefault(),S=0;else if(v.key==="End")v.preventDefault(),S=d.length-1;else return;o(d[S].route),(j=b[S])==null||j.focus()},[c,o,d]);return i.jsx("nav",{className:To.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:m,"data-testid":"sidebar-nav",children:d.map(v=>{const b=v.view===c,_=v.view===u;return i.jsx(wi,{text:v.label,placement:"bottom",className:_?To.tabEnd:void 0,children:i.jsxs("button",{role:"tab",type:"button","aria-selected":b,tabIndex:b?0:-1,className:`${To.tab} ${b?To.tabActive:""}`,onClick:()=>p(v),"data-testid":v.testId,"aria-label":v.label,children:[i.jsx("span",{className:To.tabIcon,"aria-hidden":"true",children:v.icon}),i.jsx("span",{className:To.tabLabel,children:v.label})]})},v.view)})})}const pI="_container_pi6ii_1",mI="_content_pi6ii_66",Kb={container:pI,content:mI},hI=320,R1=220,I1=600,O1="grackle-sidebar-width";function gI(){try{const t=localStorage.getItem(O1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=R1&&s<=I1)return s}}catch{}return hI}function vI(t){try{localStorage.setItem(O1,String(t))}catch{}}function yI({content:t}){const[s]=y.useState(gI),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=R1&&m<=I1&&vI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:Kb.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:Kb.content,children:t})})}const bI="_bar_tnfsh_1",_I="_btnPrimary_tnfsh_32",xI="_statusText_tnfsh_85",kI="_statusCompleted_tnfsh_90",SI="_statusFailed_tnfsh_94",TI="_statusBlocked_tnfsh_98",jI="_hintText_tnfsh_103",jt={bar:bI,btnPrimary:_I,statusText:xI,statusCompleted:kI,statusFailed:SI,statusBlocked:TI,hintText:jI};function wI({sessions:t,tasks:s,environments:o}){const r=vt(),c=Jt(),d=nn("/sessions/:sessionId"),u=nn("/tasks/:taskId"),p=nn("/tasks/:taskId/stream"),m=nn("/tasks/:taskId/edit"),g=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),v=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),_=nn("/sessions/new"),k=nn("/environments/:environmentId/workspaces/:workspaceId"),S=nn("/tasks/new"),T=nn("/chat"),j=nn("/"),w=nn("/settings/*"),C=d==null?void 0:d.params.sessionId,D=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(g==null?void 0:g.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId),A=g??v??b,E=(A==null?void 0:A.params.environmentId)??(k==null?void 0:k.params.environmentId),R=c.pathname.startsWith("/environments")&&!k&&!A,O=!!T,M=!!_,$=!!k&&!g&&!v&&!b,Y=!!S;if(!!j&&!M&&!$&&!Y||!!w||(!!m||!!b)||Y||R||M)return i.jsx(i.Fragment,{});if(O)return o.find(ae=>ae.adapterType==="local"&&ae.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Add a local environment to start chatting"})});if($)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Select a task or click + to create one"})});if(D){const Z=s.find(B=>B.id===D);if(!Z)return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})});const ae=new Map(s.map(B=>[B.id,B])),H=Z.dependsOn.some(B=>{const F=ae.get(B);return F!==void 0&&F.status!=="complete"});if(Z.status==="not_started"){const B=H?Z.dependsOn.map(F=>ae.get(F)).filter(F=>F&&F.status!=="complete").map(F=>F.title):[];return i.jsx("div",{className:jt.bar,children:H?i.jsxs("span",{className:jt.statusBlocked,children:["Blocked by: ",B.join(", ")]}):i.jsx("span",{className:jt.hintText,children:"Use the buttons above to start or manage this task"})})}if(Z.status==="working"||Z.status==="paused"){const B=Z.latestSessionId||void 0,F=B?t.find(ne=>ne.id===B):void 0;return F&&F.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Waiting for agent..."})})}if(Z.status==="complete")return i.jsxs("div",{className:jt.bar,children:[i.jsx("span",{className:`${jt.statusText} ${jt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Di(Z.workspaceId,void 0,E)),className:jt.btnPrimary,children:"+ New Task"})]});if(Z.status==="failed")return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:`${jt.statusText} ${jt.statusFailed}`,children:"Task failed"})})}if(C){const Z=t.find(B=>B.id===C),ae=(Z==null?void 0:Z.status)==="stopped";if(Z!==void 0&&!ae)return i.jsx(i.Fragment,{});if(ae)return i.jsxs("div",{className:jt.bar,children:[i.jsxs("span",{className:`${jt.statusText} ${jt.hintText}`,children:["Session ",Z.endReason||Z.status]}),i.jsx("button",{onClick:()=>r(G_(Z.environmentId)),className:jt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:jt.bar,children:i.jsx("span",{className:jt.hintText,children:"Loading..."})})}const NI="_nav_14i94_1",CI="_tab_14i94_24",EI="_tabActive_14i94_62",AI="_tabLabel_14i94_75",DI="_statusDot_14i94_81",MI="_pulse_14i94_87",RI="_addButton_14i94_99",II="_empty_14i94_132",Ha={nav:NI,tab:CI,tabActive:EI,tabLabel:AI,statusDot:DI,pulse:MI,addButton:RI,empty:II},OI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function BI({environments:t}){const s=vt(),o=y.useRef(null),r=nn("/environments/:environmentId"),c=nn("/environments/:environmentId/edit"),d=nn("/environments/:environmentId/workspaces/:workspaceId"),u=nn("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=y.useCallback(_=>{s(Io(_))},[s]),v=y.useCallback(_=>{var w;const k=(w=o.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),T=S>=0?S:t.findIndex(C=>C.id===m);let j=T;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),j=(T+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),j=(T-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),j=0;else if(_.key==="End")_.preventDefault(),j=k.length-1;else return;j<t.length&&s(Io(t[j].id)),k[j].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Ha.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const k=_.id===m,S=_.id===b,T=OI[_.status]||"var(--text-tertiary)",j=_.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Ha.tab} ${k?Ha.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Ha.statusDot} ${j?Ha.pulse:""}`,style:{color:T},"aria-hidden":"true",children:i.jsx(Ti,{size:w_,fill:"currentColor"})}),i.jsx("span",{className:Ha.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),i.jsx("button",{type:"button",className:Ha.addButton,onClick:()=>s(zN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Ha.empty,children:"No environments yet."})]})}function LI(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 B1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=LI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(i.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(i.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(i.jsx("span",{children:t.slice(d)},`p${d}`)),i.jsx(i.Fragment,{children:c})}function zI(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 $I(t,s){const o=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=o.get(p);m?m.push(d):o.set(p,[d])}const r=[],c=new Set;for(const d of Uj){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ka(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ka(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const HI="_container_z4i38_1",PI="_header_z4i38_5",UI="_headerActions_z4i38_17",VI="_searchInput_z4i38_23",qI="_searchHighlight_z4i38_56",GI="_groupToggle_z4i38_62",FI="_groupToggleActive_z4i38_89",KI="_addButton_z4i38_93",ZI="_taskRow_z4i38_120",YI="_selected_z4i38_140",JI="_expandArrow_z4i38_150",WI="_expanded_z4i38_157",XI="_leafSpacer_z4i38_161",QI="_taskStatusIcon_z4i38_166",eO="_taskTitle_z4i38_170",tO="_workspaceBadge_z4i38_177",nO="_childCountBadge_z4i38_195",sO="_dependencyBadge_z4i38_208",aO="_blockedBadge_z4i38_220",iO="_addChildButton_z4i38_225",oO="_emptyState_z4i38_268",rO="_statusGroupHeader_z4i38_275",lO="_statusGroupIcon_z4i38_294",cO="_statusGroupLabel_z4i38_298",dO="_statusGroupCount_z4i38_303",Je={container:HI,header:PI,headerActions:UI,searchInput:VI,searchHighlight:qI,groupToggle:GI,groupToggleActive:FI,addButton:KI,taskRow:ZI,selected:YI,expandArrow:JI,expanded:WI,leafSpacer:XI,taskStatusIcon:QI,taskTitle:eO,workspaceBadge:tO,childCountBadge:nO,dependencyBadge:sO,blockedBadge:aO,addChildButton:iO,emptyState:oO,statusGroupHeader:rO,statusGroupIcon:lO,statusGroupLabel:cO,statusGroupCount:dO},uO=[{name:"title",weight:2},{name:"description",weight:1}],L1=16,fO=16,z1="grackle-task-group-by-status";function Zb(){try{return localStorage.getItem(z1)==="true"}catch{return!1}}function pO(t){try{localStorage.setItem(z1,String(t))}catch{}}function mO({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return i.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[i.jsxs("div",{className:Je.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[i.jsx("span",{className:`${Je.expandArrow} ${s?Je.expanded:""}`,"aria-hidden":"true",children:i.jsx(da,{size:Ze})}),i.jsx("span",{className:Je.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:Je.statusGroupLabel,children:t.label}),i.jsx("span",{className:Je.statusGroupCount,children:t.tasks.length})]}),i.jsx(as,{children:s&&i.jsx($t.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const m=Ka(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(os(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(os(p.id)))},className:`${Je.taskRow} ${g?Je.selected:""}`,style:{"--task-indent":`${L1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:Je.leafSpacer}),i.jsx("span",{className:Je.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${rl(p.status)}`,children:m.icon}),i.jsx("span",{className:Je.taskTitle,title:p.title,children:i.jsx(B1,{text:p.title,indices:d.get(p.id),highlightClass:Je.searchHighlight})}),v&&i.jsx("span",{className:Je.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function $1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Ka(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(w=>u.get(w)!=="complete"),b=o.has(t.id),_=t.children.length>0,k=c===t.id,S=L1+s*fO,j=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(os(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:w=>{w.currentTarget===w.target&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),d(os(t.id)))},className:`${Je.taskRow} ${k?Je.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&i.jsx("span",{className:`${Je.expandArrow} ${b?Je.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),r(t.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),r(t.id))},children:i.jsx(da,{size:Ze,"aria-hidden":"true"})}),!_&&i.jsx("span",{className:Je.leafSpacer}),i.jsx("span",{className:Je.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${rl(t.status)}`,children:g.icon}),i.jsx("span",{className:Je.taskTitle,title:t.title,children:i.jsx(B1,{text:t.title,indices:p.get(t.id),highlightClass:Je.searchHighlight})}),j&&i.jsx("span",{className:Je.workspaceBadge,title:j,children:j}),_&&i.jsxs("span",{className:Je.childCountBadge,children:[t.children.filter(w=>w.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${Je.dependencyBadge} ${v?Je.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<I2&&i.jsx(wi,{text:"Add child task",children:i.jsx("button",{onClick:w=>{w.stopPropagation(),d(Di(t.workspaceId,t.id))},"aria-label":"Add child task",className:Je.addChildButton,children:"+"})})]}),i.jsx(as,{children:_&&b&&i.jsx($t.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(w=>i.jsx($1,{node:w,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},w.id))})})]})}function hO({workspaces:t,tasks:s}){const o=vt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Zb),[g,v]=y.useState(Zb),[b,_]=y.useState(new Map),k=nn("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,T=y.useMemo(()=>new Map(s.map(Z=>[Z.id,Z.status])),[s]),j=y.useMemo(()=>new Map(t.map(Z=>[Z.id,Z.name])),[t]),w=()=>{const Z=!p;pO(Z),m(Z),Z&&(v(!0),_(new Map))},C=Z=>{_(ae=>{const H=new Map(ae),B=H.has(Z)?H.get(Z):g;return H.set(Z,!B),H})},D=Z=>b.has(Z)?b.get(Z):g,A=Z=>{c(ae=>{const H=new Set(ae);return H.has(Z)?(H.delete(Z),u(B=>new Set(B).add(Z))):(H.add(Z),u(B=>{const F=new Set(B);return F.delete(Z),F})),H})};y.useEffect(()=>{const Z=new Set(s.filter(ae=>ae.parentTaskId).map(ae=>ae.parentTaskId));Z.size>0&&c(ae=>{const H=new Set(ae);for(const B of Z)d.has(B)||H.add(B);return H})},[s,d]);const[E,R]=y.useState(""),{directMatchTaskIds:O,treeMatchTaskIds:M,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Z=R2(s,E,uO),ae=new Set(Z.map(ge=>ge.item.id)),H=new Map;for(const ge of Z){const ne=ge.matches.find(ce=>ce.key==="title");ne&&H.set(ge.item.id,ne.indices)}const B=new Set(ae),F=new Map(s.map(ge=>[ge.id,ge]));for(const ge of[...ae]){let ne=F.get(ge);for(;ne!=null&&ne.parentTaskId;)B.add(ne.parentTaskId),ne=F.get(ne.parentTaskId)}return{directMatchTaskIds:ae,treeMatchTaskIds:B,titleHighlights:H}},[E,s]),Y=O!==null,V=Y?p?O:M:null,ee=V?s.filter(Z=>V.has(Z.id)):s,le=p?[]:zI(ee);return i.jsxs("div",{className:Je.container,children:[i.jsxs("div",{className:Je.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:Je.headerActions,children:[i.jsx(wi,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${Je.groupToggle} ${p?Je.groupToggleActive:""}`,onClick:w,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(oj,{size:zt})})}),i.jsx(wi,{text:"New task",children:i.jsx("button",{className:Je.addButton,onClick:()=>o(Di()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:Z=>R(Z.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:Je.searchInput,"data-testid":"sidebar-search"}),p?$I(ee,T).map(Z=>i.jsx(mO,{group:Z,isExpanded:D(Z.status),onToggle:()=>C(Z.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:j},Z.status)):le.map(Z=>i.jsx($1,{node:Z,depth:0,expandedTasks:r,toggleTask:A,selectedTaskId:S,navigate:o,taskStatusById:T,titleHighlights:$,workspaceNames:j},Z.id)),ee.length===0&&!Y&&i.jsx("div",{className:Je.emptyState,children:"No tasks yet. Click + to create one."}),ee.length===0&&Y&&i.jsx("div",{className:Je.emptyState,children:"No matching tasks"})]})}const gO="_toast_ed2dk_1",vO="_success_ed2dk_18",yO="_icon_ed2dk_22",bO="_error_ed2dk_25",_O="_warning_ed2dk_32",xO="_info_ed2dk_38",kO="_message_ed2dk_53",SO="_close_ed2dk_60",$r={toast:gO,success:vO,icon:yO,error:bO,warning:_O,info:xO,message:kO,close:SO},TO={success:i.jsx(Ci,{size:wt}),error:i.jsx(Is,{size:wt}),warning:i.jsx(mm,{size:wt}),info:i.jsx(pm,{size:wt})};function jO({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),i.jsxs($t.div,{className:`${$r.toast} ${$r[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[i.jsx("span",{className:$r.icon,"aria-hidden":"true",children:TO[t.variant]}),i.jsx("span",{className:$r.message,children:t.message}),i.jsx("button",{type:"button",className:$r.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]})}const wO="_container_qqse2_1",NO={container:wO};function CO({toasts:t,onDismiss:s}){return i.jsx("div",{className:NO.container,"data-testid":"toast-container",children:i.jsx(as,{children:t.map(o=>i.jsx(jO,{toast:o,onDismiss:s},o.id))})})}const EO="_callout_e5awm_1",AO="_success_e5awm_11",DO="_icon_e5awm_15",MO="_error_e5awm_18",RO="_warning_e5awm_25",IO="_info_e5awm_32",OO="_content_e5awm_48",BO="_close_e5awm_53",Hr={callout:EO,success:AO,icon:DO,error:MO,warning:RO,info:IO,content:OO,close:BO},LO={success:i.jsx(Ci,{size:wt}),error:i.jsx(Is,{size:wt}),warning:i.jsx(mm,{size:wt}),info:i.jsx(pm,{size:wt})};function zO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return i.jsx(i.Fragment,{children:!c&&i.jsxs("div",{className:[Hr.callout,Hr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:Hr.icon,"aria-hidden":"true",children:LO[t]}),i.jsx("span",{className:Hr.content,children:s}),o&&i.jsx("button",{type:"button",className:Hr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]})})}function $O({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return i.jsx(i.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return i.jsx("div",{"data-testid":"update-banner",children:i.jsxs(zO,{variant:"info",dismissible:!0,children:[i.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",i.jsx("code",{children:c})]})})}const HO="_container_m1fsr_1",PO="_heading_m1fsr_7",UO="_section_m1fsr_14",VO="_sectionTitle_m1fsr_26",qO="_sectionDescription_m1fsr_35",GO="_emptyState_m1fsr_41",FO="_tokenList_m1fsr_48",KO="_tokenRow_m1fsr_55",ZO="_tokenBadge_m1fsr_68",YO="_tokenName_m1fsr_83",JO="_tokenTarget_m1fsr_90",WO="_deleteButton_m1fsr_99",XO="_addForm_m1fsr_113",QO="_formRow_m1fsr_119",eB="_input_m1fsr_125",tB="_select_m1fsr_155",nB="_addButton_m1fsr_187",sB="_emptyStateInfo_m1fsr_221",aB="_themeOptions_m1fsr_229",iB="_themeOption_m1fsr_229",oB="_themeOptionSelected_m1fsr_254",rB="_themeOptionHeader_m1fsr_259",lB="_themeOptionLabel_m1fsr_266",cB="_themeOptionDesc_m1fsr_273",dB="_variantToggle_m1fsr_279",uB="_variantButton_m1fsr_286",fB="_variantActive_m1fsr_305",pB="_themeSwatches_m1fsr_311",mB="_themeSwatch_m1fsr_311",hB="_systemToggle_m1fsr_325",gB="_systemToggleHint_m1fsr_341",vB="_themeActive_m1fsr_348",yB="_aboutGrid_m1fsr_354",bB="_aboutItem_m1fsr_360",_B="_aboutLabel_m1fsr_373",xB="_aboutValue_m1fsr_379",kB="_aboutDot_m1fsr_387",SB="_aboutDotConnected_m1fsr_394",TB="_aboutDotDisconnected_m1fsr_398",jB="_aboutDotConnecting_m1fsr_402",fe={container:HO,heading:PO,section:UO,sectionTitle:VO,sectionDescription:qO,emptyState:GO,tokenList:FO,tokenRow:KO,tokenBadge:ZO,tokenName:YO,tokenTarget:JO,deleteButton:WO,addForm:XO,formRow:QO,input:eB,select:tB,addButton:nB,emptyStateInfo:sB,themeOptions:aB,themeOption:iB,themeOptionSelected:oB,themeOptionHeader:rB,themeOptionLabel:lB,themeOptionDesc:cB,variantToggle:dB,variantButton:uB,variantActive:fB,themeSwatches:pB,themeSwatch:mB,systemToggle:hB,systemToggleHint:gB,themeActive:vB,aboutGrid:yB,aboutItem:bB,aboutLabel:_B,aboutValue:xB,aboutDot:kB,aboutDotConnected:SB,aboutDotDisconnected:TB,aboutDotConnecting:jB},wB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function NB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,k]=y.useState(null),S=w=>{if(w.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),b("")},T=w=>{k(w)},j=()=>{_&&(o(_),r==null||r("Token deleted","info")),k(null)};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>k(null)}),i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),i.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:fe.tokenList,children:t.map(w=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenBadge,children:w.tokenType}),i.jsx("span",{className:fe.tokenName,children:w.name}),i.jsx("span",{className:fe.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),i.jsx("button",{className:fe.deleteButton,onClick:()=>T(w.name),title:`Delete ${w.name}`,"aria-label":`Delete ${w.name}`,children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]},w.name))}),i.jsxs("form",{className:fe.addForm,onSubmit:S,children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:w=>d(w.target.value)}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:w=>p(w.target.value)})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsx("select",{className:fe.select,value:m,onChange:w=>g(w.target.value),children:wB.map(w=>i.jsx("option",{value:w.value,children:w.label},w.value))}),i.jsx("input",{className:fe.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),i.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Ed=[{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"]}],H1=new Set(Ed.map(t=>t.id)),Yb="grackle";function am(t){return Ed.find(s=>s.id===t)}function CB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),i.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:fe.themeOptions,children:Ed.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return i.jsxs("button",{type:"button",className:`${fe.themeOption} ${p?fe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:fe.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:fe.themeOptionLabel,children:d.label}),i.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:fe.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${p&&m?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),i.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${p&&!m?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&i.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:fe.systemToggle,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),i.jsx("span",{children:"Match system light/dark preference"})]}),i.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:fe.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}const EB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},AB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function DB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"About"}),i.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:fe.aboutGrid,children:[i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Connection"}),i.jsxs("span",{className:fe.aboutValue,children:[i.jsx("span",{className:`${fe.aboutDot} ${AB[t]}`}),EB[t]]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Environments"}),i.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:fe.aboutValue,children:d})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Version"}),i.jsx("span",{className:fe.aboutValue,children:"0.120.0"})]})]})]})}const MB="_container_cddyd_1",RB="_header_cddyd_8",IB="_headerTitle_cddyd_35",OB="_badge_cddyd_44",BB="_headerActions_cddyd_54",LB="_body_cddyd_61",zB="_formContent_cddyd_73",$B="_section_cddyd_85",HB="_label_cddyd_91",PB="_titleInput_cddyd_98",UB="_descriptionTextarea_cddyd_131",VB="_parentContext_cddyd_167",qB="_parentLabel_cddyd_175",GB="_parentName_cddyd_182",FB="_personaSelect_cddyd_186",KB="_depList_cddyd_220",ZB="_depItem_cddyd_226",YB="_depItemSelected_cddyd_248",JB="_noDeps_cddyd_252",WB="_btnPrimary_cddyd_258",XB="_btnGhost_cddyd_289",at={container:MB,header:RB,headerTitle:IB,badge:OB,headerActions:BB,body:LB,formContent:zB,section:$B,label:HB,titleInput:PB,descriptionTextarea:UB,parentContext:VB,parentLabel:qB,parentName:GB,personaSelect:FB,depList:KB,depItem:ZB,depItemSelected:YB,noDeps:JB,btnPrimary:WB,btnGhost:XB};function P1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=vt(),k=t==="edit",S=k&&s?d.find(_e=>_e.id===s):void 0,T=k?(S==null?void 0:S.workspaceId)??"":o??"",[j,w]=y.useState(T),C=T||j,D=u.find(_e=>_e.id===C),A=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!k&&!o,R=k?(S==null?void 0:S.parentTaskId)??"":r??"",O=R?d.find(_e=>_e.id===R):void 0,[M,$]=y.useState((S==null?void 0:S.title)??""),[Y,V]=y.useState((S==null?void 0:S.description)??""),[ee,le]=y.useState((S==null?void 0:S.dependsOn)??[]),[Z,ae]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[H,B]=y.useState((S==null?void 0:S.canDecompose)??!1),[F,ge]=y.useState(!1),ne=y.useRef(!1);y.useEffect(()=>{k&&S&&!ne.current&&(ne.current=!0,$(S.title),V(S.description),le(S.dependsOn),ae(S.defaultPersonaId),B(S.canDecompose))},[k,S]);const ce=d.filter(_e=>_e.workspaceId===C&&(!k||_e.id!==s)&&_e.id!==R),me=M.trim().length>0&&(!k||S!==void 0)&&C.length>0,ke=_e=>{le(Oe=>Oe.includes(_e)?Oe.filter(Ht=>Ht!==_e):[...Oe,_e])},De=()=>{!me||F||k&&S===void 0||(k&&s?(g(s,M.trim(),Y,ee,Z),b==null||b("Task updated","success"),v?v():_(os(s,void 0,C,A),{replace:!0})):(ge(!0),m(C,M.trim(),Y,ee.length>0?ee:void 0,R||void 0,Z,H,()=>{b==null||b("Task created","success"),_(o?ji(o,A):"/tasks",{replace:!0})},_e=>{b==null||b(_e,"error"),ge(!1)})))},ot=()=>{if(v){v();return}_(k&&s?os(s,void 0,C,A):o?ji(o,A):"/tasks")},yt=k?"edit task":R?"child task":"new task";return i.jsxs("div",{className:at.container,children:[i.jsxs("div",{className:at.header,children:[i.jsxs("div",{className:at.headerTitle,children:[i.jsx("span",{className:at.badge,children:yt}),O&&i.jsxs("span",{className:at.parentContext,children:[i.jsx("span",{className:at.parentLabel,children:"Child of"}),i.jsx("span",{className:at.parentName,children:O.title})]})]}),i.jsxs("div",{className:at.headerActions,children:[i.jsx("button",{onClick:De,disabled:!me||F,className:at.btnPrimary,"data-testid":"task-edit-save",children:F?"Creating…":k?"Save Changes":"Create"}),i.jsx("button",{onClick:ot,className:at.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:at.body,children:i.jsxs("div",{className:at.formContent,children:[E&&i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:j,onChange:_e=>w(_e.target.value),className:at.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(_e=>i.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:M,onChange:_e=>$(_e.target.value),placeholder:"Task title...",autoFocus:!0,className:at.titleInput,"data-testid":"task-edit-title",onKeyDown:_e=>{_e.key==="Enter"&&me&&De()}})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:Y,onChange:_e=>V(_e.target.value),placeholder:"Describe the task... (markdown supported)",className:at.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:at.section,children:[i.jsx("label",{className:at.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:Z,onChange:_e=>ae(_e.target.value),className:at.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(_e=>i.jsx("option",{value:_e.id,children:_e.name},_e.id))]})]}),!k&&i.jsx("div",{className:at.section,children:i.jsxs("label",{className:at.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:H,onChange:_e=>B(_e.target.checked)}),"Can spawn subtasks"]})}),i.jsxs("div",{className:at.section,children:[i.jsx("div",{className:at.label,children:"Dependencies"}),ce.length===0?i.jsx("div",{className:at.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:at.depList,children:ce.map(_e=>{const Oe=ee.includes(_e.id);return i.jsxs("label",{className:`${at.depItem} ${Oe?at.depItemSelected:""}`,"data-testid":`dep-option-${_e.id}`,children:[i.jsx("input",{type:"checkbox",checked:Oe,onChange:()=>ke(_e.id)}),_e.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",_e.status,")"]})]},_e.id)})})]})]})})]})}const QB="_actionButtons_1rjka_1",eL="_btnPrimary_1rjka_8",tL="_btnDanger_1rjka_39",nL="_btnGhost_1rjka_78",Zt={actionButtons:QB,btnPrimary:eL,btnDanger:tL,btnGhost:nL};function sL({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return o?i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Zt.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Zt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Zt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Zt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const aL="_workpadSection_y8nj9_1",iL="_workpadLabel_y8nj9_9",oL="_workpadStatus_y8nj9_17",rL="_workpadSummary_y8nj9_23",lL="_workpadExtra_y8nj9_29",Pa={workpadSection:aL,workpadLabel:iL,workpadStatus:oL,workpadSummary:rL,workpadExtra:lL};function cL({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return i.jsxs("div",{className:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),i.jsx("div",{className:Pa.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:Pa.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:Pa.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:Pa.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const dL="_overviewDashboard_r05qm_1",uL="_overviewHero_r05qm_7",fL="_statusBadge_r05qm_14",pL="_statusPending_r05qm_26",mL="_statusAssigned_r05qm_31",hL="_statusInProgress_r05qm_36",gL="_statusReview_r05qm_41",vL="_statusDone_r05qm_46",yL="_statusFailed_r05qm_51",bL="_statusWaitingInput_r05qm_56",_L="_overviewBranchPill_r05qm_61",xL="_branchLink_r05qm_76",kL="_overviewSection_r05qm_87",SL="_overviewLabel_r05qm_93",TL="_overviewValue_r05qm_100",jL="_overviewMuted_r05qm_105",wL="_overviewMarkdown_r05qm_111",NL="_envRow_r05qm_180",CL="_envDot_r05qm_186",EL="_envDotGreen_r05qm_193",AL="_envDotYellow_r05qm_197",DL="_envDotRed_r05qm_201",ML="_envDotGray_r05qm_205",RL="_depList_r05qm_209",IL="_depItem_r05qm_215",OL="_depBlocked_r05qm_222",BL="_depDone_r05qm_226",LL="_timeline_r05qm_230",zL="_timelineRow_r05qm_236",$L="_timelineKey_r05qm_243",HL="_timelineValue_r05qm_249",PL="_timelineDelta_r05qm_253",UL="_reviewNotes_r05qm_264",be={overviewDashboard:dL,overviewHero:uL,statusBadge:fL,statusPending:pL,statusAssigned:mL,statusInProgress:hL,statusReview:gL,statusDone:vL,statusFailed:yL,statusWaitingInput:bL,overviewBranchPill:_L,branchLink:xL,overviewSection:kL,overviewLabel:SL,overviewValue:TL,overviewMuted:jL,overviewMarkdown:wL,envRow:NL,envDot:CL,envDotGreen:EL,envDotYellow:AL,envDotRed:DL,envDotGray:ML,depList:RL,depItem:IL,depBlocked:OL,depDone:BL,timeline:LL,timelineRow:zL,timelineKey:$L,timelineValue:HL,timelineDelta:PL,reviewNotes:UL};function Hc(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 kp(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 Jb(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 VL({status:t}){const s=Ka(t),o=Pj(t);return i.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function qL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(S=>S.id===g):void 0,b=r.find(S=>S.id===t.workspaceId),_=o.find(S=>S.id===d),k=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:be.overviewHero,children:[i.jsx(VL,{status:t.status}),t.branch&&i.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:k?i.jsxs("a",{href:k,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:be.overviewLabel,children:"Description"}),i.jsx("div",{className:be.overviewMarkdown,children:i.jsx(um,{remarkPlugins:[fm],children:t.description})})]}),t.workpad&&i.jsx(cL,{workpad:t.workpad}),i.jsxs("div",{className:be.overviewSection,children:[i.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Jb(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Jb(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:_.displayName}),i.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:be.overviewMuted,children:"None"}):i.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const T=s.get(S),j=(T==null?void 0:T.status)==="complete";return i.jsxs("div",{className:`${be.depItem} ${j?be.depDone:be.depBlocked}`,children:[i.jsx("span",{children:j?"✓":"○"}),i.jsx("span",{children:(T==null?void 0:T.title)??S})]},S)})})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:be.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:be.timeline,children:[t.createdAt&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Created"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=kp(t.createdAt,t.assignedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Assigned"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.assignedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=kp(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Started"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.startedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=kp(t.startedAt,t.completedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Completed"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.completedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:be.overviewLabel,children:"Usage"}),i.jsxs("div",{className:be.timeline,children:[i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsx("span",{className:be.timelineValue,children:As(u.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:be.timelineValue,children:As(p.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:be.overviewLabel,children:"Budget"}),i.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Tokens"}),i.jsxs("span",{className:be.timelineValue,children:[Oo(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Oo(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsxs("span",{className:be.timelineValue,children:[As((u==null?void 0:u.costMillicents)??0)," / ",As(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function GL({plugins:t,loading:s,onSetPluginEnabled:o}){return i.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[i.jsx("h2",{className:fe.heading,children:"Plugins"}),i.jsxs("div",{className:fe.section,children:[i.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&i.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&i.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return i.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&i.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),i.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&i.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),i.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:i.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function FL({githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u}){const[p,m]=y.useState(""),[g,v]=y.useState(""),[b,_]=y.useState(!1),[k,S]=y.useState(!1),[T,j]=y.useState(!1),[w,C]=y.useState(null),D=t.find(M=>M.id===w),A=async M=>{if(M.preventDefault(),!(!p.trim()||!g.trim())){S(!0);try{await o(p.trim(),g.trim(),"",b),u==null||u("GitHub account added","success"),m(""),v(""),_(!1)}catch($){const Y=$ instanceof Error?$.message:"Failed to add account";u==null||u(Y,"error")}finally{S(!1)}}},E=async M=>{try{await r(M,{isDefault:!0}),u==null||u("Default account updated","success")}catch($){const Y=$ instanceof Error?$.message:"Failed to update account";u==null||u(Y,"error")}},R=async()=>{if(w)try{await c(w),u==null||u("GitHub account removed","info")}catch(M){const $=M instanceof Error?M.message:"Failed to remove account";u==null||u($,"error")}finally{C(null)}},O=async()=>{j(!0);try{const M=await d();M.imported>0?u==null||u(`Imported ${M.imported} account(s): ${M.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(M){const $=M instanceof Error?M.message:"Import failed";u==null||u($,"error")}finally{j(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:w!==null,title:"Remove GitHub Account?",description:D?`"${D.label}"${D.username?` (@${D.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{R().catch(()=>{})},onCancel:()=>C(null)}),i.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),i.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?i.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):i.jsx("div",{className:fe.tokenList,children:t.map(M=>i.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${M.id}`,children:[M.isDefault&&i.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),i.jsx("span",{className:fe.tokenName,children:M.label}),M.username&&i.jsxs("span",{className:fe.tokenTarget,children:["@",M.username]}),!M.isDefault&&i.jsx("button",{className:fe.deleteButton,onClick:()=>{E(M.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${M.label} as default`,"data-testid":`github-account-set-default-${M.id}`,children:i.jsx(Oj,{size:zt,"aria-hidden":"true"})}),i.jsx("button",{className:fe.deleteButton,onClick:()=>C(M.id),title:`Remove ${M.label}`,"aria-label":`Remove ${M.label}`,"data-testid":`github-account-remove-${M.id}`,children:i.jsx(Is,{size:zt,"aria-hidden":"true"})})]},M.id))}),i.jsxs("form",{className:fe.addForm,onSubmit:M=>{A(M).catch(()=>{})},children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:p,onChange:M=>m(M.target.value),"data-testid":"github-account-label-input"}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:g,onChange:M=>v(M.target.value),"data-testid":"github-account-token-input"})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:b,onChange:M=>_(M.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),i.jsx("button",{className:fe.addButton,type:"submit",disabled:!p.trim()||!g.trim()||k,"data-testid":"github-account-add-button",children:k?"Adding...":"Add Account"}),i.jsx("button",{className:fe.addButton,type:"button",onClick:()=>{O().catch(()=>{})},disabled:T,"data-testid":"github-account-import-button",children:T?"Importing...":"Import from gh CLI"})]})]})]})]})}const KL="_container_legrg_1",ZL="_header_legrg_8",YL="_headerTitle_legrg_35",JL="_badge_legrg_44",WL="_headerActions_legrg_54",XL="_body_legrg_61",QL="_formContent_legrg_73",e8="_section_legrg_85",t8="_label_legrg_91",n8="_nameInput_legrg_98",s8="_fieldInput_legrg_131",a8="_adapterSelect_legrg_164",i8="_readOnlyValue_legrg_198",o8="_codespaceSection_legrg_204",r8="_codespaceActions_legrg_210",l8="_creatingHint_legrg_216",c8="_errorHint_legrg_222",d8="_btnPrimary_legrg_235",u8="_btnGhost_legrg_266",oe={container:KL,header:ZL,headerTitle:YL,badge:JL,headerActions:WL,body:XL,formContent:QL,section:e8,label:t8,nameInput:n8,fieldInput:s8,adapterSelect:a8,readOnlyValue:i8,codespaceSection:o8,codespaceActions:r8,creatingHint:l8,errorHint:c8,btnPrimary:d8,btnGhost:u8},ed=1,td=65535;function Sp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=ed&&s<=td}function Tp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function f8({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[k,S]=y.useState("");return g==="create"?i.jsxs("div",{className:oe.codespaceSection,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repository"}),i.jsx("input",{type:"text",value:b,onChange:T=>_(T.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:k,onChange:T=>S(T.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:oe.codespaceActions,children:[i.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:oe.codespaceSection,children:i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:T=>{T.target.value==="__create__"?(v("create"),s("")):(s(T.target.value),T.target.value&&!o.trim()&&r(T.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(T=>i.jsxs("option",{value:T.name,children:[T.name," (",T.repository,") — ",T.state]},T.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:oe.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:T=>s(T.target.value),placeholder:"Or enter codespace name manually...",className:oe.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:oe.errorHint,children:d})]})})}function U1({mode:t,environmentId:s,environments:o,githubAccounts:r,onAddEnvironment:c,onUpdateEnvironment:d,onListCodespaces:u,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b,onListDockerContainers:_,dockerContainers:k,dockerContainersError:S,onShowToast:T}){const j=vt(),w=t==="edit",C=w&&s?o.find(re=>re.id===s):void 0,[D,A]=y.useState(""),[E,R]=y.useState("local"),[O,M]=y.useState(""),[$,Y]=y.useState(""),[V,ee]=y.useState(""),[le,Z]=y.useState(""),[ae,H]=y.useState(""),[B,F]=y.useState(""),[ge,ne]=y.useState(""),[ce,me]=y.useState(""),[ke,De]=y.useState("create"),[ot,yt]=y.useState(""),[_e,Oe]=y.useState(null),Ht=y.useCallback(()=>{const re={};if(E==="local"){if(O.trim()&&(re.host=O.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.port=ve)}}else if(E==="ssh"){if(re.host=O.trim(),V.trim()&&(re.user=V.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.sshPort=ve)}le.trim()&&(re.identityFile=le.trim())}else E==="docker"?ke==="attach"?ot.trim()&&(re.attach=ot.trim()):(ae.trim()&&(re.image=ae.trim()),B.trim()&&(re.repo=B.trim())):E==="codespace"&&(re.codespaceName=ge.trim());return re},[E,O,$,V,le,ae,B,ge,ke,ot]),Nt=()=>!(!D.trim()||E==="ssh"&&!O.trim()||E==="codespace"&&!ge.trim()||E==="docker"&&ke==="attach"&&!ot.trim()||(E==="local"||E==="ssh")&&!Sp($)),ue=()=>{Nt()&&(c(D.trim(),E,Ht(),ce||void 0),T==null||T("Environment added successfully","success"),j(Ro,{replace:!0}))},Re=()=>{j(s?Io(s):Ro)},Q=y.useCallback((re,ve)=>{if(!C||!s)return;const Xe=Tp(C.adapterConfig),an=ve.trim();an?Xe[re]=an:delete Xe[re],d(s,{adapterConfig:Xe})},[C,s,d]),et=y.useCallback((re,ve)=>{if(!C||!s)return;const Xe=Tp(C.adapterConfig);if(ve.trim()){const an=Number(ve);Number.isInteger(an)&&an>=ed&&an<=td&&(Xe[re]=an)}else delete Xe[re];d(s,{adapterConfig:Xe})},[C,s,d]);if(w){if(!C)return i.jsxs("div",{className:oe.container,children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsx("div",{className:oe.formContent,children:i.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const re=Tp(C.adapterConfig);return i.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Name"}),i.jsx(Bt,{value:C.displayName,onSave:ve=>{s&&d(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:_e,onActivate:Oe,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Adapter Type"}),i.jsx("span",{className:oe.readOnlyValue,"data-testid":"env-edit-adapter-type",children:C.adapterType})]}),(C.adapterType==="codespace"||C.adapterType==="docker")&&(r.length>0||!!C.githubAccountId)&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"GitHub Account"}),i.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:oe.adapterSelect,"data-testid":"env-edit-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>i.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Bt,{value:String(re.host??""),onSave:ve=>Q("host",ve),mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Port"}),i.jsx(Bt,{value:String(re.port??""),onSave:ve=>et("port",ve),validate:ve=>Sp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),C.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Bt,{value:String(re.host??""),onSave:ve=>Q("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:_e,onActivate:Oe,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"User"}),i.jsx(Bt,{value:String(re.user??""),onSave:ve=>Q("user",ve),mode:"edit",fieldId:"user",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"SSH Port"}),i.jsx(Bt,{value:String(re.sshPort??""),onSave:ve=>et("sshPort",ve),validate:ve=>Sp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:_e,onActivate:Oe,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Identity File"}),i.jsx(Bt,{value:String(re.identityFile??""),onSave:ve=>Q("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:_e,onActivate:Oe,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),C.adapterType==="docker"&&re.attach!==void 0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Attach (container)"}),i.jsx(Bt,{value:String(re.attach??""),onSave:ve=>Q("attach",ve),validate:ve=>ve.trim()===""?"Container name is required":void 0,mode:"edit",fieldId:"attach",activeFieldId:_e,onActivate:Oe,placeholder:"container name or ID",ariaLabel:"Attach container","data-testid":"env-edit-attach"})]}),C.adapterType==="docker"&&re.attach===void 0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Image"}),i.jsx(Bt,{value:String(re.image??""),onSave:ve=>Q("image",ve),mode:"edit",fieldId:"image",activeFieldId:_e,onActivate:Oe,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repo"}),i.jsx(Bt,{value:String(re.repo??""),onSave:ve=>Q("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:_e,onActivate:Oe,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),C.adapterType==="codespace"&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace Name"}),i.jsx(Bt,{value:String(re.codespaceName??""),onSave:ve=>Q("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:_e,onActivate:Oe,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"new environment"})}),i.jsxs("div",{className:oe.headerActions,children:[i.jsx("button",{onClick:ue,disabled:!Nt(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:D,onChange:re=>A(re.target.value),placeholder:"Environment name...",autoFocus:!0,className:oe.nameInput,"data-testid":"env-create-name",onKeyDown:re=>{re.key==="Enter"&&Nt()&&ue()}})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:E,onChange:re=>{R(re.target.value),re.target.value==="codespace"&&u(ce||void 0)},className:oe.adapterSelect,"data-testid":"env-create-adapter",children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"ssh",children:"ssh"}),i.jsx("option",{value:"docker",children:"docker"}),i.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),i.jsxs("select",{id:"env-create-github-account",value:ce,onChange:re=>{me(re.target.value),E==="codespace"&&u(re.target.value||void 0)},className:oe.adapterSelect,"data-testid":"env-create-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(re=>i.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>M(re.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ed,max:td,value:$,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>M(re.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:V,onChange:re=>ee(re.target.value),placeholder:"User (optional)...",className:oe.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ed,max:td,value:$,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:le,onChange:re=>Z(re.target.value),placeholder:"Identity file (optional)...",className:oe.fieldInput,"data-testid":"env-create-identity"})]})]}),E==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-docker-mode",children:"Source"}),i.jsxs("select",{id:"env-docker-mode",value:ke,onChange:re=>{const ve=re.target.value;De(ve),ve==="attach"&&_()},className:oe.adapterSelect,"data-testid":"env-docker-mode",children:[i.jsx("option",{value:"create",children:"Create new container"}),i.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),ke==="create"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:ae,onChange:re=>H(re.target.value),placeholder:"Image (optional)...",className:oe.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:B,onChange:re=>F(re.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}):i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Container"}),!S&&k.length>0&&i.jsxs("select",{value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&A(re.target.value)},className:oe.adapterSelect,"data-testid":"env-docker-container-select",children:[i.jsx("option",{value:"",children:"Select a container..."}),k.map(re=>i.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(S||k.length===0)&&i.jsxs(i.Fragment,{children:[S?i.jsx("span",{className:oe.errorHint,children:S}):i.jsx("span",{className:oe.creatingHint,children:"No running containers found."}),i.jsx("input",{type:"text",value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&A(re.target.value)},placeholder:"Enter container name/ID...",className:oe.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&i.jsx(f8,{codespaceName:ge,onCodespaceNameChange:ne,envName:D,onEnvNameChange:A,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b})]})})]})}const p8="_group_1iprv_1",m8="_groupTitle_1iprv_8",h8="_shortcutList_1iprv_17",g8="_shortcutRow_1iprv_23",v8="_keys_1iprv_36",y8="_kbd_1iprv_43",b8="_description_1iprv_60",yi={group:p8,groupTitle:m8,shortcutList:h8,shortcutRow:g8,keys:v8,kbd:y8,description:b8},_8=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Root",shortcuts:[{keys:["Ctrl/Cmd","Enter"],description:"Send message (when the composer is focused)"},{keys:["Enter"],description:"Insert a new line in the message composer"}]}];function x8(){return i.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),_8.map(t=>i.jsxs("div",{className:yi.group,children:[i.jsx("h4",{className:yi.groupTitle,children:t.title}),i.jsx("div",{className:yi.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:yi.shortcutRow,children:[i.jsx("span",{className:yi.keys,children:s.keys.map(o=>i.jsx("kbd",{className:yi.kbd,children:o},o))}),i.jsx("span",{className:yi.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 S8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),i.jsx("div",{className:fe.tokenList,children:k8.map(r=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenName,children:r.label}),i.jsx("span",{className:fe.tokenTarget,children:r.description}),i.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>i.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const T8="_container_10efq_1",j8="_header_10efq_7",w8="_list_10efq_105",N8="_card_10efq_111",C8="_cardHeader_10efq_125",E8="_cardTitle_10efq_135",A8="_defaultBadge_10efq_141",D8="_cardActions_10efq_155",M8="_description_10efq_160",R8="_meta_10efq_166",I8="_empty_10efq_212",O8="_typeBadge_10efq_362",es={container:T8,header:j8,list:w8,card:N8,cardHeader:C8,cardTitle:E8,defaultBadge:A8,cardActions:D8,description:M8,meta:R8,empty:I8,typeBadge:O8};function B8({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),p(null)};return i.jsxs("div",{className:es.container,children:[i.jsxs("div",{className:es.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:es.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:es.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return i.jsxs("div",{className:es.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(v.id))},children:[i.jsxs("div",{className:es.cardHeader,children:[i.jsxs("span",{className:es.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:es.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&i.jsx("span",{className:es.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:es.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:es.description,children:v.description}),i.jsxs("div",{className:es.meta,children:[v.runtime&&i.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&i.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&i.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),i.jsx(ys,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const L8="_container_uy08i_1",z8="_header_uy08i_7",$8="_count_uy08i_13",H8="_presets_uy08i_18",P8="_presetButton_uy08i_24",U8="_filterInput_uy08i_41",V8="_groups_uy08i_53",q8="_group_uy08i_53",G8="_groupHeader_uy08i_68",F8="_groupName_uy08i_77",K8="_groupCount_uy08i_81",Z8="_toolList_uy08i_87",Y8="_toolItem_uy08i_95",J8="_toolName_uy08i_103",yn={container:L8,header:z8,count:$8,presets:H8,presetButton:P8,filterInput:U8,groups:V8,group:q8,groupHeader:G8,groupName:F8,groupCount:K8,toolList:Z8,toolItem:Y8,toolName:J8},W8=(()=>{const t=new Map;for(const s of b_){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()}))})(),X8=[{name:"default",label:"Default",tools:y_},{name:"worker",label:"Worker",tools:O2},{name:"orchestrator",label:"Orchestrator",tools:B2},{name:"admin",label:"Admin",tools:L2}];function Wb({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,o]),p=y.useCallback((v,b)=>{if(o)return;const _=new Set(d);for(const k of v)b?_.delete(k):_.add(k);s([..._].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:yn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:yn.header,children:i.jsx("span",{className:yn.count,children:t.length===0?`Using default (${y_.length} tools)`:`${t.length} of ${b_.size} tools selected`})}),i.jsxs("div",{className:yn.presets,"data-testid":"mcp-tool-presets",children:[X8.map(v=>i.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:yn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:yn.groups,children:W8.map(({group:v,tools:b})=>{const _=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(_.length===0)return null;const k=_.every(S=>d.has(S));return i.jsxs("div",{className:yn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:yn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:yn.groupName,children:v}),i.jsxs("span",{className:yn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),i.jsx("div",{className:yn.toolList,children:_.map(S=>i.jsxs("label",{className:yn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),i.jsx("span",{className:yn.toolName,children:S})]},S))})]},v)})})]})}function im(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function V1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(p<7)return`in ${p} day${p===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Q8="_container_1gfuq_1",e7="_header_1gfuq_7",t7="_list_1gfuq_19",n7="_card_1gfuq_25",s7="_cardHeader_1gfuq_40",a7="_cardTitle_1gfuq_46",i7="_statusBadge_1gfuq_56",o7="_enabled_1gfuq_68",r7="_disabled_1gfuq_71",l7="_cardActions_1gfuq_75",c7="_cardMeta_1gfuq_80",d7="_empty_1gfuq_98",ts={container:Q8,header:e7,list:t7,card:n7,cardHeader:s7,cardTitle:a7,statusBadge:i7,enabled:o7,disabled:r7,cardActions:l7,cardMeta:c7,empty:d7};function u7({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=y.useState(null),m=u?t.find(_=>_.id===u):void 0,g=async _=>{await o(_),p(null)},v=y.useMemo(()=>{const _=new Map;for(const k of s)_.set(k.id,k.name);return _},[s]),b=_=>v.get(_)??_;return i.jsxs("div",{className:ts.container,children:[i.jsxs("div",{className:ts.header,children:[i.jsx("h2",{children:"Schedules"}),i.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?i.jsx("p",{className:ts.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):i.jsx("div",{className:ts.list,children:t.map(_=>i.jsxs("div",{className:ts.card,"data-testid":`schedule-card-${_.id}`,onClick:()=>d(_.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(_.id))},children:[i.jsxs("div",{className:ts.cardHeader,children:[i.jsxs("span",{className:ts.cardTitle,children:[i.jsx("strong",{children:_.title}),i.jsx("span",{className:`${ts.statusBadge} ${_.enabled?ts.enabled:ts.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:ts.cardActions,onClick:k=>k.stopPropagation(),children:[i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(_.id,{enabled:!_.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${_.id}`,title:_.enabled?"Disable schedule":"Enable schedule",children:_.enabled?"Disable":"Enable"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),i.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),i.jsxs("div",{className:ts.cardMeta,children:[i.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&i.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?im(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?i.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",V1(_.nextRunAt)]}):null,_.runCount>0&&i.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),i.jsx(ys,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const f7="_nav_1bhou_1",p7="_tab_1bhou_24",m7="_tabIcon_1bhou_62",h7="_tabActive_1bhou_68",Pc={nav:f7,tab:p7,tabIcon:m7,tabActive:h7},na=[{path:"credentials",label:"Credentials",icon:i.jsx(ej,{size:wt})},{path:"github-accounts",label:"GitHub Accounts",icon:i.jsx(KT,{size:wt})},{path:"personas",label:"Personas",icon:i.jsx(zj,{size:wt})},{path:"schedules",label:"Schedules",icon:i.jsx(TT,{size:wt})},{path:"appearance",label:"Appearance",icon:i.jsx(_j,{size:wt})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(nj,{size:wt})},{path:"plugins",label:"Plugins",icon:i.jsx(wj,{size:wt})},{path:"about",label:"About",icon:i.jsx(pm,{size:wt})}];function g7(){var u;const t=Jt(),s=vt(),o=y.useRef(null),r=((u=na.find(p=>{const m=`${ki}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??na[0].path,c=y.useCallback(p=>{s(`${ki}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const m=(k=o.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(T=>T===document.activeElement),v=g>=0?g:na.findIndex(T=>T.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%na.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+na.length)%na.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=na.length-1;else return;const _=na[b].path;s(`${ki}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return i.jsx("nav",{className:Pc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:na.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Pc.tab} ${m?Pc.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:Pc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const v7=["lifecycle:","pipe:","stdin:"];function q1(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function y7(t,s){let o=!1;for(const r of t.subscribers){const c=s.get(r.sessionId);if(c&&(o=!0,c.taskId))return{kind:"task",taskId:c.taskId}}return o?{kind:"unattached"}:{kind:"external"}}function b7(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const p=y7(u,o);if(p.kind==="task"){const m=r.get(p.taskId);m?m.push(u):r.set(p.taskId,[u])}else c.push(u)}const d=Array.from(r,([u,p])=>({taskId:u,streams:p}));return c.length>0&&d.push({taskId:void 0,streams:c}),d}const _7="_container_16qkd_1",x7="_header_16qkd_7",k7="_title_16qkd_15",S7="_headerActions_16qkd_21",T7="_internalsToggle_16qkd_27",j7="_refreshButton_16qkd_37",w7="_state_16qkd_52",N7="_group_16qkd_59",C7="_groupHeader_16qkd_63",E7="_row_16qkd_72",A7="_selected_16qkd_92",D7="_kindBadge_16qkd_96",M7="_kindChatroom_16qkd_108",R7="_kindPipe_16qkd_114",I7="_kindChannel_16qkd_120",O7="_streamName_16qkd_126",B7="_meta_16qkd_135",Yt={container:_7,header:x7,title:k7,headerActions:S7,internalsToggle:T7,refreshButton:j7,state:w7,group:N7,groupHeader:C7,row:E7,selected:A7,kindBadge:D7,kindChatroom:M7,kindPipe:R7,kindChannel:I7,streamName:O7,meta:B7},L7={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function z7({kind:t}){return t==="chatroom"?i.jsx(mj,{size:Ze,"aria-hidden":"true"}):t==="pipe"?i.jsx(GT,{size:Ze,"aria-hidden":"true"}):i.jsx(YT,{size:Ze,"aria-hidden":"true"})}function $7({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:p,selectedStreamId:m,onSelectStream:g,onRefresh:v}){const b=b7(t,s),_={chatroom:Yt.kindChatroom,pipe:Yt.kindPipe,channel:Yt.kindChannel},k=S=>{var T;return((T=o.find(j=>j.id===S))==null?void 0:T.title)??S};return i.jsxs("div",{className:Yt.container,"data-testid":"coordination-list",children:[i.jsxs("div",{className:Yt.header,children:[i.jsx("span",{className:Yt.title,children:"Coordination"}),i.jsxs("div",{className:Yt.headerActions,children:[i.jsxs("label",{className:Yt.internalsToggle,children:[i.jsx("input",{type:"checkbox",checked:u,onChange:S=>p(S.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&i.jsx("button",{type:"button",className:Yt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:i.jsx(Cj,{size:Ze,"aria-hidden":"true"})})]})]}),r&&t.length===0&&i.jsxs("div",{className:Yt.state,children:["Loading","…"]}),!r&&c&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-empty",children:"No active streams"}),b.map(S=>i.jsxs("div",{className:Yt.group,children:[i.jsx("div",{className:Yt.groupHeader,children:S.taskId?k(S.taskId):"Unattached / external (CLI · MCP)"}),S.streams.map(T=>{const j=q1(T),w=T.id===m;return i.jsxs("button",{type:"button",className:`${Yt.row}${w?` ${Yt.selected}`:""}`,onClick:()=>g(T.id),"data-testid":`coordination-row-${T.id}`,"aria-current":w?"page":void 0,children:[i.jsxs("span",{className:`${Yt.kindBadge} ${_[j]}`,children:[i.jsx(z7,{kind:j})," ",L7[j]]}),i.jsx("span",{className:Yt.streamName,children:T.name}),i.jsxs("span",{className:Yt.meta,children:[T.subscriberCount," ",T.subscriberCount===1?"sub":"subs"," ","·"," ",T.messageBufferDepth," buffered"]})]},T.id)})]},S.taskId??"__orphans__"))]})}const H7="_transcript_1p4cm_1",P7="_message_1p4cm_10",U7="_meta_1p4cm_16",V7="_sender_1p4cm_24",q7="_time_1p4cm_29",G7="_content_1p4cm_34",F7="_state_1p4cm_42",Ua={transcript:H7,message:P7,meta:U7,sender:V7,time:q7,content:G7,state:F7};function K7(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleTimeString()}function Z7({messages:t,loading:s=!1}){return s?i.jsx("div",{className:Ua.state,"data-testid":"stream-transcript-loading",children:"Loading transcript…"}):t.length===0?i.jsx("div",{className:Ua.state,"data-testid":"stream-transcript-empty",children:"No messages yet."}):i.jsx("div",{className:Ua.transcript,"data-testid":"stream-transcript",children:t.map(o=>i.jsxs("div",{className:Ua.message,"data-testid":"stream-transcript-message",children:[i.jsxs("div",{className:Ua.meta,children:[i.jsx("span",{className:Ua.sender,title:o.senderId,children:o.senderId.slice(0,12)}),i.jsx("span",{className:Ua.time,children:K7(o.timestamp)})]}),i.jsx("div",{className:Ua.content,children:o.content})]},o.seq))})}const Y7="_panel_iibrt_1",J7="_header_iibrt_24",W7="_title_iibrt_33",X7="_closeButton_iibrt_43",Q7="_body_iibrt_57",ez="_section_iibrt_63",tz="_sectionLabel_iibrt_67",nz="_metaRow_iibrt_76",sz="_metaKey_iibrt_84",az="_metaValue_iibrt_90",iz="_subscriberCard_iibrt_99",oz="_subscriberHeader_iibrt_107",rz="_sessionLink_iibrt_114",lz="_badges_iibrt_132",cz="_badgeRw_iibrt_150 _badge_iibrt_132",dz="_badgeR_iibrt_150 _badge_iibrt_132",uz="_badgeW_iibrt_162 _badge_iibrt_132",fz="_badgeAsync_iibrt_168 _badge_iibrt_132",pz="_badgeSync_iibrt_174 _badge_iibrt_132",mz="_badgeDetach_iibrt_178 _badge_iibrt_132",hz="_spawnTag_iibrt_184 _badge_iibrt_132",gz="_fdNumber_iibrt_189",vz="_emptySubscribers_iibrt_195",yz="_metaValueMono_iibrt_201 _metaValue_iibrt_90",bz="_advanced_iibrt_216",_z="_advancedSummary_iibrt_220",Pe={panel:Y7,header:J7,title:W7,closeButton:X7,body:Q7,section:ez,sectionLabel:tz,metaRow:nz,metaKey:sz,metaValue:az,subscriberCard:iz,subscriberHeader:oz,sessionLink:rz,badges:lz,badgeRw:cz,badgeR:dz,badgeW:uz,badgeAsync:fz,badgeSync:pz,badgeDetach:mz,spawnTag:hz,fdNumber:gz,emptySubscribers:vz,metaValueMono:yz,advanced:bz,advancedSummary:_z},xz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function kz({permission:t}){const s=t==="rw"?Pe.badgeRw:t==="r"?Pe.badgeR:Pe.badgeW;return i.jsx("span",{className:s,children:t})}function Sz({mode:t}){const s=t==="async"?Pe.badgeAsync:t==="detach"?Pe.badgeDetach:Pe.badgeSync;return i.jsx("span",{className:s,children:t})}function Tz({stream:t,messages:s,transcriptLoading:o,onClose:r}){const c=vt();return y.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r]),i.jsxs("div",{className:Pe.panel,"data-testid":"stream-detail-panel",children:[i.jsxs("div",{className:Pe.header,children:[i.jsx("h3",{className:Pe.title,children:t.name}),i.jsx("button",{type:"button",className:Pe.closeButton,onClick:r,"aria-label":"Close stream details",children:"×"})]}),i.jsxs("div",{className:Pe.body,children:[i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Overview"}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Kind"}),i.jsx("span",{className:Pe.metaValue,children:xz[q1(t)]})]}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Participants"}),i.jsx("span",{className:Pe.metaValue,children:t.subscriberCount})]}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Buffered"}),i.jsxs("span",{className:Pe.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Participants"}),t.subscribers.length===0?i.jsx("div",{className:Pe.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(d=>i.jsxs("div",{className:Pe.subscriberCard,"data-testid":`subscriber-card-${d.subscriptionId}`,children:[i.jsxs("button",{type:"button",className:Pe.sessionLink,onClick:()=>{c(Sm(d.sessionId))},title:d.sessionId,children:[d.sessionId.slice(0,12),"…"]}),d.createdBySpawn&&i.jsx("span",{className:Pe.spawnTag,children:"spawn"})]},d.subscriptionId))]}),i.jsxs("div",{className:Pe.section,children:[i.jsx("div",{className:Pe.sectionLabel,children:"Conversation"}),i.jsx(Z7,{messages:s??[],loading:o??!1})]}),i.jsxs("details",{className:Pe.advanced,"data-testid":"stream-advanced",children:[i.jsx("summary",{className:Pe.advancedSummary,children:"Advanced"}),i.jsxs("div",{className:Pe.metaRow,children:[i.jsx("span",{className:Pe.metaKey,children:"Stream ID"}),i.jsx("span",{className:Pe.metaValueMono,children:t.id})]}),t.subscribers.map(d=>i.jsxs("div",{className:Pe.subscriberCard,children:[i.jsxs("div",{className:Pe.subscriberHeader,children:[i.jsxs("span",{className:Pe.fdNumber,children:["fd ",d.fd]}),i.jsxs("span",{className:Pe.metaValueMono,title:d.subscriptionId,children:[d.subscriptionId.slice(0,12),"…"]})]}),i.jsxs("div",{className:Pe.badges,children:[i.jsx(kz,{permission:d.permission}),i.jsx(Sz,{mode:d.deliveryMode})]})]},d.subscriptionId))]})]})]})}function jz({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(my.map(d=>[d,[]]));for(const d of t){const u=rl(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(S=>S.status==="complete").length;let b;if(u==="paused"&&o){const S=o.get(d.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(u);k?k.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return my.map(d=>{const u=Ka(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const wz="_boardContainer_1c4y1_1",Nz="_column_1c4y1_17",Cz="_columnHeader_1c4y1_34",Ez="_columnIcon_1c4y1_47",Az="_columnLabel_1c4y1_52",Dz="_columnCount_1c4y1_57",Mz="_cardList_1c4y1_67",Rz="_emptyPlaceholder_1c4y1_76",Iz="_card_1c4y1_67",Oz="_cardHeader_1c4y1_107",Bz="_cardStatusIcon_1c4y1_113",Lz="_cardTitle_1c4y1_119",zz="_cardBadges_1c4y1_127",$z="_badge_1c4y1_134",Hz="_blockedBadge_1c4y1_146",Pz="_childBadge_1c4y1_151",Uz="_depBadge_1c4y1_155",Vz="_parentBadge_1c4y1_159",qz="_pausedSubBadge_1c4y1_166",Gz="_personaBadge_1c4y1_170",Fz="_envBadge_1c4y1_174",Kz="_emptyCta_1c4y1_178",Zz="_ctaButton_1c4y1_188",Yz="_ctaDescription_1c4y1_204",lt={boardContainer:wz,column:Nz,columnHeader:Cz,columnIcon:Ez,columnLabel:Az,columnCount:Dz,cardList:Mz,emptyPlaceholder:Rz,card:Iz,cardHeader:Oz,cardStatusIcon:Bz,cardTitle:Lz,cardBadges:zz,badge:$z,blockedBadge:Hz,childBadge:Pz,depBadge:Uz,parentBadge:Vz,pausedSubBadge:qz,personaBadge:Gz,envBadge:Fz,emptyCta:Kz,ctaButton:Zz,ctaDescription:Yz};function Jz({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=vt(),p=y.useMemo(()=>o.filter(_=>_.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(_=>[_.id,_.status])),[o]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),T=new Map,j=new Map,w=new Map;for(const C of p)if(C.latestSessionId){const D=_.get(C.latestSessionId);if(D){if(T.set(C.id,D.endReason||D.status),D.personaId){const A=k.get(D.personaId);A&&j.set(C.id,A.name)}if(D.environmentId){const A=S.get(D.environmentId);A&&w.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:T,personaNameByTaskId:j,environmentNameByTaskId:w}},[p,r,c,d]),b=y.useMemo(()=>jz({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:lt.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:lt.ctaButton,onClick:()=>u(Di(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:lt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:lt.boardContainer,"data-testid":"board-container",children:b.map(_=>i.jsxs("section",{className:lt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:lt.columnHeader,children:[i.jsx("span",{className:lt.columnIcon,style:{color:_.style.color},children:_.style.icon}),i.jsx("span",{className:lt.columnLabel,children:_.label}),i.jsx("span",{className:lt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),i.jsx("div",{className:lt.cardList,children:_.tasks.length===0?i.jsx("div",{className:lt.emptyPlaceholder,children:"No tasks"}):i.jsx(as,{mode:"popLayout",children:_.tasks.map(k=>i.jsx($t.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(Wz,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(os(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function Wz({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Ka(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:lt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[i.jsxs("div",{className:lt.cardHeader,children:[i.jsx("span",{className:lt.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:lt.cardTitle,children:d.title})]}),i.jsxs("div",{className:lt.cardBadges,children:[b&&i.jsx("span",{className:`${lt.badge} ${lt.parentBadge}`,title:b.title,children:b.title}),p>0&&i.jsxs("span",{className:`${lt.badge} ${lt.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${lt.badge} ${lt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${lt.badge} ${lt.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${lt.badge} ${lt.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${lt.badge} ${lt.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${lt.badge} ${lt.envBadge}`,children:r})]})]})}const Xz="_formContent_ymnez_1",Qz="_section_ymnez_13",e$="_label_ymnez_19",t$="_titleInput_ymnez_26",n$="_descriptionTextarea_ymnez_58",s$="_selectField_ymnez_94",a$="_checkboxRow_ymnez_128",i$="_checkboxLabel_ymnez_141",o$="_fieldError_ymnez_146",xt={formContent:Xz,section:Qz,label:e$,titleInput:t$,descriptionTextarea:n$,selectField:s$,checkboxRow:a$,checkboxLabel:i$,fieldError:o$};function r$(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 l$=100;function c$({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:xt.formContent,children:[i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:xt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:l$,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:xt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:xt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:xt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:xt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:xt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:xt.section,children:i.jsxs("label",{className:xt.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:xt.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:xt.section,children:[i.jsx("label",{className:xt.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:xt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const G1=y.createContext(void 0),d$=4e3;function u$({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=d$)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(G1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(G1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const om="grackle-theme",F1="grackle-prefer-system",K1="(prefers-color-scheme: dark)";let Gr=[],nd;function jp(){nd=void 0;for(const t of Gr)t()}function rm(){return typeof window>"u"?!1:window.matchMedia(K1).matches}function Wr(){if(typeof localStorage>"u")return Yb;try{const t=localStorage.getItem(om);if(t!==null&&H1.has(t))return t}catch{}return Yb}function md(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(F1)==="true"}catch{return!1}}function lm(t){return Ed.find(s=>s.variantLightId===t||s.variantDarkId===t)}function Z1(t,s){const o=am(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?rm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=lm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return rm()?r.variantDarkId:r.variantLightId}return t}function No(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Z1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&No(Wr(),md());function f$(){return nd===void 0&&(nd={themeId:Wr(),systemDark:rm(),preferSystem:md()}),nd}function p$(t){return Gr=[...Gr,t],()=>{Gr=Gr.filter(s=>s!==t)}}function m$(){const t=y.useSyncExternalStore(p$,f$),{themeId:s,preferSystem:o}=t,r=Z1(s,o),c=y.useCallback(u=>{if(H1.has(u)){try{localStorage.setItem(om,u)}catch{}No(u,md(),!0),jp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(F1,u?"true":"false")}catch{}if(u){const p=Wr(),m=am(p);if(m!=null&&m.hidden){const g=lm(p);if(g)try{localStorage.setItem(om,g.id)}catch{}}}No(Wr(),u,!0),jp()},[]);return y.useEffect(()=>{No(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(K1),p=()=>{const m=Wr(),g=md();if(g){const v=am(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&No(m,g),v!=null&&v.hidden){const b=lm(m);b!=null&&b.variantDarkId&&b.variantLightId&&No(m,g)}}jp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const Y1=y.createContext(void 0);function h$({children:t}){const s=m$();return i.jsx(Y1.Provider,{value:s,children:t})}function J1(){const t=y.useContext(Y1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const W1=y.createContext(void 0),X1=y.createContext(void 0);function g$({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return i.jsx(X1.Provider,{value:r,children:i.jsx(W1.Provider,{value:s,children:t})})}function v$(){return y.useContext(W1)}function y$(){const t=y.useContext(X1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const rh=y.createContext(void 0);function ut(){const t=y.useContext(rh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function Q1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ek(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function b$(t){return Q1(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 _$=new Set(["off","subscription","api_key"]),Uc=new Set(["off","on"]);function x$(t){return Q1(t)&&_$.has(t.claude)&&Uc.has(t.github)&&Uc.has(t.copilot)&&Uc.has(t.codex)&&Uc.has(t.goose)}function tk(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 nk(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const jo=5e3;function k$(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 Ni={label:"Home",url:Po};function S$(t){return t?[Ni,{label:"Settings",url:ki},{label:t,url:void 0}]:[Ni,{label:"Settings",url:void 0}]}const sk={label:"Environments",url:Ro};function T$(){return[Ni,{label:"Environments",url:void 0}]}function j$(){return[Ni,{label:"New Chat",url:void 0}]}function w$(t){return[Ni,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function N$(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Ni,sk,{label:(d==null?void 0:d.displayName)??"Environment",url:Io(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function C$(t,s,o,r,c){const d=k$(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(k=>k.id===p):void 0,g=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=g?r.find(k=>k.id===g):void 0,b=[Ni];v&&g&&(b.push(sk),b.push({label:v.displayName,url:Io(g)})),m&&g&&b.push({label:m.name,url:ji(m.id,g)});for(let k=0;k<d.length-1;k++)b.push({label:d[k].title,url:os(d[k].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}function lh(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 Vc(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 E$(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 ch(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),_=b?Vc(b):void 0;if(_)try{const k=JSON.parse(v.content);o.set(_,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),k=_?E$(_):void 0;if(!k)return v;const S=o.get(k);if(!S)return v;r.add(k),c.add(b);let T;const j=v.content.trim();if(j.startsWith("{"))try{const w=JSON.parse(j);typeof w.detailedContent=="string"&&(T=w.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:T}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Vc(b):void 0;_&&r.has(_)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const _=d[v],k=d[b];let S;try{const T=JSON.parse(_.content);S={tool:T.tool,args:T.args}}catch{}if(S){let T;const j=k.content.trim();if(j.startsWith("{"))try{const D=JSON.parse(j);typeof D.detailedContent=="string"&&(T=D.detailedContent)}catch{}d[b]={...k,toolUseCtx:{...S,detailedResult:T}},c.add(b);const w=s.get(_),C=w?Vc(w):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...w??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const _=Vc(b);if(_&&r.has(_))return!1;const k=b.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function A$(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=ak(s),d=s.filter(m=>cm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||cm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function ak(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function cm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function D$(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=ak(t),c=[];for(const p of t){const m=p.workspaceId?((u=o.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):cm(p,r)?c.push({task:p,reason:"blocked",workspaceName:m}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((p,m)=>(d[p.reason]??3)-(d[m.reason]??3)),c}function M$(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 R$(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const Cs=[{id:"kn-auth-flow",label:"Authentication Flow",kind:"knowledge",category:"concept",content:"The application uses JWT Bearer tokens for stateless authentication. Access tokens expire after 24h. Refresh tokens are stored in the database and rotated on use. The auth middleware verifies tokens and attaches the decoded payload to req.user.",tags:["auth","jwt","security"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:30:00Z",updatedAt:"2026-02-27T08:15:00Z",val:5},{id:"kn-db-schema",label:"Database Schema",kind:"knowledge",category:"concept",content:"PostgreSQL database with tables: users, sessions, refresh_tokens, audit_log. Uses UUID primary keys, TIMESTAMPTZ for all timestamps, and JSONB for flexible metadata columns. Connection pooling via pg-pool with per-tenant isolation.",tags:["database","postgres","schema"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:00:00Z",updatedAt:"2026-02-26T22:45:00Z",val:4},{id:"kn-error-handling",label:"Error Response Pattern",kind:"knowledge",category:"concept",content:"All API errors follow the shape { error: string, code: string, details?: unknown }. HTTP status codes map to: 400 (validation), 401 (unauthenticated), 403 (forbidden), 404 (not found), 409 (conflict), 429 (rate limited), 500 (internal).",tags:["api","errors","patterns"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:17:00Z",updatedAt:"2026-02-27T08:17:00Z",val:3},{id:"kn-rate-limiting",label:"Rate Limiting Strategy",kind:"knowledge",category:"concept",content:"Token-bucket algorithm with in-memory state per client IP. Default rate: 100 requests/minute, burst: 20. Returns 429 with Retry-After header. Redis adapter available for multi-instance deployments.",tags:["api","rate-limiting","infrastructure"],workspaceId:"proj-alpha",createdAt:"2026-02-27T09:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:2},{id:"kn-etl-pipeline",label:"ETL Pipeline Architecture",kind:"knowledge",category:"concept",content:"Data pipelines follow an Extract-Transform-Load pattern with pluggable stages. Each stage reads from a source (Postgres, S3, API), transforms via configurable mappers, and loads into a target (Parquet, BigQuery, S3). Incremental loads use high-watermark tracking.",tags:["etl","pipeline","architecture"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:05:00Z",val:4},{id:"kn-parquet-format",label:"Parquet Output Format",kind:"knowledge",category:"concept",content:"Parquet files are written with row-group buffering (configurable batch size, default 10000 rows). Supports Snappy, ZSTD, and GZIP compression. Schema is derived from the internal column type system using Arrow type mapping.",tags:["parquet","data-format","compression"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:05:00Z",updatedAt:"2026-02-26T08:15:00Z",val:3},{id:"kn-jwt-over-session",label:"JWT over Session Auth",kind:"knowledge",category:"decision",content:"Chose JWT tokens over server-side sessions for stateless auth. Rationale: (1) no session store needed, (2) works across microservices without shared state, (3) supports mobile clients natively. Trade-off: tokens can't be revoked instantly (mitigated by short expiry + refresh rotation).",tags:["auth","decision","jwt"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-25T10:00:00Z",val:3},{id:"kn-pg-pool-decision",label:"pg-pool over Knex",kind:"knowledge",category:"decision",content:"Chose pg-pool over Knex for connection pooling. pg-pool gives direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool and adds query-building overhead we don't need since we write raw SQL with parameterized queries.",tags:["database","decision","postgres"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:30:00Z",updatedAt:"2026-02-23T11:30:00Z",val:2},{id:"kn-watermark-decision",label:"Local Watermark Storage",kind:"knowledge",category:"decision",content:"Currently using local SQLite for watermark storage. This works for single-worker pipelines but needs to move to a shared store (Redis or Postgres) for production multi-worker scenarios. Tracked as a follow-up task.",tags:["pipeline","decision","watermarks"],workspaceId:"proj-beta",createdAt:"2026-02-27T09:05:00Z",updatedAt:"2026-02-27T09:05:00Z",val:2},{id:"kn-jwt-middleware",label:"JWT Verify Middleware",kind:"knowledge",category:"snippet",content:`\`\`\`typescript
325
+ --- End forwarded ---`}function a5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function i5({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=y.useMemo(()=>c.size,[c]),m=y.useCallback(S=>{r(!0),S!==void 0?(d(new Set([S])),u.current=S):(d(new Set),u.current=void 0)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,j)=>{if(j&&u.current!==void 0){const T=Math.min(u.current,S),w=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let A=T;A<=w;A++)A<t.length&&rl(t[A])&&D.add(A);return D})}else d(T=>{const w=new Set(T);return w.has(S)?w.delete(S):w.add(S),w.size===0?(r(!1),u.current=void 0):u.current=S,w})},[t]),b=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)rl(t[j])&&S.add(j);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const j=[...c].sort((w,C)=>w-C).filter(w=>w<t.length).map(w=>t[w]);if(j.length===0)return!1;const T=s(j);try{return await navigator.clipboard.writeText(T),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:k}}const o5="_wrapper_1cdza_1",r5="_scrollContainer_1cdza_9",l5="_selectingPadding_1cdza_16",c5="_toolbar_1cdza_20",d5="_directionToggle_1cdza_27",u5="_scrollToAnchor_1cdza_65",f5="_scrollToAnchorBottom_1cdza_89",p5="_scrollToAnchorTop_1cdza_93",m5="_eventOverflowWarning_1cdza_97",aa={wrapper:o5,scrollContainer:r5,selectingPadding:l5,toolbar:c5,directionToggle:d5,scrollToAnchor:u5,scrollToAnchorBottom:f5,scrollToAnchorTop:p5,eventOverflowWarning:m5},h5=10*1024,g5=new Set(["running","idle"]);function v5(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 M1="grackle-stream-direction";function y5(){try{return localStorage.getItem(M1)==="reversed"}catch{return!1}}function b5({eventsDropped:t}){return t<=0?i.jsx(i.Fragment,{}):i.jsxs("div",{className:aa.eventOverflowWarning,role:"alert",children:[i.jsx(mm,{size:$t,"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 ih({events:t,eventsDropped:s,emptyState:o,onShowToast:r,sessions:c,currentSessionId:d,environments:u,personas:p,onForward:m,sandboxProxyUrl:g}){const v=y.useRef(null),[b,_]=y.useState(y5),k=D3(),[S,j]=y.useState(!1),[T,w]=y.useState(!1),[C,D]=y.useState(void 0),A=i5({events:t,formatForClipboard:D1}),E=y.useMemo(()=>t.filter(rl).length,[t]),R=y.useMemo(()=>c?c.filter(ce=>g5.has(ce.status)&&ce.id!==d):[],[c,d]),O=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:M,scrollToAnchor:$}=e5({scrollRef:v,contentLength:t.length,isReversed:b,paused:A.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(M1,ce?"reversed":"default")}catch{}};y.useEffect(()=>{if(!A.isSelecting)return;const ce=me=>{me.key==="Escape"&&!S&&!T&&A.cancelSelection()};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce)}},[A.isSelecting,A.cancelSelection,S,T]);const V=y.useCallback(async()=>{await A.copySelected()&&(r==null||r(`Copied ${A.selectedCount} message${A.selectedCount===1?"":"s"} to clipboard`,"success"))},[A,r]),ne=y.useCallback(()=>[...A.selectedIndices].sort((me,xe)=>me-xe).filter(me=>me<t.length).map(me=>t[me]),[A.selectedIndices,t]),le=y.useCallback(ce=>{if(!ce)return"this session";const me=c==null?void 0:c.find(De=>De.id===ce);if(!me)return ce.slice(0,8);const xe=u==null?void 0:u.find(De=>De.id===me.environmentId);return(xe==null?void 0:xe.displayName)??me.environmentId.slice(0,8)},[c,u]),Z=y.useCallback(async(ce,me)=>{if(!m)return;const xe=le(ce);try{await m(ce,me);const De=A.selectedCount;r==null||r(`Forwarded ${De} message${De===1?"":"s"} to ${xe}`,"success"),A.cancelSelection()}catch{r==null||r("Failed to forward messages","error")}},[m,le,r,A]),se=y.useCallback(ce=>{j(!1);const me=ne(),xe=le(d),De=s5(xe,me);if(new TextEncoder().encode(De).length>h5){D({sessionId:ce,text:De}),w(!0);return}Z(ce,De).catch(()=>{})},[ne,le,d,Z]),H=y.useCallback(()=>{w(!1),C&&(Z(C.sessionId,C.text).catch(()=>{}),D(void 0))},[C,Z]),B=y.useCallback(()=>{w(!1),D(void 0)},[]),F=k?0:.2,ge=b?-8:8,ee=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return i.jsxs("div",{className:aa.wrapper,children:[i.jsx("div",{className:aa.toolbar,children:i.jsx(wi,{text:b?"Showing newest first":"Showing oldest first",children:i.jsx("button",{className:aa.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?i.jsx(fy,{size:$t,"aria-hidden":"true"}):i.jsx(py,{size:$t,"aria-hidden":"true"})})})}),i.jsxs("div",{ref:v,className:`${aa.scrollContainer} ${A.isSelecting?aa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,i.jsx(b5,{eventsDropped:s}),i.jsx(as,{initial:!1,children:O.map((ce,me)=>{const xe=b?t.length-1-me:me;return i.jsx(Ht.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:F,ease:"easeOut"},children:i.jsx(_6,{copyText:n5(ce),isContentBearing:rl(ce),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(xe),checkboxLabel:v5(ce),onSelect:()=>{A.enterSelectionMode(xe)},onToggle:De=>{A.toggleEvent(xe,De)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:i.jsx(iD,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:g})})},`${ce.sessionId}-${ce.timestamp}-${xe}`)})})]}),i.jsx(as,{children:A.isSelecting&&i.jsx(E6,{selectedCount:A.selectedCount,totalSelectable:E,onSelectAll:A.selectAll,onDeselectAll:A.deselectAll,onCopy:()=>{V().catch(()=>{})},onForward:m!==void 0?()=>{j(!0)}:void 0,forwardDisabled:R.length===0,onCancel:A.cancelSelection})}),i.jsx(W6,{isOpen:S,sessions:R,environments:u??[],personas:p,onSelect:se,onCancel:()=>{j(!1)}}),i.jsx(ys,{isOpen:T,title:"Send large message?",description:`This will forward a large message (${ee} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:B}),i.jsx(as,{children:!M&&i.jsxs(Ht.button,{className:`${aa.scrollToAnchor} ${b?aa.scrollToAnchorTop:aa.scrollToAnchorBottom}`,onClick:$,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[b?i.jsx(py,{size:$t,"aria-hidden":"true"}):i.jsx(fy,{size:$t,"aria-hidden":"true"})," New events"]})})]})}function oh(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,_]=y.useState(""),k=y.useRef(!1),S=d===c,j=y.useCallback(O=>{v(O),_("")},[]),T=y.useCallback(()=>{_("")},[]),w=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const O=m?g.trim():g;if(r){const $=r(g);if($){_($);return}}const M=m?s.trim():s;if(O===M){w();return}o(O),w()},[g,s,m,r,o,w]),D=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),A=y.useCallback(O=>{if(k.current){k.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(O=>{O.key==="Escape"?w():O.key==="Enter"&&p&&C()},[w,p,C]),R=(()=>{if(!S)return!1;const O=m?s.trim():s;return(m?g.trim():g)!==O})();return y.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),_(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:R,startEdit:D,cancelEdit:w,save:C,setDraft:j,clearError:T,handleBlur:A,handleKeyDown:E,ignoreInitialBlurRef:k}}const _5="_editFieldWrapper_yuzty_1",x5="_editInput_yuzty_10",k5="_editTextarea_yuzty_42",S5="_editSelect_yuzty_78",j5="_editError_yuzty_111",T5="_editInputInvalid_yuzty_118",w5="_editHint_yuzty_123",N5="_unsavedDot_yuzty_132",C5="_metaValueClickable_yuzty_140",E5="_editButton_yuzty_159",A5="_metaPlaceholder_yuzty_175",D5="_worktreeToggle_yuzty_180",it={editFieldWrapper:_5,editInput:x5,editTextarea:k5,editSelect:S5,editError:j5,editInputInvalid:T5,editHint:w5,unsavedDot:N5,metaValueClickable:C5,editButton:E5,metaPlaceholder:A5,worktreeToggle:D5};function Lt(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":k}=t,S=y.useRef(null),j=oh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const w=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(w)}},[j.isEditing]),c==="create"){const w=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{className:`${it.editInput} ${C?it.editInputInvalid:""}`,value:s,onChange:w,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),C&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("input",{ref:S,className:`${it.editInput} ${j.error?it.editInputInvalid:""}`,value:j.draft,onChange:w=>j.setDraft(w.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),j.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),j.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:j.error}),i.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const T=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":_,"data-testid":k?`${k}-button`:void 0,children:[T!==void 0?T:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function sm(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=oh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const T=window.setTimeout(()=>{var w;(w=k.current)==null||w.focus()},0);return()=>window.clearTimeout(T)}},[S.isEditing]),c==="create"){const T=C=>{m==null||m(C.target.value)},w=r==null?void 0:r(s);return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{className:`${it.editTextarea} ${w?it.editInputInvalid:""}`,value:s,onChange:T,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:w})]})}if(S.isEditing)return i.jsxs("div",{className:it.editFieldWrapper,children:[i.jsx("textarea",{ref:k,className:`${it.editTextarea} ${S.error?it.editInputInvalid:""}`,value:S.draft,onChange:T=>S.setDraft(T.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&i.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&i.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),i.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return i.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[j!==void 0?j:s?i.jsx("span",{children:s}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function pd(t){var D;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=oh({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const A=window.setTimeout(()=>{var E;(E=k.current)==null||E.focus()},0);return()=>window.clearTimeout(A)}},[S.isEditing]);const j=y.useCallback(A=>{const E=A.target.value;S.ignoreInitialBlurRef.current=!1,E!==s&&o(E),S.cancelEdit()},[s,o,S]),T=y.useCallback(A=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}A.relatedTarget instanceof HTMLElement&&A.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return i.jsx("select",{className:it.editSelect,value:s,onChange:A=>m==null?void 0:m(A.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>i.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return i.jsx("select",{ref:k,className:it.editSelect,value:S.draft,onChange:j,onBlur:T,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>i.jsx("option",{value:A.value,children:A.label},A.value))});const w=g==null?void 0:g(s),C=(D=c.find(A=>A.value===s))==null?void 0:D.label;return i.jsxs("button",{type:"button",className:it.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:C?i.jsx("span",{children:C}):i.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),i.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function M5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return i.jsxs("label",{className:it.worktreeToggle,"data-testid":d,children:[i.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),i.jsx("span",{children:r})]})}const R5="_nav_1snmp_1",I5="_searchForm_1snmp_8",O5="_searchInput_1snmp_15",B5="_searchButton_1snmp_33",L5="_clearButton_1snmp_68",z5="_workspaceSelect_1snmp_85",$5="_listHeader_1snmp_99",H5="_nodeList_1snmp_108",P5="_nodeItem_1snmp_116",U5="_indicator_1snmp_129",V5="_label_1snmp_136",q5="_badge_1snmp_145",Qn={nav:R5,searchForm:I5,searchInput:O5,searchButton:B5,clearButton:L5,workspaceSelect:z5,listHeader:$5,nodeList:H5,nodeItem:P5,indicator:U5,label:V5,badge:q5};function G5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return i.jsxs("div",{className:Qn.nav,"data-testid":"knowledge-nav",children:[i.jsxs("form",{className:Qn.searchForm,onSubmit:v,children:[i.jsx("input",{className:Qn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),i.jsx("button",{type:"submit",className:Qn.searchButton,disabled:o,children:"Go"})]}),r&&i.jsx("button",{type:"button",className:Qn.clearButton,onClick:b,children:"Clear search"}),i.jsxs("select",{className:Qn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[i.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>i.jsx("option",{value:S.id,children:S.name},S.id))]}),i.jsxs("div",{className:Qn.listHeader,children:["Nodes (",t.length,")"]}),i.jsx("ul",{className:Qn.nodeList,children:t.map(S=>i.jsxs("li",{className:Qn.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[i.jsx("span",{className:Qn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),i.jsx("span",{className:Qn.label,children:S.label}),i.jsx("span",{className:Qn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const F5="_container_bwu10_1",K5="_hamburger_bwu10_33",Z5="_brand_bwu10_49",Y5="_brandLogo_bwu10_68",J5="_info_bwu10_75",W5="_connectionLabel_bwu10_90",X5="_connectionDot_bwu10_103",Q5="_connected_bwu10_106",eI="_disconnected_bwu10_110",tI="_connecting_bwu10_113",As={container:F5,hamburger:K5,brand:Z5,brandLogo:Y5,info:J5,connectionLabel:W5,connectionDot:X5,connected:Q5,disconnected:eI,connecting:tI},nI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},sI={connected:As.connected,connecting:As.connecting,disconnected:As.disconnected};function aI({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=_t(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=nI[t];return i.jsxs("div",{className:As.container,children:[r&&i.jsx("button",{type:"button",className:As.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:i.jsx(dT,{size:Ct,"aria-hidden":"true"})}),i.jsx(wi,{text:"Home",placement:"bottom",children:i.jsxs("button",{type:"button",className:As.brand,onClick:()=>d(Uo),"data-testid":"statusbar-brand",children:[i.jsx("img",{src:Cd("icon-192x192.png"),alt:"",className:As.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),i.jsxs("div",{className:As.info,children:[i.jsxs("span",{"aria-label":g,children:[i.jsx("span",{className:`${As.connectionDot} ${sI[t]}`,"aria-hidden":"true",children:i.jsx(ji,{size:w_,fill:"currentColor"})})," ",i.jsx("span",{className:As.connectionLabel,"aria-hidden":"true",children:g})]}),i.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),i.jsxs("span",{children:[m," active"]})]})]})}const iI="_nav_gx5h3_1",oI="_tab_gx5h3_35",rI="_tabIcon_gx5h3_68",lI="_tabLabel_gx5h3_79",cI="_tabActive_gx5h3_84",dI="_tabEnd_gx5h3_90",To={nav:iI,tab:oI,tabIcon:rI,tabLabel:lI,tabActive:cI,tabEnd:dI},Qc=[{view:"dashboard",label:"Dashboard",icon:i.jsx(Wj,{size:Ct}),route:Uo,testId:"sidebar-tab-dashboard",order:0},{view:"tasks",label:"Tasks",icon:i.jsx(Aj,{size:Ct}),route:FN,testId:"sidebar-tab-tasks",order:1},{view:"environments",label:"Environments",icon:i.jsx(gT,{size:Ct}),route:Io,testId:"sidebar-tab-environments",order:2},{view:"chat",label:"Root",icon:i.jsx(fT,{size:Ct}),route:GN,testId:"sidebar-tab-chat",order:3},{view:"knowledge",label:"Knowledge",icon:i.jsx(kj,{size:Ct}),route:J_,testId:"sidebar-tab-knowledge",order:5},{view:"coordination",label:"Coordination",icon:i.jsx(yT,{size:Ct}),route:Z_,testId:"sidebar-tab-coordination",order:6},{view:"settings",label:"Settings",icon:i.jsx(DT,{size:Ct}),route:HN,testId:"sidebar-tab-settings",align:"end"}];function uI(t){return t===Uo||t==="/"?"dashboard":t.startsWith(Z_)?"coordination":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(J_)?"knowledge":t.startsWith(ki)?"settings":"tasks"}function fI({tabs:t=Qc}){var g;const s=Jt(),o=_t(),r=y.useRef(null),c=uI(s.pathname),d=y.useMemo(()=>{const v=(b,_)=>(b.order??Number.MAX_SAFE_INTEGER)-(_.order??Number.MAX_SAFE_INTEGER);return[...t.filter(b=>b.align!=="end").sort(v),...t.filter(b=>b.align==="end")]},[t]),u=(g=d.find(v=>v.align==="end"))==null?void 0:g.view,p=y.useCallback(v=>{o(v.route)},[o]),m=y.useCallback(v=>{var j,T;const b=(j=r.current)==null?void 0:j.querySelectorAll('[role="tab"]');if(!b)return;const _=Array.from(b).findIndex(w=>w===document.activeElement),k=_>=0?_:d.findIndex(w=>w.view===c);let S=k;if(v.key==="ArrowRight"||v.key==="j"||v.key==="J")v.preventDefault(),S=(k+1)%d.length;else if(v.key==="ArrowLeft"||v.key==="k"||v.key==="K")v.preventDefault(),S=(k-1+d.length)%d.length;else if(v.key==="Home")v.preventDefault(),S=0;else if(v.key==="End")v.preventDefault(),S=d.length-1;else return;o(d[S].route),(T=b[S])==null||T.focus()},[c,o,d]);return i.jsx("nav",{className:To.nav,ref:r,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:m,"data-testid":"sidebar-nav",children:d.map(v=>{const b=v.view===c,_=v.view===u;return i.jsx(wi,{text:v.label,placement:"bottom",className:_?To.tabEnd:void 0,children:i.jsxs("button",{role:"tab",type:"button","aria-selected":b,tabIndex:b?0:-1,className:`${To.tab} ${b?To.tabActive:""}`,onClick:()=>p(v),"data-testid":v.testId,"aria-label":v.label,children:[i.jsx("span",{className:To.tabIcon,"aria-hidden":"true",children:v.icon}),i.jsx("span",{className:To.tabLabel,children:v.label})]})},v.view)})})}const pI="_container_pi6ii_1",mI="_content_pi6ii_66",Kb={container:pI,content:mI},hI=320,R1=220,I1=600,O1="grackle-sidebar-width";function gI(){try{const t=localStorage.getItem(O1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=R1&&s<=I1)return s}}catch{}return hI}function vI(t){try{localStorage.setItem(O1,String(t))}catch{}}function yI({content:t}){const[s]=y.useState(gI),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=R1&&m<=I1&&vI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return i.jsx("div",{className:Kb.container,ref:o,"data-testid":"sidebar",style:{width:s},children:i.jsx("div",{className:Kb.content,children:t})})}const bI="_bar_tnfsh_1",_I="_btnPrimary_tnfsh_32",xI="_statusText_tnfsh_85",kI="_statusCompleted_tnfsh_90",SI="_statusFailed_tnfsh_94",jI="_statusBlocked_tnfsh_98",TI="_hintText_tnfsh_103",Nt={bar:bI,btnPrimary:_I,statusText:xI,statusCompleted:kI,statusFailed:SI,statusBlocked:jI,hintText:TI};function wI({sessions:t,tasks:s,environments:o}){const r=_t(),c=Jt(),d=tn("/sessions/:sessionId"),u=tn("/tasks/:taskId"),p=tn("/tasks/:taskId/stream"),m=tn("/tasks/:taskId/edit"),g=tn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),v=tn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=tn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),_=tn("/sessions/new"),k=tn("/environments/:environmentId/workspaces/:workspaceId"),S=tn("/tasks/new"),j=tn("/chat"),T=tn("/"),w=tn("/settings/*"),C=d==null?void 0:d.params.sessionId,D=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(g==null?void 0:g.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId),A=g??v??b,E=(A==null?void 0:A.params.environmentId)??(k==null?void 0:k.params.environmentId),R=c.pathname.startsWith("/environments")&&!k&&!A,O=!!j,M=!!_,$=!!k&&!g&&!v&&!b,Y=!!S;if(!!T&&!M&&!$&&!Y||!!w||(!!m||!!b)||Y||R||M)return i.jsx(i.Fragment,{});if(O)return o.find(se=>se.adapterType==="local"&&se.status==="connected")?i.jsx(i.Fragment,{}):i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:Nt.hintText,children:"Add a local environment to start chatting"})});if($)return i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:Nt.hintText,children:"Select a task or click + to create one"})});if(D){const Z=s.find(B=>B.id===D);if(!Z)return i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:Nt.hintText,children:"Loading..."})});const se=new Map(s.map(B=>[B.id,B])),H=Z.dependsOn.some(B=>{const F=se.get(B);return F!==void 0&&F.status!=="complete"});if(Z.status==="not_started"){const B=H?Z.dependsOn.map(F=>se.get(F)).filter(F=>F&&F.status!=="complete").map(F=>F.title):[];return i.jsx("div",{className:Nt.bar,children:H?i.jsxs("span",{className:Nt.statusBlocked,children:["Blocked by: ",B.join(", ")]}):i.jsx("span",{className:Nt.hintText,children:"Use the buttons above to start or manage this task"})})}if(Z.status==="working"||Z.status==="paused"){const B=Z.latestSessionId||void 0,F=B?t.find(ee=>ee.id===B):void 0;return F&&F.status!=="stopped"?i.jsx(i.Fragment,{}):i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:Nt.hintText,children:"Waiting for agent..."})})}if(Z.status==="complete")return i.jsxs("div",{className:Nt.bar,children:[i.jsx("span",{className:`${Nt.statusText} ${Nt.statusCompleted}`,children:"Task completed"}),i.jsx("button",{onClick:()=>r(Di(Z.workspaceId,void 0,E)),className:Nt.btnPrimary,children:"+ New Task"})]});if(Z.status==="failed")return i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:`${Nt.statusText} ${Nt.statusFailed}`,children:"Task failed"})})}if(C){const Z=t.find(B=>B.id===C),se=(Z==null?void 0:Z.status)==="stopped";if(Z!==void 0&&!se)return i.jsx(i.Fragment,{});if(se)return i.jsxs("div",{className:Nt.bar,children:[i.jsxs("span",{className:`${Nt.statusText} ${Nt.hintText}`,children:["Session ",Z.endReason||Z.status]}),i.jsx("button",{onClick:()=>r(G_(Z.environmentId)),className:Nt.btnPrimary,children:"+ New Chat"})]})}return i.jsx("div",{className:Nt.bar,children:i.jsx("span",{className:Nt.hintText,children:"Loading..."})})}const NI="_nav_14i94_1",CI="_tab_14i94_24",EI="_tabActive_14i94_62",AI="_tabLabel_14i94_75",DI="_statusDot_14i94_81",MI="_pulse_14i94_87",RI="_addButton_14i94_99",II="_empty_14i94_132",Ha={nav:NI,tab:CI,tabActive:EI,tabLabel:AI,statusDot:DI,pulse:MI,addButton:RI,empty:II},OI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function BI({environments:t}){const s=_t(),o=y.useRef(null),r=tn("/environments/:environmentId"),c=tn("/environments/:environmentId/edit"),d=tn("/environments/:environmentId/workspaces/:workspaceId"),u=tn("/environments/:environmentId/workspaces/:workspaceId/*"),p=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=p==="new"?void 0:p,g=y.useCallback(_=>{s(Oo(_))},[s]),v=y.useCallback(_=>{var w;const k=(w=o.current)==null?void 0:w.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===m);let T=j;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),T=(j+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),T=(j-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),T=0;else if(_.key==="End")_.preventDefault(),T=k.length-1;else return;T<t.length&&s(Oo(t[T].id)),k[T].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return i.jsxs("div",{className:Ha.nav,"data-testid":"environment-nav",children:[i.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const k=_.id===m,S=_.id===b,j=OI[_.status]||"var(--text-tertiary)",T=_.status==="connected";return i.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Ha.tab} ${k?Ha.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[i.jsx("span",{className:`${Ha.statusDot} ${T?Ha.pulse:""}`,style:{color:j},"aria-hidden":"true",children:i.jsx(ji,{size:w_,fill:"currentColor"})}),i.jsx("span",{className:Ha.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),i.jsx("button",{type:"button",className:Ha.addButton,onClick:()=>s(zN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&i.jsx("div",{className:Ha.empty,children:"No environments yet."})]})}function LI(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 B1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return i.jsx(i.Fragment,{children:t});const r=LI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(i.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(i.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(i.jsx("span",{children:t.slice(d)},`p${d}`)),i.jsx(i.Fragment,{children:c})}function zI(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 $I(t,s){const o=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=o.get(p);m?m.push(d):o.set(p,[d])}const r=[],c=new Set;for(const d of UT){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ka(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ka(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const HI="_container_z4i38_1",PI="_header_z4i38_5",UI="_headerActions_z4i38_17",VI="_searchInput_z4i38_23",qI="_searchHighlight_z4i38_56",GI="_groupToggle_z4i38_62",FI="_groupToggleActive_z4i38_89",KI="_addButton_z4i38_93",ZI="_taskRow_z4i38_120",YI="_selected_z4i38_140",JI="_expandArrow_z4i38_150",WI="_expanded_z4i38_157",XI="_leafSpacer_z4i38_161",QI="_taskStatusIcon_z4i38_166",eO="_taskTitle_z4i38_170",tO="_workspaceBadge_z4i38_177",nO="_childCountBadge_z4i38_195",sO="_dependencyBadge_z4i38_208",aO="_blockedBadge_z4i38_220",iO="_addChildButton_z4i38_225",oO="_emptyState_z4i38_268",rO="_statusGroupHeader_z4i38_275",lO="_statusGroupIcon_z4i38_294",cO="_statusGroupLabel_z4i38_298",dO="_statusGroupCount_z4i38_303",We={container:HI,header:PI,headerActions:UI,searchInput:VI,searchHighlight:qI,groupToggle:GI,groupToggleActive:FI,addButton:KI,taskRow:ZI,selected:YI,expandArrow:JI,expanded:WI,leafSpacer:XI,taskStatusIcon:QI,taskTitle:eO,workspaceBadge:tO,childCountBadge:nO,dependencyBadge:sO,blockedBadge:aO,addChildButton:iO,emptyState:oO,statusGroupHeader:rO,statusGroupIcon:lO,statusGroupLabel:cO,statusGroupCount:dO},uO=[{name:"title",weight:2},{name:"description",weight:1}],L1=16,fO=16,z1="grackle-task-group-by-status";function Zb(){try{return localStorage.getItem(z1)==="true"}catch{return!1}}function pO(t){try{localStorage.setItem(z1,String(t))}catch{}}function mO({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return i.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[i.jsxs("div",{className:We.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[i.jsx("span",{className:`${We.expandArrow} ${s?We.expanded:""}`,"aria-hidden":"true",children:i.jsx(ua,{size:Ye})}),i.jsx("span",{className:We.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),i.jsx("span",{className:We.statusGroupLabel,children:t.label}),i.jsx("span",{className:We.statusGroupCount,children:t.tasks.length})]}),i.jsx(as,{children:s&&i.jsx(Ht.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(p=>{const m=Ka(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return i.jsxs("div",{onClick:()=>c(os(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(os(p.id)))},className:`${We.taskRow} ${g?We.selected:""}`,style:{"--task-indent":`${L1}px`},"data-task-id":p.id,children:[i.jsx("span",{className:We.leafSpacer}),i.jsx("span",{className:We.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${ll(p.status)}`,children:m.icon}),i.jsx("span",{className:We.taskTitle,title:p.title,children:i.jsx(B1,{text:p.title,indices:d.get(p.id),highlightClass:We.searchHighlight})}),v&&i.jsx("span",{className:We.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function $1({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Ka(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(w=>u.get(w)!=="complete"),b=o.has(t.id),_=t.children.length>0,k=c===t.id,S=L1+s*fO,T=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{onClick:()=>d(os(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:w=>{w.currentTarget===w.target&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),d(os(t.id)))},className:`${We.taskRow} ${k?We.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&i.jsx("span",{className:`${We.expandArrow} ${b?We.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:w=>{w.stopPropagation(),r(t.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),w.stopPropagation(),r(t.id))},children:i.jsx(ua,{size:Ye,"aria-hidden":"true"})}),!_&&i.jsx("span",{className:We.leafSpacer}),i.jsx("span",{className:We.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${ll(t.status)}`,children:g.icon}),i.jsx("span",{className:We.taskTitle,title:t.title,children:i.jsx(B1,{text:t.title,indices:p.get(t.id),highlightClass:We.searchHighlight})}),T&&i.jsx("span",{className:We.workspaceBadge,title:T,children:T}),_&&i.jsxs("span",{className:We.childCountBadge,children:[t.children.filter(w=>w.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&i.jsx("span",{className:`${We.dependencyBadge} ${v?We.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<I2&&i.jsx(wi,{text:"Add child task",children:i.jsx("button",{onClick:w=>{w.stopPropagation(),d(Di(t.workspaceId,t.id))},"aria-label":"Add child task",className:We.addChildButton,children:"+"})})]}),i.jsx(as,{children:_&&b&&i.jsx(Ht.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(w=>i.jsx($1,{node:w,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},w.id))})})]})}function hO({workspaces:t,tasks:s}){const o=_t(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Zb),[g,v]=y.useState(Zb),[b,_]=y.useState(new Map),k=tn("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(Z=>[Z.id,Z.status])),[s]),T=y.useMemo(()=>new Map(t.map(Z=>[Z.id,Z.name])),[t]),w=()=>{const Z=!p;pO(Z),m(Z),Z&&(v(!0),_(new Map))},C=Z=>{_(se=>{const H=new Map(se),B=H.has(Z)?H.get(Z):g;return H.set(Z,!B),H})},D=Z=>b.has(Z)?b.get(Z):g,A=Z=>{c(se=>{const H=new Set(se);return H.has(Z)?(H.delete(Z),u(B=>new Set(B).add(Z))):(H.add(Z),u(B=>{const F=new Set(B);return F.delete(Z),F})),H})};y.useEffect(()=>{const Z=new Set(s.filter(se=>se.parentTaskId).map(se=>se.parentTaskId));Z.size>0&&c(se=>{const H=new Set(se);for(const B of Z)d.has(B)||H.add(B);return H})},[s,d]);const[E,R]=y.useState(""),{directMatchTaskIds:O,treeMatchTaskIds:M,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Z=R2(s,E,uO),se=new Set(Z.map(ge=>ge.item.id)),H=new Map;for(const ge of Z){const ee=ge.matches.find(ce=>ce.key==="title");ee&&H.set(ge.item.id,ee.indices)}const B=new Set(se),F=new Map(s.map(ge=>[ge.id,ge]));for(const ge of[...se]){let ee=F.get(ge);for(;ee!=null&&ee.parentTaskId;)B.add(ee.parentTaskId),ee=F.get(ee.parentTaskId)}return{directMatchTaskIds:se,treeMatchTaskIds:B,titleHighlights:H}},[E,s]),Y=O!==null,V=Y?p?O:M:null,ne=V?s.filter(Z=>V.has(Z.id)):s,le=p?[]:zI(ne);return i.jsxs("div",{className:We.container,children:[i.jsxs("div",{className:We.header,children:[i.jsx("span",{children:"Tasks"}),i.jsxs("div",{className:We.headerActions,children:[i.jsx(wi,{text:p?"Switch to tree view":"Group tasks by status",children:i.jsx("button",{className:`${We.groupToggle} ${p?We.groupToggleActive:""}`,onClick:w,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:i.jsx(oT,{size:$t})})}),i.jsx(wi,{text:"New task",children:i.jsx("button",{className:We.addButton,onClick:()=>o(Di()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&i.jsx("input",{type:"text",value:E,onChange:Z=>R(Z.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:We.searchInput,"data-testid":"sidebar-search"}),p?$I(ne,j).map(Z=>i.jsx(mO,{group:Z,isExpanded:D(Z.status),onToggle:()=>C(Z.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:T},Z.status)):le.map(Z=>i.jsx($1,{node:Z,depth:0,expandedTasks:r,toggleTask:A,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:$,workspaceNames:T},Z.id)),ne.length===0&&!Y&&i.jsx("div",{className:We.emptyState,children:"No tasks yet. Click + to create one."}),ne.length===0&&Y&&i.jsx("div",{className:We.emptyState,children:"No matching tasks"})]})}const gO="_toast_ed2dk_1",vO="_success_ed2dk_18",yO="_icon_ed2dk_22",bO="_error_ed2dk_25",_O="_warning_ed2dk_32",xO="_info_ed2dk_38",kO="_message_ed2dk_53",SO="_close_ed2dk_60",Hr={toast:gO,success:vO,icon:yO,error:bO,warning:_O,info:xO,message:kO,close:SO},jO={success:i.jsx(Ci,{size:Ct}),error:i.jsx(Os,{size:Ct}),warning:i.jsx(mm,{size:Ct}),info:i.jsx(pm,{size:Ct})};function TO({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),i.jsxs(Ht.div,{className:`${Hr.toast} ${Hr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[i.jsx("span",{className:Hr.icon,"aria-hidden":"true",children:jO[t.variant]}),i.jsx("span",{className:Hr.message,children:t.message}),i.jsx("button",{type:"button",className:Hr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:i.jsx(Os,{size:$t,"aria-hidden":"true"})})]})}const wO="_container_qqse2_1",NO={container:wO};function CO({toasts:t,onDismiss:s}){return i.jsx("div",{className:NO.container,"data-testid":"toast-container",children:i.jsx(as,{children:t.map(o=>i.jsx(TO,{toast:o,onDismiss:s},o.id))})})}const EO="_callout_e5awm_1",AO="_success_e5awm_11",DO="_icon_e5awm_15",MO="_error_e5awm_18",RO="_warning_e5awm_25",IO="_info_e5awm_32",OO="_content_e5awm_48",BO="_close_e5awm_53",Pr={callout:EO,success:AO,icon:DO,error:MO,warning:RO,info:IO,content:OO,close:BO},LO={success:i.jsx(Ci,{size:Ct}),error:i.jsx(Os,{size:Ct}),warning:i.jsx(mm,{size:Ct}),info:i.jsx(pm,{size:Ct})};function zO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return i.jsx(i.Fragment,{children:!c&&i.jsxs("div",{className:[Pr.callout,Pr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[i.jsx("span",{className:Pr.icon,"aria-hidden":"true",children:LO[t]}),i.jsx("span",{className:Pr.content,children:s}),o&&i.jsx("button",{type:"button",className:Pr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:i.jsx(Os,{size:$t,"aria-hidden":"true"})})]})})}function $O({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return i.jsx(i.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return i.jsx("div",{"data-testid":"update-banner",children:i.jsxs(zO,{variant:"info",dismissible:!0,children:[i.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",i.jsx("code",{children:c})]})})}const HO="_container_m1fsr_1",PO="_heading_m1fsr_7",UO="_section_m1fsr_14",VO="_sectionTitle_m1fsr_26",qO="_sectionDescription_m1fsr_35",GO="_emptyState_m1fsr_41",FO="_tokenList_m1fsr_48",KO="_tokenRow_m1fsr_55",ZO="_tokenBadge_m1fsr_68",YO="_tokenName_m1fsr_83",JO="_tokenTarget_m1fsr_90",WO="_deleteButton_m1fsr_99",XO="_addForm_m1fsr_113",QO="_formRow_m1fsr_119",eB="_input_m1fsr_125",tB="_select_m1fsr_155",nB="_addButton_m1fsr_187",sB="_emptyStateInfo_m1fsr_221",aB="_themeOptions_m1fsr_229",iB="_themeOption_m1fsr_229",oB="_themeOptionSelected_m1fsr_254",rB="_themeOptionHeader_m1fsr_259",lB="_themeOptionLabel_m1fsr_266",cB="_themeOptionDesc_m1fsr_273",dB="_variantToggle_m1fsr_279",uB="_variantButton_m1fsr_286",fB="_variantActive_m1fsr_305",pB="_themeSwatches_m1fsr_311",mB="_themeSwatch_m1fsr_311",hB="_systemToggle_m1fsr_325",gB="_systemToggleHint_m1fsr_341",vB="_themeActive_m1fsr_348",yB="_aboutGrid_m1fsr_354",bB="_aboutItem_m1fsr_360",_B="_aboutLabel_m1fsr_373",xB="_aboutValue_m1fsr_379",kB="_aboutDot_m1fsr_387",SB="_aboutDotConnected_m1fsr_394",jB="_aboutDotDisconnected_m1fsr_398",TB="_aboutDotConnecting_m1fsr_402",fe={container:HO,heading:PO,section:UO,sectionTitle:VO,sectionDescription:qO,emptyState:GO,tokenList:FO,tokenRow:KO,tokenBadge:ZO,tokenName:YO,tokenTarget:JO,deleteButton:WO,addForm:XO,formRow:QO,input:eB,select:tB,addButton:nB,emptyStateInfo:sB,themeOptions:aB,themeOption:iB,themeOptionSelected:oB,themeOptionHeader:rB,themeOptionLabel:lB,themeOptionDesc:cB,variantToggle:dB,variantButton:uB,variantActive:fB,themeSwatches:pB,themeSwatch:mB,systemToggle:hB,systemToggleHint:gB,themeActive:vB,aboutGrid:yB,aboutItem:bB,aboutLabel:_B,aboutValue:xB,aboutDot:kB,aboutDotConnected:SB,aboutDotDisconnected:jB,aboutDotConnecting:TB},wB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function NB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,k]=y.useState(null),S=w=>{if(w.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),b("")},j=w=>{k(w)},T=()=>{_&&(o(_),r==null||r("Token deleted","info")),k(null)};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:T,onCancel:()=>k(null)}),i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),i.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):i.jsx("div",{className:fe.tokenList,children:t.map(w=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenBadge,children:w.tokenType}),i.jsx("span",{className:fe.tokenName,children:w.name}),i.jsx("span",{className:fe.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),i.jsx("button",{className:fe.deleteButton,onClick:()=>j(w.name),title:`Delete ${w.name}`,"aria-label":`Delete ${w.name}`,children:i.jsx(Os,{size:$t,"aria-hidden":"true"})})]},w.name))}),i.jsxs("form",{className:fe.addForm,onSubmit:S,children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:w=>d(w.target.value)}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:w=>p(w.target.value)})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsx("select",{className:fe.select,value:m,onChange:w=>g(w.target.value),children:wB.map(w=>i.jsx("option",{value:w.value,children:w.label},w.value))}),i.jsx("input",{className:fe.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:w=>b(w.target.value)}),i.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Ed=[{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"]}],H1=new Set(Ed.map(t=>t.id)),Yb="grackle";function am(t){return Ed.find(s=>s.id===t)}function CB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),i.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),i.jsx("div",{className:fe.themeOptions,children:Ed.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return i.jsxs("button",{type:"button",className:`${fe.themeOption} ${p?fe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[i.jsxs("span",{className:fe.themeOptionHeader,children:[i.jsxs("span",{children:[i.jsx("span",{className:fe.themeOptionLabel,children:d.label}),i.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&i.jsxs("span",{className:fe.variantToggle,children:[i.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${p&&m?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),i.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${p&&!m?fe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&i.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((g,v)=>i.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),i.jsxs("label",{className:fe.systemToggle,children:[i.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),i.jsx("span",{children:"Match system light/dark preference"})]}),i.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),i.jsxs("p",{className:fe.themeActive,children:["Active theme: ",i.jsx("strong",{children:s})]})]})}const EB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},AB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function DB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return i.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"About"}),i.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),i.jsxs("div",{className:fe.aboutGrid,children:[i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Connection"}),i.jsxs("span",{className:fe.aboutValue,children:[i.jsx("span",{className:`${fe.aboutDot} ${AB[t]}`}),EB[t]]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Environments"}),i.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),i.jsx("span",{className:fe.aboutValue,children:d})]}),i.jsxs("div",{className:fe.aboutItem,children:[i.jsx("span",{className:fe.aboutLabel,children:"Version"}),i.jsx("span",{className:fe.aboutValue,children:"0.122.0"})]})]})]})}const MB="_container_cddyd_1",RB="_header_cddyd_8",IB="_headerTitle_cddyd_35",OB="_badge_cddyd_44",BB="_headerActions_cddyd_54",LB="_body_cddyd_61",zB="_formContent_cddyd_73",$B="_section_cddyd_85",HB="_label_cddyd_91",PB="_titleInput_cddyd_98",UB="_descriptionTextarea_cddyd_131",VB="_parentContext_cddyd_167",qB="_parentLabel_cddyd_175",GB="_parentName_cddyd_182",FB="_personaSelect_cddyd_186",KB="_depList_cddyd_220",ZB="_depItem_cddyd_226",YB="_depItemSelected_cddyd_248",JB="_noDeps_cddyd_252",WB="_btnPrimary_cddyd_258",XB="_btnGhost_cddyd_289",Qe={container:MB,header:RB,headerTitle:IB,badge:OB,headerActions:BB,body:LB,formContent:zB,section:$B,label:HB,titleInput:PB,descriptionTextarea:UB,parentContext:VB,parentLabel:qB,parentName:GB,personaSelect:FB,depList:KB,depItem:ZB,depItemSelected:YB,noDeps:JB,btnPrimary:WB,btnGhost:XB};function P1({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=_t(),k=t==="edit",S=k&&s?d.find(ke=>ke.id===s):void 0,j=k?(S==null?void 0:S.workspaceId)??"":o??"",[T,w]=y.useState(j),C=j||T,D=u.find(ke=>ke.id===C),A=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!k&&!o,R=k?(S==null?void 0:S.parentTaskId)??"":r??"",O=R?d.find(ke=>ke.id===R):void 0,[M,$]=y.useState((S==null?void 0:S.title)??""),[Y,V]=y.useState((S==null?void 0:S.description)??""),[ne,le]=y.useState((S==null?void 0:S.dependsOn)??[]),[Z,se]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[H,B]=y.useState((S==null?void 0:S.canDecompose)??!1),[F,ge]=y.useState((S==null?void 0:S.injectKnowledge)??!0),[ee,ce]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{k&&S&&!me.current&&(me.current=!0,$(S.title),V(S.description),le(S.dependsOn),se(S.defaultPersonaId),B(S.canDecompose),ge(S.injectKnowledge))},[k,S]);const xe=d.filter(ke=>ke.workspaceId===C&&(!k||ke.id!==s)&&ke.id!==R),De=M.trim().length>0&&(!k||S!==void 0)&&C.length>0,ot=ke=>{le(ct=>ct.includes(ke)?ct.filter(ue=>ue!==ke):[...ct,ke])},yt=()=>{!De||ee||k&&S===void 0||(k&&s?(g(s,M.trim(),Y,ne,Z),b==null||b("Task updated","success"),v?v():_(os(s,void 0,C,A),{replace:!0})):(ce(!0),m(C,M.trim(),Y,ne.length>0?ne:void 0,R||void 0,Z,H,F,()=>{b==null||b("Task created","success"),_(o?Ti(o,A):"/tasks",{replace:!0})},ke=>{b==null||b(ke,"error"),ce(!1)})))},lt=()=>{if(v){v();return}_(k&&s?os(s,void 0,C,A):o?Ti(o,A):"/tasks")},Pe=k?"edit task":R?"child task":"new task";return i.jsxs("div",{className:Qe.container,children:[i.jsxs("div",{className:Qe.header,children:[i.jsxs("div",{className:Qe.headerTitle,children:[i.jsx("span",{className:Qe.badge,children:Pe}),O&&i.jsxs("span",{className:Qe.parentContext,children:[i.jsx("span",{className:Qe.parentLabel,children:"Child of"}),i.jsx("span",{className:Qe.parentName,children:O.title})]})]}),i.jsxs("div",{className:Qe.headerActions,children:[i.jsx("button",{onClick:yt,disabled:!De||ee,className:Qe.btnPrimary,"data-testid":"task-edit-save",children:ee?"Creating…":k?"Save Changes":"Create"}),i.jsx("button",{onClick:lt,className:Qe.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:Qe.body,children:i.jsxs("div",{className:Qe.formContent,children:[E&&i.jsxs("div",{className:Qe.section,children:[i.jsx("label",{className:Qe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),i.jsxs("select",{id:"task-edit-workspace",value:T,onChange:ke=>w(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-workspace",children:[i.jsx("option",{value:"",children:"Select a workspace..."}),u.map(ke=>i.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),i.jsxs("div",{className:Qe.section,children:[i.jsx("label",{className:Qe.label,htmlFor:"task-edit-title",children:"Title"}),i.jsx("input",{id:"task-edit-title",type:"text",value:M,onChange:ke=>$(ke.target.value),placeholder:"Task title...",autoFocus:!0,className:Qe.titleInput,"data-testid":"task-edit-title",onKeyDown:ke=>{ke.key==="Enter"&&De&&yt()}})]}),i.jsxs("div",{className:Qe.section,children:[i.jsx("label",{className:Qe.label,htmlFor:"task-edit-description",children:"Description"}),i.jsx("textarea",{id:"task-edit-description",value:Y,onChange:ke=>V(ke.target.value),placeholder:"Describe the task... (markdown supported)",className:Qe.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),i.jsxs("div",{className:Qe.section,children:[i.jsx("label",{className:Qe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),i.jsxs("select",{id:"task-edit-persona",value:Z,onChange:ke=>se(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),p.map(ke=>i.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),!k&&i.jsx("div",{className:Qe.section,children:i.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-can-decompose",children:[i.jsx("input",{type:"checkbox",checked:H,onChange:ke=>B(ke.target.checked)}),"Can spawn subtasks"]})}),!k&&i.jsx("div",{className:Qe.section,children:i.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-inject-knowledge",children:[i.jsx("input",{type:"checkbox",checked:F,onChange:ke=>ge(ke.target.checked)}),"Inject related prior work from the knowledge graph"]})}),i.jsxs("div",{className:Qe.section,children:[i.jsx("div",{className:Qe.label,children:"Dependencies"}),xe.length===0?i.jsx("div",{className:Qe.noDeps,children:"No other tasks in this workspace"}):i.jsx("div",{className:Qe.depList,children:xe.map(ke=>{const ct=ne.includes(ke.id);return i.jsxs("label",{className:`${Qe.depItem} ${ct?Qe.depItemSelected:""}`,"data-testid":`dep-option-${ke.id}`,children:[i.jsx("input",{type:"checkbox",checked:ct,onChange:()=>ot(ke.id)}),ke.title,i.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",ke.status,")"]})]},ke.id)})})]})]})})]})}const QB="_actionButtons_1rjka_1",eL="_btnPrimary_1rjka_8",tL="_btnDanger_1rjka_39",nL="_btnGhost_1rjka_78",Zt={actionButtons:QB,btnPrimary:eL,btnDanger:tL,btnGhost:nL};function sL({task:t,sessionId:s,isBlocked:o,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return o?i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Zt.btnPrimary,children:"Start"}),i.jsx("button",{onClick:m,className:Zt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:u,disabled:!s,className:Zt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:d,className:Zt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),i.jsx("button",{onClick:c,className:Zt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return i.jsx("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return i.jsxs("div",{className:Zt.actionButtons,"data-testid":"task-action-buttons",children:[i.jsx("button",{onClick:r,className:Zt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),i.jsx("button",{onClick:p,className:Zt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const aL="_workpadSection_y8nj9_1",iL="_workpadLabel_y8nj9_9",oL="_workpadStatus_y8nj9_17",rL="_workpadSummary_y8nj9_23",lL="_workpadExtra_y8nj9_29",Pa={workpadSection:aL,workpadLabel:iL,workpadStatus:oL,workpadSummary:rL,workpadExtra:lL};function cL({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return i.jsxs("div",{className:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),i.jsx("div",{className:Pa.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return i.jsxs("div",{className:Pa.workpadSection,"data-testid":"workpad-panel",children:[i.jsx("div",{className:Pa.workpadLabel,children:"Workpad"}),s.status&&i.jsx("div",{className:Pa.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&i.jsx("div",{className:Pa.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&i.jsx("div",{className:Pa.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const dL="_overviewDashboard_r05qm_1",uL="_overviewHero_r05qm_7",fL="_statusBadge_r05qm_14",pL="_statusPending_r05qm_26",mL="_statusAssigned_r05qm_31",hL="_statusInProgress_r05qm_36",gL="_statusReview_r05qm_41",vL="_statusDone_r05qm_46",yL="_statusFailed_r05qm_51",bL="_statusWaitingInput_r05qm_56",_L="_overviewBranchPill_r05qm_61",xL="_branchLink_r05qm_76",kL="_overviewSection_r05qm_87",SL="_overviewLabel_r05qm_93",jL="_overviewValue_r05qm_100",TL="_overviewMuted_r05qm_105",wL="_overviewMarkdown_r05qm_111",NL="_envRow_r05qm_180",CL="_envDot_r05qm_186",EL="_envDotGreen_r05qm_193",AL="_envDotYellow_r05qm_197",DL="_envDotRed_r05qm_201",ML="_envDotGray_r05qm_205",RL="_depList_r05qm_209",IL="_depItem_r05qm_215",OL="_depBlocked_r05qm_222",BL="_depDone_r05qm_226",LL="_timeline_r05qm_230",zL="_timelineRow_r05qm_236",$L="_timelineKey_r05qm_243",HL="_timelineValue_r05qm_249",PL="_timelineDelta_r05qm_253",UL="_reviewNotes_r05qm_264",be={overviewDashboard:dL,overviewHero:uL,statusBadge:fL,statusPending:pL,statusAssigned:mL,statusInProgress:hL,statusReview:gL,statusDone:vL,statusFailed:yL,statusWaitingInput:bL,overviewBranchPill:_L,branchLink:xL,overviewSection:kL,overviewLabel:SL,overviewValue:jL,overviewMuted:TL,overviewMarkdown:wL,envRow:NL,envDot:CL,envDotGreen:EL,envDotYellow:AL,envDotRed:DL,envDotGray:ML,depList:RL,depItem:IL,depBlocked:OL,depDone:BL,timeline:LL,timelineRow:zL,timelineKey:$L,timelineValue:HL,timelineDelta:PL,reviewNotes:UL};function Hc(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 kp(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 Jb(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 VL({status:t}){const s=Ka(t),o=PT(t);return i.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function qL({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:p}){const m=c.length>0?c[c.length-1]:void 0,g=(m==null?void 0:m.environmentId)??"",v=g?o.find(S=>S.id===g):void 0,b=r.find(S=>S.id===t.workspaceId),_=o.find(S=>S.id===d),k=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return i.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[i.jsxs("div",{className:be.overviewHero,children:[i.jsx(VL,{status:t.status}),t.branch&&i.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:k?i.jsxs("a",{href:k,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):i.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[i.jsx("div",{className:be.overviewLabel,children:"Description"}),i.jsx("div",{className:be.overviewMarkdown,children:i.jsx(um,{remarkPlugins:[fm],children:t.description})})]}),t.workpad&&i.jsx(cL,{workpad:t.workpad}),i.jsxs("div",{className:be.overviewSection,children:[i.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Jb(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?i.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[i.jsx("span",{className:`${be.envDot} ${Jb(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),i.jsx("span",{className:be.overviewValue,children:_.displayName}),i.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):i.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[i.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?i.jsx("div",{className:be.overviewMuted,children:"None"}):i.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const j=s.get(S),T=(j==null?void 0:j.status)==="complete";return i.jsxs("div",{className:`${be.depItem} ${T?be.depDone:be.depBlocked}`,children:[i.jsx("span",{children:T?"✓":"○"}),i.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[i.jsx("div",{className:be.overviewLabel,children:"Timeline"}),i.jsxs("div",{className:be.timeline,children:[t.createdAt&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Created"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=kp(t.createdAt,t.assignedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Assigned"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.assignedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=kp(t.assignedAt??t.createdAt,t.startedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Started"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.startedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=kp(t.startedAt,t.completedAt);return i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Completed"}),i.jsx("span",{className:be.timelineValue,children:Hc(t.completedAt)}),S!==void 0&&i.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&i.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[i.jsx("div",{className:be.overviewLabel,children:"Usage"}),i.jsxs("div",{className:be.timeline,children:[i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsx("span",{className:be.timelineValue,children:Ds(u.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),i.jsx("span",{className:be.timelineValue,children:Ds(p.costMillicents)}),i.jsxs("span",{className:be.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[i.jsx("div",{className:be.overviewLabel,children:"Budget"}),i.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Tokens"}),i.jsxs("span",{className:be.timelineValue,children:[Bo(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Bo(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&i.jsxs("div",{className:be.timelineRow,children:[i.jsx("span",{className:be.timelineKey,children:"Cost"}),i.jsxs("span",{className:be.timelineValue,children:[Ds((u==null?void 0:u.costMillicents)??0)," / ",Ds(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&i.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[i.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),i.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function GL({plugins:t,loading:s,onSetPluginEnabled:o}){return i.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[i.jsx("h2",{className:fe.heading,children:"Plugins"}),i.jsxs("div",{className:fe.section,children:[i.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&i.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&i.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return i.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[i.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&i.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),i.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&i.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),i.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:i.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function FL({githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u}){const[p,m]=y.useState(""),[g,v]=y.useState(""),[b,_]=y.useState(!1),[k,S]=y.useState(!1),[j,T]=y.useState(!1),[w,C]=y.useState(null),D=t.find(M=>M.id===w),A=async M=>{if(M.preventDefault(),!(!p.trim()||!g.trim())){S(!0);try{await o(p.trim(),g.trim(),"",b),u==null||u("GitHub account added","success"),m(""),v(""),_(!1)}catch($){const Y=$ instanceof Error?$.message:"Failed to add account";u==null||u(Y,"error")}finally{S(!1)}}},E=async M=>{try{await r(M,{isDefault:!0}),u==null||u("Default account updated","success")}catch($){const Y=$ instanceof Error?$.message:"Failed to update account";u==null||u(Y,"error")}},R=async()=>{if(w)try{await c(w),u==null||u("GitHub account removed","info")}catch(M){const $=M instanceof Error?M.message:"Failed to remove account";u==null||u($,"error")}finally{C(null)}},O=async()=>{T(!0);try{const M=await d();M.imported>0?u==null||u(`Imported ${M.imported} account(s): ${M.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(M){const $=M instanceof Error?M.message:"Import failed";u==null||u($,"error")}finally{T(!1)}};return i.jsxs(i.Fragment,{children:[i.jsx(ys,{isOpen:w!==null,title:"Remove GitHub Account?",description:D?`"${D.label}"${D.username?` (@${D.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{R().catch(()=>{})},onCancel:()=>C(null)}),i.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),i.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?i.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?i.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):i.jsx("div",{className:fe.tokenList,children:t.map(M=>i.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${M.id}`,children:[M.isDefault&&i.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),i.jsx("span",{className:fe.tokenName,children:M.label}),M.username&&i.jsxs("span",{className:fe.tokenTarget,children:["@",M.username]}),!M.isDefault&&i.jsx("button",{className:fe.deleteButton,onClick:()=>{E(M.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${M.label} as default`,"data-testid":`github-account-set-default-${M.id}`,children:i.jsx(OT,{size:$t,"aria-hidden":"true"})}),i.jsx("button",{className:fe.deleteButton,onClick:()=>C(M.id),title:`Remove ${M.label}`,"aria-label":`Remove ${M.label}`,"data-testid":`github-account-remove-${M.id}`,children:i.jsx(Os,{size:$t,"aria-hidden":"true"})})]},M.id))}),i.jsxs("form",{className:fe.addForm,onSubmit:M=>{A(M).catch(()=>{})},children:[i.jsxs("div",{className:fe.formRow,children:[i.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:p,onChange:M=>m(M.target.value),"data-testid":"github-account-label-input"}),i.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:g,onChange:M=>v(M.target.value),"data-testid":"github-account-token-input"})]}),i.jsxs("div",{className:fe.formRow,children:[i.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:b,onChange:M=>_(M.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),i.jsx("button",{className:fe.addButton,type:"submit",disabled:!p.trim()||!g.trim()||k,"data-testid":"github-account-add-button",children:k?"Adding...":"Add Account"}),i.jsx("button",{className:fe.addButton,type:"button",onClick:()=>{O().catch(()=>{})},disabled:j,"data-testid":"github-account-import-button",children:j?"Importing...":"Import from gh CLI"})]})]})]})]})}const KL="_container_legrg_1",ZL="_header_legrg_8",YL="_headerTitle_legrg_35",JL="_badge_legrg_44",WL="_headerActions_legrg_54",XL="_body_legrg_61",QL="_formContent_legrg_73",e8="_section_legrg_85",t8="_label_legrg_91",n8="_nameInput_legrg_98",s8="_fieldInput_legrg_131",a8="_adapterSelect_legrg_164",i8="_readOnlyValue_legrg_198",o8="_codespaceSection_legrg_204",r8="_codespaceActions_legrg_210",l8="_creatingHint_legrg_216",c8="_errorHint_legrg_222",d8="_btnPrimary_legrg_235",u8="_btnGhost_legrg_266",oe={container:KL,header:ZL,headerTitle:YL,badge:JL,headerActions:WL,body:XL,formContent:QL,section:e8,label:t8,nameInput:n8,fieldInput:s8,adapterSelect:a8,readOnlyValue:i8,codespaceSection:o8,codespaceActions:r8,creatingHint:l8,errorHint:c8,btnPrimary:d8,btnGhost:u8},ed=1,td=65535;function Sp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=ed&&s<=td}function jp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function f8({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[k,S]=y.useState("");return g==="create"?i.jsxs("div",{className:oe.codespaceSection,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repository"}),i.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Machine Type"}),i.jsx("input",{type:"text",value:k,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),i.jsxs("div",{className:oe.codespaceActions,children:[i.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),i.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):i.jsx("div",{className:oe.codespaceSection,children:i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace"}),!u&&i.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[i.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>i.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),i.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&i.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:oe.errorHint,children:u}),i.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:oe.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&i.jsx("span",{className:oe.errorHint,children:d})]})})}function U1({mode:t,environmentId:s,environments:o,githubAccounts:r,onAddEnvironment:c,onUpdateEnvironment:d,onListCodespaces:u,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b,onListDockerContainers:_,dockerContainers:k,dockerContainersError:S,onShowToast:j}){const T=_t(),w=t==="edit",C=w&&s?o.find(re=>re.id===s):void 0,[D,A]=y.useState(""),[E,R]=y.useState("local"),[O,M]=y.useState(""),[$,Y]=y.useState(""),[V,ne]=y.useState(""),[le,Z]=y.useState(""),[se,H]=y.useState(""),[B,F]=y.useState(""),[ge,ee]=y.useState(""),[ce,me]=y.useState(""),[xe,De]=y.useState("create"),[ot,yt]=y.useState(""),[lt,Pe]=y.useState(null),ke=y.useCallback(()=>{const re={};if(E==="local"){if(O.trim()&&(re.host=O.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.port=ve)}}else if(E==="ssh"){if(re.host=O.trim(),V.trim()&&(re.user=V.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(re.sshPort=ve)}le.trim()&&(re.identityFile=le.trim())}else E==="docker"?xe==="attach"?ot.trim()&&(re.attach=ot.trim()):(se.trim()&&(re.image=se.trim()),B.trim()&&(re.repo=B.trim())):E==="codespace"&&(re.codespaceName=ge.trim());return re},[E,O,$,V,le,se,B,ge,xe,ot]),ct=()=>!(!D.trim()||E==="ssh"&&!O.trim()||E==="codespace"&&!ge.trim()||E==="docker"&&xe==="attach"&&!ot.trim()||(E==="local"||E==="ssh")&&!Sp($)),ue=()=>{ct()&&(c(D.trim(),E,ke(),ce||void 0),j==null||j("Environment added successfully","success"),T(Io,{replace:!0}))},Re=()=>{T(s?Oo(s):Io)},Q=y.useCallback((re,ve)=>{if(!C||!s)return;const et=jp(C.adapterConfig),sn=ve.trim();sn?et[re]=sn:delete et[re],d(s,{adapterConfig:et})},[C,s,d]),nt=y.useCallback((re,ve)=>{if(!C||!s)return;const et=jp(C.adapterConfig);if(ve.trim()){const sn=Number(ve);Number.isInteger(sn)&&sn>=ed&&sn<=td&&(et[re]=sn)}else delete et[re];d(s,{adapterConfig:et})},[C,s,d]);if(w){if(!C)return i.jsxs("div",{className:oe.container,children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsx("div",{className:oe.formContent,children:i.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const re=jp(C.adapterConfig);return i.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"edit environment"})}),i.jsx("div",{className:oe.headerActions,children:i.jsx("button",{onClick:Re,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Name"}),i.jsx(Lt,{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:lt,onActivate:Pe,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Adapter Type"}),i.jsx("span",{className:oe.readOnlyValue,"data-testid":"env-edit-adapter-type",children:C.adapterType})]}),(C.adapterType==="codespace"||C.adapterType==="docker")&&(r.length>0||!!C.githubAccountId)&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"GitHub Account"}),i.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:oe.adapterSelect,"data-testid":"env-edit-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>i.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Lt,{value:String(re.host??""),onSave:ve=>Q("host",ve),mode:"edit",fieldId:"host",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Port"}),i.jsx(Lt,{value:String(re.port??""),onSave:ve=>nt("port",ve),validate:ve=>Sp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),C.adapterType==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Host"}),i.jsx(Lt,{value:String(re.host??""),onSave:ve=>Q("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:lt,onActivate:Pe,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"User"}),i.jsx(Lt,{value:String(re.user??""),onSave:ve=>Q("user",ve),mode:"edit",fieldId:"user",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"SSH Port"}),i.jsx(Lt,{value:String(re.sshPort??""),onSave:ve=>nt("sshPort",ve),validate:ve=>Sp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:lt,onActivate:Pe,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Identity File"}),i.jsx(Lt,{value:String(re.identityFile??""),onSave:ve=>Q("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:lt,onActivate:Pe,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),C.adapterType==="docker"&&re.attach!==void 0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Attach (container)"}),i.jsx(Lt,{value:String(re.attach??""),onSave:ve=>Q("attach",ve),validate:ve=>ve.trim()===""?"Container name is required":void 0,mode:"edit",fieldId:"attach",activeFieldId:lt,onActivate:Pe,placeholder:"container name or ID",ariaLabel:"Attach container","data-testid":"env-edit-attach"})]}),C.adapterType==="docker"&&re.attach===void 0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Image"}),i.jsx(Lt,{value:String(re.image??""),onSave:ve=>Q("image",ve),mode:"edit",fieldId:"image",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Repo"}),i.jsx(Lt,{value:String(re.repo??""),onSave:ve=>Q("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:lt,onActivate:Pe,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),C.adapterType==="codespace"&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Codespace Name"}),i.jsx(Lt,{value:String(re.codespaceName??""),onSave:ve=>Q("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:lt,onActivate:Pe,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return i.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[i.jsxs("div",{className:oe.header,children:[i.jsx("div",{className:oe.headerTitle,children:i.jsx("span",{className:oe.badge,children:"new environment"})}),i.jsxs("div",{className:oe.headerActions,children:[i.jsx("button",{onClick:ue,disabled:!ct(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),i.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Cancel"})]})]}),i.jsx("div",{className:oe.body,children:i.jsxs("div",{className:oe.formContent,children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),i.jsx("input",{id:"env-create-name",type:"text",value:D,onChange:re=>A(re.target.value),placeholder:"Environment name...",autoFocus:!0,className:oe.nameInput,"data-testid":"env-create-name",onKeyDown:re=>{re.key==="Enter"&&ct()&&ue()}})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),i.jsxs("select",{id:"env-create-adapter",value:E,onChange:re=>{R(re.target.value),re.target.value==="codespace"&&u(ce||void 0)},className:oe.adapterSelect,"data-testid":"env-create-adapter",children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"ssh",children:"ssh"}),i.jsx("option",{value:"docker",children:"docker"}),i.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),i.jsxs("select",{id:"env-create-github-account",value:ce,onChange:re=>{me(re.target.value),E==="codespace"&&u(re.target.value||void 0)},className:oe.adapterSelect,"data-testid":"env-create-github-account",children:[i.jsx("option",{value:"",children:"(Default)"}),r.map(re=>i.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>M(re.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ed,max:td,value:$,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),i.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>M(re.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),i.jsx("input",{id:"env-create-user",type:"text",value:V,onChange:re=>ne(re.target.value),placeholder:"User (optional)...",className:oe.fieldInput,"data-testid":"env-create-user"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),i.jsx("input",{id:"env-create-port",type:"number",min:ed,max:td,value:$,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),i.jsx("input",{id:"env-create-identity",type:"text",value:le,onChange:re=>Z(re.target.value),placeholder:"Identity file (optional)...",className:oe.fieldInput,"data-testid":"env-create-identity"})]})]}),E==="docker"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-docker-mode",children:"Source"}),i.jsxs("select",{id:"env-docker-mode",value:xe,onChange:re=>{const ve=re.target.value;De(ve),ve==="attach"&&_()},className:oe.adapterSelect,"data-testid":"env-docker-mode",children:[i.jsx("option",{value:"create",children:"Create new container"}),i.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),xe==="create"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),i.jsx("input",{id:"env-create-image",type:"text",value:se,onChange:re=>H(re.target.value),placeholder:"Image (optional)...",className:oe.fieldInput,"data-testid":"env-create-image"})]}),i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),i.jsx("input",{id:"env-create-repo",type:"text",value:B,onChange:re=>F(re.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}):i.jsxs("div",{className:oe.section,children:[i.jsx("label",{className:oe.label,children:"Container"}),!S&&k.length>0&&i.jsxs("select",{value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&A(re.target.value)},className:oe.adapterSelect,"data-testid":"env-docker-container-select",children:[i.jsx("option",{value:"",children:"Select a container..."}),k.map(re=>i.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(S||k.length===0)&&i.jsxs(i.Fragment,{children:[S?i.jsx("span",{className:oe.errorHint,children:S}):i.jsx("span",{className:oe.creatingHint,children:"No running containers found."}),i.jsx("input",{type:"text",value:ot,onChange:re=>{yt(re.target.value),re.target.value&&!D.trim()&&A(re.target.value)},placeholder:"Enter container name/ID...",className:oe.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&i.jsx(f8,{codespaceName:ge,onCodespaceNameChange:ee,envName:D,onEnvNameChange:A,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b})]})})]})}const p8="_group_1iprv_1",m8="_groupTitle_1iprv_8",h8="_shortcutList_1iprv_17",g8="_shortcutRow_1iprv_23",v8="_keys_1iprv_36",y8="_kbd_1iprv_43",b8="_description_1iprv_60",yi={group:p8,groupTitle:m8,shortcutList:h8,shortcutRow:g8,keys:v8,kbd:y8,description:b8},_8=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Root",shortcuts:[{keys:["Ctrl/Cmd","Enter"],description:"Send message (when the composer is focused)"},{keys:["Enter"],description:"Insert a new line in the message composer"}]}];function x8(){return i.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[i.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),i.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),_8.map(t=>i.jsxs("div",{className:yi.group,children:[i.jsx("h4",{className:yi.groupTitle,children:t.title}),i.jsx("div",{className:yi.shortcutList,children:t.shortcuts.map(s=>i.jsxs("div",{className:yi.shortcutRow,children:[i.jsx("span",{className:yi.keys,children:s.keys.map(o=>i.jsx("kbd",{className:yi.kbd,children:o},o))}),i.jsx("span",{className:yi.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 S8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return i.jsxs("section",{className:fe.section,children:[i.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),i.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),i.jsx("div",{className:fe.tokenList,children:k8.map(r=>i.jsxs("div",{className:fe.tokenRow,children:[i.jsx("span",{className:fe.tokenName,children:r.label}),i.jsx("span",{className:fe.tokenTarget,children:r.description}),i.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>i.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const j8="_container_10efq_1",T8="_header_10efq_7",w8="_list_10efq_105",N8="_card_10efq_111",C8="_cardHeader_10efq_125",E8="_cardTitle_10efq_135",A8="_defaultBadge_10efq_141",D8="_cardActions_10efq_155",M8="_description_10efq_160",R8="_meta_10efq_166",I8="_empty_10efq_212",O8="_typeBadge_10efq_362",es={container:j8,header:T8,list:w8,card:N8,cardHeader:C8,cardTitle:E8,defaultBadge:A8,cardActions:D8,description:M8,meta:R8,empty:I8,typeBadge:O8};function B8({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await o(v),p(null)};return i.jsxs("div",{className:es.container,children:[i.jsxs("div",{className:es.header,children:[i.jsx("h2",{children:"Personas"}),i.jsx(nn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?i.jsx("p",{className:es.empty,children:"No personas yet. Create one to get started."}):i.jsx("div",{className:es.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return i.jsxs("div",{className:es.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(v.id))},children:[i.jsxs("div",{className:es.cardHeader,children:[i.jsxs("span",{className:es.cardTitle,children:[i.jsx("strong",{children:v.name}),i.jsx("span",{className:es.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&i.jsx("span",{className:es.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),i.jsxs("div",{className:es.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&i.jsx("p",{className:es.description,children:v.description}),i.jsxs("div",{className:es.meta,children:[v.runtime&&i.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&i.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&i.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),i.jsx(ys,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const L8="_container_uy08i_1",z8="_header_uy08i_7",$8="_count_uy08i_13",H8="_presets_uy08i_18",P8="_presetButton_uy08i_24",U8="_filterInput_uy08i_41",V8="_groups_uy08i_53",q8="_group_uy08i_53",G8="_groupHeader_uy08i_68",F8="_groupName_uy08i_77",K8="_groupCount_uy08i_81",Z8="_toolList_uy08i_87",Y8="_toolItem_uy08i_95",J8="_toolName_uy08i_103",vn={container:L8,header:z8,count:$8,presets:H8,presetButton:P8,filterInput:U8,groups:V8,group:q8,groupHeader:G8,groupName:F8,groupCount:K8,toolList:Z8,toolItem:Y8,toolName:J8},W8=(()=>{const t=new Map;for(const s of b_){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()}))})(),X8=[{name:"default",label:"Default",tools:y_},{name:"worker",label:"Worker",tools:O2},{name:"orchestrator",label:"Orchestrator",tools:B2},{name:"admin",label:"Admin",tools:L2}];function Wb({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,o]),p=y.useCallback((v,b)=>{if(o)return;const _=new Set(d);for(const k of v)b?_.delete(k):_.add(k);s([..._].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return i.jsxs("div",{className:vn.container,"data-testid":"mcp-tool-selector",children:[i.jsx("div",{className:vn.header,children:i.jsx("span",{className:vn.count,children:t.length===0?`Using default (${y_.length} tools)`:`${t.length} of ${b_.size} tools selected`})}),i.jsxs("div",{className:vn.presets,"data-testid":"mcp-tool-presets",children:[X8.map(v=>i.jsx("button",{type:"button",className:vn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),i.jsx("button",{type:"button",className:vn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),i.jsx("input",{type:"text",className:vn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),i.jsx("div",{className:vn.groups,children:W8.map(({group:v,tools:b})=>{const _=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(_.length===0)return null;const k=_.every(S=>d.has(S));return i.jsxs("div",{className:vn.group,"data-testid":`tool-group-${v}`,children:[i.jsxs("label",{className:vn.groupHeader,children:[i.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:o,"data-testid":`group-toggle-${v}`}),i.jsx("span",{className:vn.groupName,children:v}),i.jsxs("span",{className:vn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),i.jsx("div",{className:vn.toolList,children:_.map(S=>i.jsxs("label",{className:vn.toolItem,children:[i.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),i.jsx("span",{className:vn.toolName,children:S})]},S))})]},v)})})]})}function im(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}function V1(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(p<7)return`in ${p} day${p===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Q8="_container_1gfuq_1",e7="_header_1gfuq_7",t7="_list_1gfuq_19",n7="_card_1gfuq_25",s7="_cardHeader_1gfuq_40",a7="_cardTitle_1gfuq_46",i7="_statusBadge_1gfuq_56",o7="_enabled_1gfuq_68",r7="_disabled_1gfuq_71",l7="_cardActions_1gfuq_75",c7="_cardMeta_1gfuq_80",d7="_empty_1gfuq_98",ts={container:Q8,header:e7,list:t7,card:n7,cardHeader:s7,cardTitle:a7,statusBadge:i7,enabled:o7,disabled:r7,cardActions:l7,cardMeta:c7,empty:d7};function u7({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,p]=y.useState(null),m=u?t.find(_=>_.id===u):void 0,g=async _=>{await o(_),p(null)},v=y.useMemo(()=>{const _=new Map;for(const k of s)_.set(k.id,k.name);return _},[s]),b=_=>v.get(_)??_;return i.jsxs("div",{className:ts.container,children:[i.jsxs("div",{className:ts.header,children:[i.jsx("h2",{children:"Schedules"}),i.jsx(nn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?i.jsx("p",{className:ts.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):i.jsx("div",{className:ts.list,children:t.map(_=>i.jsxs("div",{className:ts.card,"data-testid":`schedule-card-${_.id}`,onClick:()=>d(_.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(_.id))},children:[i.jsxs("div",{className:ts.cardHeader,children:[i.jsxs("span",{className:ts.cardTitle,children:[i.jsx("strong",{children:_.title}),i.jsx("span",{className:`${ts.statusBadge} ${_.enabled?ts.enabled:ts.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),i.jsxs("div",{className:ts.cardActions,onClick:k=>k.stopPropagation(),children:[i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(_.id,{enabled:!_.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${_.id}`,title:_.enabled?"Disable schedule":"Enable schedule",children:_.enabled?"Disable":"Enable"}),i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),i.jsx(nn,{variant:"ghost",size:"sm",onClick:()=>p(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),i.jsxs("div",{className:ts.cardMeta,children:[i.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&i.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),i.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?im(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?i.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",V1(_.nextRunAt)]}):null,_.runCount>0&&i.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),i.jsx(ys,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const f7="_nav_1bhou_1",p7="_tab_1bhou_24",m7="_tabIcon_1bhou_62",h7="_tabActive_1bhou_68",Pc={nav:f7,tab:p7,tabIcon:m7,tabActive:h7},sa=[{path:"credentials",label:"Credentials",icon:i.jsx(eT,{size:Ct})},{path:"github-accounts",label:"GitHub Accounts",icon:i.jsx(Kj,{size:Ct})},{path:"personas",label:"Personas",icon:i.jsx(zT,{size:Ct})},{path:"schedules",label:"Schedules",icon:i.jsx(jj,{size:Ct})},{path:"appearance",label:"Appearance",icon:i.jsx(_T,{size:Ct})},{path:"shortcuts",label:"Shortcuts",icon:i.jsx(nT,{size:Ct})},{path:"plugins",label:"Plugins",icon:i.jsx(wT,{size:Ct})},{path:"about",label:"About",icon:i.jsx(pm,{size:Ct})}];function g7(){var u;const t=Jt(),s=_t(),o=y.useRef(null),r=((u=sa.find(p=>{const m=`${ki}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??sa[0].path,c=y.useCallback(p=>{s(`${ki}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const m=(k=o.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:sa.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%sa.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+sa.length)%sa.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=sa.length-1;else return;const _=sa[b].path;s(`${ki}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return i.jsx("nav",{className:Pc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:sa.map(p=>{const m=p.path===r;return i.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Pc.tab} ${m?Pc.tabActive:""}`,onClick:()=>c(p.path),children:[i.jsx("span",{className:Pc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const v7=["lifecycle:","pipe:","stdin:"];function q1(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function y7(t,s){let o=!1;for(const r of t.subscribers){const c=s.get(r.sessionId);if(c&&(o=!0,c.taskId))return{kind:"task",taskId:c.taskId}}return o?{kind:"unattached"}:{kind:"external"}}function b7(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const p=y7(u,o);if(p.kind==="task"){const m=r.get(p.taskId);m?m.push(u):r.set(p.taskId,[u])}else c.push(u)}const d=Array.from(r,([u,p])=>({taskId:u,streams:p}));return c.length>0&&d.push({taskId:void 0,streams:c}),d}const _7="_container_16qkd_1",x7="_header_16qkd_7",k7="_title_16qkd_15",S7="_headerActions_16qkd_21",j7="_internalsToggle_16qkd_27",T7="_refreshButton_16qkd_37",w7="_state_16qkd_52",N7="_group_16qkd_59",C7="_groupHeader_16qkd_63",E7="_row_16qkd_72",A7="_selected_16qkd_92",D7="_kindBadge_16qkd_96",M7="_kindChatroom_16qkd_108",R7="_kindPipe_16qkd_114",I7="_kindChannel_16qkd_120",O7="_streamName_16qkd_126",B7="_meta_16qkd_135",Yt={container:_7,header:x7,title:k7,headerActions:S7,internalsToggle:j7,refreshButton:T7,state:w7,group:N7,groupHeader:C7,row:E7,selected:A7,kindBadge:D7,kindChatroom:M7,kindPipe:R7,kindChannel:I7,streamName:O7,meta:B7},L7={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function z7({kind:t}){return t==="chatroom"?i.jsx(mT,{size:Ye,"aria-hidden":"true"}):t==="pipe"?i.jsx(Gj,{size:Ye,"aria-hidden":"true"}):i.jsx(Yj,{size:Ye,"aria-hidden":"true"})}function $7({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:p,selectedStreamId:m,onSelectStream:g,onRefresh:v}){const b=b7(t,s),_={chatroom:Yt.kindChatroom,pipe:Yt.kindPipe,channel:Yt.kindChannel},k=S=>{var j;return((j=o.find(T=>T.id===S))==null?void 0:j.title)??S};return i.jsxs("div",{className:Yt.container,"data-testid":"coordination-list",children:[i.jsxs("div",{className:Yt.header,children:[i.jsx("span",{className:Yt.title,children:"Coordination"}),i.jsxs("div",{className:Yt.headerActions,children:[i.jsxs("label",{className:Yt.internalsToggle,children:[i.jsx("input",{type:"checkbox",checked:u,onChange:S=>p(S.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&i.jsx("button",{type:"button",className:Yt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:i.jsx(CT,{size:Ye,"aria-hidden":"true"})})]})]}),r&&t.length===0&&i.jsxs("div",{className:Yt.state,children:["Loading","…"]}),!r&&c&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&i.jsx("div",{className:Yt.state,"data-testid":"coordination-empty",children:"No active streams"}),b.map(S=>i.jsxs("div",{className:Yt.group,children:[i.jsx("div",{className:Yt.groupHeader,children:S.taskId?k(S.taskId):"Unattached / external (CLI · MCP)"}),S.streams.map(j=>{const T=q1(j),w=j.id===m;return i.jsxs("button",{type:"button",className:`${Yt.row}${w?` ${Yt.selected}`:""}`,onClick:()=>g(j.id),"data-testid":`coordination-row-${j.id}`,"aria-current":w?"page":void 0,children:[i.jsxs("span",{className:`${Yt.kindBadge} ${_[T]}`,children:[i.jsx(z7,{kind:T})," ",L7[T]]}),i.jsx("span",{className:Yt.streamName,children:j.name}),i.jsxs("span",{className:Yt.meta,children:[j.subscriberCount," ",j.subscriberCount===1?"sub":"subs"," ","·"," ",j.messageBufferDepth," buffered"]})]},j.id)})]},S.taskId??"__orphans__"))]})}const H7="_transcript_1p4cm_1",P7="_message_1p4cm_10",U7="_meta_1p4cm_16",V7="_sender_1p4cm_24",q7="_time_1p4cm_29",G7="_content_1p4cm_34",F7="_state_1p4cm_42",Ua={transcript:H7,message:P7,meta:U7,sender:V7,time:q7,content:G7,state:F7};function K7(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleTimeString()}function Z7({messages:t,loading:s=!1}){return s?i.jsx("div",{className:Ua.state,"data-testid":"stream-transcript-loading",children:"Loading transcript…"}):t.length===0?i.jsx("div",{className:Ua.state,"data-testid":"stream-transcript-empty",children:"No messages yet."}):i.jsx("div",{className:Ua.transcript,"data-testid":"stream-transcript",children:t.map(o=>i.jsxs("div",{className:Ua.message,"data-testid":"stream-transcript-message",children:[i.jsxs("div",{className:Ua.meta,children:[i.jsx("span",{className:Ua.sender,title:o.senderId,children:o.senderId.slice(0,12)}),i.jsx("span",{className:Ua.time,children:K7(o.timestamp)})]}),i.jsx("div",{className:Ua.content,children:o.content})]},o.seq))})}const Y7="_panel_iibrt_1",J7="_header_iibrt_24",W7="_title_iibrt_33",X7="_closeButton_iibrt_43",Q7="_body_iibrt_57",ez="_section_iibrt_63",tz="_sectionLabel_iibrt_67",nz="_metaRow_iibrt_76",sz="_metaKey_iibrt_84",az="_metaValue_iibrt_90",iz="_subscriberCard_iibrt_99",oz="_subscriberHeader_iibrt_107",rz="_sessionLink_iibrt_114",lz="_badges_iibrt_132",cz="_badgeRw_iibrt_150 _badge_iibrt_132",dz="_badgeR_iibrt_150 _badge_iibrt_132",uz="_badgeW_iibrt_162 _badge_iibrt_132",fz="_badgeAsync_iibrt_168 _badge_iibrt_132",pz="_badgeSync_iibrt_174 _badge_iibrt_132",mz="_badgeDetach_iibrt_178 _badge_iibrt_132",hz="_spawnTag_iibrt_184 _badge_iibrt_132",gz="_fdNumber_iibrt_189",vz="_emptySubscribers_iibrt_195",yz="_metaValueMono_iibrt_201 _metaValue_iibrt_90",bz="_advanced_iibrt_216",_z="_advancedSummary_iibrt_220",He={panel:Y7,header:J7,title:W7,closeButton:X7,body:Q7,section:ez,sectionLabel:tz,metaRow:nz,metaKey:sz,metaValue:az,subscriberCard:iz,subscriberHeader:oz,sessionLink:rz,badges:lz,badgeRw:cz,badgeR:dz,badgeW:uz,badgeAsync:fz,badgeSync:pz,badgeDetach:mz,spawnTag:hz,fdNumber:gz,emptySubscribers:vz,metaValueMono:yz,advanced:bz,advancedSummary:_z},xz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function kz({permission:t}){const s=t==="rw"?He.badgeRw:t==="r"?He.badgeR:He.badgeW;return i.jsx("span",{className:s,children:t})}function Sz({mode:t}){const s=t==="async"?He.badgeAsync:t==="detach"?He.badgeDetach:He.badgeSync;return i.jsx("span",{className:s,children:t})}function jz({stream:t,messages:s,transcriptLoading:o,onClose:r}){const c=_t();return y.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r]),i.jsxs("div",{className:He.panel,"data-testid":"stream-detail-panel",children:[i.jsxs("div",{className:He.header,children:[i.jsx("h3",{className:He.title,children:t.name}),i.jsx("button",{type:"button",className:He.closeButton,onClick:r,"aria-label":"Close stream details",children:"×"})]}),i.jsxs("div",{className:He.body,children:[i.jsxs("div",{className:He.section,children:[i.jsx("div",{className:He.sectionLabel,children:"Overview"}),i.jsxs("div",{className:He.metaRow,children:[i.jsx("span",{className:He.metaKey,children:"Kind"}),i.jsx("span",{className:He.metaValue,children:xz[q1(t)]})]}),i.jsxs("div",{className:He.metaRow,children:[i.jsx("span",{className:He.metaKey,children:"Participants"}),i.jsx("span",{className:He.metaValue,children:t.subscriberCount})]}),i.jsxs("div",{className:He.metaRow,children:[i.jsx("span",{className:He.metaKey,children:"Buffered"}),i.jsxs("span",{className:He.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),i.jsxs("div",{className:He.section,children:[i.jsx("div",{className:He.sectionLabel,children:"Participants"}),t.subscribers.length===0?i.jsx("div",{className:He.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(d=>i.jsxs("div",{className:He.subscriberCard,"data-testid":`subscriber-card-${d.subscriptionId}`,children:[i.jsxs("button",{type:"button",className:He.sessionLink,onClick:()=>{c(Sm(d.sessionId))},title:d.sessionId,children:[d.sessionId.slice(0,12),"…"]}),d.createdBySpawn&&i.jsx("span",{className:He.spawnTag,children:"spawn"})]},d.subscriptionId))]}),i.jsxs("div",{className:He.section,children:[i.jsx("div",{className:He.sectionLabel,children:"Conversation"}),i.jsx(Z7,{messages:s??[],loading:o??!1})]}),i.jsxs("details",{className:He.advanced,"data-testid":"stream-advanced",children:[i.jsx("summary",{className:He.advancedSummary,children:"Advanced"}),i.jsxs("div",{className:He.metaRow,children:[i.jsx("span",{className:He.metaKey,children:"Stream ID"}),i.jsx("span",{className:He.metaValueMono,children:t.id})]}),t.subscribers.map(d=>i.jsxs("div",{className:He.subscriberCard,children:[i.jsxs("div",{className:He.subscriberHeader,children:[i.jsxs("span",{className:He.fdNumber,children:["fd ",d.fd]}),i.jsxs("span",{className:He.metaValueMono,title:d.subscriptionId,children:[d.subscriptionId.slice(0,12),"…"]})]}),i.jsxs("div",{className:He.badges,children:[i.jsx(kz,{permission:d.permission}),i.jsx(Sz,{mode:d.deliveryMode})]})]},d.subscriptionId))]})]})]})}function Tz({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(my.map(d=>[d,[]]));for(const d of t){const u=ll(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(S=>S.status==="complete").length;let b;if(u==="paused"&&o){const S=o.get(d.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(u);k?k.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return my.map(d=>{const u=Ka(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const wz="_boardContainer_1c4y1_1",Nz="_column_1c4y1_17",Cz="_columnHeader_1c4y1_34",Ez="_columnIcon_1c4y1_47",Az="_columnLabel_1c4y1_52",Dz="_columnCount_1c4y1_57",Mz="_cardList_1c4y1_67",Rz="_emptyPlaceholder_1c4y1_76",Iz="_card_1c4y1_67",Oz="_cardHeader_1c4y1_107",Bz="_cardStatusIcon_1c4y1_113",Lz="_cardTitle_1c4y1_119",zz="_cardBadges_1c4y1_127",$z="_badge_1c4y1_134",Hz="_blockedBadge_1c4y1_146",Pz="_childBadge_1c4y1_151",Uz="_depBadge_1c4y1_155",Vz="_parentBadge_1c4y1_159",qz="_pausedSubBadge_1c4y1_166",Gz="_personaBadge_1c4y1_170",Fz="_envBadge_1c4y1_174",Kz="_emptyCta_1c4y1_178",Zz="_ctaButton_1c4y1_188",Yz="_ctaDescription_1c4y1_204",dt={boardContainer:wz,column:Nz,columnHeader:Cz,columnIcon:Ez,columnLabel:Az,columnCount:Dz,cardList:Mz,emptyPlaceholder:Rz,card:Iz,cardHeader:Oz,cardStatusIcon:Bz,cardTitle:Lz,cardBadges:zz,badge:$z,blockedBadge:Hz,childBadge:Pz,depBadge:Uz,parentBadge:Vz,pausedSubBadge:qz,personaBadge:Gz,envBadge:Fz,emptyCta:Kz,ctaButton:Zz,ctaDescription:Yz};function Jz({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=_t(),p=y.useMemo(()=>o.filter(_=>_.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(_=>[_.id,_.status])),[o]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,T=new Map,w=new Map;for(const C of p)if(C.latestSessionId){const D=_.get(C.latestSessionId);if(D){if(j.set(C.id,D.endReason||D.status),D.personaId){const A=k.get(D.personaId);A&&T.set(C.id,A.name)}if(D.environmentId){const A=S.get(D.environmentId);A&&w.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:T,environmentNameByTaskId:w}},[p,r,c,d]),b=y.useMemo(()=>Tz({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?i.jsxs("div",{className:dt.emptyCta,"data-testid":"board-empty-cta",children:[i.jsx("button",{className:dt.ctaButton,onClick:()=>u(Di(t,void 0,s)),children:"Create Task"}),i.jsx("div",{className:dt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):i.jsx("div",{className:dt.boardContainer,"data-testid":"board-container",children:b.map(_=>i.jsxs("section",{className:dt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[i.jsxs("div",{className:dt.columnHeader,children:[i.jsx("span",{className:dt.columnIcon,style:{color:_.style.color},children:_.style.icon}),i.jsx("span",{className:dt.columnLabel,children:_.label}),i.jsx("span",{className:dt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),i.jsx("div",{className:dt.cardList,children:_.tasks.length===0?i.jsx("div",{className:dt.emptyPlaceholder,children:"No tasks"}):i.jsx(as,{mode:"popLayout",children:_.tasks.map(k=>i.jsx(Ht.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:i.jsx(Wz,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(os(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function Wz({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Ka(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return i.jsxs("div",{className:dt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[i.jsxs("div",{className:dt.cardHeader,children:[i.jsx("span",{className:dt.cardStatusIcon,style:{color:v.color},children:v.icon}),i.jsx("span",{className:dt.cardTitle,children:d.title})]}),i.jsxs("div",{className:dt.cardBadges,children:[b&&i.jsx("span",{className:`${dt.badge} ${dt.parentBadge}`,title:b.title,children:b.title}),p>0&&i.jsxs("span",{className:`${dt.badge} ${dt.childBadge}`,children:[m,"/",p]}),u&&i.jsx("span",{className:`${dt.badge} ${dt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&i.jsx("span",{className:`${dt.badge} ${dt.depBadge}`,children:"dep"}),g&&i.jsx("span",{className:`${dt.badge} ${dt.pausedSubBadge}`,children:g}),o&&i.jsx("span",{className:`${dt.badge} ${dt.personaBadge}`,children:o}),r&&i.jsx("span",{className:`${dt.badge} ${dt.envBadge}`,children:r})]})]})}const Xz="_formContent_ymnez_1",Qz="_section_ymnez_13",e$="_label_ymnez_19",t$="_titleInput_ymnez_26",n$="_descriptionTextarea_ymnez_58",s$="_selectField_ymnez_94",a$="_checkboxRow_ymnez_128",i$="_checkboxLabel_ymnez_141",o$="_fieldError_ymnez_146",St={formContent:Xz,section:Qz,label:e$,titleInput:t$,descriptionTextarea:n$,selectField:s$,checkboxRow:a$,checkboxLabel:i$,fieldError:o$};function r$(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 l$=100;function c$({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return i.jsxs("div",{className:St.formContent,children:[i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-name",children:"Name"}),i.jsx("input",{id:"ws-name",className:St.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:l$,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&i.jsx("span",{className:St.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-description",children:"Description"}),i.jsx("textarea",{id:"ws-description",className:St.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-repo",children:"Repository URL"}),i.jsx("input",{id:"ws-repo",className:St.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&i.jsx("span",{className:St.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-environment",children:"Environment"}),i.jsxs("select",{id:"ws-environment",className:St.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[i.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>i.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&i.jsx("span",{className:St.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-persona",children:"Default Persona"}),i.jsxs("select",{id:"ws-persona",className:St.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[i.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>i.jsx("option",{value:m.id,children:m.name},m.id))]})]}),i.jsx("div",{className:St.section,children:i.jsxs("label",{className:St.checkboxRow,children:[i.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),i.jsx("span",{className:St.checkboxLabel,children:"Enable worktree isolation"})]})}),i.jsxs("div",{className:St.section,children:[i.jsx("label",{className:St.label,htmlFor:"ws-workdir",children:"Working Directory"}),i.jsx("input",{id:"ws-workdir",className:St.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const G1=y.createContext(void 0),d$=4e3;function u$({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=d$)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return i.jsx(G1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function fn(){const t=y.useContext(G1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const om="grackle-theme",F1="grackle-prefer-system",K1="(prefers-color-scheme: dark)";let Fr=[],nd;function Tp(){nd=void 0;for(const t of Fr)t()}function rm(){return typeof window>"u"?!1:window.matchMedia(K1).matches}function Xr(){if(typeof localStorage>"u")return Yb;try{const t=localStorage.getItem(om);if(t!==null&&H1.has(t))return t}catch{}return Yb}function md(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(F1)==="true"}catch{return!1}}function lm(t){return Ed.find(s=>s.variantLightId===t||s.variantDarkId===t)}function Z1(t,s){const o=am(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?rm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=lm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return rm()?r.variantDarkId:r.variantLightId}return t}function Co(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Z1(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Co(Xr(),md());function f$(){return nd===void 0&&(nd={themeId:Xr(),systemDark:rm(),preferSystem:md()}),nd}function p$(t){return Fr=[...Fr,t],()=>{Fr=Fr.filter(s=>s!==t)}}function m$(){const t=y.useSyncExternalStore(p$,f$),{themeId:s,preferSystem:o}=t,r=Z1(s,o),c=y.useCallback(u=>{if(H1.has(u)){try{localStorage.setItem(om,u)}catch{}Co(u,md(),!0),Tp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(F1,u?"true":"false")}catch{}if(u){const p=Xr(),m=am(p);if(m!=null&&m.hidden){const g=lm(p);if(g)try{localStorage.setItem(om,g.id)}catch{}}}Co(Xr(),u,!0),Tp()},[]);return y.useEffect(()=>{Co(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(K1),p=()=>{const m=Xr(),g=md();if(g){const v=am(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&Co(m,g),v!=null&&v.hidden){const b=lm(m);b!=null&&b.variantDarkId&&b.variantLightId&&Co(m,g)}}Tp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const Y1=y.createContext(void 0);function h$({children:t}){const s=m$();return i.jsx(Y1.Provider,{value:s,children:t})}function J1(){const t=y.useContext(Y1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const W1=y.createContext(void 0),X1=y.createContext(void 0);function g$({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return i.jsx(X1.Provider,{value:r,children:i.jsx(W1.Provider,{value:s,children:t})})}function v$(){return y.useContext(W1)}function y$(){const t=y.useContext(X1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const rh=y.createContext(void 0);function pt(){const t=y.useContext(rh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function Q1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ek(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function b$(t){return Q1(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 _$=new Set(["off","subscription","api_key"]),Uc=new Set(["off","on"]);function x$(t){return Q1(t)&&_$.has(t.claude)&&Uc.has(t.github)&&Uc.has(t.copilot)&&Uc.has(t.codex)&&Uc.has(t.goose)}function tk(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 nk(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 wo=5e3;function k$(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 Ni={label:"Home",url:Uo};function S$(t){return t?[Ni,{label:"Settings",url:ki},{label:t,url:void 0}]:[Ni,{label:"Settings",url:void 0}]}const sk={label:"Environments",url:Io};function j$(){return[Ni,{label:"Environments",url:void 0}]}function T$(){return[Ni,{label:"New Chat",url:void 0}]}function w$(t){return[Ni,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function N$(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Ni,sk,{label:(d==null?void 0:d.displayName)??"Environment",url:Oo(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function C$(t,s,o,r,c){const d=k$(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(k=>k.id===p):void 0,g=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=g?r.find(k=>k.id===g):void 0,b=[Ni];v&&g&&(b.push(sk),b.push({label:v.displayName,url:Oo(g)})),m&&g&&b.push({label:m.name,url:Ti(m.id,g)});for(let k=0;k<d.length-1;k++)b.push({label:d[k].title,url:os(d[k].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}function lh(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 Vc(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 E$(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 ch(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const o=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),_=b?Vc(b):void 0;if(_)try{const k=JSON.parse(v.content);o.set(_,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),k=_?E$(_):void 0;if(!k)return v;const S=o.get(k);if(!S)return v;r.add(k),c.add(b);let j;const T=v.content.trim();if(T.startsWith("{"))try{const w=JSON.parse(T);typeof w.detailedContent=="string"&&(j=w.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Vc(b):void 0;_&&r.has(_)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const _=d[v],k=d[b];let S;try{const j=JSON.parse(_.content);S={tool:j.tool,args:j.args}}catch{}if(S){let j;const T=k.content.trim();if(T.startsWith("{"))try{const D=JSON.parse(T);typeof D.detailedContent=="string"&&(j=D.detailedContent)}catch{}d[b]={...k,toolUseCtx:{...S,detailedResult:j}},c.add(b);const w=s.get(_),C=w?Vc(w):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...w??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const _=Vc(b);if(_&&r.has(_))return!1;const k=b.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function A$(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=ak(s),d=s.filter(m=>cm(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||cm(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function ak(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function cm(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function D$(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=ak(t),c=[];for(const p of t){const m=p.workspaceId?((u=o.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):cm(p,r)?c.push({task:p,reason:"blocked",workspaceName:m}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((p,m)=>(d[p.reason]??3)-(d[m.reason]??3)),c}function M$(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 R$(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 Es=[{id:"kn-auth-flow",label:"Authentication Flow",kind:"knowledge",category:"concept",content:"The application uses JWT Bearer tokens for stateless authentication. Access tokens expire after 24h. Refresh tokens are stored in the database and rotated on use. The auth middleware verifies tokens and attaches the decoded payload to req.user.",tags:["auth","jwt","security"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:30:00Z",updatedAt:"2026-02-27T08:15:00Z",val:5},{id:"kn-db-schema",label:"Database Schema",kind:"knowledge",category:"concept",content:"PostgreSQL database with tables: users, sessions, refresh_tokens, audit_log. Uses UUID primary keys, TIMESTAMPTZ for all timestamps, and JSONB for flexible metadata columns. Connection pooling via pg-pool with per-tenant isolation.",tags:["database","postgres","schema"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:00:00Z",updatedAt:"2026-02-26T22:45:00Z",val:4},{id:"kn-error-handling",label:"Error Response Pattern",kind:"knowledge",category:"concept",content:"All API errors follow the shape { error: string, code: string, details?: unknown }. HTTP status codes map to: 400 (validation), 401 (unauthenticated), 403 (forbidden), 404 (not found), 409 (conflict), 429 (rate limited), 500 (internal).",tags:["api","errors","patterns"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:17:00Z",updatedAt:"2026-02-27T08:17:00Z",val:3},{id:"kn-rate-limiting",label:"Rate Limiting Strategy",kind:"knowledge",category:"concept",content:"Token-bucket algorithm with in-memory state per client IP. Default rate: 100 requests/minute, burst: 20. Returns 429 with Retry-After header. Redis adapter available for multi-instance deployments.",tags:["api","rate-limiting","infrastructure"],workspaceId:"proj-alpha",createdAt:"2026-02-27T09:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:2},{id:"kn-etl-pipeline",label:"ETL Pipeline Architecture",kind:"knowledge",category:"concept",content:"Data pipelines follow an Extract-Transform-Load pattern with pluggable stages. Each stage reads from a source (Postgres, S3, API), transforms via configurable mappers, and loads into a target (Parquet, BigQuery, S3). Incremental loads use high-watermark tracking.",tags:["etl","pipeline","architecture"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:05:00Z",val:4},{id:"kn-parquet-format",label:"Parquet Output Format",kind:"knowledge",category:"concept",content:"Parquet files are written with row-group buffering (configurable batch size, default 10000 rows). Supports Snappy, ZSTD, and GZIP compression. Schema is derived from the internal column type system using Arrow type mapping.",tags:["parquet","data-format","compression"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:05:00Z",updatedAt:"2026-02-26T08:15:00Z",val:3},{id:"kn-jwt-over-session",label:"JWT over Session Auth",kind:"knowledge",category:"decision",content:"Chose JWT tokens over server-side sessions for stateless auth. Rationale: (1) no session store needed, (2) works across microservices without shared state, (3) supports mobile clients natively. Trade-off: tokens can't be revoked instantly (mitigated by short expiry + refresh rotation).",tags:["auth","decision","jwt"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-25T10:00:00Z",val:3},{id:"kn-pg-pool-decision",label:"pg-pool over Knex",kind:"knowledge",category:"decision",content:"Chose pg-pool over Knex for connection pooling. pg-pool gives direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool and adds query-building overhead we don't need since we write raw SQL with parameterized queries.",tags:["database","decision","postgres"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:30:00Z",updatedAt:"2026-02-23T11:30:00Z",val:2},{id:"kn-watermark-decision",label:"Local Watermark Storage",kind:"knowledge",category:"decision",content:"Currently using local SQLite for watermark storage. This works for single-worker pipelines but needs to move to a shared store (Redis or Postgres) for production multi-worker scenarios. Tracked as a follow-up task.",tags:["pipeline","decision","watermarks"],workspaceId:"proj-beta",createdAt:"2026-02-27T09:05:00Z",updatedAt:"2026-02-27T09:05:00Z",val:2},{id:"kn-jwt-middleware",label:"JWT Verify Middleware",kind:"knowledge",category:"snippet",content:`\`\`\`typescript
326
326
  export function verifyToken(req: Request, res: Response, next: NextFunction): void {
327
327
  const header = req.headers.authorization;
328
328
  if (!header?.startsWith("Bearer ")) {
@@ -345,7 +345,7 @@ CREATE TABLE audit_log (
345
345
  ip_address INET,
346
346
  created_at TIMESTAMPTZ DEFAULT now()
347
347
  );
348
- \`\`\``,tags:["database","audit","schema","sql"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:45:15Z",updatedAt:"2026-02-26T22:45:15Z",val:2},{id:"kn-n1-query",label:"N+1 Query in User List",kind:"knowledge",category:"insight",content:"GET /api/users performs a separate query for each user's role metadata, resulting in N+1 queries. For 500 users this adds ~2 seconds of latency. Solution: use a JOIN or batch lookup to fetch all role data in a single query.",tags:["performance","database","n+1"],workspaceId:"proj-alpha",createdAt:"2026-02-22T09:30:00Z",updatedAt:"2026-02-22T09:30:00Z",val:2},{id:"kn-session-race",label:"Session Cleanup Race Condition",kind:"knowledge",category:"insight",content:"When two concurrent requests hit /api/logout, the second call throws a 500 because the session row has already been deleted. Fix: use DELETE ... RETURNING or add IF EXISTS guard to make the operation idempotent.",tags:["bug","concurrency","sessions"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:50:00Z",updatedAt:"2026-02-26T22:50:00Z",val:2},{id:"kn-ref-task-001",label:"JWT Auth Task",kind:"reference",sourceType:"task",sourceId:"task-001",content:"Implement JWT authentication across all protected routes, replacing session-based auth.",workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-27T08:15:00Z",val:3},{id:"kn-ref-task-006",label:"Parquet Export Task",kind:"reference",sourceType:"task",sourceId:"task-006",content:"Add Parquet export support for pipeline outputs, enabling downstream Spark consumption.",workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:3},{id:"kn-ref-sess-001",label:"Auth Middleware Session",kind:"reference",sourceType:"session",sourceId:"sess-001",content:"Active session implementing JWT auth middleware, rewrote auth.ts, login.ts, and test suite.",workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:00Z",updatedAt:"2026-02-27T08:15:42Z",val:2}],Va=[{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"}],I$=new Map(Cs.map(t=>[t.id,t]));function wp(t){const s=I$.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Xb={"kn-auth-flow":{node:wp("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:wp("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:wp("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"}]}},Qb=[{id:"stream-planning",name:"jwt-planning-room",selfEcho:!0,subscriberCount:2,messageBufferDepth:3,subscribers:[{subscriptionId:"sub-p1",sessionId:"sess-001",fd:3,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-p2",sessionId:"sess-002",fd:4,permission:"r",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-metrics",name:"rate-limit-metrics",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-m1",sessionId:"sess-004",fd:3,permission:"r",deliveryMode:"sync",createdBySpawn:!1}]},{id:"stream-cli",name:"cli-inspector",selfEcho:!1,subscriberCount:1,messageBufferDepth:1,subscribers:[{subscriptionId:"sub-c1",sessionId:"external-cli-session",fd:5,permission:"rw",deliveryMode:"async",createdBySpawn:!1}]},{id:"stream-lifecycle",name:"lifecycle:sess-001-7f3a",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-l1",sessionId:"sess-001",fd:6,permission:"rw",deliveryMode:"detach",createdBySpawn:!0}]},{id:"stream-pipe",name:"pipe:sess-001-sess-004",selfEcho:!1,subscriberCount:2,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-pp1",sessionId:"sess-001",fd:7,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-pp2",sessionId:"sess-004",fd:8,permission:"rw",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-stdin",name:"stdin:sess-002-9c2e",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-s1",sessionId:"sess-002",fd:9,permission:"w",deliveryMode:"detach",createdBySpawn:!0}]}],O$={"stream-planning":[{streamId:"stream-planning",seq:"01J0000000000000000000MSG1",senderId:"sess-001",content:"Proposing JWT with RS256 + 15-min access tokens.",timestamp:"2026-05-24T18:00:01.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG2",senderId:"sess-002",content:"Agreed. Refresh tokens rotate on use; store the jti denylist in Redis.",timestamp:"2026-05-24T18:00:07.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG3",senderId:"sess-001",content:"Ship it. I'll wire the middleware; you take the refresh endpoint.",timestamp:"2026-05-24T18:00:14.000Z"}]},B$=[{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:""}],L$=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",taskId:"task-001",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",taskId:"task-003",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",taskId:"task-006c",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],z$=[{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.
348
+ \`\`\``,tags:["database","audit","schema","sql"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:45:15Z",updatedAt:"2026-02-26T22:45:15Z",val:2},{id:"kn-n1-query",label:"N+1 Query in User List",kind:"knowledge",category:"insight",content:"GET /api/users performs a separate query for each user's role metadata, resulting in N+1 queries. For 500 users this adds ~2 seconds of latency. Solution: use a JOIN or batch lookup to fetch all role data in a single query.",tags:["performance","database","n+1"],workspaceId:"proj-alpha",createdAt:"2026-02-22T09:30:00Z",updatedAt:"2026-02-22T09:30:00Z",val:2},{id:"kn-session-race",label:"Session Cleanup Race Condition",kind:"knowledge",category:"insight",content:"When two concurrent requests hit /api/logout, the second call throws a 500 because the session row has already been deleted. Fix: use DELETE ... RETURNING or add IF EXISTS guard to make the operation idempotent.",tags:["bug","concurrency","sessions"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:50:00Z",updatedAt:"2026-02-26T22:50:00Z",val:2},{id:"kn-ref-task-001",label:"JWT Auth Task",kind:"reference",sourceType:"task",sourceId:"task-001",content:"Implement JWT authentication across all protected routes, replacing session-based auth.",workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-27T08:15:00Z",val:3},{id:"kn-ref-task-006",label:"Parquet Export Task",kind:"reference",sourceType:"task",sourceId:"task-006",content:"Add Parquet export support for pipeline outputs, enabling downstream Spark consumption.",workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:3},{id:"kn-ref-sess-001",label:"Auth Middleware Session",kind:"reference",sourceType:"session",sourceId:"sess-001",content:"Active session implementing JWT auth middleware, rewrote auth.ts, login.ts, and test suite.",workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:00Z",updatedAt:"2026-02-27T08:15:42Z",val:2}],Va=[{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"}],I$=new Map(Es.map(t=>[t.id,t]));function wp(t){const s=I$.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Xb={"kn-auth-flow":{node:wp("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:wp("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:wp("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"}]}},Qb=[{id:"stream-planning",name:"jwt-planning-room",selfEcho:!0,subscriberCount:2,messageBufferDepth:3,subscribers:[{subscriptionId:"sub-p1",sessionId:"sess-001",fd:3,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-p2",sessionId:"sess-002",fd:4,permission:"r",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-metrics",name:"rate-limit-metrics",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-m1",sessionId:"sess-004",fd:3,permission:"r",deliveryMode:"sync",createdBySpawn:!1}]},{id:"stream-cli",name:"cli-inspector",selfEcho:!1,subscriberCount:1,messageBufferDepth:1,subscribers:[{subscriptionId:"sub-c1",sessionId:"external-cli-session",fd:5,permission:"rw",deliveryMode:"async",createdBySpawn:!1}]},{id:"stream-lifecycle",name:"lifecycle:sess-001-7f3a",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-l1",sessionId:"sess-001",fd:6,permission:"rw",deliveryMode:"detach",createdBySpawn:!0}]},{id:"stream-pipe",name:"pipe:sess-001-sess-004",selfEcho:!1,subscriberCount:2,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-pp1",sessionId:"sess-001",fd:7,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-pp2",sessionId:"sess-004",fd:8,permission:"rw",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-stdin",name:"stdin:sess-002-9c2e",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-s1",sessionId:"sess-002",fd:9,permission:"w",deliveryMode:"detach",createdBySpawn:!0}]}],O$={"stream-planning":[{streamId:"stream-planning",seq:"01J0000000000000000000MSG1",senderId:"sess-001",content:"Proposing JWT with RS256 + 15-min access tokens.",timestamp:"2026-05-24T18:00:01.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG2",senderId:"sess-002",content:"Agreed. Refresh tokens rotate on use; store the jti denylist in Redis.",timestamp:"2026-05-24T18:00:07.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG3",senderId:"sess-001",content:"Ship it. I'll wire the middleware; you take the refresh endpoint.",timestamp:"2026-05-24T18:00:14.000Z"}]},B$=[{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:""}],L$=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",taskId:"task-001",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",taskId:"task-003",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",taskId:"task-006c",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3}],z$=[{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T14:00:01Z",content:"running"},{sessionId:"sess-001-prev",eventType:"system",timestamp:"2026-02-26T14:00:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
349
349
  Project: acme/alpha — Node.js + Express REST API
350
350
  Task: Implement auth middleware using JWT tokens`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:05Z",content:"I'll start by reading the current authentication middleware to understand what needs to change."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tu-prev-001",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:07Z",content:`import session from "express-session";
351
351
  import type { Request, Response, NextFunction } from "express";
@@ -654,11 +654,11 @@ src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stri
654
654
  2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
655
655
  3. Add middleware to extract tenant ID from the request
656
656
 
657
- This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],$$=[{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"}],H$=[{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}],P$=[{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:""}],U$=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","knowledge_search","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Reports issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Report anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and logs a summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:'const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));\nfor (const f of files) {\n const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);\n if (eslintResult.exitCode !== 0) {\n console.log(`Lint issues in ${f.filename}: ${eslintResult.stderr}`);\n }\n const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);\n if (prettierResult.exitCode !== 0) {\n console.log(`Prettier issues in ${f.filename}: ${prettierResult.stderr}`);\n }\n}\nconsole.log(`Ran ESLint and Prettier on ${files.length} files`);',allowedMcpTools:[]}],V$={"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 e_=[{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
+ 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"}],$$=[{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"}],H$=[{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,injectKnowledge:!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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!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,injectKnowledge:!0,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,injectKnowledge:!0,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,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],P$=[{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:""}],U$=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","knowledge_search","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Reports issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Report anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and logs a summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:'const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));\nfor (const f of files) {\n const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);\n if (eslintResult.exitCode !== 0) {\n console.log(`Lint issues in ${f.filename}: ${eslintResult.stderr}`);\n }\n const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);\n if (prettierResult.exitCode !== 0) {\n console.log(`Prettier issues in ${f.filename}: ${prettierResult.stderr}`);\n }\n}\nconsole.log(`Ran ESLint and Prettier on ${files.length} files`);',allowedMcpTools:[]}],V$={"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 Oe(t){return new Date(Date.now()+t).toISOString()}const e_=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(1600),content:`src/routes/users.ts
658
658
  src/routes/auth.ts
659
659
  src/routes/billing.ts
660
660
  src/routes/admin.ts
661
- src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Le(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
661
+ src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Oe(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
662
662
 
663
663
  \`\`\`typescript
664
664
  const router = Router();
@@ -670,12 +670,12 @@ router.post("/", createUser);
670
670
  router.get("/:id", getUser);
671
671
  router.put("/:id", updateUser);
672
672
  router.delete("/:id", deleteUser);
673
- \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Le(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Le(4e3),content:` PASS src/routes/__tests__/users.test.ts
673
+ \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(4e3),content:` PASS src/routes/__tests__/users.test.ts
674
674
  PASS src/routes/__tests__/auth.test.ts
675
675
  PASS src/routes/__tests__/billing.test.ts
676
676
 
677
677
  Test Suites: 3 passed, 3 total
678
- Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Le(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Le(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Le(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`CREATE TABLE users (
678
+ Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Oe(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Oe(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Oe(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(1800),content:`CREATE TABLE users (
679
679
  id UUID PRIMARY KEY,
680
680
  name TEXT NOT NULL,
681
681
  email TEXT UNIQUE NOT NULL,
@@ -686,18 +686,18 @@ CREATE TABLE sessions (
686
686
  id UUID PRIMARY KEY,
687
687
  user_id UUID REFERENCES users(id),
688
688
  expires_at TIMESTAMPTZ NOT NULL
689
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(2600),content:`I found the tables to modify:
689
+ );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Oe(2600),content:`I found the tables to modify:
690
690
  - **users**: add column \`last_login_at\`
691
691
  - **sessions**: add index on \`expires_at\`
692
692
  - **audit_log**: new table
693
693
 
694
694
  This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
695
695
 
696
- Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Le(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Le(1700),content:`Applying 002_add_last_login.sql... done
696
+ Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Oe(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(1700),content:`Applying 002_add_last_login.sql... done
697
697
  Applying 003_sessions_index.sql... done
698
698
  Applying 004_audit_log.sql... done
699
699
 
700
- 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Le(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Le(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`import { StripeClient } from "./stripe-client.js";
700
+ 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Oe(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Oe(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(1800),content:`import { StripeClient } from "./stripe-client.js";
701
701
  import type { Invoice, LineItem } from "../types/billing.js";
702
702
 
703
703
  export class BillingService {
@@ -707,7 +707,7 @@ export class BillingService {
707
707
  const invoices = await this.stripe.listInvoices(userId);
708
708
  return invoices.reduce((sum, inv) => sum + inv.total, 0);
709
709
  }
710
- }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Le(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Le(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Le(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Le(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Le(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Le(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Le(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Le(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Le(1800),content:`import jwt from "jsonwebtoken";
710
+ }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Oe(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Oe(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:Oe(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:Oe(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:Oe(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(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:Oe(1800),content:`import jwt from "jsonwebtoken";
711
711
  import type { Request, Response, NextFunction } from "express";
712
712
 
713
713
  const JWT_SECRET = process.env.JWT_SECRET || "change-me";
@@ -729,7 +729,7 @@ export function verifyToken(req: Request, res: Response, next: NextFunction): vo
729
729
  } catch {
730
730
  res.status(403).json({ error: "Invalid token" });
731
731
  }
732
- }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Le(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Le(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Le(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Le(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Le(5800),content:`[exit 0] > jest --grep auth
732
+ }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Oe(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:Oe(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:Oe(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Oe(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:Oe(5800),content:`[exit 0] > jest --grep auth
733
733
 
734
734
  PASS src/auth.test.ts
735
735
  ✓ validates JWT token (12ms)
@@ -737,19 +737,19 @@ export function verifyToken(req: Request, res: Response, next: NextFunction): vo
737
737
  ✓ handles missing header (1ms)
738
738
 
739
739
  Tests: 3 passed, 3 total
740
- Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Le(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Le(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
741
- src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Le(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Le(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Le(8800),content:"completed"}}]}],ns={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function t_(t){return t?Qb:Qb.filter(s=>!v7.some(o=>s.name.startsWith(o)))}const n_=400;function q$({children:t}){const[s,o]=y.useState(B$),[r,c]=y.useState(L$),[d,u]=y.useState(()=>t_(!1)),[p,m]=y.useState(z$),[g,v]=y.useState(void 0),[b,_]=y.useState($$),[k,S]=y.useState(""),[T,j]=y.useState(H$),[w,C]=y.useState(P$),[D,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,R]=y.useState(U$),[O,M]=y.useState([]),[$]=y.useState(V$),[Y,V]=y.useState(""),[ee,le]=y.useState(Cs),[Z,ae]=y.useState(Va),[H,B]=y.useState(void 0),[F,ge]=y.useState(void 0),[ne,ce]=y.useState(""),me=y.useRef(void 0),ke=y.useRef(0),De=y.useRef(0),ot=y.useRef(new Set),yt=y.useRef(new Map),_e=y.useRef(T);_e.current=T;const Oe=y.useRef(new Map),Ht=y.useRef(new Map),Nt=y.useCallback(U=>(ke.current+=1,`mock-${U}-${String(ke.current).padStart(3,"0")}`),[]),ue=y.useCallback(()=>{const U=e_[De.current%e_.length];return De.current+=1,U},[]),Re=y.useCallback((U,se,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=yt.current.get(de))==null||ye.delete(pe)),U()},se);ot.current.add(pe),de&&(yt.current.has(de)||yt.current.set(de,new Set),yt.current.get(de).add(pe))},[]),Q=y.useCallback(U=>{const se=yt.current.get(U);se&&(se.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),yt.current.delete(U))},[]),et=y.useCallback((U,se,de)=>{c(pe=>pe.map(ye=>ye.id===U?{...ye,status:se,...de!==void 0?{endReason:de}:{}}:ye))},[]),re=y.useCallback(U=>{m(se=>[...se,U])},[]),ve=y.useCallback((U,se,de)=>{se.forEach((pe,ye)=>{Re(()=>{const Qe={sessionId:U,...pe.event,timestamp:new Date().toISOString()};if(re(Qe),pe.event.eventType==="status"){const Te=tk(pe.event.content),Be=nk(pe.event.content);et(U,Te,Be)}ye===se.length-1&&de&&de()},pe.delayMs,U)})},[Re,re,et]),Xe=y.useCallback(async(U,se,de,pe)=>{console.log("[MockGrackle] spawn",{environmentId:U,prompt:se,runtime:pe});const ye=Nt("sess"),Qe={id:ye,environmentId:U,runtime:pe||"claude-code",status:"running",prompt:se,startedAt:new Date().toISOString()};c(Be=>[...Be,Qe]),v(ye);const Te=ue();if(console.log(`[MockGrackle] Playing scenario: ${Te.label}`),Te.pauseForInput){const Be=Te.pauseAfterStep??Te.steps.length-1,Ge=Te.steps.slice(0,Be+1),ht=Ge.length>0?Ge[Ge.length-1].delayMs:0;ve(ye,Ge),Re(()=>{et(ye,"idle"),re({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ht+n_,ye),Te.resumeSteps&&Oe.current.set(ye,Te.resumeSteps)}else ve(ye,Te.steps)},[Nt,ue,ve,Re,et,re]),an=y.useCallback(async U=>{console.log("[MockGrackle] kill",U),Q(U),Oe.current.delete(U),et(U,"stopped","killed"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),j(se=>se.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,et,re]),_s=y.useCallback(async U=>{console.log("[MockGrackle] stopGraceful",U),Q(U),Oe.current.delete(U),et(U,"stopped","terminated"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),j(se=>se.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,et,re]),ls=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Os=y.useCallback(async U=>{console.log("[MockGrackle] loadSessionEvents",U)},[]),pa=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Ri=y.useCallback(async(U,se,de,pe,ye,Qe,Te,Be,Ge)=>{console.log("[MockGrackle] createWorkspace",{name:U,description:se});const ht={id:Nt("proj"),name:U,description:se||"",repoUrl:de||"",linkedEnvironmentIds:pe?[pe]:[],status:"active",workingDirectory:Te||"",useWorktrees:Qe??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_(tt=>[...tt,ht]),Be&&Be(ht)},[Nt]),Wt=y.useCallback(async U=>{console.log("[MockGrackle] archiveWorkspace",U),_(se=>se.map(de=>de.id===U?{...de,status:"archived"}:de))},[]),Wa=y.useCallback(async U=>{console.log("[MockGrackle] loadTasks",U)},[]),Xa=y.useCallback(async(U,se,de,pe,ye,Qe,Te,Be,Ge)=>{console.log("[MockGrackle] createTask",{workspaceId:U,title:se,parentTaskId:ye}),j(ht=>{const Qt=ht.filter(Ss=>Ss.workspaceId===U).reduce((Ss,Li)=>Math.max(Ss,Li.sortOrder),0),on=ye?ht.find(Ss=>Ss.id===ye):void 0;if(ye&&!on)return console.warn("[MockGrackle] Parent task not found:",ye),ht;if(on&&!on.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),ht;const Et=on?on.depth+1:0,ks={id:Nt("task"),workspaceId:U,title:se,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:Qt+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:Et,childTaskIds:[],canDecompose:Te??!ye,defaultPersonaId:Qe||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...ht,ks]}),Be&&Be()},[Nt]),ma=y.useCallback(async(U,se,de,pe)=>{var ht;console.log("[MockGrackle] startTask",{taskId:U});const ye=_e.current.find(tt=>tt.id===U),Qe=(ye==null?void 0:ye.title)??"",Te=Nt("sess"),Be={id:Te,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:Qe||U,startedAt:new Date().toISOString()};c(tt=>[...tt,Be]),j(tt=>tt.map(Qt=>Qt.id===U?{...Qt,status:"working",latestSessionId:Te,branch:`mock/${U.slice(0,8)}`}:Qt));const Ge=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ge.label}`),Ge.pauseForInput){const tt=Ge.pauseAfterStep??Ge.steps.length-1,Qt=Ge.steps.slice(0,tt+1),on=Qt.length>0?Qt[Qt.length-1].delayMs:0;if(ve(Te,Qt),Re(()=>{et(Te,"idle"),re({sessionId:Te,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},on+n_,Te),Ge.resumeSteps){const Et=[...Ge.resumeSteps];Oe.current.set(Te,Et);const ks=Et.reduce((Ss,Li)=>Math.max(Ss,Li.delayMs),0);Ht.current.set(Te,{taskId:U,delayAfterResume:ks+200})}}else{const tt=Ge.steps.length>0?Ge.steps[Ge.steps.length-1].delayMs:0;ve(Te,Ge.steps);const Qt=(ht=Ge.steps[Ge.steps.length-1])==null?void 0:ht.event.content;Re(()=>{Qt==="completed"?j(on=>on.map(Et=>Et.id===U&&Et.status==="working"?{...Et,status:"paused"}:Et)):Qt==="failed"&&j(on=>on.map(Et=>Et.id===U&&Et.status==="working"?{...Et,status:"failed"}:Et))},tt+100,Te)}},[Nt,ue,ve,Re,et,re]),Bs=y.useCallback(async(U,se)=>{console.log("[MockGrackle] sendInput",{sessionId:U,text:se}),re({sessionId:U,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${se}`}),et(U,"running"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const de=Oe.current.get(U);if(de)Oe.current.delete(U),ve(U,de);else{const ye=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];ve(U,ye)}const pe=Ht.current.get(U);pe&&(Ht.current.delete(U),Re(()=>{j(ye=>ye.map(Qe=>Qe.id===pe.taskId&&Qe.status==="working"?{...Qe,status:"paused"}:Qe))},pe.delayAfterResume,U))},[re,et,ve,Re]),xs=y.useCallback(async U=>{console.log("[MockGrackle] completeTask",U),j(se=>se.map(de=>de.id===U?{...de,status:"complete"}:de))},[]),Ne=y.useCallback(async U=>{console.log("[MockGrackle] resumeTask",U)},[]),Ue=y.useCallback(async(U,se,de,pe,ye)=>{console.log("[MockGrackle] updateTask",{taskId:U,title:se}),j(Qe=>Qe.map(Te=>Te.id===U?{...Te,title:se.trim()||Te.title,description:de,dependsOn:pe,...ye!==void 0?{defaultPersonaId:ye}:{}}:Te))},[]),_n=y.useCallback(async U=>{console.log("[MockGrackle] deleteTask",U),j(se=>se.filter(de=>de.id!==U))},[]),mn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Pt=y.useCallback(async(U,se,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:U,adapterType:se,adapterConfig:de})},[]),Cn=y.useCallback(async(U,se)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:U,...se}),o(de=>de.map(pe=>pe.id!==U?pe:{...pe,...se.displayName!==void 0?{displayName:se.displayName}:{},...se.adapterConfig!==void 0?{adapterConfig:JSON.stringify(se.adapterConfig)}:{}}))},[]),Xt=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Ii=y.useCallback(async(U,se,de,pe,ye)=>{console.log("[MockGrackle] setToken",{name:U,tokenType:de}),C(Qe=>[...Qe.filter(Be=>Be.name!==U),{name:U,tokenType:de,envVar:pe,filePath:ye,expiresAt:""}])},[]),Oi=y.useCallback(async U=>{console.log("[MockGrackle] deleteToken",U),C(se=>se.filter(de=>de.name!==U))},[]),hl=y.useCallback(async U=>{console.log("[MockGrackle] updateCredentialProviders",U),A(U)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const Bi=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:mn,addEnvironment:Pt,updateEnvironment:Cn,provisionEnvironment:async(U,se)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ns},sessions:{sessions:r,sessionsLoading:!1,events:p,eventsDropped:0,lastSpawnedId:g,taskSessions:$,spawn:Xe,sendInput:Bs,kill:an,stopGraceful:_s,loadSessionEvents:Os,clearEvents:pa,loadTaskSessions:async U=>{console.log("[MockGrackle] loadTaskSessions",U)},domainHook:ns},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Ri,archiveWorkspace:Wt,updateWorkspace:async(U,se)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:U,...se}),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,...se.name!==void 0?{name:se.name}:{},...se.description!==void 0?{description:se.description}:{},...se.repoUrl!==void 0?{repoUrl:se.repoUrl}:{},...se.environmentId!==void 0?{environmentId:se.environmentId}:{},...se.workingDirectory!==void 0?{workingDirectory:se.workingDirectory}:{},...se.useWorktrees!==void 0?{useWorktrees:se.useWorktrees}:{},...se.defaultPersonaId!==void 0?{defaultPersonaId:se.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(U,se)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:U,environmentId:se}),se==="error-env"){S("Failed to link environment");return}S(""),_(de=>de.map(pe=>pe.id!==U||pe.linkedEnvironmentIds.includes(se)?pe:{...pe,linkedEnvironmentIds:[...pe.linkedEnvironmentIds,se]}))},unlinkEnvironment:async(U,se)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:U,environmentId:se}),se==="error-env"){S("Failed to unlink environment");return}S(""),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,linkedEnvironmentIds:pe.linkedEnvironmentIds.filter(ye=>ye!==se)}))},linkOperationError:k,clearLinkOperationError:()=>{S("")},domainHook:ns},tasks:{tasks:T,tasksLoading:!1,taskStartingId:void 0,loadTasks:Wa,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Xa,startTask:ma,stopTask:async U=>{console.log("[MockGrackle] stopTask",{taskId:U}),await xs(U)},completeTask:xs,resumeTask:Ne,updateTask:Ue,deleteTask:_n,domainHook:ns},tokens:{tokens:w,tokensLoading:!1,loadTokens:Xt,setToken:Ii,deleteToken:Oi,domainHook:ns},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:hl,domainHook:ns},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ns},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ns},personas:{personas:E,personasLoading:!1,createPersona:async(U,se,de,pe,ye,Qe,Te,Be,Ge)=>{console.log("[MockGrackle] createPersona",{name:U});const ht={id:`mock-persona-${Date.now()}`,name:U,description:se,systemPrompt:de,toolConfig:"{}",runtime:pe??"claude-code",model:ye||"",maxTurns:Qe||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:Te||"agent",script:Be||"",allowedMcpTools:Ge||[]};return R(tt=>[...tt,ht]),ht},updatePersona:async(U,se,de,pe,ye,Qe,Te,Be,Ge,ht)=>{console.log("[MockGrackle] updatePersona",{personaId:U,name:se});const tt=E.find(Et=>Et.id===U);if(!tt)throw new Error(`Persona not found: ${U}`);const Qt=new Date().toISOString(),on={...tt,...se!==void 0?{name:se}:{},...de!==void 0?{description:de}:{},...pe!==void 0?{systemPrompt:pe}:{},...ye!==void 0?{runtime:ye}:{},...Qe!==void 0?{model:Qe}:{},...Te!==void 0?{maxTurns:Te}:{},...Be!==void 0?{type:Be}:{},...Ge!==void 0?{script:Ge}:{},...ht!==void 0?{allowedMcpTools:ht}:{},updatedAt:Qt};return R(Et=>Et.map(ks=>ks.id===U?on:ks)),on},deletePersona:async U=>{console.log("[MockGrackle] deletePersona",U),R(se=>se.filter(de=>de.id!==U))},domainHook:ns},schedules:{schedules:O,schedulesLoading:!1,createSchedule:async(U,se,de,pe,ye)=>{console.log("[MockGrackle] createSchedule",{title:U});const Qe={id:`mock-schedule-${Date.now()}`,title:U,description:se,scheduleExpression:de,personaId:pe,workspaceId:ye??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return M(Te=>[...Te,Qe]),Qe},updateSchedule:async(U,se)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:U,fields:se});let de;if(M(pe=>pe.map(ye=>ye.id!==U?ye:(de={...ye,...se,updatedAt:new Date().toISOString()},de))),!de)throw new Error(`Schedule not found: ${U}`);return de},deleteSchedule:async U=>{console.log("[MockGrackle] deleteSchedule",U),M(se=>se.filter(de=>de.id!==U))},domainHook:ns},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(U=!1)=>{u(t_(U))},liveMessages:O$,loadTranscript:async()=>{},handleStreamMessage:()=>{},domainHook:ns},knowledge:{graphData:{nodes:ee,links:Z},selectedNode:H,loading:!1,selectedId:F,searchQuery:ne,search:async U=>{if(console.log("[MockGrackle] knowledge.search",U),!U.trim()){ce(U);return}ce(U);const se=me.current,de=se?Cs.filter(Te=>!Te.workspaceId||Te.workspaceId===se):Cs,pe=U.toLowerCase(),ye=de.filter(Te=>{var Be,Ge,ht;return Te.label.toLowerCase().includes(pe)||((Be=Te.content)==null?void 0:Be.toLowerCase().includes(pe))||((Ge=Te.tags)==null?void 0:Ge.some(tt=>tt.toLowerCase().includes(pe)))||((ht=Te.category)==null?void 0:ht.toLowerCase().includes(pe))});le(ye);const Qe=new Set(ye.map(Te=>Te.id));ae(Va.filter(Te=>Qe.has(Te.source)&&Qe.has(Te.target))),ge(void 0),B(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ce("");const U=me.current,se=U?Cs.filter(pe=>!pe.workspaceId||pe.workspaceId===U):Cs;le(se);const de=new Set(se.map(pe=>pe.id));ae(Va.filter(pe=>de.has(pe.source)&&de.has(pe.target)))},selectNode:async U=>{console.log("[MockGrackle] knowledge.selectNode",U),ge(U);const se=U in Xb?Xb[U]:void 0;if(se)B(se);else{const de=Cs.find(pe=>pe.id===U);if(de){const pe=Va.filter(ye=>ye.source===U||ye.target===U).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));B({node:de,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ge(void 0),B(void 0)},expandNode:async U=>{console.log("[MockGrackle] knowledge.expandNode",U),le(se=>{const de=new Set(se.map(Be=>Be.id)),pe=Va.filter(Be=>Be.source===U||Be.target===U),ye=new Set;for(const Be of pe)de.has(Be.source)||ye.add(Be.source),de.has(Be.target)||ye.add(Be.target);if(ye.size===0)return se;const Qe=Cs.filter(Be=>ye.has(Be.id)),Te=new Set([...de,...ye]);return ae(Be=>{const Ge=new Set(Be.map(tt=>`${tt.source}|${tt.target}|${tt.type}`)),ht=Va.filter(tt=>Te.has(tt.source)&&Te.has(tt.target)&&!Ge.has(`${tt.source}|${tt.target}|${tt.type}`));return ht.length>0?[...Be,...ht]:Be}),[...se,...Qe]})},loadRecent:async U=>{if(console.log("[MockGrackle] knowledge.loadRecent",U),me.current=U,U){const se=Cs.filter(pe=>!pe.workspaceId||pe.workspaceId===U);le(se);const de=new Set(se.map(pe=>pe.id));ae(Va.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else le(Cs),ae(Va);ce("")},handleEvent:()=>!1,domainHook:ns},githubAccounts:{githubAccounts:[],githubAccountsLoading:!1,loadGitHubAccounts:async()=>{console.log("[MockGrackle] loadGitHubAccounts")},addGitHubAccount:async(U,se,de,pe)=>{console.log("[MockGrackle] addGitHubAccount",U)},updateGitHubAccount:async(U,se)=>{console.log("[MockGrackle] updateGitHubAccount",U,se)},removeGitHubAccount:async U=>{console.log("[MockGrackle] removeGitHubAccount",U)},importGitHubAccounts:async()=>(console.log("[MockGrackle] importGitHubAccounts"),{imported:0,usernames:[]})},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(U,se)=>{console.log("[MockGrackle] setPluginEnabled",U,se)}},appDefaultPersonaId:Y,setAppDefaultPersonaId:async U=>{console.log("[MockGrackle] setAppDefaultPersonaId",U),V(U)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(U,se)=>{console.log(`[MockGrackle] loadUsage(${U}, ${se})`)},refresh:ls}),[s,r,d,p,g,$,b,k,T,w,D,E,O,Y,ee,Z,H,F,ne,Xe,Bs,an,_s,Os,pa,Ri,Wt,Wa,Xa,ma,xs,Ne,Ue,_n,mn,Pt,Cn,Xt,Ii,Oi,hl,ls]);return i.jsx(rh.Provider,{value:Bi,children:t})}const ik=3e3,G$=ik;function F$(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.onStreamMessage);d.current=t.onStreamMessage;const u=y.useRef(t.onConnect);u.current=t.onConnect;const p=y.useRef(t.onDisconnect);return p.current=t.onDisconnect,y.useEffect(()=>{let m=!1,g,v;async function b(){var S,T,j;if(m)return;Promise.resolve((S=u.current)==null?void 0:S.call(u)).catch(()=>{});let _=!1;const k=()=>{!_&&!m&&(_=!0,o("connected"))};v=setTimeout(k,G$);try{const w=ze.streamEvents({});for await(const C of w){if(k(),m)break;const D=C.event;if(D.case==="sessionEvent"){const A=D.value;r.current({sessionId:A.sessionId,type:A.type,timestamp:A.timestamp,content:A.content,raw:A.raw})}else if(D.case==="domainEvent"){const A=D.value;c.current({id:A.id,type:A.type,timestamp:A.timestamp,payloadJson:A.payloadJson})}else if(D.case==="streamMessageEvent"){const A=D.value;(T=d.current)==null||T.call(d,{streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp})}}}catch(w){if(clearTimeout(v),w instanceof ra&&w.code===__.Unauthenticated){window.location.href=qN;return}}clearTimeout(v),m||(o("connecting"),(j=p.current)==null||j.call(p),g=setTimeout(()=>{b().catch(()=>{})},ik))}return b().catch(()=>{}),()=>{m=!0,clearTimeout(g),clearTimeout(v)}},[]),{connectionStatus:s}}const dm=["core","orchestration","scheduling"],ok=y.createContext({pluginNames:[...dm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function K$({children:t}){const[s,o]=y.useState([...dm]),[r,c]=y.useState(void 0),[d,u]=y.useState(void 0),[p,m]=y.useState(!0),[g,v]=y.useState(void 0);return y.useEffect(()=>{let b=!1;return fetch("/api/manifest").then(async _=>{if(!_.ok)throw new Error(`Manifest fetch returned ${_.status}`);return _.json()}).then(_=>{b||(o(_.plugins.map(k=>k.name)),c(_.sandboxPort),u(_.sandboxOrigin),m(!1))}).catch(_=>{b||(o([...dm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),i.jsx(ok.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:p,error:g},children:t})}function Ad(){return y.useContext(ok)}function dh(){const{sandboxPort:t,sandboxOrigin:s}=Ad();if(typeof window>"u")return;if(s!==void 0&&s!=="")try{return new URL("/sandbox.html",s).toString()}catch{}if(t===void 0)return;const o=new URL(window.location.origin);return o.port=String(t),o.pathname="/sandbox.html",o.toString()}const Z$=new Set(["dashboard","chat","environments","coordination","settings"]),Y$=new Set(["tasks"]),J$=new Set(["knowledge"]),rk={core:{navItems:Qc.filter(t=>Z$.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:Qc.filter(t=>Y$.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:Qc.filter(t=>J$.has(t.view)),domainHookKeys:["knowledge"]}};function W$(t){return t.flatMap(s=>{var o;return((o=rk[s])==null?void 0:o.navItems)??[]})}function X$(t){return new Set(t.flatMap(s=>{var o;return((o=rk[s])==null?void 0:o.domainHookKeys)??[]}))}function Q$(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function s_(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,taskId:t.taskId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function e9(t){return{sessionId:t.sessionId,eventType:x_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function a_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:z2(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function i_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:$2(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 t9(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function n9(t){return{claude:H2(t.claude),github:Cc(t.github),copilot:Cc(t.copilot),codex:Cc(t.codex),goose:Cc(t.goose)}}function s9(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function a9(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function Np(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 i9(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Cp(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 qc(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 Ep(t){return{source:t.fromId,target:t.toId,type:t.type}}function o9(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function r9(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(o9),selfEcho:t.selfEcho}}function bs(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const o_=5e3;function Pr(t){return t instanceof ra?t.message:"Operation failed"}function l9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(ze.listEnvironments({}));s(C.environments.map(Q$))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(A=>A.filter(E=>E.id!==D)),d(A=>{const E={...A};return delete E[D],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return ek("environment.provision_progress","invalid payload"),!0;if(d(A=>({...A,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const A=D.environmentId;setTimeout(()=>{d(E=>{const R={...E};return delete R[A],R})},o_)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const A=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(A),!0}return!1},[]),_=y.useCallback(async(C,D,A,E)=>{p("");try{await ze.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(A??{}),githubAccountId:E??""})}catch(R){p(Pr(R))}},[]),k=y.useCallback(async(C,D)=>{p("");try{await ze.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0,githubAccountId:D.githubAccountId})}catch(A){p(Pr(A))}},[]),S=y.useCallback(async(C,D)=>{p("");try{const A=ze.provisionEnvironment({id:C,force:D??!1});for await(const E of A)d(R=>({...R,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(R=>{const O={...R};return delete O[C],O})},o_)}catch(A){d(E=>{const R={...E};return delete R[C],R}),p(Pr(A))}},[]),T=y.useCallback(async C=>{p("");try{await ze.stopEnvironment({id:C})}catch(D){p(Pr(D))}},[]),j=y.useCallback(async C=>{p("");try{await ze.removeEnvironment({id:C})}catch(D){p(Pr(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:T,removeEnvironment:j,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const Ap=new Set(["pending","running","idle"]),c9=new Set(["completed","failed","interrupted","hibernating","suspended"]),r_=["pending","running","idle"];function d9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const $=(await r(ze.listSessions({}))).sessions.map(s_);s(Y=>{const V=new Map(Y.map(ee=>[ee.id,ee]));return $.map(ee=>{const le=V.get(ee.id),Z=le==null?void 0:le.status;return!Z||Z===ee.status?ee:c9.has(Z)&&Ap.has(ee.status)?{...ee,status:Z,...le.endReason!==void 0?{endReason:le.endReason}:{}}:Ap.has(Z)&&Ap.has(ee.status)&&r_.indexOf(Z)>r_.indexOf(ee.status)?{...ee,status:Z}:ee})})}catch{}},[r]),k=y.useCallback(M=>{if(M.type!=="session_event")return!1;if(!b$(M.payload))return ek("session_event","payload is not a valid SessionEvent"),!0;const $=M.payload;let Y=0;if(d(V=>{const ee=[...V,$];return ee.length>jo?(Y=ee.length-jo,ee.slice(-jo)):ee}),Y>0&&p(V=>V+Y),$.eventType==="usage")try{const V=JSON.parse($.content),ee=Number(V.input_tokens)||0,le=Number(V.output_tokens)||0,Z=Number(V.cost_millicents)||0;(ee>0||le>0||Z>0)&&s(ae=>ae.map(H=>H.id===$.sessionId?{...H,inputTokens:(H.inputTokens??0)+ee,outputTokens:(H.outputTokens??0)+le,costMillicents:(H.costMillicents??0)+Z}:H))}catch{}if($.eventType==="status"){const V=tk($.content),ee=nk($.content);s(le=>le.some(ae=>ae.id===$.sessionId)?le.map(ae=>ae.id===$.sessionId?{...ae,status:V,...ee!==void 0?{endReason:ee}:{}}:ae):[...le,{id:$.sessionId,environmentId:"",runtime:"",status:V,prompt:"",startedAt:$.timestamp,...ee!==void 0?{endReason:ee}:{}}])}return!0},[]),S=y.useCallback(M=>{k({type:"session_event",payload:M})},[k]),T=y.useCallback(M=>{var $,Y,V,ee,le;switch(M.type){case"sessions":{const Z=Array.isArray(($=M.payload)==null?void 0:$.sessions)?M.payload.sessions:[];return s(Z),!0}case"spawned":{const Z=(Y=M.payload)==null?void 0:Y.sessionId;return typeof Z=="string"&&Z&&g(Z),_().catch(()=>{}),!0}case"session_events":{const Z=Array.isArray((V=M.payload)==null?void 0:V.events)?M.payload.events:[];return Z.length>0&&d(Z),!0}case"task_sessions":{const Z=(ee=M.payload)==null?void 0:ee.taskId;if(typeof Z=="string"&&Z){const ae=Array.isArray((le=M.payload)==null?void 0:le.sessions)?M.payload.sessions:[];b(H=>({...H,[Z]:ae}))}return!0}default:return!1}},[_]),j=y.useCallback(async(M,$,Y,V,ee)=>{try{const le=await ze.spawnAgent({environmentId:M,prompt:$,personaId:Y||"",workingDirectory:V||"",workspaceId:ee||""});g(le.id),await _()}catch{}},[_]),w=y.useCallback(async(M,$)=>{await ze.sendInput({sessionId:M,text:$})},[]),C=y.useCallback(async M=>{try{await ze.killAgent({id:M,graceful:!1})}catch{}},[]),D=y.useCallback(async M=>{try{await ze.killAgent({id:M,graceful:!0})}catch{}},[]),A=y.useCallback(async M=>{try{const Y=(await ze.getSessionEvents({id:M})).events.map(e9);if(Y.length>0){let V=0;d(ee=>{const le=new Set;for(const H of ee)H.sessionId===M&&le.add(`${H.timestamp}|${H.eventType}`);const Z=Y.filter(H=>!le.has(`${H.timestamp}|${H.eventType}`)),ae=[...ee,...Z].sort((H,B)=>H.sessionId!==B.sessionId?0:H.timestamp.localeCompare(B.timestamp));return ae.length>jo?(V=ae.length-jo,ae.slice(-jo)):ae}),V>0&&p(ee=>ee+V)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),R=y.useCallback(async M=>{try{const Y=(await ze.getTaskSessions({id:M})).sessions.map(s_);b(V=>({...V,[M]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:j,sendInput:w,kill:C,stopGraceful:D,loadSessionEvents:A,clearEvents:E,loadTaskSessions:R,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:T,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function l_(t){return t instanceof ra?t.message:"Operation failed"}function u9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(ze.listWorkspaces({}));s(C.workspaces.map(a_))}catch{}},[r]),g=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=y.useCallback(()=>{d(!1)},[]),b=y.useCallback(async(C,D,A,E,R,O,M,$,Y)=>{d(!0);try{const V=await ze.createWorkspace({name:C,description:D||"",repoUrl:A||"",environmentId:E||"",defaultPersonaId:R||void 0,useWorktrees:O??!0,workingDirectory:M||void 0}),ee=a_(V);s(le=>le.some(Z=>Z.id===ee.id)?le:[...le,ee]),d(!1),$==null||$(ee)}catch(V){d(!1);const ee=V instanceof ra?V.message:"Failed to create workspace";Y==null||Y(ee)}},[]),_=y.useCallback(async C=>{try{await ze.archiveWorkspace({id:C})}catch{}},[]),k=y.useCallback(async(C,D)=>{try{await ze.updateWorkspace({id:C,...D})}catch{}},[]),S=y.useCallback(()=>{p("")},[]),T=y.useCallback(async(C,D)=>{try{p(""),await ze.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){p(l_(A))}},[m]),j=y.useCallback(async(C,D)=>{try{p(""),await ze.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){p(l_(A))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:_,updateWorkspace:k,linkEnvironment:T,unlinkEnvironment:j,linkOperationError:u,clearLinkOperationError:S,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function f9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await Ln.listTasks({workspaceId:E})).tasks.map(i_);s(M=>[...M.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(Ln.listTasks({}))).tasks.map(i_);s(O=>{const M=new Set(R.map($=>$.id));return[...O.filter($=>!M.has($.id)),...R]})}catch{}},[r]),g=y.useCallback((E,R)=>{const O=M=>{clearTimeout(u.current[M]),u.current[M]=setTimeout(()=>{delete u.current[M],p(M).catch(()=>{})},200)};E?O(E):R&&s(M=>{const $=M.find(Y=>Y.id===R);return $!=null&&$.workspaceId?O($.workspaceId):m().catch(()=>{}),M})},[p,m]),v=y.useCallback(E=>{const R=E.payload;switch(E.type){case"task.created":{const O=typeof R.workspaceId=="string"?R.workspaceId:"";return O&&p(O).catch(()=>{}),!0}case"task.started":{const O=typeof R.taskId=="string"?R.taskId:"",M=typeof R.sessionId=="string"?R.sessionId:"",$=typeof R.workspaceId=="string"?R.workspaceId:"";return d(Y=>O&&Y===O?void 0:Y),M&&O&&s(Y=>Y.map(V=>V.id===O?{...V,latestSessionId:M}:V)),g($,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof R.workspaceId=="string"?R.workspaceId:"",M=typeof R.taskId=="string"?R.taskId:"";return d($=>M&&$===M?void 0:$),g(O,M),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var R,O;if(E.type==="tasks"){const M=Array.isArray((R=E.payload)==null?void 0:R.tasks)?E.payload.tasks:[],$=typeof((O=E.payload)==null?void 0:O.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s($?Y=>[...Y.filter(V=>V.workspaceId!==$),...M]:Y=>{const V=new Set(M.map(ee=>ee.id));return[...Y.filter(ee=>!V.has(ee.id)),...M]}),!0}return!1},[]),k=y.useCallback(async(E,R,O,M,$,Y,V,ee,le)=>{try{await Ln.createTask({workspaceId:E,title:R,description:O||"",dependsOn:M||[],parentTaskId:$||"",defaultPersonaId:Y||void 0,canDecompose:V??void 0}),ee==null||ee()}catch(Z){const ae=Z instanceof ra?Z.message:"Failed to create task";le==null||le(ae)}},[]),S=y.useCallback(async(E,R,O,M)=>{d(E);try{await Ln.startTask({taskId:E,personaId:R||"",environmentId:O||"",notes:M||""})}catch($){if($ instanceof ra&&$.code===__.ResourceExhausted)return;throw d(void 0),$}},[]),T=y.useCallback(async E=>{try{await Ln.stopTask({id:E})}catch{}},[]),j=y.useCallback(async E=>{try{await Ln.completeTask({id:E})}catch{}},[]),w=y.useCallback(async E=>{try{await Ln.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,R,O,M,$)=>{try{await Ln.updateTask({id:E,title:R,description:O,dependsOn:M,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await Ln.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:k,startTask:S,stopTask:T,completeTask:j,resumeTask:w,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function p9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const g=await r(ze.listTokens({}));s(g.tokens.map(t9))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,k)=>{try{await ze.setToken({name:g,value:v,type:b,envVar:_,filePath:k})}catch{}},[]),p=y.useCallback(async g=>{try{await ze.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function m9(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r(ze.getCredentialProviders({}));s(n9(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(x$(m.payload)&&s(m.payload),!0):!1,[]),u=y.useCallback(async m=>{const g=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(g.map(({provider:v,value:b})=>ze.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function h9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async b=>{try{const _=await ze.listCodespaces({githubAccountId:b??""});s(_.codespaces.map(s9)),d(_.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await ze.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(k){p(!1);const S=k instanceof ra?k.message:"Failed to create codespace";r(S)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function g9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await ze.listDockerContainers({});s(u.containers.map(a9)),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 v9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const v=await r(Ln.listPersonas({}));s(v.personas.map(Np))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,b,_,k,S,T,j,w,C)=>{const D=await Ln.createPersona({name:v,description:b,systemPrompt:_,runtime:k||"",model:S||"",maxTurns:T||0,type:j||"agent",script:w||"",allowedMcpTools:C||[]}),A=Np(D);return s(E=>[...E.filter(R=>R.id!==A.id),A]),A},[]),p=y.useCallback(async(v,b,_,k,S,T,j,w,C,D)=>{const A={id:v};b!==void 0&&(A.name=b),_!==void 0&&(A.description=_),k!==void 0&&(A.systemPrompt=k),S!==void 0&&(A.runtime=S),T!==void 0&&(A.model=T),j!==void 0&&(A.maxTurns=j),w!==void 0&&(A.type=w),C!==void 0&&(A.script=C),D!==void 0&&(A.allowedMcpTools={tools:D});const E=await Ln.updatePersona(A),R=Np(E);return s(O=>O.map(M=>M.id===R.id?R:M)),R},[]),m=y.useCallback(async v=>{await Ln.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function y9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Dc.listSchedules({}));s(b.schedules.map(Cp))}catch{}},[r]),u=y.useCallback(b=>{switch(b.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),p=y.useCallback(async(b,_,k,S,T,j)=>{const w=await Dc.createSchedule({title:b,description:_,scheduleExpression:k,personaId:S,workspaceId:T||"",parentTaskId:j||""}),C=Cp(w);return s(D=>[...D.filter(A=>A.id!==C.id),C]),C},[]),m=y.useCallback(async(b,_)=>{const k={id:b};_.title!==void 0&&(k.title=_.title),_.description!==void 0&&(k.description=_.description),_.scheduleExpression!==void 0&&(k.scheduleExpression=_.scheduleExpression),_.personaId!==void 0&&(k.personaId=_.personaId),_.enabled!==void 0&&(k.enabled=_.enabled);const S=await Dc.updateSchedule(k),T=Cp(S);return s(j=>j.map(w=>w.id===T.id?T:w)),T},[]),g=y.useCallback(async b=>{await Dc.deleteSchedule({id:b}),s(_=>_.filter(k=>k.id!==b))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:p,updateSchedule:m,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function b9(t){if(t)try{return JSON.parse(t)}catch{return}}function _9(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),k=y.useCallback(async E=>{const R=E??"";_.current=R,b(""),g(!0);try{const O=await Mc.listRecentKnowledgeNodes({limit:30,workspaceId:R}),M=new Map,$=[];for(const Y of O.nodes)M.set(Y.id,qc(Y));for(const Y of O.edges)$.push(Ep(Y));for(const Y of $){const V=M.get(Y.source);V&&(V.val+=1);const ee=M.get(Y.target);ee&&(ee.val+=1)}s(M),r($)}catch{}finally{g(!1)}},[]),S=y.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const R=await Mc.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,M=[];for(const $ of R.results){$.node&&O.set($.node.id,qc($.node,$.edges.length));for(const Y of $.edges)M.push(Ep(Y))}s(O),r(M)}catch{}finally{g(!1)}}},[]),T=y.useCallback(()=>{k(_.current).catch(()=>{})},[k]),j=y.useCallback(async E=>{p(E);try{const R=await Mc.getKnowledgeNode({id:E});if(!R.node){d(void 0);return}d({node:qc(R.node,R.edges.length),edges:R.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:b9(O.metadataJson)}))})}catch{d(void 0)}},[]),w=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const R=await Mc.expandKnowledgeNode({id:E,depth:1});s(O=>{const M=new Map(O);for(const $ of R.nodes)M.has($.id)||M.set($.id,qc($));return M}),r(O=>{const M=new Set(O.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of R.edges){const V=Ep(Y),ee=`${V.source}:${V.target}:${V.type}`;M.has(ee)||$.push(V)}return[...O,...$]})}catch{}},[]),D=y.useCallback(E=>!1,[]),A={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:S,clearSearch:T,selectNode:j,clearSelection:w,expandNode:C,loadRecent:k,handleEvent:D,domainHook:A}}function x9(){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:Cd("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}}}const Gc=500;function k9(){const[t,s]=y.useState([]),[o,r]=y.useState({}),[c,d]=y.useState(!1),[u,p]=y.useState(!1),{loading:m,track:g}=bs(),v=y.useRef(0),b=y.useCallback(async(j=!1)=>{const w=v.current;try{const C=await g(ze.listStreams({includeInternal:j}));v.current===w&&(s(C.streams.map(r9)),p(!1))}catch{v.current===w&&p(!0)}finally{v.current===w&&d(!0)}},[g]),_=y.useCallback(async(j,w)=>{let C;try{C=(await ze.getStreamTranscript({streamId:j,beforeSeq:w??"",limit:0})).messages.map(A=>({streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp}))}catch{return}r(D=>{const A=new Map;for(const O of D[j]??[])A.set(O.seq,O);for(const O of C)A.set(O.seq,O);const E=Array.from(A.values()).sort((O,M)=>O.seq.localeCompare(M.seq)),R=E.length>Gc?E.slice(E.length-Gc):E;return{...D,[j]:R}})},[]),k=y.useCallback(j=>{r(w=>{const C=w[j.streamId]??[];if(C.some(E=>E.seq===j.seq))return w;const D=[...C,j],A=D.length>Gc?D.slice(D.length-Gc):D;return{...w,[j.streamId]:A}})},[]),S=y.useCallback(j=>!1,[]);return{streams:t,streamsLoading:m,streamsLoadedOnce:c,streamsLoadError:u,loadStreams:b,liveMessages:o,loadTranscript:_,handleStreamMessage:k,handleEvent:S,domainHook:{onConnect:b,onDisconnect:()=>{v.current+=1,s([]),r({}),d(!1),p(!1)},handleEvent:S}}}function S9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r(ze.listPlugins({}));s(m.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=y.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,g)=>{try{const v=await ze.setPluginEnabled({name:m,enabled:g});s(b=>b.map(_=>_.name===v.name?{..._,enabled:v.enabled}:_))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function T9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const b=await r(ze.listGitHubAccounts({}));s(b.accounts.map(_=>({id:_.id,label:_.label,username:_.username,isDefault:_.isDefault,createdAt:_.createdAt})))}catch{}},[r]),d=y.useCallback(b=>b.type==="github_account.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(b,_,k,S)=>{const T=await ze.addGitHubAccount({label:b,token:_,username:k,isDefault:S});s(j=>[...T.isDefault?j.map(C=>({...C,isDefault:!1})):j,{id:T.id,label:T.label,username:T.username,isDefault:T.isDefault,createdAt:T.createdAt}])},[]),p=y.useCallback(async(b,_)=>{const k=await ze.updateGitHubAccount({id:b,..._});s(S=>S.map(T=>T.id===k.id?{...T,label:k.label,username:k.username,isDefault:k.isDefault}:_.isDefault?{...T,isDefault:!1}:T))},[]),m=y.useCallback(async b=>{await ze.removeGitHubAccount({id:b}),s(_=>_.filter(k=>k.id!==b))},[]),g=y.useCallback(async()=>{const b=await ze.importGitHubAccounts({});return b.imported>0&&await c(),{imported:b.imported,usernames:b.usernames}},[c]);return{githubAccounts:t,githubAccountsLoading:o,loadGitHubAccounts:c,addGitHubAccount:u,updateGitHubAccount:p,removeGitHubAccount:m,importGitHubAccounts:g,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function j9(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Ad(),p=X$(u),m=l9(),g=d9(),v=u9(),b=f9(),_=p9(),k=m9(),S=h9(),T=g9(),j=v9(),w=y9(),C=_9(),D=x9(),A=k9(),E=S9(),R=T9(),O=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[b.domainHook]:[],...p.has("tokens")?[_.domainHook]:[],...p.has("credentials")?[k.domainHook]:[],...p.has("codespaces")?[S.domainHook]:[],...p.has("dockerContainers")?[T.domainHook]:[],...p.has("personas")?[j.domainHook]:[],...p.has("schedules")?[w.domainHook]:[],...p.has("knowledge")?[C.domainHook]:[],...p.has("notifications")?[D.domainHook]:[],...p.has("streams")?[A.domainHook]:[],...p.has("plugins")?[E.domainHook]:[],R.domainHook],{connectionStatus:M}=F$({onSessionEvent:F=>{g.handleSessionEvent({sessionId:F.sessionId,eventType:x_(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const ge=JSON.parse(F.payloadJson);Z({id:F.id,type:F.type,timestamp:F.timestamp,payload:ge})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onStreamMessage:F=>{A.handleStreamMessage(F)},onConnect:ae,onDisconnect:H}),$="default_persona_id",Y="onboarding_completed",V=y.useCallback(async F=>{const ge=await ze.setSetting({key:$,value:F});s(ge.value)},[]),ee=y.useCallback(async()=>{r(!0);try{await ze.setSetting({key:Y,value:"true"})}catch{}},[]),le=y.useCallback(async(F,ge)=>{try{const ne=await ze.getUsage({scope:F,id:ge}),ce=`${F}:${ge}`;d(me=>({...me,[ce]:i9(ne)}))}catch{}},[]);function Z(F){const ge=F.payload.key,ne=F.payload.value;if(F.type==="setting.changed"){ge===$&&s(ne??""),ge===Y&&r(ne==="true");return}for(const ce of O)if(ce.handleEvent(F))break;(F.type==="environment.removed"||F.type==="task.started")&&g.loadSessions().catch(()=>{}),(F.type==="session.started"||F.type==="session.stopped")&&A.loadStreams().catch(()=>{})}async function ae(){for(const F of O)F.onConnect().catch(()=>{});try{const F=await ze.getSetting({key:$});s(F.value)}catch{}try{const F=await ze.getSetting({key:Y});r(F.value==="true")}catch{}}function H(){O.forEach(F=>F.onDisconnect())}const B=y.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),_.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,_.loadTokens]);return{connectionStatus:M,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:b.tasks,tasksLoading:b.tasksLoading,taskStartingId:b.taskStartingId,loadTasks:b.loadTasks,loadAllTasks:b.loadAllTasks,createTask:b.createTask,startTask:b.startTask,stopTask:b.stopTask,completeTask:b.completeTask,resumeTask:b.resumeTask,updateTask:b.updateTask,deleteTask:b.deleteTask,domainHook:b.domainHook},tokens:{tokens:_.tokens,tokensLoading:_.tokensLoading,loadTokens:_.loadTokens,setToken:_.setToken,deleteToken:_.deleteToken,domainHook:_.domainHook},credentials:{credentialProviders:k.credentialProviders,credentialsLoading:k.credentialsLoading,updateCredentialProviders:k.updateCredentialProviders,domainHook:k.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},dockerContainers:{dockerContainers:T.dockerContainers,dockerContainersError:T.dockerContainersError,listDockerContainers:T.listDockerContainers,domainHook:T.domainHook},personas:{personas:j.personas,personasLoading:j.personasLoading,createPersona:j.createPersona,updatePersona:j.updatePersona,deletePersona:j.deletePersona,domainHook:j.domainHook},schedules:{schedules:w.schedules,schedulesLoading:w.schedulesLoading,createSchedule:w.createSchedule,updateSchedule:w.updateSchedule,deleteSchedule:w.deleteSchedule,domainHook:w.domainHook},streams:{streams:A.streams,streamsLoading:A.streamsLoading,streamsLoadedOnce:A.streamsLoadedOnce,streamsLoadError:A.streamsLoadError,loadStreams:A.loadStreams,liveMessages:A.liveMessages,loadTranscript:A.loadTranscript,handleStreamMessage:A.handleStreamMessage,domainHook:A.domainHook},knowledge:C,plugins:{plugins:E.plugins,pluginsLoading:E.pluginsLoading,loadPlugins:E.loadPlugins,setPluginEnabled:E.setPluginEnabled},githubAccounts:{githubAccounts:R.githubAccounts,githubAccountsLoading:R.githubAccountsLoading,loadGitHubAccounts:R.loadGitHubAccounts,addGitHubAccount:R.addGitHubAccount,updateGitHubAccount:R.updateGitHubAccount,removeGitHubAccount:R.removeGitHubAccount,importGitHubAccounts:R.importGitHubAccounts},appDefaultPersonaId:t,setAppDefaultPersonaId:V,onboardingCompleted:o,completeOnboarding:ee,usageCache:c,loadUsage:le,refresh:B}}function w9({children:t}){const s=j9();return i.jsx(rh.Provider,{value:s,children:t})}function N9(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);p&&p.status!==u.status&&(u.status==="sleeping"||u.status==="connecting"||(u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&p.status==="connected"&&s("Environment disconnected","warning")))}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function C9(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 E9={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 A9(t){return E9[t]}function D9(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=A9(d.status);p&&o.push(p)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function M9(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=D9(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const R9="_dashboard_16pzm_1",I9="_kpiStrip_16pzm_11",O9="_kpiCard_16pzm_23",B9="_kpiValue_16pzm_68",L9="_kpiLabel_16pzm_76",z9="_bodyGrid_16pzm_84",$9="_section_16pzm_96",H9="_sectionHeader_16pzm_109",P9="_sectionIcon_16pzm_118",U9="_sectionTitle_16pzm_123",V9="_sectionCount_16pzm_131",q9="_sectionBody_16pzm_138",G9="_emptyHint_16pzm_143",F9="_sessionRow_16pzm_150",K9="_sessionPrompt_16pzm_177",Z9="_sessionEnv_16pzm_186",Y9="_sessionRuntime_16pzm_192",J9="_sessionStatus_16pzm_198",W9="_statusDot_16pzm_207",X9="_attentionRow_16pzm_233",Q9="_attentionTitle_16pzm_259",eH="_attentionMeta_16pzm_267",tH="_reasonBadge_16pzm_274",nH="_bottomGrid_16pzm_301",sH="_envRow_16pzm_312",aH="_envName_16pzm_323",iH="_envStatusBadge_16pzm_333",oH="_workspaceRow_16pzm_369",rH="_workspaceTop_16pzm_395",lH="_workspaceName_16pzm_401",cH="_workspaceCounts_16pzm_407",dH="_progressBar_16pzm_415",uH="_progressFill_16pzm_422",he={dashboard:R9,kpiStrip:I9,kpiCard:O9,kpiValue:B9,kpiLabel:L9,bodyGrid:z9,section:$9,sectionHeader:H9,sectionIcon:P9,sectionTitle:U9,sectionCount:V9,sectionBody:q9,emptyHint:G9,sessionRow:F9,sessionPrompt:K9,sessionEnv:Z9,sessionRuntime:Y9,sessionStatus:J9,statusDot:W9,attentionRow:X9,attentionTitle:Q9,attentionMeta:eH,reasonBadge:tH,bottomGrid:nH,envRow:sH,envName:aH,envStatusBadge:iH,workspaceRow:oH,workspaceTop:rH,workspaceName:lH,workspaceCounts:cH,progressBar:dH,progressFill:uH};function fH(){return i.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:he.kpiCard,children:[i.jsx(je,{width:"3rem",height:"2rem"}),i.jsx(je,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:he.bodyGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[i.jsx(je,{width:"60%",height:"0.875rem"}),i.jsx(je,{width:"4rem",height:"0.75rem"}),i.jsx(je,{width:"3rem",height:"0.75rem"}),i.jsx(je,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx(je,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx(je,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.envRow,children:[i.jsx(je,{width:"60%",height:"0.875rem"}),i.jsx(je,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(je,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(je,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(je,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx(je,{width:"50%",height:"0.875rem"}),i.jsx(je,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const pH={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Fc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function mH(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 Kc({value:t,label:s,accent:o,index:r,testId:c}){return i.jsxs($t.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:pH,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:he.kpiValue,children:t}),i.jsx("span",{className:he.kpiLabel,children:s})]})}function hH(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=ut(),g=vt(),v=y.useRef(new Set);y.useEffect(()=>{for(const j of t)v.current.has(j.id)||(v.current.add(j.id),c(j.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>A$(d,o,p),[d,o,p]),_=y.useMemo(()=>M$(d,p),[d,p]),k=y.useMemo(()=>D$(o,t),[o,t]),S=y.useMemo(()=>R$(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(fH,{}):i.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[i.jsx(Kc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Kc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Kc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Kc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),i.jsxs("div",{className:he.bodyGrid,children:[i.jsxs($t.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:he.sectionCount,children:_.length})]}),i.jsx("div",{className:he.sectionBody,children:_.length===0?i.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:j,environmentName:w})=>i.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(Sm(j.id)),"data-testid":"session-row",children:[i.jsx("span",{className:he.sessionPrompt,title:j.prompt,children:j.prompt||"—"}),i.jsx("span",{className:he.sessionEnv,children:w}),i.jsx("span",{className:he.sessionRuntime,children:j.runtime}),i.jsxs("span",{className:he.sessionStatus,children:[i.jsx("span",{className:he.statusDot,"data-status":j.status}),j.status]})]},j.id))})]}),i.jsxs($t.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:he.sectionCount,children:k.length})]}),i.jsx("div",{className:he.sectionBody,children:k.length===0?i.jsx("div",{className:he.emptyHint,children:"All clear"}):k.map(({task:j,reason:w,workspaceName:C})=>i.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(os(j.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx("span",{className:he.reasonBadge,"data-reason":w,children:w}),j.title]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx("span",{children:C})})]},j.id))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs($t.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:he.sectionCount,children:p.length})]}),i.jsx("div",{className:he.sectionBody,children:p.length===0?i.jsx("div",{className:he.emptyHint,children:"No environments configured"}):p.map(j=>i.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:he.envName,children:j.displayName}),i.jsx("span",{className:he.envStatusBadge,"data-status":j.status,children:j.status})]},j.id))})]}),i.jsxs($t.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:he.sectionCount,children:t.length})]}),i.jsx("div",{className:he.sectionBody,children:S.length===0?i.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:j,totalTasks:w,completedTasks:C,workingTasks:D,failedTasks:A})=>{const E=w>0?Math.round(C/w*100):0;return i.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(ji(j.id,j.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx("span",{className:he.workspaceName,children:j.name}),i.jsxs("span",{className:he.workspaceCounts,"aria-label":mH(C,w,D,A),children:[C,"/",w,D>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),A>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",A]})]})]}),w>0&&i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},j.id)})})]})]})]})}const gH="_panelContainer_1udy7_1",vH="_emptyState_1udy7_8",yH="_workspaceSummary_1udy7_17",bH="_workspaceSummaryTitle_1udy7_28",_H="_workspaceSummarySubtitle_1udy7_32",xH="_header_1udy7_36",kH="_headerInfo_1udy7_71",SH="_headerTitle_1udy7_106",TH="_taskStatusBadge_1udy7_128",jH="_taskBranch_1udy7_137",wH="_taskBlockedBadge_1udy7_143",NH="_tabBar_1udy7_277",CH="_tab_1udy7_277",EH="_active_1udy7_303",AH="_eventScroll_1udy7_308",DH="_overviewContent_1udy7_325",MH="_overviewDashboard_1udy7_334",RH="_overviewHero_1udy7_340",IH="_overviewSection_1udy7_347",OH="_overviewLabel_1udy7_353",BH="_envRow_1udy7_360",LH="_timeline_1udy7_366",zH="_timelineRow_1udy7_372",$H="_waitingMessage_1udy7_379",HH="_errorMessage_1udy7_383",PH="_emptyCta_1udy7_387",UH="_ctaTitle_1udy7_399",VH="_ctaDescription_1udy7_405",qH="_ctaButton_1udy7_412",GH="_workspaceHeader_1udy7_533",FH="_workspaceName_1udy7_558",KH="_workspaceMeta_1udy7_571",ZH="_metaRow_1udy7_579",YH="_metaLabel_1udy7_592",JH="_metaValue_1udy7_607",WH="_archiveButton_1udy7_617",XH="_repoLink_1udy7_647",QH="_metaToggle_1udy7_657",eP="_metaToggleArrow_1udy7_678",tP="_metaToggleArrowOpen_1udy7_683",nP="_progressBarContainer_1udy7_687",sP="_progressBar_1udy7_687",aP="_progressFill_1udy7_703",iP="_progressLabel_1udy7_710",oP="_metaTimestamps_1udy7_717",rP="_metaTimestamp_1udy7_717",lP="_metaPlaceholder_1udy7_739",cP="_linkedEnvList_1udy7_744",dP="_linkedEnvChip_1udy7_750",uP="_chipDismiss_1udy7_762",fP="_linkError_1udy7_777",pP="_linkEnvSelect_1udy7_782",W={panelContainer:gH,emptyState:vH,workspaceSummary:yH,workspaceSummaryTitle:bH,workspaceSummarySubtitle:_H,header:xH,headerInfo:kH,headerTitle:SH,taskStatusBadge:TH,taskBranch:jH,taskBlockedBadge:wH,tabBar:NH,tab:CH,active:EH,eventScroll:AH,overviewContent:DH,overviewDashboard:MH,overviewHero:RH,overviewSection:IH,overviewLabel:OH,envRow:BH,timeline:LH,timelineRow:zH,waitingMessage:$H,errorMessage:HH,emptyCta:PH,ctaTitle:UH,ctaDescription:VH,ctaButton:qH,workspaceHeader:GH,workspaceName:FH,workspaceMeta:KH,metaRow:ZH,metaLabel:YH,metaValue:JH,archiveButton:WH,repoLink:XH,metaToggle:QH,metaToggleArrow:eP,metaToggleArrowOpen:tP,progressBarContainer:nP,progressBar:sP,progressFill:aP,progressLabel:iP,metaTimestamps:oP,metaTimestamp:rP,metaPlaceholder:lP,linkedEnvList:cP,linkedEnvChip:dP,chipDismiss:uP,linkError:fP,linkEnvSelect:pP};function mP(){return i.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function hP(){return i.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function gP(){const{workspaces:{workspaces:t},environments:{environments:s}}=ut(),o=vt(),r=s.length>0;return t.length>0?i.jsx(hH,{}):i.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:W.ctaButton,onClick:()=>o(Y_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const vP="_panelContainer_1rih4_1",yP="_chatHeader_1rih4_9",bP="_chatHeaderInfo_1rih4_38",_P="_chatHeaderActions_1rih4_44",xP="_emptyState_1rih4_64",kP="_emptyTitle_1rih4_76",SP="_emptyDescription_1rih4_82",TP="_emptyHint_1rih4_88",aa={panelContainer:vP,chatHeader:yP,chatHeaderInfo:bP,chatHeaderActions:_P,emptyState:xP,emptyTitle:kP,emptyDescription:SP,emptyHint:TP};function c_(){return i.jsx("div",{className:aa.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(je,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function jP({hasLocalEnvironment:t}){return i.jsxs("div",{className:aa.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:aa.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:aa.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&i.jsx("div",{className:aa.emptyHint,children:"Go to Settings → Environments to add one."})]})}function wP(){const t=dh(),{tasks:{tasks:s,tasksLoading:o,startTask:r},sessions:{sessions:c,sessionsLoading:d,events:u,eventsDropped:p,taskSessions:m,loadTaskSessions:g,loadSessionEvents:v,kill:b,stopGraceful:_,sendInput:k,spawn:S},environments:{environments:T,provisionEnvironment:j},personas:{personas:w}}=ut(),{showToast:C}=pn(),D=y.useRef(void 0),[A,E]=y.useState(),R=s.find(le=>le.id===Ec),O=R!=null&&R.latestSessionId?c.find(le=>le.id===R.latestSessionId)??(m[Ec]??[]).find(le=>le.id===R.latestSessionId):void 0;y.useEffect(()=>{g(Ec).catch(()=>{})},[R==null?void 0:R.latestSessionId,g]),y.useEffect(()=>{O&&O.id!==D.current&&(D.current=O.id,v(O.id).catch(()=>{}))},[O==null?void 0:O.id,v]);const M=y.useMemo(()=>{if(!O)return[];const le=u.filter(Z=>Z.sessionId===O.id);return ch(lh(le))},[u,O==null?void 0:O.id]),$=T.find(le=>le.adapterType==="local"&&le.status==="connected"),Y=O!==void 0&&O.status!=="stopped"&&O.status!=="suspended",V=(O==null?void 0:O.status)==="idle";y.useEffect(()=>{A&&O&&V&&(k(O.id,A).catch(()=>{C("Failed to send message","error")}),E(void 0))},[A,V,O==null?void 0:O.id,k,C]);const ee=y.useCallback((le,Z,ae,H)=>{H&&E(H),r(le,Z,ae).catch(()=>{})},[r]);return!R&&(d||o)?i.jsx(c_,{}):R!=null&&R.latestSessionId&&!O?i.jsx(c_,{}):i.jsxs("div",{className:aa.panelContainer,"data-testid":"chat-page",children:[Y&&i.jsxs("div",{className:aa.chatHeader,children:[i.jsxs("span",{className:aa.chatHeaderInfo,children:["Session: ",O.id.slice(0,8)," | ",O.runtime," | ",O.status]}),i.jsx("div",{className:aa.chatHeaderActions,children:i.jsx(W_,{label:"Stop",onClick:()=>{_(O.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{_(O.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{b(O.id).catch(()=>{})}}]})})]}),i.jsx(ih,{events:M,eventsDropped:p,sandboxProxyUrl:t,emptyState:i.jsx(jP,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&i.jsx(vd,{mode:Y?"send":"start",sessionId:Y?O.id:void 0,taskId:Ec,environmentId:Y?O.environmentId:$.id,personas:w,environments:T,onSendInput:(le,Z)=>{k(le,Z).catch(()=>{C("Failed to send message","error")})},onSpawn:(le,Z,ae)=>{S(le,Z,ae).catch(()=>{})},onStartTask:ee,onProvisionEnvironment:le=>{j(le).catch(()=>{})},onShowToast:C})]})}const NP="_container_1jtgv_1",CP={container:NP};function EP(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c,liveMessages:d,loadTranscript:u},sessions:{sessions:p},tasks:{tasks:m}}=ut(),[g,v]=y.useState(!1),[b,_]=y.useState(void 0),[k,S]=y.useState(!1);y.useEffect(()=>{if(b===void 0){S(!1);return}let C=!0;return S(!0),u(b).then(()=>{C&&S(!1)}).catch(()=>{C&&S(!1)}),()=>{C=!1}},[b,u]);const T=y.useRef(!1);y.useEffect(()=>{if(!T.current){T.current=!0;return}c(g).catch(()=>{})},[g,c]);const j=y.useCallback(()=>{c(g).catch(()=>{})},[c,g]),w=b!==void 0?t.find(C=>C.id===b):void 0;return i.jsxs("div",{className:CP.container,"data-testid":"coordination-page",children:[i.jsx($7,{streams:t,sessions:p,tasks:m,loading:s,loadError:r,loadedOnce:o,showInternals:g,onToggleInternals:v,selectedStreamId:b,onSelectStream:_,onRefresh:j}),w&&i.jsx(Tz,{stream:w,messages:d[w.id]??[],transcriptLoading:k,onClose:()=>_(void 0)})]})}function AP(){const t=j$(),[s]=km(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=ut(),{showToast:g}=pn();return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:t}),i.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(vd,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{g("Failed to send message","error")})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function DP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:W.header,children:[i.jsx("span",{children:i.jsx(je,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:W.headerInfo,children:i.jsx(je,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:W.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(je,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function MP({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:W.header,children:[i.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Oo((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${As(s.costMillicents??0)}`:""]}),i.jsxs("span",{className:W.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(W_,{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 RP({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return i.jsx("div",{className:s?W.errorMessage:W.waitingMessage,children:o})}function IP(){const{sessionId:t}=ua(),s=dh(),{sessions:{events:o,eventsDropped:r,sessions:c,sessionsLoading:d,kill:u,stopGraceful:p,loadSessionEvents:m,sendInput:g,spawn:v},tasks:{startTask:b},personas:{personas:_},environments:{environments:k,provisionEnvironment:S}}=ut(),{showToast:T}=pn(),j=y.useRef(void 0),w=w$(t),C=c.find(E=>E.id===t)??void 0,D=y.useMemo(()=>{const E=t?o.filter(R=>R.sessionId===t):[];return ch(lh(E))},[o,t]);if(y.useEffect(()=>{t&&t!==j.current&&(j.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return i.jsx(DP,{});if(!t)return i.jsx("div",{className:W.emptyState,children:"No session selected"});const A=(C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="idle";return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:w}),i.jsx(MP,{sessionId:t,session:C,isActive:A,onStop:()=>{p(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),i.jsx(ih,{events:D,eventsDropped:r,emptyState:i.jsx(RP,{session:C}),onShowToast:T,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:k,personas:_,onForward:(E,R)=>g(E,R)}),A&&i.jsx(vd,{mode:"send",sessionId:t,environmentId:C.environmentId,personas:_,environments:k,onSendInput:(E,R)=>{g(E,R).catch(()=>{T("Failed to send message","error")})},onSpawn:(E,R,O)=>{v(E,R,O).catch(()=>{})},onStartTask:(E,R,O)=>{b(E,R,O).catch(()=>{})},onProvisionEnvironment:E=>{S(E).catch(()=>{})},onShowToast:T})]})}function OP(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Fa(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&OP(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function BP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.workspaceHeader,children:i.jsx("span",{className:W.workspaceName,children:i.jsx(je,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:i.jsx(je,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:W.progressBarContainer,children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),i.jsx(je,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),i.jsx("span",{className:W.tab,children:"Board"}),i.jsx("span",{className:W.tab,children:"Tasks"})]}),i.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(nm,{lines:2},s))})]})}function d_(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 Dp=100;function LP(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function zP(){const{workspaceId:t,environmentId:s}=ua(),o=vt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:_},personas:{personas:k},sessions:{sessions:S},usageCache:T,loadUsage:j}=ut(),{resolvedThemeId:w}=J1(),[C,D]=y.useState("tasks"),[A,E]=y.useState(!1),[R,O]=y.useState(null),[M,$]=y.useState(!1),Y=y.useRef(void 0),V=d.find(ne=>ne.id===t),ee=s??(V==null?void 0:V.linkedEnvironmentIds[0])??"",le=N$(t,ee,d,c);Fa({key:"1"},()=>D("graph")),Fa({key:"2"},()=>D("board")),Fa({key:"3"},()=>D("tasks")),y.useEffect(()=>{const ne=Y.current;Y.current=t,!(ne===void 0||ne===t)&&R!==null&&O(null)},[t,R]);const Z=S.reduce((ne,ce)=>ne+(ce.costMillicents??0),0);y.useEffect(()=>{t&&j("workspace",t).catch(()=>{})},[t,j,Z]);const ae=t?T[`workspace:${t}`]:void 0,H=r.filter(ne=>ne.workspaceId===t),B=H.filter(ne=>ne.status==="complete").length,F=H.length,ge=F>0?Math.round(B/F*100):0;return!V&&u?i.jsx(BP,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:le}),i.jsxs("div",{className:W.workspaceHeader,children:[i.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:i.jsx(Bt,{value:(V==null?void 0:V.name)||"",onSave:ne=>{V&&m(V.id,{name:ne}).catch(()=>{})},validate:ne=>{const ce=ne.trim();if(!ce)return"Name is required";if(ce.length>Dp)return`Max ${Dp} characters`},maxLength:Dp,fieldId:"name",activeFieldId:R,onActivate:O,ariaLabel:"Workspace name",renderDisplay:ne=>ne||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:W.metaToggle,onClick:()=>$(!M),"aria-expanded":!M,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${W.metaToggleArrow} ${M?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!M&&i.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Description"}),i.jsx("div",{className:W.metaValue,children:i.jsx(sm,{value:(V==null?void 0:V.description)||"",onSave:ne=>{V&&m(V.id,{description:ne}).catch(()=>{})},fieldId:"description",activeFieldId:R,onActivate:O,renderDisplay:ne=>ne?i.jsx("span",{className:W.overviewMarkdown,children:i.jsx(um,{remarkPlugins:[fm],children:ne})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Repository"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Bt,{value:(V==null?void 0:V.repoUrl)||"",onSave:ne=>{V&&m(V.id,{repoUrl:ne}).catch(()=>{})},validate:ne=>{const ce=ne.trim();if(ce&&!/^https?:\/\/.+/.test(ce))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:R,onActivate:O,renderDisplay:ne=>{const ce=LP(ne);return ce?i.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:ne}):ne?i.jsx("span",{children:ne}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Environments"}),i.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:V?i.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const ne=[...new Set(V.linkedEnvironmentIds)];return ne.length===0?i.jsx("span",{className:W.metaPlaceholder,children:"None"}):ne.map(ce=>{const me=c.find(ke=>ke.id===ce);return i.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,i.jsx("button",{className:W.chipDismiss,onClick:()=>{v(V.id,ce).catch(()=>{})},title:`Unlink ${(me==null?void 0:me.displayName)||ce}`,"aria-label":`Unlink ${(me==null?void 0:me.displayName)||ce}`,"data-testid":`unlink-env-${ce}`,disabled:ne.length<=1,children:"x"})]},ce)})})(),(()=>{const ne=new Set(V.linkedEnvironmentIds),ce=c.filter(me=>!ne.has(me.id));return ce.length===0?null:i.jsxs("select",{className:W.linkEnvSelect,value:"",onChange:me=>{me.target.value&&g(V.id,me.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>i.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&i.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Persona"}),i.jsx("div",{className:W.metaValue,children:i.jsx(pd,{value:(V==null?void 0:V.defaultPersonaId)||"",onSave:ne=>{V&&m(V.id,{defaultPersonaId:ne}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...k.map(ne=>({value:ne.id,label:ne.name}))],fieldId:"defaultPersonaId",activeFieldId:R,onActivate:O,renderDisplay:ne=>{const ce=k.find(me=>me.id===ne);if(ce)return i.jsx("span",{children:ce.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Worktrees"}),i.jsx("div",{className:W.metaValue,children:i.jsx(M5,{checked:(V==null?void 0:V.useWorktrees)??!0,onChange:ne=>{V&&m(V.id,{useWorktrees:ne}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Working Dir"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Bt,{value:(V==null?void 0:V.workingDirectory)||"",onSave:ne=>{V&&m(V.id,{workingDirectory:ne}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:R,onActivate:O,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),V&&i.jsxs("div",{className:W.metaTimestamps,children:[i.jsxs("span",{className:W.metaTimestamp,children:["Created ",d_(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&i.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",d_(V.updatedAt)]})]})]}),F>0&&i.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),i.jsxs("span",{className:W.progressLabel,children:[B,"/",F]})]}),ae&&ae.costMillicents>0&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Usage: ",As(ae.costMillicents)," (",ae.sessionCount," session",ae.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Oo(((ae==null?void 0:ae.inputTokens)??0)+((ae==null?void 0:ae.outputTokens)??0))," / ",Oo(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",As((ae==null?void 0:ae.costMillicents)??0)," / ",As(V.costBudgetMillicents)]})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>D("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&F>0&&i.jsxs("div",{className:W.workspaceSummary,children:[i.jsx("span",{className:W.workspaceSummaryTitle,children:`${B}/${F} tasks complete`}),i.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&F===0&&i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{className:W.ctaButton,onClick:()=>o(Di(t,void 0,ee)),children:"Create Task"}),i.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx(Jz,{workspaceId:t,environmentId:ee,tasks:r,sessions:S,personas:k,environments:c}),C==="graph"&&i.jsx(YN,{workspaceId:t,environmentId:ee,tasks:r,resolvedThemeId:w}),i.jsx(ys,{isOpen:A,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{V&&(p(V.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const $P="_container_3pgew_1",HP="_header_3pgew_8",PP="_headerTitle_3pgew_35",UP="_headerActions_3pgew_44",VP="_body_3pgew_51",qP="_btnPrimary_3pgew_63",GP="_btnGhost_3pgew_94",FP="_error_3pgew_116",qa={container:$P,header:HP,headerTitle:PP,headerActions:UP,body:VP,btnPrimary:qP,btnGhost:GP,error:FP};function KP(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 ZP=[{label:"Home",url:Po},{label:"New Workspace",url:void 0}];function YP(){const[t]=km(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=ut(),{showToast:u}=pn(),p=vt(),[m,g]=y.useState(()=>{var j;return r$(void 0,s||((j=o[0])==null?void 0:j.id))}),[v,b]=y.useState(),[_,k]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(j=>{var w;return j.environmentId?j:{...j,environmentId:((w=o[0])==null?void 0:w.id)??""}})},[o,s,m.environmentId]);const S=()=>{const j=KP(m);if(j){b(j),k(void 0);return}b(void 0),k(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,w=>{u("Workspace created","success"),p(ji(w.id,w.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},w=>{k(w)}).catch(()=>{})},T=()=>{p(s?Io(s):Po,{replace:!0})};return i.jsxs("div",{className:qa.container,children:[i.jsxs("div",{className:qa.header,children:[i.jsx("div",{className:qa.headerTitle,children:i.jsx(fa,{segments:ZP})}),i.jsxs("div",{className:qa.headerActions,children:[i.jsx("button",{className:qa.btnGhost,onClick:T,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:qa.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(C1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:qa.body,children:[i.jsx(c$,{values:m,onChange:j=>{g(j),b(void 0),k(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&i.jsx("div",{className:qa.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function u_(){const{workspaceId:t,environmentId:s}=ua(),[o]=km(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=ut(),{showToast:v}=pn();return i.jsx(P1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,k,S,T,j,w,C,D)=>{u(b,_,k,S,T,j,w,C,D).catch(()=>{})},onUpdateTask:(b,_,k,S,T)=>{p(b,_,k,S,T).catch(()=>{})},onShowToast:v})}function JP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.header,children:i.jsxs("span",{className:W.headerTitle,children:[i.jsx(je,{width:"12rem",height:"1rem"}),i.jsx(je,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),i.jsx("span",{className:W.tab,children:"Stream"})]}),i.jsx("div",{className:W.overviewContent,children:i.jsxs("div",{className:W.overviewDashboard,children:[i.jsx("div",{className:W.overviewHero,children:i.jsx(je,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Description"}),i.jsx(tm,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Environment"}),i.jsxs("div",{className:W.envRow,children:[i.jsx(je,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(je,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),i.jsx(tm,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Timeline"}),i.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:W.timelineRow,children:[i.jsx(je,{width:"4rem",height:"0.75rem"}),i.jsx(je,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function wo(){const{taskId:t,workspaceId:s,environmentId:o}=ua(),r=dh(),c=Jt(),d=vt(),{showToast:u}=pn(),{sessions:{events:p,eventsDropped:m,sessions:g,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:k,spawn:S,kill:T},tasks:{tasks:j,tasksLoading:w,startTask:C,stopTask:D,resumeTask:A,deleteTask:E,createTask:R,updateTask:O},environments:{environments:M,provisionEnvironment:$},workspaces:{workspaces:Y},personas:{personas:V},usageCache:ee,loadUsage:le}=ut(),Z=y.useRef(void 0),ae=y.useRef(void 0),H=y.useRef(void 0),B=y.useRef(void 0),F=y.useRef(void 0),ge=c.pathname.endsWith("/stream")?"stream":"overview",ne=c.pathname.endsWith("/edit"),[ce,me]=y.useState(ge),[ke,De]=y.useState(!1),[ot,yt]=y.useState(void 0),[_e,Oe]=y.useState(""),[Ht,Nt]=y.useState(ne),ue=y.useRef(ge),Re=y.useRef(ne),Q=j.find(Ne=>Ne.id===t),et=(Q==null?void 0:Q.workspaceId)||void 0,re=Y.find(Ne=>Ne.id===et);y.useEffect(()=>{ge!==ue.current&&(ue.current=ge,ge!==ce&&me(ge))},[ge,ce]),y.useEffect(()=>{ne!==Re.current&&(Re.current=ne,ne!==Ht&&Nt(ne))},[ne,Ht]),y.useEffect(()=>{if(_e===""){if(re!=null&&re.linkedEnvironmentIds[0])Oe(re.linkedEnvironmentIds[0]);else if(M.length>0){const Ne=M.find(Ue=>Ue.status==="connected");Oe((Ne==null?void 0:Ne.id)??M[0].id)}}},[_e,re==null?void 0:re.linkedEnvironmentIds[0],M]);const ve=Q?b[Q.id]??[]:[];let Xe;ot&&ve.some(Ne=>Ne.id===ot)?Xe=ot:Xe=(Q==null?void 0:Q.latestSessionId)||void 0;const an=()=>{De(!0)},_s=()=>{if(!Q)return;E(Q.id).catch(()=>{}),De(!1);const Ne=o??(re==null?void 0:re.linkedEnvironmentIds[0]);d(Q.workspaceId&&Ne?ji(Q.workspaceId,Ne):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==ae.current&&(ae.current=Q==null?void 0:Q.id,yt(void 0),Oe(""),Nt(ne))},[Q==null?void 0:Q.id,ne]),y.useEffect(()=>{if(!(Q!=null&&Q.id))return;const Ne=Q.id!==B.current,Ue=Q.latestSessionId!==F.current;(Ne||Ue)&&(B.current=Q.id,F.current=Q.latestSessionId,_(Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.latestSessionId,_]),y.useEffect(()=>{if((Q==null?void 0:Q.status)!==H.current){const Ne=H.current===void 0;H.current=Q==null?void 0:Q.status;const Ue=(Q==null?void 0:Q.status)==="not_started"?"overview":(Q==null?void 0:Q.status)==="working"||(Q==null?void 0:Q.status)==="paused"?"stream":(Q==null?void 0:Q.status)==="complete"?"overview":void 0;Ue&&Ue!==ce&&!(Ne&&ge!=="overview")&&me(Ue)}},[Q==null?void 0:Q.status,ce,ge]);const ls=y.useMemo(()=>new Map(j.map(Ne=>[Ne.id,Ne])),[j]),Os=y.useMemo(()=>{const Ne=Xe?p.filter(Ue=>Ue.sessionId===Xe):[];return ch(lh(Ne))},[p,Xe]),pa=Q?Q.dependsOn.some(Ne=>{const Ue=ls.get(Ne);return Ue!==void 0&&Ue.status!=="complete"}):!1,Ri=y.useMemo(()=>C$(t,o,Y,M,ls),[t,o,Y,M,ls]);y.useEffect(()=>{Xe&&Xe!==Z.current&&(Z.current=Xe,v(Xe).catch(()=>{}))},[Xe,v]);const Wt=ve.reduce((Ne,Ue)=>Ne+(Ue.costMillicents??0),0);y.useEffect(()=>{Q&&(le("task",Q.id).catch(()=>{}),Q.childTaskIds.length>0&&le("task_tree",Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.childTaskIds.length,le,Wt]);const Wa=Q?`task:${Q.id}`:"",Xa=Wa in ee?ee[Wa]:void 0,ma=Q?`task_tree:${Q.id}`:"",Bs=Q&&Q.childTaskIds.length>0&&ma in ee?ee[ma]:void 0,xs=Ne=>{me(Ne),d(os(t,Ne==="overview"?void 0:Ne,s,o))};return Fa({key:"1"},()=>xs("overview")),Fa({key:"2"},()=>xs("stream")),!Q&&w?i.jsx(JP,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(fa,{segments:Ri}),i.jsxs("div",{className:W.header,children:[i.jsxs("span",{className:W.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&i.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&i.jsx("span",{className:W.taskBranch,children:Q.branch}),pa&&i.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),Q&&i.jsx(sL,{task:Q,sessionId:Xe,isBlocked:pa,onStart:()=>{C(Q.id,void 0,_e).catch(Ne=>{const Ue=Ne instanceof ra?Ne.message:"Failed to start task";u(Ue,"error")})},onResume:()=>{A(Q.id).catch(()=>{})},onStop:()=>{D(Q.id).catch(()=>{})},onPause:()=>{Xe&&T(Xe).catch(()=>{})},onDelete:an,onEdit:()=>Nt(!0)})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>xs("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>xs("stream"),children:"Stream"})]}),i.jsxs(as,{mode:"wait",children:[ce==="overview"&&i.jsx($t.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:W.overviewContent,"data-testid":"task-overview",children:Ht&&Q?i.jsx(P1,{mode:"edit",taskId:Q.id,workspaceId:et,environmentId:o,tasks:j,workspaces:Y,personas:V,onCreateTask:(Ne,Ue,_n,mn,Pt,Cn,Xt,Ii,Oi)=>{R(Ne,Ue,_n,mn,Pt,Cn,Xt,Ii,Oi).catch(()=>{})},onUpdateTask:(Ne,Ue,_n,mn,Pt)=>{O(Ne,Ue,_n,mn,Pt).catch(()=>{})},onEditDone:()=>{ne?d(os(Q.id,void 0,s,o),{replace:!0}):Nt(!1)},onShowToast:u}):Q?i.jsx(qL,{task:Q,tasksById:ls,environments:M,workspaces:Y,taskSessions:ve,selectedEnvId:_e,taskUsage:Xa,treeUsage:Bs}):i.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&i.jsxs($t.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[i.jsx(u6,{taskSessions:ve,selectedSessionId:Xe,onSelect:Ne=>yt(Ne)}),i.jsx(ih,{events:Os,eventsDropped:m,sandboxProxyUrl:r,emptyState:!Xe&&Q?pa?i.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(Q.id,void 0,_e).catch(Ne=>{const Ue=Ne instanceof ra?Ne.message:"Failed to start task";u(Ue,"error")})},children:"Start Task"}),i.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):Xe&&Os.length===0?i.jsx("div",{className:W.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream")]}),(()=>{if(!Q||Q.status!=="working"&&Q.status!=="paused")return;const Ne=Xe?g.find(Ue=>Ue.id===Xe):void 0;if(!(!Ne||Ne.status==="stopped"))return i.jsx(vd,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:V,environments:M,onSendInput:(Ue,_n)=>{k(Ue,_n).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ue,_n,mn)=>{S(Ue,_n,mn,void 0,et).catch(()=>{})},onStartTask:(Ue,_n,mn)=>{C(Ue,_n,mn).catch(()=>{})},onProvisionEnvironment:Ue=>{$(Ue).catch(()=>{})},onShowToast:u})})(),Q&&i.jsx(ys,{isOpen:ke,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:_s,onCancel:()=>De(!1)})]})}function WP(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m},dockerContainers:{dockerContainers:g,dockerContainersError:v,listDockerContainers:b},githubAccounts:{githubAccounts:_}}=ut(),{showToast:k}=pn();return i.jsx(U1,{mode:"new",environments:t,githubAccounts:_,onAddEnvironment:(S,T,j,w)=>{s(S,T,j,w).catch(()=>{})},onUpdateEnvironment:(S,T)=>{o(S,T).catch(()=>{})},onListCodespaces:S=>{p(S).catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(S,T)=>{m(S,T).catch(()=>{})},onListDockerContainers:()=>{b().catch(()=>{})},dockerContainers:g,dockerContainersError:v,onShowToast:k})}function XP(){const{environmentId:t}=ua(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g},dockerContainers:{dockerContainers:v,dockerContainersError:b,listDockerContainers:_},githubAccounts:{githubAccounts:k}}=ut(),{showToast:S}=pn();return i.jsx(U1,{mode:"edit",environmentId:t,environments:s,githubAccounts:k,onAddEnvironment:(T,j,w,C)=>{o(T,j,w,C).catch(()=>{})},onUpdateEnvironment:(T,j)=>{r(T,j).catch(()=>{})},onListCodespaces:T=>{m(T).catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(T,j)=>{g(T,j).catch(()=>{})},onListDockerContainers:()=>{_().catch(()=>{})},dockerContainers:v,dockerContainersError:b,onShowToast:S})}const QP="_layout_11u79_1",eU="_content_11u79_8",tU="_tabPanel_11u79_14",Xr={layout:QP,content:eU,tabPanel:tU};function nU(){const t=T$();return i.jsxs("div",{className:Xr.layout,children:[i.jsx(fa,{segments:t}),i.jsx("div",{className:Xr.content,children:i.jsx(Ai,{})})]})}const sU="_container_144a4_1",aU="_envHeader_144a4_6",iU="_envTitleRow_144a4_10",oU="_statusDot_144a4_16",rU="_envName_144a4_21",lU="_statusBadge_144a4_27",cU="_envMeta_144a4_33",dU="_metaTag_144a4_39",uU="_actions_144a4_51",fU="_provisionMessage_144a4_59",pU="_errorMessage_144a4_64",mU="_section_144a4_69",hU="_sectionHeader_144a4_73",gU="_cardList_144a4_121",vU="_card_144a4_121",yU="_cardHeader_144a4_138",bU="_cardName_144a4_144",_U="_cardActions_144a4_149",xU="_cardDescription_144a4_154",kU="_cardMeta_144a4_160",SU="_repoLink_144a4_166",TU="_empty_144a4_174",jU="_errorHint_144a4_180",wU="_btnPrimary_144a4_186",NU="_btnOutline_144a4_220",CU="_btnSmall_144a4_247",EU="_btnDanger_144a4_273",Me={container:sU,envHeader:aU,envTitleRow:iU,statusDot:oU,envName:rU,statusBadge:lU,envMeta:cU,metaTag:dU,actions:uU,provisionMessage:fU,errorMessage:pU,section:mU,sectionHeader:hU,cardList:gU,card:vU,cardHeader:yU,cardName:bU,cardActions:_U,cardDescription:xU,cardMeta:kU,repoLink:SU,empty:TU,errorHint:jU,btnPrimary:wU,btnOutline:NU,btnSmall:CU,btnDanger:EU};function AU(){return i.jsxs("div",{className:Me.container,"aria-hidden":"true",children:[i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx(je,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(je,{width:"12rem",height:"1.5rem"}),i.jsx(je,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsx(je,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:Me.actions,children:[i.jsx(je,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(je,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:Me.section,children:[i.jsx("div",{className:Me.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:Me.cardList,children:[i.jsx(nm,{lines:2}),i.jsx(nm,{lines:2})]})]})]})}const DU={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function MU(){const{environmentId:t}=ua(),s=vt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:_,clearLinkOperationError:k},sessions:{sessions:S}}=ut(),[T,j]=y.useState(!1),[w,C]=y.useState(!1),[D,A]=y.useState(void 0),E=o.find(B=>B.id===t);if(!E&&r)return i.jsx(AU,{});if(!t||!E)return i.jsx(zn,{to:Ro,replace:!0});const R=m.filter(B=>B.linkedEnvironmentIds.includes(E.id)),O=S.filter(B=>B.environmentId===E.id),M=O.reduce((B,F)=>B+(F.costMillicents??0),0),$=DU[E.status]||"var(--text-tertiary)",Y=E.status==="connected",V=E.status==="connecting",ee=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",le=E.id in c?c[E.id]:void 0,Z=()=>{p(E.id).catch(()=>{}),j(!1),s(Ro,{replace:!0})},ae=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=B=>{g(B).catch(()=>{}),A(void 0)};return i.jsxs("div",{className:Me.container,children:[i.jsx(ys,{isOpen:T,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>j(!1)}),i.jsx(ys,{isOpen:w,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:ae,onCancel:()=>C(!1)}),i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx("span",{className:Me.statusDot,style:{color:$},children:"●"}),i.jsx("h2",{className:Me.envName,children:E.displayName||E.id}),i.jsx("span",{className:Me.statusBadge,style:{color:$},children:E.status})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsxs("span",{className:Me.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&i.jsxs("span",{className:Me.metaTag,children:[O.length," session",O.length!==1?"s":""]}),M>0&&i.jsxs("span",{className:Me.metaTag,children:["Cost: ",As(M)]})]})]}),i.jsxs("div",{className:Me.actions,children:[Y&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(G_(E.id)),children:"New Chat"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>C(!0),disabled:le!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ee&&i.jsx("button",{className:Me.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&le!==void 0&&i.jsx("span",{className:Me.provisionMessage,children:le.message}),E.status==="error"&&(le==null?void 0:le.stage)==="error"&&i.jsx("span",{className:Me.errorMessage,children:le.message}),i.jsx("button",{className:Me.btnOutline,onClick:()=>s($N(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:Me.btnDanger,onClick:()=>j(!0),children:"Delete"})]}),i.jsxs("div",{className:Me.section,children:[i.jsxs("div",{className:Me.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(`${Y_}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const B=m.filter(F=>!F.linkedEnvironmentIds.includes(E.id)&&F.status==="active");return B.length===0?null:i.jsxs("select",{className:Me.btnPrimary,value:"",onChange:F=>{F.target.value&&v(F.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),B.map(F=>i.jsx("option",{value:F.id,children:F.name},F.id))]})})()]}),_&&i.jsxs("p",{className:Me.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,i.jsx("button",{className:Me.btnSmall,onClick:k,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),R.length===0&&i.jsx("p",{className:Me.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:Me.cardList,"data-testid":"linked-workspaces-list",children:R.map(B=>i.jsx(RU,{workspace:B,confirmArchiveId:D,onOpen:()=>s(ji(B.id,E.id)),onArchive:()=>A(B.id),onConfirmArchive:()=>H(B.id),onCancelArchive:()=>A(void 0),onUnlink:()=>{b(B.id,E.id).catch(()=>{})}},B.id))})]})]})}function RU({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const p=s===t.id,m=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:Me.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[i.jsxs("div",{className:Me.cardHeader,children:[i.jsx("strong",{className:Me.cardName,children:t.name}),i.jsxs("div",{className:Me.cardActions,children:[i.jsx("button",{className:Me.btnSmall,onClick:o,children:"Open"}),i.jsx("button",{className:Me.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:Me.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:Me.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:Me.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:Me.cardMeta,children:m?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Me.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const IU={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function OU(){const s=Jt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=IU[s],r=S$(o);return i.jsxs("div",{className:Xr.layout,children:[i.jsx(fa,{segments:r}),i.jsx("div",{className:Xr.content,children:i.jsx("div",{className:Xr.tabPanel,children:i.jsx(Ai,{})},s)})]})}function BU(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=ut(),{showToast:d}=pn();return i.jsxs(i.Fragment,{children:[i.jsx(S8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(NB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function LU(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=ut(),{showToast:u}=pn();return i.jsx(FL,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function zU(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=ut(),{showToast:c}=pn(),d=vt();return i.jsx(B8,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(PN),onNavigateToPersona:u=>d(F_(u))})}const $U="_container_1ooin_1",HU="_form_1ooin_7",PU="_formActions_1ooin_75",UU="_editableSection_1ooin_82",VU="_defaultBadge_1ooin_93",qU="_typeToggle_1ooin_107",GU="_scriptEditor_1ooin_121",FU="_optional_1ooin_128",hs={container:$U,form:HU,formActions:PU,editableSection:UU,defaultBadge:VU,typeToggle:qU,scriptEditor:GU,optional:FU},f_=[{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)"}],p_=[{value:"genaiscript",label:"genaiscript"}],KU="0";function m_(){const{personaId:t}=ua(),s=vt(),{showToast:o}=pn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=ut(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return i.jsx(zn,{to:Yf,replace:!0});const b=[{label:"Settings",url:ki},{label:"Personas",url:Yf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:hs.container,children:[i.jsx(fa,{segments:b}),i.jsx(ZU,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Yf)},showToast:o})]})}function ZU({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=vt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,T]=y.useState((t==null?void 0:t.systemPrompt)??""),[j,w]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[A,E]=y.useState((t==null?void 0:t.maxTurns)??0),[R,O]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[M,$]=y.useState((t==null?void 0:t.script)??""),[Y,V]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[ee,le]=y.useState(!1),[Z,ae]=y.useState(null),[H,B]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!H){B(!0),b(t.name),k(t.description),T(t.systemPrompt);const ue=t.type==="script"?"script":"agent";w(ue==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),O(ue),$(t.script||""),V(t.allowedMcpTools)}},[s,t,H]);const F=ue=>{O(ue),ue==="script"?w("genaiscript"):j==="genaiscript"&&w("claude-code")},ge=!s&&t===void 0,ne=v.trim().length>0&&!ge&&S.trim().length>0&&(R==="script"?M.trim().length>0:!!j&&!!C),ce=s&&ne,me=!s&&o===(t==null?void 0:t.id),ke=!s&&t&&!me&&R==="agent"&&!!j&&!!C,De=(ue,Re)=>{if(!ue.trim())return`${Re} is required`},ot=ue=>{if(ue.preventDefault(),!(ge||!ne)){if(t){c(t.id,v,_,S,j,C,A,R,M).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,S,j,C,A,R,M,Y).then(Re=>{m("Persona created","success"),g(F_(Re.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},yt=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},_e=async(ue,Re,Q,et)=>ue().then(()=>{Re(),m(Q,"success")},()=>{m(et,"error")}),Oe=(ue,Re)=>{if(!t)return;const Q=ue==="type"?String(Re):R,et=ue==="runtime"?String(Re):ue==="type"?String(Re)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,re=ue==="model"?String(Re):C,ve=ue==="maxTurns"?Number(Re):A,Xe=ue==="systemPrompt"?String(Re):S,an=ue==="script"?String(Re):M;_e(()=>c(t.id,ue==="name"?String(Re):v,ue==="description"?String(Re):_,Xe,et,re,ve,Q,an),()=>{if(ue==="type"){const _s=String(Re)==="script"?"script":"agent";O(_s),w(et)}ue==="runtime"&&w(String(Re)),ue==="name"&&b(String(Re)),ue==="description"&&k(String(Re)),ue==="systemPrompt"&&T(String(Re)),ue==="model"&&D(String(Re)),ue==="maxTurns"&&E(Number(Re)),ue==="script"&&$(String(Re))},"Persona updated","Failed to update persona").catch(()=>{})},Ht=ue=>{ot(ue)},Nt=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[ge?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:Ht,className:hs.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:hs.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:R==="agent",onChange:()=>F("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:R==="script",onChange:()=>F("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:ue=>b(ue.target.value),placeholder:R==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx("input",{type:"text",value:_,onChange:ue=>k(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:j,onChange:ue=>w(ue.target.value),"data-testid":"persona-runtime-select",children:(R==="script"?p_:f_).map(ue=>i.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),R==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:A,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>T(ue.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),R==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:hs.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>T(ue.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),i.jsxs("label",{children:["Script",i.jsx("textarea",{value:M,onChange:ue=>$(ue.target.value),placeholder:`script({ model: "openai:gpt-4o" });
740
+ Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Oe(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:Oe(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
741
+ src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Oe(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:Oe(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Oe(8800),content:"completed"}}]}],ns={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function t_(t){return t?Qb:Qb.filter(s=>!v7.some(o=>s.name.startsWith(o)))}const n_=400;function q$({children:t}){const[s,o]=y.useState(B$),[r,c]=y.useState(L$),[d,u]=y.useState(()=>t_(!1)),[p,m]=y.useState(z$),[g,v]=y.useState(void 0),[b,_]=y.useState($$),[k,S]=y.useState(""),[j,T]=y.useState(H$),[w,C]=y.useState(P$),[D,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,R]=y.useState(U$),[O,M]=y.useState([]),[$]=y.useState(V$),[Y,V]=y.useState(""),[ne,le]=y.useState(Es),[Z,se]=y.useState(Va),[H,B]=y.useState(void 0),[F,ge]=y.useState(void 0),[ee,ce]=y.useState(""),me=y.useRef(void 0),xe=y.useRef(0),De=y.useRef(0),ot=y.useRef(new Set),yt=y.useRef(new Map),lt=y.useRef(j);lt.current=j;const Pe=y.useRef(new Map),ke=y.useRef(new Map),ct=y.useCallback(U=>(xe.current+=1,`mock-${U}-${String(xe.current).padStart(3,"0")}`),[]),ue=y.useCallback(()=>{const U=e_[De.current%e_.length];return De.current+=1,U},[]),Re=y.useCallback((U,ae,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=yt.current.get(de))==null||ye.delete(pe)),U()},ae);ot.current.add(pe),de&&(yt.current.has(de)||yt.current.set(de,new Set),yt.current.get(de).add(pe))},[]),Q=y.useCallback(U=>{const ae=yt.current.get(U);ae&&(ae.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),yt.current.delete(U))},[]),nt=y.useCallback((U,ae,de)=>{c(pe=>pe.map(ye=>ye.id===U?{...ye,status:ae,...de!==void 0?{endReason:de}:{}}:ye))},[]),re=y.useCallback(U=>{m(ae=>[...ae,U])},[]),ve=y.useCallback((U,ae,de)=>{ae.forEach((pe,ye)=>{Re(()=>{const tt={sessionId:U,...pe.event,timestamp:new Date().toISOString()};if(re(tt),pe.event.eventType==="status"){const je=tk(pe.event.content),Le=nk(pe.event.content);nt(U,je,Le)}ye===ae.length-1&&de&&de()},pe.delayMs,U)})},[Re,re,nt]),et=y.useCallback(async(U,ae,de,pe)=>{console.log("[MockGrackle] spawn",{environmentId:U,prompt:ae,runtime:pe});const ye=ct("sess"),tt={id:ye,environmentId:U,runtime:pe||"claude-code",status:"running",prompt:ae,startedAt:new Date().toISOString()};c(Le=>[...Le,tt]),v(ye);const je=ue();if(console.log(`[MockGrackle] Playing scenario: ${je.label}`),je.pauseForInput){const Le=je.pauseAfterStep??je.steps.length-1,Ue=je.steps.slice(0,Le+1),At=Ue.length>0?Ue[Ue.length-1].delayMs:0;ve(ye,Ue),Re(()=>{nt(ye,"idle"),re({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},At+n_,ye),je.resumeSteps&&Pe.current.set(ye,je.resumeSteps)}else ve(ye,je.steps)},[ct,ue,ve,Re,nt,re]),sn=y.useCallback(async U=>{console.log("[MockGrackle] kill",U),Q(U),Pe.current.delete(U),nt(U,"stopped","killed"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),T(ae=>ae.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,nt,re]),_s=y.useCallback(async U=>{console.log("[MockGrackle] stopGraceful",U),Q(U),Pe.current.delete(U),nt(U,"stopped","terminated"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),T(ae=>ae.map(de=>de.latestSessionId===U&&de.status==="working"?{...de,status:"not_started"}:de))},[Q,nt,re]),ls=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Bs=y.useCallback(async U=>{console.log("[MockGrackle] loadSessionEvents",U)},[]),ma=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Ri=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createWorkspace",{name:U,description:ae});const At={id:ct("proj"),name:U,description:ae||"",repoUrl:de||"",linkedEnvironmentIds:pe?[pe]:[],status:"active",workingDirectory:je||"",useWorktrees:tt??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_(qe=>[...qe,At]),Le&&Le(At)},[ct]),Wt=y.useCallback(async U=>{console.log("[MockGrackle] archiveWorkspace",U),_(ae=>ae.map(de=>de.id===U?{...de,status:"archived"}:de))},[]),Wa=y.useCallback(async U=>{console.log("[MockGrackle] loadTasks",U)},[]),Xa=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue,At)=>{console.log("[MockGrackle] createTask",{workspaceId:U,title:ae,parentTaskId:ye}),T(qe=>{const Cn=qe.filter(Ss=>Ss.workspaceId===U).reduce((Ss,js)=>Math.max(Ss,js.sortOrder),0),bt=ye?qe.find(Ss=>Ss.id===ye):void 0;if(ye&&!bt)return console.warn("[MockGrackle] Parent task not found:",ye),qe;if(bt&&!bt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),qe;const ks=bt?bt.depth+1:0,zi={id:ct("task"),workspaceId:U,title:ae,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:Cn+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:ks,childTaskIds:[],canDecompose:je??!ye,injectKnowledge:Le??!0,defaultPersonaId:tt||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...qe,zi]}),Ue&&Ue()},[ct]),ha=y.useCallback(async(U,ae,de,pe)=>{var At;console.log("[MockGrackle] startTask",{taskId:U});const ye=lt.current.find(qe=>qe.id===U),tt=(ye==null?void 0:ye.title)??"",je=ct("sess"),Le={id:je,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:tt||U,startedAt:new Date().toISOString()};c(qe=>[...qe,Le]),T(qe=>qe.map(an=>an.id===U?{...an,status:"working",latestSessionId:je,branch:`mock/${U.slice(0,8)}`}:an));const Ue=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ue.label}`),Ue.pauseForInput){const qe=Ue.pauseAfterStep??Ue.steps.length-1,an=Ue.steps.slice(0,qe+1),Cn=an.length>0?an[an.length-1].delayMs:0;if(ve(je,an),Re(()=>{nt(je,"idle"),re({sessionId:je,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Cn+n_,je),Ue.resumeSteps){const bt=[...Ue.resumeSteps];Pe.current.set(je,bt);const ks=bt.reduce((zi,Ss)=>Math.max(zi,Ss.delayMs),0);ke.current.set(je,{taskId:U,delayAfterResume:ks+200})}}else{const qe=Ue.steps.length>0?Ue.steps[Ue.steps.length-1].delayMs:0;ve(je,Ue.steps);const an=(At=Ue.steps[Ue.steps.length-1])==null?void 0:At.event.content;Re(()=>{an==="completed"?T(Cn=>Cn.map(bt=>bt.id===U&&bt.status==="working"?{...bt,status:"paused"}:bt)):an==="failed"&&T(Cn=>Cn.map(bt=>bt.id===U&&bt.status==="working"?{...bt,status:"failed"}:bt))},qe+100,je)}},[ct,ue,ve,Re,nt,re]),Ls=y.useCallback(async(U,ae)=>{console.log("[MockGrackle] sendInput",{sessionId:U,text:ae}),re({sessionId:U,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ae}`}),nt(U,"running"),re({sessionId:U,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const de=Pe.current.get(U);if(de)Pe.current.delete(U),ve(U,de);else{const ye=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];ve(U,ye)}const pe=ke.current.get(U);pe&&(ke.current.delete(U),Re(()=>{T(ye=>ye.map(tt=>tt.id===pe.taskId&&tt.status==="working"?{...tt,status:"paused"}:tt))},pe.delayAfterResume,U))},[re,nt,ve,Re]),xs=y.useCallback(async U=>{console.log("[MockGrackle] completeTask",U),T(ae=>ae.map(de=>de.id===U?{...de,status:"complete"}:de))},[]),Ne=y.useCallback(async U=>{console.log("[MockGrackle] resumeTask",U)},[]),Ve=y.useCallback(async(U,ae,de,pe,ye)=>{console.log("[MockGrackle] updateTask",{taskId:U,title:ae}),T(tt=>tt.map(je=>je.id===U?{...je,title:ae.trim()||je.title,description:de,dependsOn:pe,...ye!==void 0?{defaultPersonaId:ye}:{}}:je))},[]),bn=y.useCallback(async U=>{console.log("[MockGrackle] deleteTask",U),T(ae=>ae.filter(de=>de.id!==U))},[]),pn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Pt=y.useCallback(async(U,ae,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:U,adapterType:ae,adapterConfig:de})},[]),Nn=y.useCallback(async(U,ae)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:U,...ae}),o(de=>de.map(pe=>pe.id!==U?pe:{...pe,...ae.displayName!==void 0?{displayName:ae.displayName}:{},...ae.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ae.adapterConfig)}:{}}))},[]),Xt=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Ii=y.useCallback(async(U,ae,de,pe,ye)=>{console.log("[MockGrackle] setToken",{name:U,tokenType:de}),C(tt=>[...tt.filter(Le=>Le.name!==U),{name:U,tokenType:de,envVar:pe,filePath:ye,expiresAt:""}])},[]),Oi=y.useCallback(async U=>{console.log("[MockGrackle] deleteToken",U),C(ae=>ae.filter(de=>de.name!==U))},[]),Bi=y.useCallback(async U=>{console.log("[MockGrackle] updateCredentialProviders",U),A(U)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const Li=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:pn,addEnvironment:Pt,updateEnvironment:Nn,provisionEnvironment:async(U,ae)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ns},sessions:{sessions:r,sessionsLoading:!1,events:p,eventsDropped:0,lastSpawnedId:g,taskSessions:$,spawn:et,sendInput:Ls,kill:sn,stopGraceful:_s,loadSessionEvents:Bs,clearEvents:ma,loadTaskSessions:async U=>{console.log("[MockGrackle] loadTaskSessions",U)},domainHook:ns},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Ri,archiveWorkspace:Wt,updateWorkspace:async(U,ae)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:U,...ae}),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,...ae.name!==void 0?{name:ae.name}:{},...ae.description!==void 0?{description:ae.description}:{},...ae.repoUrl!==void 0?{repoUrl:ae.repoUrl}:{},...ae.environmentId!==void 0?{environmentId:ae.environmentId}:{},...ae.workingDirectory!==void 0?{workingDirectory:ae.workingDirectory}:{},...ae.useWorktrees!==void 0?{useWorktrees:ae.useWorktrees}:{},...ae.defaultPersonaId!==void 0?{defaultPersonaId:ae.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(U,ae)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:U,environmentId:ae}),ae==="error-env"){S("Failed to link environment");return}S(""),_(de=>de.map(pe=>pe.id!==U||pe.linkedEnvironmentIds.includes(ae)?pe:{...pe,linkedEnvironmentIds:[...pe.linkedEnvironmentIds,ae]}))},unlinkEnvironment:async(U,ae)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:U,environmentId:ae}),ae==="error-env"){S("Failed to unlink environment");return}S(""),_(de=>de.map(pe=>pe.id!==U?pe:{...pe,linkedEnvironmentIds:pe.linkedEnvironmentIds.filter(ye=>ye!==ae)}))},linkOperationError:k,clearLinkOperationError:()=>{S("")},domainHook:ns},tasks:{tasks:j,tasksLoading:!1,taskStartingId:void 0,loadTasks:Wa,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Xa,startTask:ha,stopTask:async U=>{console.log("[MockGrackle] stopTask",{taskId:U}),await xs(U)},completeTask:xs,resumeTask:Ne,updateTask:Ve,deleteTask:bn,domainHook:ns},tokens:{tokens:w,tokensLoading:!1,loadTokens:Xt,setToken:Ii,deleteToken:Oi,domainHook:ns},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:Bi,domainHook:ns},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ns},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ns},personas:{personas:E,personasLoading:!1,createPersona:async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createPersona",{name:U});const At={id:`mock-persona-${Date.now()}`,name:U,description:ae,systemPrompt:de,toolConfig:"{}",runtime:pe??"claude-code",model:ye||"",maxTurns:tt||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:je||"agent",script:Le||"",allowedMcpTools:Ue||[]};return R(qe=>[...qe,At]),At},updatePersona:async(U,ae,de,pe,ye,tt,je,Le,Ue,At)=>{console.log("[MockGrackle] updatePersona",{personaId:U,name:ae});const qe=E.find(bt=>bt.id===U);if(!qe)throw new Error(`Persona not found: ${U}`);const an=new Date().toISOString(),Cn={...qe,...ae!==void 0?{name:ae}:{},...de!==void 0?{description:de}:{},...pe!==void 0?{systemPrompt:pe}:{},...ye!==void 0?{runtime:ye}:{},...tt!==void 0?{model:tt}:{},...je!==void 0?{maxTurns:je}:{},...Le!==void 0?{type:Le}:{},...Ue!==void 0?{script:Ue}:{},...At!==void 0?{allowedMcpTools:At}:{},updatedAt:an};return R(bt=>bt.map(ks=>ks.id===U?Cn:ks)),Cn},deletePersona:async U=>{console.log("[MockGrackle] deletePersona",U),R(ae=>ae.filter(de=>de.id!==U))},domainHook:ns},schedules:{schedules:O,schedulesLoading:!1,createSchedule:async(U,ae,de,pe,ye)=>{console.log("[MockGrackle] createSchedule",{title:U});const tt={id:`mock-schedule-${Date.now()}`,title:U,description:ae,scheduleExpression:de,personaId:pe,workspaceId:ye??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return M(je=>[...je,tt]),tt},updateSchedule:async(U,ae)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:U,fields:ae});let de;if(M(pe=>pe.map(ye=>ye.id!==U?ye:(de={...ye,...ae,updatedAt:new Date().toISOString()},de))),!de)throw new Error(`Schedule not found: ${U}`);return de},deleteSchedule:async U=>{console.log("[MockGrackle] deleteSchedule",U),M(ae=>ae.filter(de=>de.id!==U))},domainHook:ns},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(U=!1)=>{u(t_(U))},liveMessages:O$,loadTranscript:async()=>{},handleStreamMessage:()=>{},domainHook:ns},knowledge:{graphData:{nodes:ne,links:Z},selectedNode:H,loading:!1,selectedId:F,searchQuery:ee,search:async U=>{if(console.log("[MockGrackle] knowledge.search",U),!U.trim()){ce(U);return}ce(U);const ae=me.current,de=ae?Es.filter(je=>!je.workspaceId||je.workspaceId===ae):Es,pe=U.toLowerCase(),ye=de.filter(je=>{var Le,Ue,At;return je.label.toLowerCase().includes(pe)||((Le=je.content)==null?void 0:Le.toLowerCase().includes(pe))||((Ue=je.tags)==null?void 0:Ue.some(qe=>qe.toLowerCase().includes(pe)))||((At=je.category)==null?void 0:At.toLowerCase().includes(pe))});le(ye);const tt=new Set(ye.map(je=>je.id));se(Va.filter(je=>tt.has(je.source)&&tt.has(je.target))),ge(void 0),B(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ce("");const U=me.current,ae=U?Es.filter(pe=>!pe.workspaceId||pe.workspaceId===U):Es;le(ae);const de=new Set(ae.map(pe=>pe.id));se(Va.filter(pe=>de.has(pe.source)&&de.has(pe.target)))},selectNode:async U=>{console.log("[MockGrackle] knowledge.selectNode",U),ge(U);const ae=U in Xb?Xb[U]:void 0;if(ae)B(ae);else{const de=Es.find(pe=>pe.id===U);if(de){const pe=Va.filter(ye=>ye.source===U||ye.target===U).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));B({node:de,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ge(void 0),B(void 0)},expandNode:async U=>{console.log("[MockGrackle] knowledge.expandNode",U),le(ae=>{const de=new Set(ae.map(Le=>Le.id)),pe=Va.filter(Le=>Le.source===U||Le.target===U),ye=new Set;for(const Le of pe)de.has(Le.source)||ye.add(Le.source),de.has(Le.target)||ye.add(Le.target);if(ye.size===0)return ae;const tt=Es.filter(Le=>ye.has(Le.id)),je=new Set([...de,...ye]);return se(Le=>{const Ue=new Set(Le.map(qe=>`${qe.source}|${qe.target}|${qe.type}`)),At=Va.filter(qe=>je.has(qe.source)&&je.has(qe.target)&&!Ue.has(`${qe.source}|${qe.target}|${qe.type}`));return At.length>0?[...Le,...At]:Le}),[...ae,...tt]})},loadRecent:async U=>{if(console.log("[MockGrackle] knowledge.loadRecent",U),me.current=U,U){const ae=Es.filter(pe=>!pe.workspaceId||pe.workspaceId===U);le(ae);const de=new Set(ae.map(pe=>pe.id));se(Va.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else le(Es),se(Va);ce("")},handleEvent:()=>!1,domainHook:ns},githubAccounts:{githubAccounts:[],githubAccountsLoading:!1,loadGitHubAccounts:async()=>{console.log("[MockGrackle] loadGitHubAccounts")},addGitHubAccount:async(U,ae,de,pe)=>{console.log("[MockGrackle] addGitHubAccount",U)},updateGitHubAccount:async(U,ae)=>{console.log("[MockGrackle] updateGitHubAccount",U,ae)},removeGitHubAccount:async U=>{console.log("[MockGrackle] removeGitHubAccount",U)},importGitHubAccounts:async()=>(console.log("[MockGrackle] importGitHubAccounts"),{imported:0,usernames:[]})},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(U,ae)=>{console.log("[MockGrackle] setPluginEnabled",U,ae)}},appDefaultPersonaId:Y,setAppDefaultPersonaId:async U=>{console.log("[MockGrackle] setAppDefaultPersonaId",U),V(U)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(U,ae)=>{console.log(`[MockGrackle] loadUsage(${U}, ${ae})`)},refresh:ls}),[s,r,d,p,g,$,b,k,j,w,D,E,O,Y,ne,Z,H,F,ee,et,Ls,sn,_s,Bs,ma,Ri,Wt,Wa,Xa,ha,xs,Ne,Ve,bn,pn,Pt,Nn,Xt,Ii,Oi,Bi,ls]);return i.jsx(rh.Provider,{value:Li,children:t})}const ik=3e3,G$=ik;function F$(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.onStreamMessage);d.current=t.onStreamMessage;const u=y.useRef(t.onConnect);u.current=t.onConnect;const p=y.useRef(t.onDisconnect);return p.current=t.onDisconnect,y.useEffect(()=>{let m=!1,g,v;async function b(){var S,j,T;if(m)return;Promise.resolve((S=u.current)==null?void 0:S.call(u)).catch(()=>{});let _=!1;const k=()=>{!_&&!m&&(_=!0,o("connected"))};v=setTimeout(k,G$);try{const w=Be.streamEvents({});for await(const C of w){if(k(),m)break;const D=C.event;if(D.case==="sessionEvent"){const A=D.value;r.current({sessionId:A.sessionId,type:A.type,timestamp:A.timestamp,content:A.content,raw:A.raw})}else if(D.case==="domainEvent"){const A=D.value;c.current({id:A.id,type:A.type,timestamp:A.timestamp,payloadJson:A.payloadJson})}else if(D.case==="streamMessageEvent"){const A=D.value;(j=d.current)==null||j.call(d,{streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp})}}}catch(w){if(clearTimeout(v),w instanceof la&&w.code===__.Unauthenticated){window.location.href=qN;return}}clearTimeout(v),m||(o("connecting"),(T=p.current)==null||T.call(p),g=setTimeout(()=>{b().catch(()=>{})},ik))}return b().catch(()=>{}),()=>{m=!0,clearTimeout(g),clearTimeout(v)}},[]),{connectionStatus:s}}const dm=["core","orchestration","scheduling"],ok=y.createContext({pluginNames:[...dm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function K$({children:t}){const[s,o]=y.useState([...dm]),[r,c]=y.useState(void 0),[d,u]=y.useState(void 0),[p,m]=y.useState(!0),[g,v]=y.useState(void 0);return y.useEffect(()=>{let b=!1;return fetch("/api/manifest").then(async _=>{if(!_.ok)throw new Error(`Manifest fetch returned ${_.status}`);return _.json()}).then(_=>{b||(o(_.plugins.map(k=>k.name)),c(_.sandboxPort),u(_.sandboxOrigin),m(!1))}).catch(_=>{b||(o([...dm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),i.jsx(ok.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:p,error:g},children:t})}function Ad(){return y.useContext(ok)}function dh(){const{sandboxPort:t,sandboxOrigin:s}=Ad();if(typeof window>"u")return;if(s!==void 0&&s!=="")try{return new URL("/sandbox.html",s).toString()}catch{}if(t===void 0)return;const o=new URL(window.location.origin);return o.port=String(t),o.pathname="/sandbox.html",o.toString()}const Z$=new Set(["dashboard","chat","environments","coordination","settings"]),Y$=new Set(["tasks"]),J$=new Set(["knowledge"]),rk={core:{navItems:Qc.filter(t=>Z$.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:Qc.filter(t=>Y$.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:Qc.filter(t=>J$.has(t.view)),domainHookKeys:["knowledge"]}};function W$(t){return t.flatMap(s=>{var o;return((o=rk[s])==null?void 0:o.navItems)??[]})}function X$(t){return new Set(t.flatMap(s=>{var o;return((o=rk[s])==null?void 0:o.domainHookKeys)??[]}))}function Q$(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function s_(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,taskId:t.taskId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function e9(t){return{sessionId:t.sessionId,eventType:x_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function a_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:z2(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function i_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:$2(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,injectKnowledge:t.injectKnowledge,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function t9(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function n9(t){return{claude:H2(t.claude),github:Cc(t.github),copilot:Cc(t.copilot),codex:Cc(t.codex),goose:Cc(t.goose)}}function s9(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function a9(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function Np(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 i9(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Cp(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 qc(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 Ep(t){return{source:t.fromId,target:t.toId,type:t.type}}function o9(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function r9(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(o9),selfEcho:t.selfEcho}}function bs(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const o_=5e3;function Ur(t){return t instanceof la?t.message:"Operation failed"}function l9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const C=await r(Be.listEnvironments({}));s(C.environments.map(Q$))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(A=>A.filter(E=>E.id!==D)),d(A=>{const E={...A};return delete E[D],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return ek("environment.provision_progress","invalid payload"),!0;if(d(A=>({...A,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const A=D.environmentId;setTimeout(()=>{d(E=>{const R={...E};return delete R[A],R})},o_)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const A=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(A),!0}return!1},[]),_=y.useCallback(async(C,D,A,E)=>{p("");try{await Be.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(A??{}),githubAccountId:E??""})}catch(R){p(Ur(R))}},[]),k=y.useCallback(async(C,D)=>{p("");try{await Be.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0,githubAccountId:D.githubAccountId})}catch(A){p(Ur(A))}},[]),S=y.useCallback(async(C,D)=>{p("");try{const A=Be.provisionEnvironment({id:C,force:D??!1});for await(const E of A)d(R=>({...R,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(R=>{const O={...R};return delete O[C],O})},o_)}catch(A){d(E=>{const R={...E};return delete R[C],R}),p(Ur(A))}},[]),j=y.useCallback(async C=>{p("");try{await Be.stopEnvironment({id:C})}catch(D){p(Ur(D))}},[]),T=y.useCallback(async C=>{p("");try{await Be.removeEnvironment({id:C})}catch(D){p(Ur(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:T,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const Ap=new Set(["pending","running","idle"]),c9=new Set(["completed","failed","interrupted","hibernating","suspended"]),r_=["pending","running","idle"];function d9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const $=(await r(Be.listSessions({}))).sessions.map(s_);s(Y=>{const V=new Map(Y.map(ne=>[ne.id,ne]));return $.map(ne=>{const le=V.get(ne.id),Z=le==null?void 0:le.status;return!Z||Z===ne.status?ne:c9.has(Z)&&Ap.has(ne.status)?{...ne,status:Z,...le.endReason!==void 0?{endReason:le.endReason}:{}}:Ap.has(Z)&&Ap.has(ne.status)&&r_.indexOf(Z)>r_.indexOf(ne.status)?{...ne,status:Z}:ne})})}catch{}},[r]),k=y.useCallback(M=>{if(M.type!=="session_event")return!1;if(!b$(M.payload))return ek("session_event","payload is not a valid SessionEvent"),!0;const $=M.payload;let Y=0;if(d(V=>{const ne=[...V,$];return ne.length>wo?(Y=ne.length-wo,ne.slice(-wo)):ne}),Y>0&&p(V=>V+Y),$.eventType==="usage")try{const V=JSON.parse($.content),ne=Number(V.input_tokens)||0,le=Number(V.output_tokens)||0,Z=Number(V.cost_millicents)||0;(ne>0||le>0||Z>0)&&s(se=>se.map(H=>H.id===$.sessionId?{...H,inputTokens:(H.inputTokens??0)+ne,outputTokens:(H.outputTokens??0)+le,costMillicents:(H.costMillicents??0)+Z}:H))}catch{}if($.eventType==="status"){const V=tk($.content),ne=nk($.content);s(le=>le.some(se=>se.id===$.sessionId)?le.map(se=>se.id===$.sessionId?{...se,status:V,...ne!==void 0?{endReason:ne}:{}}:se):[...le,{id:$.sessionId,environmentId:"",runtime:"",status:V,prompt:"",startedAt:$.timestamp,...ne!==void 0?{endReason:ne}:{}}])}return!0},[]),S=y.useCallback(M=>{k({type:"session_event",payload:M})},[k]),j=y.useCallback(M=>{var $,Y,V,ne,le;switch(M.type){case"sessions":{const Z=Array.isArray(($=M.payload)==null?void 0:$.sessions)?M.payload.sessions:[];return s(Z),!0}case"spawned":{const Z=(Y=M.payload)==null?void 0:Y.sessionId;return typeof Z=="string"&&Z&&g(Z),_().catch(()=>{}),!0}case"session_events":{const Z=Array.isArray((V=M.payload)==null?void 0:V.events)?M.payload.events:[];return Z.length>0&&d(Z),!0}case"task_sessions":{const Z=(ne=M.payload)==null?void 0:ne.taskId;if(typeof Z=="string"&&Z){const se=Array.isArray((le=M.payload)==null?void 0:le.sessions)?M.payload.sessions:[];b(H=>({...H,[Z]:se}))}return!0}default:return!1}},[_]),T=y.useCallback(async(M,$,Y,V,ne)=>{try{const le=await Be.spawnAgent({environmentId:M,prompt:$,personaId:Y||"",workingDirectory:V||"",workspaceId:ne||""});g(le.id),await _()}catch{}},[_]),w=y.useCallback(async(M,$)=>{await Be.sendInput({sessionId:M,text:$})},[]),C=y.useCallback(async M=>{try{await Be.killAgent({id:M,graceful:!1})}catch{}},[]),D=y.useCallback(async M=>{try{await Be.killAgent({id:M,graceful:!0})}catch{}},[]),A=y.useCallback(async M=>{try{const Y=(await Be.getSessionEvents({id:M})).events.map(e9);if(Y.length>0){let V=0;d(ne=>{const le=new Set;for(const H of ne)H.sessionId===M&&le.add(`${H.timestamp}|${H.eventType}`);const Z=Y.filter(H=>!le.has(`${H.timestamp}|${H.eventType}`)),se=[...ne,...Z].sort((H,B)=>H.sessionId!==B.sessionId?0:H.timestamp.localeCompare(B.timestamp));return se.length>wo?(V=se.length-wo,se.slice(-wo)):se}),V>0&&p(ne=>ne+V)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),R=y.useCallback(async M=>{try{const Y=(await Be.getTaskSessions({id:M})).sessions.map(s_);b(V=>({...V,[M]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:T,sendInput:w,kill:C,stopGraceful:D,loadSessionEvents:A,clearEvents:E,loadTaskSessions:R,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function l_(t){return t instanceof la?t.message:"Operation failed"}function u9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Be.listWorkspaces({}));s(C.workspaces.map(a_))}catch{}},[r]),g=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=y.useCallback(()=>{d(!1)},[]),b=y.useCallback(async(C,D,A,E,R,O,M,$,Y)=>{d(!0);try{const V=await Be.createWorkspace({name:C,description:D||"",repoUrl:A||"",environmentId:E||"",defaultPersonaId:R||void 0,useWorktrees:O??!0,workingDirectory:M||void 0}),ne=a_(V);s(le=>le.some(Z=>Z.id===ne.id)?le:[...le,ne]),d(!1),$==null||$(ne)}catch(V){d(!1);const ne=V instanceof la?V.message:"Failed to create workspace";Y==null||Y(ne)}},[]),_=y.useCallback(async C=>{try{await Be.archiveWorkspace({id:C})}catch{}},[]),k=y.useCallback(async(C,D)=>{try{await Be.updateWorkspace({id:C,...D})}catch{}},[]),S=y.useCallback(()=>{p("")},[]),j=y.useCallback(async(C,D)=>{try{p(""),await Be.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){p(l_(A))}},[m]),T=y.useCallback(async(C,D)=>{try{p(""),await Be.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){p(l_(A))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:_,updateWorkspace:k,linkEnvironment:j,unlinkEnvironment:T,linkOperationError:u,clearLinkOperationError:S,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function f9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await Ln.listTasks({workspaceId:E})).tasks.map(i_);s(M=>[...M.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(Ln.listTasks({}))).tasks.map(i_);s(O=>{const M=new Set(R.map($=>$.id));return[...O.filter($=>!M.has($.id)),...R]})}catch{}},[r]),g=y.useCallback((E,R)=>{const O=M=>{clearTimeout(u.current[M]),u.current[M]=setTimeout(()=>{delete u.current[M],p(M).catch(()=>{})},200)};E?O(E):R&&s(M=>{const $=M.find(Y=>Y.id===R);return $!=null&&$.workspaceId?O($.workspaceId):m().catch(()=>{}),M})},[p,m]),v=y.useCallback(E=>{const R=E.payload;switch(E.type){case"task.created":{const O=typeof R.workspaceId=="string"?R.workspaceId:"";return O&&p(O).catch(()=>{}),!0}case"task.started":{const O=typeof R.taskId=="string"?R.taskId:"",M=typeof R.sessionId=="string"?R.sessionId:"",$=typeof R.workspaceId=="string"?R.workspaceId:"";return d(Y=>O&&Y===O?void 0:Y),M&&O&&s(Y=>Y.map(V=>V.id===O?{...V,latestSessionId:M}:V)),g($,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof R.workspaceId=="string"?R.workspaceId:"",M=typeof R.taskId=="string"?R.taskId:"";return d($=>M&&$===M?void 0:$),g(O,M),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var R,O;if(E.type==="tasks"){const M=Array.isArray((R=E.payload)==null?void 0:R.tasks)?E.payload.tasks:[],$=typeof((O=E.payload)==null?void 0:O.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s($?Y=>[...Y.filter(V=>V.workspaceId!==$),...M]:Y=>{const V=new Set(M.map(ne=>ne.id));return[...Y.filter(ne=>!V.has(ne.id)),...M]}),!0}return!1},[]),k=y.useCallback(async(E,R,O,M,$,Y,V,ne,le,Z)=>{try{await Ln.createTask({workspaceId:E,title:R,description:O||"",dependsOn:M||[],parentTaskId:$||"",defaultPersonaId:Y||void 0,canDecompose:V??void 0,injectKnowledge:ne??void 0}),le==null||le()}catch(se){const H=se instanceof la?se.message:"Failed to create task";Z==null||Z(H)}},[]),S=y.useCallback(async(E,R,O,M)=>{d(E);try{await Ln.startTask({taskId:E,personaId:R||"",environmentId:O||"",notes:M||""})}catch($){if($ instanceof la&&$.code===__.ResourceExhausted)return;throw d(void 0),$}},[]),j=y.useCallback(async E=>{try{await Ln.stopTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await Ln.completeTask({id:E})}catch{}},[]),w=y.useCallback(async E=>{try{await Ln.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,R,O,M,$)=>{try{await Ln.updateTask({id:E,title:R,description:O,dependsOn:M,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await Ln.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:k,startTask:S,stopTask:j,completeTask:T,resumeTask:w,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function p9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const g=await r(Be.listTokens({}));s(g.tokens.map(t9))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,k)=>{try{await Be.setToken({name:g,value:v,type:b,envVar:_,filePath:k})}catch{}},[]),p=y.useCallback(async g=>{try{await Be.deleteToken({name:g})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function m9(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r(Be.getCredentialProviders({}));s(n9(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(x$(m.payload)&&s(m.payload),!0):!1,[]),u=y.useCallback(async m=>{const g=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(g.map(({provider:v,value:b})=>Be.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function h9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async b=>{try{const _=await Be.listCodespaces({githubAccountId:b??""});s(_.codespaces.map(s9)),d(_.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await Be.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(k){p(!1);const S=k instanceof la?k.message:"Failed to create codespace";r(S)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function g9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await Be.listDockerContainers({});s(u.containers.map(a9)),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 v9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const v=await r(Ln.listPersonas({}));s(v.personas.map(Np))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,b,_,k,S,j,T,w,C)=>{const D=await Ln.createPersona({name:v,description:b,systemPrompt:_,runtime:k||"",model:S||"",maxTurns:j||0,type:T||"agent",script:w||"",allowedMcpTools:C||[]}),A=Np(D);return s(E=>[...E.filter(R=>R.id!==A.id),A]),A},[]),p=y.useCallback(async(v,b,_,k,S,j,T,w,C,D)=>{const A={id:v};b!==void 0&&(A.name=b),_!==void 0&&(A.description=_),k!==void 0&&(A.systemPrompt=k),S!==void 0&&(A.runtime=S),j!==void 0&&(A.model=j),T!==void 0&&(A.maxTurns=T),w!==void 0&&(A.type=w),C!==void 0&&(A.script=C),D!==void 0&&(A.allowedMcpTools={tools:D});const E=await Ln.updatePersona(A),R=Np(E);return s(O=>O.map(M=>M.id===R.id?R:M)),R},[]),m=y.useCallback(async v=>{await Ln.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function y9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Dc.listSchedules({}));s(b.schedules.map(Cp))}catch{}},[r]),u=y.useCallback(b=>{switch(b.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),p=y.useCallback(async(b,_,k,S,j,T)=>{const w=await Dc.createSchedule({title:b,description:_,scheduleExpression:k,personaId:S,workspaceId:j||"",parentTaskId:T||""}),C=Cp(w);return s(D=>[...D.filter(A=>A.id!==C.id),C]),C},[]),m=y.useCallback(async(b,_)=>{const k={id:b};_.title!==void 0&&(k.title=_.title),_.description!==void 0&&(k.description=_.description),_.scheduleExpression!==void 0&&(k.scheduleExpression=_.scheduleExpression),_.personaId!==void 0&&(k.personaId=_.personaId),_.enabled!==void 0&&(k.enabled=_.enabled);const S=await Dc.updateSchedule(k),j=Cp(S);return s(T=>T.map(w=>w.id===j.id?j:w)),j},[]),g=y.useCallback(async b=>{await Dc.deleteSchedule({id:b}),s(_=>_.filter(k=>k.id!==b))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:p,updateSchedule:m,deleteSchedule:g,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function b9(t){if(t)try{return JSON.parse(t)}catch{return}}function _9(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),k=y.useCallback(async E=>{const R=E??"";_.current=R,b(""),g(!0);try{const O=await Mc.listRecentKnowledgeNodes({limit:30,workspaceId:R}),M=new Map,$=[];for(const Y of O.nodes)M.set(Y.id,qc(Y));for(const Y of O.edges)$.push(Ep(Y));for(const Y of $){const V=M.get(Y.source);V&&(V.val+=1);const ne=M.get(Y.target);ne&&(ne.val+=1)}s(M),r($)}catch{}finally{g(!1)}},[]),S=y.useCallback(async E=>{if(E.trim()){b(E),p(void 0),d(void 0),g(!0);try{const R=await Mc.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,M=[];for(const $ of R.results){$.node&&O.set($.node.id,qc($.node,$.edges.length));for(const Y of $.edges)M.push(Ep(Y))}s(O),r(M)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{k(_.current).catch(()=>{})},[k]),T=y.useCallback(async E=>{p(E);try{const R=await Mc.getKnowledgeNode({id:E});if(!R.node){d(void 0);return}d({node:qc(R.node,R.edges.length),edges:R.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:b9(O.metadataJson)}))})}catch{d(void 0)}},[]),w=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const R=await Mc.expandKnowledgeNode({id:E,depth:1});s(O=>{const M=new Map(O);for(const $ of R.nodes)M.has($.id)||M.set($.id,qc($));return M}),r(O=>{const M=new Set(O.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of R.edges){const V=Ep(Y),ne=`${V.source}:${V.target}:${V.type}`;M.has(ne)||$.push(V)}return[...O,...$]})}catch{}},[]),D=y.useCallback(E=>!1,[]),A={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:D};return{graphData:{nodes:[...t.values()],links:o},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:S,clearSearch:j,selectNode:T,clearSelection:w,expandNode:C,loadRecent:k,handleEvent:D,domainHook:A}}function x9(){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:Cd("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}}}const Gc=500;function k9(){const[t,s]=y.useState([]),[o,r]=y.useState({}),[c,d]=y.useState(!1),[u,p]=y.useState(!1),{loading:m,track:g}=bs(),v=y.useRef(0),b=y.useCallback(async(T=!1)=>{const w=v.current;try{const C=await g(Be.listStreams({includeInternal:T}));v.current===w&&(s(C.streams.map(r9)),p(!1))}catch{v.current===w&&p(!0)}finally{v.current===w&&d(!0)}},[g]),_=y.useCallback(async(T,w)=>{let C;try{C=(await Be.getStreamTranscript({streamId:T,beforeSeq:w??"",limit:0})).messages.map(A=>({streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp}))}catch{return}r(D=>{const A=new Map;for(const O of D[T]??[])A.set(O.seq,O);for(const O of C)A.set(O.seq,O);const E=Array.from(A.values()).sort((O,M)=>O.seq.localeCompare(M.seq)),R=E.length>Gc?E.slice(E.length-Gc):E;return{...D,[T]:R}})},[]),k=y.useCallback(T=>{r(w=>{const C=w[T.streamId]??[];if(C.some(E=>E.seq===T.seq))return w;const D=[...C,T],A=D.length>Gc?D.slice(D.length-Gc):D;return{...w,[T.streamId]:A}})},[]),S=y.useCallback(T=>!1,[]);return{streams:t,streamsLoading:m,streamsLoadedOnce:c,streamsLoadError:u,loadStreams:b,liveMessages:o,loadTranscript:_,handleStreamMessage:k,handleEvent:S,domainHook:{onConnect:b,onDisconnect:()=>{v.current+=1,s([]),r({}),d(!1),p(!1)},handleEvent:S}}}function S9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const m=await r(Be.listPlugins({}));s(m.plugins.map(g=>({name:g.name,description:g.description,enabled:g.enabled,required:g.required,loaded:g.loaded})))}catch{}},[r]),d=y.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,g)=>{try{const v=await Be.setPluginEnabled({name:m,enabled:g});s(b=>b.map(_=>_.name===v.name?{..._,enabled:v.enabled}:_))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function j9(){const[t,s]=y.useState([]),{loading:o,track:r}=bs(),c=y.useCallback(async()=>{try{const b=await r(Be.listGitHubAccounts({}));s(b.accounts.map(_=>({id:_.id,label:_.label,username:_.username,isDefault:_.isDefault,createdAt:_.createdAt})))}catch{}},[r]),d=y.useCallback(b=>b.type==="github_account.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(b,_,k,S)=>{const j=await Be.addGitHubAccount({label:b,token:_,username:k,isDefault:S});s(T=>[...j.isDefault?T.map(C=>({...C,isDefault:!1})):T,{id:j.id,label:j.label,username:j.username,isDefault:j.isDefault,createdAt:j.createdAt}])},[]),p=y.useCallback(async(b,_)=>{const k=await Be.updateGitHubAccount({id:b,..._});s(S=>S.map(j=>j.id===k.id?{...j,label:k.label,username:k.username,isDefault:k.isDefault}:_.isDefault?{...j,isDefault:!1}:j))},[]),m=y.useCallback(async b=>{await Be.removeGitHubAccount({id:b}),s(_=>_.filter(k=>k.id!==b))},[]),g=y.useCallback(async()=>{const b=await Be.importGitHubAccounts({});return b.imported>0&&await c(),{imported:b.imported,usernames:b.usernames}},[c]);return{githubAccounts:t,githubAccountsLoading:o,loadGitHubAccounts:c,addGitHubAccount:u,updateGitHubAccount:p,removeGitHubAccount:m,importGitHubAccounts:g,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function T9(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Ad(),p=X$(u),m=l9(),g=d9(),v=u9(),b=f9(),_=p9(),k=m9(),S=h9(),j=g9(),T=v9(),w=y9(),C=_9(),D=x9(),A=k9(),E=S9(),R=j9(),O=[...p.has("environments")?[m.domainHook]:[],...p.has("sessions")?[g.domainHook]:[],...p.has("workspaces")?[v.domainHook]:[],...p.has("tasks")?[b.domainHook]:[],...p.has("tokens")?[_.domainHook]:[],...p.has("credentials")?[k.domainHook]:[],...p.has("codespaces")?[S.domainHook]:[],...p.has("dockerContainers")?[j.domainHook]:[],...p.has("personas")?[T.domainHook]:[],...p.has("schedules")?[w.domainHook]:[],...p.has("knowledge")?[C.domainHook]:[],...p.has("notifications")?[D.domainHook]:[],...p.has("streams")?[A.domainHook]:[],...p.has("plugins")?[E.domainHook]:[],R.domainHook],{connectionStatus:M}=F$({onSessionEvent:F=>{g.handleSessionEvent({sessionId:F.sessionId,eventType:x_(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const ge=JSON.parse(F.payloadJson);Z({id:F.id,type:F.type,timestamp:F.timestamp,payload:ge})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onStreamMessage:F=>{A.handleStreamMessage(F)},onConnect:se,onDisconnect:H}),$="default_persona_id",Y="onboarding_completed",V=y.useCallback(async F=>{const ge=await Be.setSetting({key:$,value:F});s(ge.value)},[]),ne=y.useCallback(async()=>{r(!0);try{await Be.setSetting({key:Y,value:"true"})}catch{}},[]),le=y.useCallback(async(F,ge)=>{try{const ee=await Be.getUsage({scope:F,id:ge}),ce=`${F}:${ge}`;d(me=>({...me,[ce]:i9(ee)}))}catch{}},[]);function Z(F){const ge=F.payload.key,ee=F.payload.value;if(F.type==="setting.changed"){ge===$&&s(ee??""),ge===Y&&r(ee==="true");return}for(const ce of O)if(ce.handleEvent(F))break;(F.type==="environment.removed"||F.type==="task.started")&&g.loadSessions().catch(()=>{}),(F.type==="session.started"||F.type==="session.stopped")&&A.loadStreams().catch(()=>{})}async function se(){for(const F of O)F.onConnect().catch(()=>{});try{const F=await Be.getSetting({key:$});s(F.value)}catch{}try{const F=await Be.getSetting({key:Y});r(F.value==="true")}catch{}}function H(){O.forEach(F=>F.onDisconnect())}const B=y.useCallback(()=>{m.loadEnvironments().catch(()=>{}),g.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),_.loadTokens().catch(()=>{})},[m.loadEnvironments,g.loadSessions,v.loadWorkspaces,_.loadTokens]);return{connectionStatus:M,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:g.sessions,sessionsLoading:g.sessionsLoading,events:g.events,eventsDropped:g.eventsDropped,lastSpawnedId:g.lastSpawnedId,taskSessions:g.taskSessions,spawn:g.spawn,sendInput:g.sendInput,kill:g.kill,stopGraceful:g.stopGraceful,loadSessionEvents:g.loadSessionEvents,clearEvents:g.clearEvents,loadTaskSessions:g.loadTaskSessions,domainHook:g.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:b.tasks,tasksLoading:b.tasksLoading,taskStartingId:b.taskStartingId,loadTasks:b.loadTasks,loadAllTasks:b.loadAllTasks,createTask:b.createTask,startTask:b.startTask,stopTask:b.stopTask,completeTask:b.completeTask,resumeTask:b.resumeTask,updateTask:b.updateTask,deleteTask:b.deleteTask,domainHook:b.domainHook},tokens:{tokens:_.tokens,tokensLoading:_.tokensLoading,loadTokens:_.loadTokens,setToken:_.setToken,deleteToken:_.deleteToken,domainHook:_.domainHook},credentials:{credentialProviders:k.credentialProviders,credentialsLoading:k.credentialsLoading,updateCredentialProviders:k.updateCredentialProviders,domainHook:k.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},dockerContainers:{dockerContainers:j.dockerContainers,dockerContainersError:j.dockerContainersError,listDockerContainers:j.listDockerContainers,domainHook:j.domainHook},personas:{personas:T.personas,personasLoading:T.personasLoading,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,domainHook:T.domainHook},schedules:{schedules:w.schedules,schedulesLoading:w.schedulesLoading,createSchedule:w.createSchedule,updateSchedule:w.updateSchedule,deleteSchedule:w.deleteSchedule,domainHook:w.domainHook},streams:{streams:A.streams,streamsLoading:A.streamsLoading,streamsLoadedOnce:A.streamsLoadedOnce,streamsLoadError:A.streamsLoadError,loadStreams:A.loadStreams,liveMessages:A.liveMessages,loadTranscript:A.loadTranscript,handleStreamMessage:A.handleStreamMessage,domainHook:A.domainHook},knowledge:C,plugins:{plugins:E.plugins,pluginsLoading:E.pluginsLoading,loadPlugins:E.loadPlugins,setPluginEnabled:E.setPluginEnabled},githubAccounts:{githubAccounts:R.githubAccounts,githubAccountsLoading:R.githubAccountsLoading,loadGitHubAccounts:R.loadGitHubAccounts,addGitHubAccount:R.addGitHubAccount,updateGitHubAccount:R.updateGitHubAccount,removeGitHubAccount:R.removeGitHubAccount,importGitHubAccounts:R.importGitHubAccounts},appDefaultPersonaId:t,setAppDefaultPersonaId:V,onboardingCompleted:o,completeOnboarding:ne,usageCache:c,loadUsage:le,refresh:B}}function w9({children:t}){const s=T9();return i.jsx(rh.Provider,{value:s,children:t})}function N9(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const p=c.get(u.id);p&&p.status!==u.status&&(u.status==="sleeping"||u.status==="connecting"||(u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&p.status==="connected"&&s("Environment disconnected","warning")))}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function C9(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 E9={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 A9(t){return E9[t]}function D9(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const p=A9(d.status);p&&o.push(p)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function M9(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=D9(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const R9="_dashboard_16pzm_1",I9="_kpiStrip_16pzm_11",O9="_kpiCard_16pzm_23",B9="_kpiValue_16pzm_68",L9="_kpiLabel_16pzm_76",z9="_bodyGrid_16pzm_84",$9="_section_16pzm_96",H9="_sectionHeader_16pzm_109",P9="_sectionIcon_16pzm_118",U9="_sectionTitle_16pzm_123",V9="_sectionCount_16pzm_131",q9="_sectionBody_16pzm_138",G9="_emptyHint_16pzm_143",F9="_sessionRow_16pzm_150",K9="_sessionPrompt_16pzm_177",Z9="_sessionEnv_16pzm_186",Y9="_sessionRuntime_16pzm_192",J9="_sessionStatus_16pzm_198",W9="_statusDot_16pzm_207",X9="_attentionRow_16pzm_233",Q9="_attentionTitle_16pzm_259",eH="_attentionMeta_16pzm_267",tH="_reasonBadge_16pzm_274",nH="_bottomGrid_16pzm_301",sH="_envRow_16pzm_312",aH="_envName_16pzm_323",iH="_envStatusBadge_16pzm_333",oH="_workspaceRow_16pzm_369",rH="_workspaceTop_16pzm_395",lH="_workspaceName_16pzm_401",cH="_workspaceCounts_16pzm_407",dH="_progressBar_16pzm_415",uH="_progressFill_16pzm_422",he={dashboard:R9,kpiStrip:I9,kpiCard:O9,kpiValue:B9,kpiLabel:L9,bodyGrid:z9,section:$9,sectionHeader:H9,sectionIcon:P9,sectionTitle:U9,sectionCount:V9,sectionBody:q9,emptyHint:G9,sessionRow:F9,sessionPrompt:K9,sessionEnv:Z9,sessionRuntime:Y9,sessionStatus:J9,statusDot:W9,attentionRow:X9,attentionTitle:Q9,attentionMeta:eH,reasonBadge:tH,bottomGrid:nH,envRow:sH,envName:aH,envStatusBadge:iH,workspaceRow:oH,workspaceTop:rH,workspaceName:lH,workspaceCounts:cH,progressBar:dH,progressFill:uH};function fH(){return i.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[i.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:he.kpiCard,children:[i.jsx(Te,{width:"3rem",height:"2rem"}),i.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),i.jsxs("div",{className:he.bodyGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>i.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"}),i.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"70%",height:"0.875rem"})]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"9rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.envRow,children:[i.jsx(Te,{width:"60%",height:"0.875rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),i.jsxs("div",{className:he.section,children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),i.jsx(Te,{width:"6rem",height:"0.75rem"}),i.jsx("span",{className:he.sectionCount,children:i.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),i.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>i.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx(Te,{width:"50%",height:"0.875rem"}),i.jsx(Te,{width:"2rem",height:"0.75rem"})]}),i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const pH={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Fc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function mH(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 Kc({value:t,label:s,accent:o,index:r,testId:c}){return i.jsxs(Ht.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:pH,initial:"hidden",animate:"visible",custom:r,children:[i.jsx("span",{className:he.kpiValue,children:t}),i.jsx("span",{className:he.kpiLabel,children:s})]})}function hH(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=pt(),g=_t(),v=y.useRef(new Set);y.useEffect(()=>{for(const T of t)v.current.has(T.id)||(v.current.add(T.id),c(T.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>A$(d,o,p),[d,o,p]),_=y.useMemo(()=>M$(d,p),[d,p]),k=y.useMemo(()=>D$(o,t),[o,t]),S=y.useMemo(()=>R$(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?i.jsx(fH,{}):i.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[i.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[i.jsx(Kc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),i.jsx(Kc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),i.jsx(Kc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),i.jsx(Kc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),i.jsxs("div",{className:he.bodyGrid,children:[i.jsxs(Ht.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),i.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),i.jsx("span",{className:he.sectionCount,children:_.length})]}),i.jsx("div",{className:he.sectionBody,children:_.length===0?i.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:T,environmentName:w})=>i.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(Sm(T.id)),"data-testid":"session-row",children:[i.jsx("span",{className:he.sessionPrompt,title:T.prompt,children:T.prompt||"—"}),i.jsx("span",{className:he.sessionEnv,children:w}),i.jsx("span",{className:he.sessionRuntime,children:T.runtime}),i.jsxs("span",{className:he.sessionStatus,children:[i.jsx("span",{className:he.statusDot,"data-status":T.status}),T.status]})]},T.id))})]}),i.jsxs(Ht.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),i.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),i.jsx("span",{className:he.sectionCount,children:k.length})]}),i.jsx("div",{className:he.sectionBody,children:k.length===0?i.jsx("div",{className:he.emptyHint,children:"All clear"}):k.map(({task:T,reason:w,workspaceName:C})=>i.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(os(T.id)),"data-testid":"attention-row",children:[i.jsxs("div",{className:he.attentionTitle,children:[i.jsx("span",{className:he.reasonBadge,"data-reason":w,children:w}),T.title]}),i.jsx("div",{className:he.attentionMeta,children:i.jsx("span",{children:C})})]},T.id))})]})]}),i.jsxs("div",{className:he.bottomGrid,children:[i.jsxs(Ht.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),i.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),i.jsx("span",{className:he.sectionCount,children:p.length})]}),i.jsx("div",{className:he.sectionBody,children:p.length===0?i.jsx("div",{className:he.emptyHint,children:"No environments configured"}):p.map(T=>i.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[i.jsx("span",{className:he.envName,children:T.displayName}),i.jsx("span",{className:he.envStatusBadge,"data-status":T.status,children:T.status})]},T.id))})]}),i.jsxs(Ht.div,{className:he.section,variants:Fc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[i.jsxs("div",{className:he.sectionHeader,children:[i.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),i.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),i.jsx("span",{className:he.sectionCount,children:t.length})]}),i.jsx("div",{className:he.sectionBody,children:S.length===0?i.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:T,totalTasks:w,completedTasks:C,workingTasks:D,failedTasks:A})=>{const E=w>0?Math.round(C/w*100):0;return i.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(Ti(T.id,T.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[i.jsxs("div",{className:he.workspaceTop,children:[i.jsx("span",{className:he.workspaceName,children:T.name}),i.jsxs("span",{className:he.workspaceCounts,"aria-label":mH(C,w,D,A),children:[C,"/",w,D>0&&i.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),A>0&&i.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",A]})]})]}),w>0&&i.jsx("div",{className:he.progressBar,children:i.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},T.id)})})]})]})]})}const gH="_panelContainer_1udy7_1",vH="_emptyState_1udy7_8",yH="_workspaceSummary_1udy7_17",bH="_workspaceSummaryTitle_1udy7_28",_H="_workspaceSummarySubtitle_1udy7_32",xH="_header_1udy7_36",kH="_headerInfo_1udy7_71",SH="_headerTitle_1udy7_106",jH="_taskStatusBadge_1udy7_128",TH="_taskBranch_1udy7_137",wH="_taskBlockedBadge_1udy7_143",NH="_tabBar_1udy7_277",CH="_tab_1udy7_277",EH="_active_1udy7_303",AH="_eventScroll_1udy7_308",DH="_overviewContent_1udy7_325",MH="_overviewDashboard_1udy7_334",RH="_overviewHero_1udy7_340",IH="_overviewSection_1udy7_347",OH="_overviewLabel_1udy7_353",BH="_envRow_1udy7_360",LH="_timeline_1udy7_366",zH="_timelineRow_1udy7_372",$H="_waitingMessage_1udy7_379",HH="_errorMessage_1udy7_383",PH="_emptyCta_1udy7_387",UH="_ctaTitle_1udy7_399",VH="_ctaDescription_1udy7_405",qH="_ctaButton_1udy7_412",GH="_workspaceHeader_1udy7_533",FH="_workspaceName_1udy7_558",KH="_workspaceMeta_1udy7_571",ZH="_metaRow_1udy7_579",YH="_metaLabel_1udy7_592",JH="_metaValue_1udy7_607",WH="_archiveButton_1udy7_617",XH="_repoLink_1udy7_647",QH="_metaToggle_1udy7_657",eP="_metaToggleArrow_1udy7_678",tP="_metaToggleArrowOpen_1udy7_683",nP="_progressBarContainer_1udy7_687",sP="_progressBar_1udy7_687",aP="_progressFill_1udy7_703",iP="_progressLabel_1udy7_710",oP="_metaTimestamps_1udy7_717",rP="_metaTimestamp_1udy7_717",lP="_metaPlaceholder_1udy7_739",cP="_linkedEnvList_1udy7_744",dP="_linkedEnvChip_1udy7_750",uP="_chipDismiss_1udy7_762",fP="_linkError_1udy7_777",pP="_linkEnvSelect_1udy7_782",W={panelContainer:gH,emptyState:vH,workspaceSummary:yH,workspaceSummaryTitle:bH,workspaceSummarySubtitle:_H,header:xH,headerInfo:kH,headerTitle:SH,taskStatusBadge:jH,taskBranch:TH,taskBlockedBadge:wH,tabBar:NH,tab:CH,active:EH,eventScroll:AH,overviewContent:DH,overviewDashboard:MH,overviewHero:RH,overviewSection:IH,overviewLabel:OH,envRow:BH,timeline:LH,timelineRow:zH,waitingMessage:$H,errorMessage:HH,emptyCta:PH,ctaTitle:UH,ctaDescription:VH,ctaButton:qH,workspaceHeader:GH,workspaceName:FH,workspaceMeta:KH,metaRow:ZH,metaLabel:YH,metaValue:JH,archiveButton:WH,repoLink:XH,metaToggle:QH,metaToggleArrow:eP,metaToggleArrowOpen:tP,progressBarContainer:nP,progressBar:sP,progressFill:aP,progressLabel:iP,metaTimestamps:oP,metaTimestamp:rP,metaPlaceholder:lP,linkedEnvList:cP,linkedEnvChip:dP,chipDismiss:uP,linkError:fP,linkEnvSelect:pP};function mP(){return i.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function hP(){return i.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function gP(){const{workspaces:{workspaces:t},environments:{environments:s}}=pt(),o=_t(),r=s.length>0;return t.length>0?i.jsx(hH,{}):i.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[i.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),i.jsx("button",{className:W.ctaButton,onClick:()=>o(Y_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&i.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const vP="_panelContainer_1rih4_1",yP="_chatHeader_1rih4_9",bP="_chatHeaderInfo_1rih4_38",_P="_chatHeaderActions_1rih4_44",xP="_emptyState_1rih4_64",kP="_emptyTitle_1rih4_76",SP="_emptyDescription_1rih4_82",jP="_emptyHint_1rih4_88",ia={panelContainer:vP,chatHeader:yP,chatHeaderInfo:bP,chatHeaderActions:_P,emptyState:xP,emptyTitle:kP,emptyDescription:SP,emptyHint:jP};function c_(){return i.jsx("div",{className:ia.panelContainer,"aria-hidden":"true",children:i.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function TP({hasLocalEnvironment:t}){return i.jsxs("div",{className:ia.emptyState,"data-testid":"chat-empty-state",children:[i.jsx("div",{className:ia.emptyTitle,children:"Welcome to Grackle"}),i.jsx("div",{className:ia.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&i.jsx("div",{className:ia.emptyHint,children:"Go to Settings → Environments to add one."})]})}function wP(){const t=dh(),{tasks:{tasks:s,tasksLoading:o,startTask:r},sessions:{sessions:c,sessionsLoading:d,events:u,eventsDropped:p,taskSessions:m,loadTaskSessions:g,loadSessionEvents:v,kill:b,stopGraceful:_,sendInput:k,spawn:S},environments:{environments:j,provisionEnvironment:T},personas:{personas:w}}=pt(),{showToast:C}=fn(),D=y.useRef(void 0),[A,E]=y.useState(),R=s.find(le=>le.id===Ec),O=R!=null&&R.latestSessionId?c.find(le=>le.id===R.latestSessionId)??(m[Ec]??[]).find(le=>le.id===R.latestSessionId):void 0;y.useEffect(()=>{g(Ec).catch(()=>{})},[R==null?void 0:R.latestSessionId,g]),y.useEffect(()=>{O&&O.id!==D.current&&(D.current=O.id,v(O.id).catch(()=>{}))},[O==null?void 0:O.id,v]);const M=y.useMemo(()=>{if(!O)return[];const le=u.filter(Z=>Z.sessionId===O.id);return ch(lh(le))},[u,O==null?void 0:O.id]),$=j.find(le=>le.adapterType==="local"&&le.status==="connected"),Y=O!==void 0&&O.status!=="stopped"&&O.status!=="suspended",V=(O==null?void 0:O.status)==="idle";y.useEffect(()=>{A&&O&&V&&(k(O.id,A).catch(()=>{C("Failed to send message","error")}),E(void 0))},[A,V,O==null?void 0:O.id,k,C]);const ne=y.useCallback((le,Z,se,H)=>{H&&E(H),r(le,Z,se).catch(()=>{})},[r]);return!R&&(d||o)?i.jsx(c_,{}):R!=null&&R.latestSessionId&&!O?i.jsx(c_,{}):i.jsxs("div",{className:ia.panelContainer,"data-testid":"chat-page",children:[Y&&i.jsxs("div",{className:ia.chatHeader,children:[i.jsxs("span",{className:ia.chatHeaderInfo,children:["Session: ",O.id.slice(0,8)," | ",O.runtime," | ",O.status]}),i.jsx("div",{className:ia.chatHeaderActions,children:i.jsx(W_,{label:"Stop",onClick:()=>{_(O.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{_(O.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{b(O.id).catch(()=>{})}}]})})]}),i.jsx(ih,{events:M,eventsDropped:p,sandboxProxyUrl:t,emptyState:i.jsx(TP,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&i.jsx(vd,{mode:Y?"send":"start",sessionId:Y?O.id:void 0,taskId:Ec,environmentId:Y?O.environmentId:$.id,personas:w,environments:j,onSendInput:(le,Z)=>{k(le,Z).catch(()=>{C("Failed to send message","error")})},onSpawn:(le,Z,se)=>{S(le,Z,se).catch(()=>{})},onStartTask:ne,onProvisionEnvironment:le=>{T(le).catch(()=>{})},onShowToast:C})]})}const NP="_container_1jtgv_1",CP={container:NP};function EP(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c,liveMessages:d,loadTranscript:u},sessions:{sessions:p},tasks:{tasks:m}}=pt(),[g,v]=y.useState(!1),[b,_]=y.useState(void 0),[k,S]=y.useState(!1);y.useEffect(()=>{if(b===void 0){S(!1);return}let C=!0;return S(!0),u(b).then(()=>{C&&S(!1)}).catch(()=>{C&&S(!1)}),()=>{C=!1}},[b,u]);const j=y.useRef(!1);y.useEffect(()=>{if(!j.current){j.current=!0;return}c(g).catch(()=>{})},[g,c]);const T=y.useCallback(()=>{c(g).catch(()=>{})},[c,g]),w=b!==void 0?t.find(C=>C.id===b):void 0;return i.jsxs("div",{className:CP.container,"data-testid":"coordination-page",children:[i.jsx($7,{streams:t,sessions:p,tasks:m,loading:s,loadError:r,loadedOnce:o,showInternals:g,onToggleInternals:v,selectedStreamId:b,onSelectStream:_,onRefresh:T}),w&&i.jsx(jz,{stream:w,messages:d[w.id]??[],transcriptLoading:k,onClose:()=>_(void 0)})]})}function AP(){const t=T$(),[s]=km(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=pt(),{showToast:g}=fn();return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(pa,{segments:t}),i.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),i.jsx(vd,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{g("Failed to send message","error")})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function DP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsxs("div",{className:W.header,children:[i.jsx("span",{children:i.jsx(Te,{width:"10rem",height:"0.875rem"})}),i.jsx("span",{className:W.headerInfo,children:i.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),i.jsx("div",{className:W.eventScroll,children:i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[i.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function MP({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return i.jsxs("div",{className:W.header,children:[i.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Bo((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Ds(s.costMillicents??0)}`:""]}),i.jsxs("span",{className:W.headerInfo,children:[s&&i.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&i.jsx(W_,{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 RP({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return i.jsx("div",{className:s?W.errorMessage:W.waitingMessage,children:o})}function IP(){const{sessionId:t}=fa(),s=dh(),{sessions:{events:o,eventsDropped:r,sessions:c,sessionsLoading:d,kill:u,stopGraceful:p,loadSessionEvents:m,sendInput:g,spawn:v},tasks:{startTask:b},personas:{personas:_},environments:{environments:k,provisionEnvironment:S}}=pt(),{showToast:j}=fn(),T=y.useRef(void 0),w=w$(t),C=c.find(E=>E.id===t)??void 0,D=y.useMemo(()=>{const E=t?o.filter(R=>R.sessionId===t):[];return ch(lh(E))},[o,t]);if(y.useEffect(()=>{t&&t!==T.current&&(T.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return i.jsx(DP,{});if(!t)return i.jsx("div",{className:W.emptyState,children:"No session selected"});const A=(C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="idle";return i.jsxs("div",{className:W.panelContainer,children:[i.jsx(pa,{segments:w}),i.jsx(MP,{sessionId:t,session:C,isActive:A,onStop:()=>{p(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),i.jsx(ih,{events:D,eventsDropped:r,emptyState:i.jsx(RP,{session:C}),onShowToast:j,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:k,personas:_,onForward:(E,R)=>g(E,R)}),A&&i.jsx(vd,{mode:"send",sessionId:t,environmentId:C.environmentId,personas:_,environments:k,onSendInput:(E,R)=>{g(E,R).catch(()=>{j("Failed to send message","error")})},onSpawn:(E,R,O)=>{v(E,R,O).catch(()=>{})},onStartTask:(E,R,O)=>{b(E,R,O).catch(()=>{})},onProvisionEnvironment:E=>{S(E).catch(()=>{})},onShowToast:j})]})}function OP(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Fa(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&OP(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function BP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.workspaceHeader,children:i.jsx("span",{className:W.workspaceName,children:i.jsx(Te,{width:"12rem",height:"1.25rem"})})}),i.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:i.jsx(Te,{width:"4rem",height:"0.625rem"})}),i.jsxs("div",{className:W.progressBarContainer,children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),i.jsx(Te,{width:"2rem",height:"0.625rem"})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),i.jsx("span",{className:W.tab,children:"Board"}),i.jsx("span",{className:W.tab,children:"Tasks"})]}),i.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>i.jsx(nm,{lines:2},s))})]})}function d_(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 Dp=100;function LP(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function zP(){const{workspaceId:t,environmentId:s}=fa(),o=_t(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:_},personas:{personas:k},sessions:{sessions:S},usageCache:j,loadUsage:T}=pt(),{resolvedThemeId:w}=J1(),[C,D]=y.useState("tasks"),[A,E]=y.useState(!1),[R,O]=y.useState(null),[M,$]=y.useState(!1),Y=y.useRef(void 0),V=d.find(ee=>ee.id===t),ne=s??(V==null?void 0:V.linkedEnvironmentIds[0])??"",le=N$(t,ne,d,c);Fa({key:"1"},()=>D("graph")),Fa({key:"2"},()=>D("board")),Fa({key:"3"},()=>D("tasks")),y.useEffect(()=>{const ee=Y.current;Y.current=t,!(ee===void 0||ee===t)&&R!==null&&O(null)},[t,R]);const Z=S.reduce((ee,ce)=>ee+(ce.costMillicents??0),0);y.useEffect(()=>{t&&T("workspace",t).catch(()=>{})},[t,T,Z]);const se=t?j[`workspace:${t}`]:void 0,H=r.filter(ee=>ee.workspaceId===t),B=H.filter(ee=>ee.status==="complete").length,F=H.length,ge=F>0?Math.round(B/F*100):0;return!V&&u?i.jsx(BP,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(pa,{segments:le}),i.jsxs("div",{className:W.workspaceHeader,children:[i.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:i.jsx(Lt,{value:(V==null?void 0:V.name)||"",onSave:ee=>{V&&m(V.id,{name:ee}).catch(()=>{})},validate:ee=>{const ce=ee.trim();if(!ce)return"Name is required";if(ce.length>Dp)return`Max ${Dp} characters`},maxLength:Dp,fieldId:"name",activeFieldId:R,onActivate:O,ariaLabel:"Workspace name",renderDisplay:ee=>ee||t||void 0,"data-testid":"edit-name"})}),i.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),i.jsxs("button",{className:W.metaToggle,onClick:()=>$(!M),"aria-expanded":!M,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[i.jsx("span",{className:`${W.metaToggleArrow} ${M?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!M&&i.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Description"}),i.jsx("div",{className:W.metaValue,children:i.jsx(sm,{value:(V==null?void 0:V.description)||"",onSave:ee=>{V&&m(V.id,{description:ee}).catch(()=>{})},fieldId:"description",activeFieldId:R,onActivate:O,renderDisplay:ee=>ee?i.jsx("span",{className:W.overviewMarkdown,children:i.jsx(um,{remarkPlugins:[fm],children:ee})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Repository"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Lt,{value:(V==null?void 0:V.repoUrl)||"",onSave:ee=>{V&&m(V.id,{repoUrl:ee}).catch(()=>{})},validate:ee=>{const ce=ee.trim();if(ce&&!/^https?:\/\/.+/.test(ce))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:R,onActivate:O,renderDisplay:ee=>{const ce=LP(ee);return ce?i.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:ee}):ee?i.jsx("span",{children:ee}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Environments"}),i.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:V?i.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const ee=[...new Set(V.linkedEnvironmentIds)];return ee.length===0?i.jsx("span",{className:W.metaPlaceholder,children:"None"}):ee.map(ce=>{const me=c.find(xe=>xe.id===ce);return i.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,i.jsx("button",{className:W.chipDismiss,onClick:()=>{v(V.id,ce).catch(()=>{})},title:`Unlink ${(me==null?void 0:me.displayName)||ce}`,"aria-label":`Unlink ${(me==null?void 0:me.displayName)||ce}`,"data-testid":`unlink-env-${ce}`,disabled:ee.length<=1,children:"x"})]},ce)})})(),(()=>{const ee=new Set(V.linkedEnvironmentIds),ce=c.filter(me=>!ee.has(me.id));return ce.length===0?null:i.jsxs("select",{className:W.linkEnvSelect,value:"",onChange:me=>{me.target.value&&g(V.id,me.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[i.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>i.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&i.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,i.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):i.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Persona"}),i.jsx("div",{className:W.metaValue,children:i.jsx(pd,{value:(V==null?void 0:V.defaultPersonaId)||"",onSave:ee=>{V&&m(V.id,{defaultPersonaId:ee}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...k.map(ee=>({value:ee.id,label:ee.name}))],fieldId:"defaultPersonaId",activeFieldId:R,onActivate:O,renderDisplay:ee=>{const ce=k.find(me=>me.id===ee);if(ce)return i.jsx("span",{children:ce.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Worktrees"}),i.jsx("div",{className:W.metaValue,children:i.jsx(M5,{checked:(V==null?void 0:V.useWorktrees)??!0,onChange:ee=>{V&&m(V.id,{useWorktrees:ee}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),i.jsxs("div",{className:W.metaRow,children:[i.jsx("span",{className:W.metaLabel,children:"Working Dir"}),i.jsx("div",{className:W.metaValue,children:i.jsx(Lt,{value:(V==null?void 0:V.workingDirectory)||"",onSave:ee=>{V&&m(V.id,{workingDirectory:ee}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:R,onActivate:O,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),V&&i.jsxs("div",{className:W.metaTimestamps,children:[i.jsxs("span",{className:W.metaTimestamp,children:["Created ",d_(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&i.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",d_(V.updatedAt)]})]})]}),F>0&&i.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[i.jsx("div",{className:W.progressBar,children:i.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),i.jsxs("span",{className:W.progressLabel,children:[B,"/",F]})]}),se&&se.costMillicents>0&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Usage: ",Ds(se.costMillicents)," (",se.sessionCount," session",se.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&i.jsx("div",{className:W.progressBarContainer,children:i.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&i.jsxs(i.Fragment,{children:["Tokens: ",Bo(((se==null?void 0:se.inputTokens)??0)+((se==null?void 0:se.outputTokens)??0))," / ",Bo(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&i.jsxs(i.Fragment,{children:["Cost: ",Ds((se==null?void 0:se.costMillicents)??0)," / ",Ds(V.costBudgetMillicents)]})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[i.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>D("graph"),children:"Graph"}),i.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),i.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&F>0&&i.jsxs("div",{className:W.workspaceSummary,children:[i.jsx("span",{className:W.workspaceSummaryTitle,children:`${B}/${F} tasks complete`}),i.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&F===0&&i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{className:W.ctaButton,onClick:()=>o(Di(t,void 0,ne)),children:"Create Task"}),i.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&i.jsx(Jz,{workspaceId:t,environmentId:ne,tasks:r,sessions:S,personas:k,environments:c}),C==="graph"&&i.jsx(YN,{workspaceId:t,environmentId:ne,tasks:r,resolvedThemeId:w}),i.jsx(ys,{isOpen:A,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{V&&(p(V.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const $P="_container_3pgew_1",HP="_header_3pgew_8",PP="_headerTitle_3pgew_35",UP="_headerActions_3pgew_44",VP="_body_3pgew_51",qP="_btnPrimary_3pgew_63",GP="_btnGhost_3pgew_94",FP="_error_3pgew_116",qa={container:$P,header:HP,headerTitle:PP,headerActions:UP,body:VP,btnPrimary:qP,btnGhost:GP,error:FP};function KP(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 ZP=[{label:"Home",url:Uo},{label:"New Workspace",url:void 0}];function YP(){const[t]=km(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=pt(),{showToast:u}=fn(),p=_t(),[m,g]=y.useState(()=>{var T;return r$(void 0,s||((T=o[0])==null?void 0:T.id))}),[v,b]=y.useState(),[_,k]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(T=>{var w;return T.environmentId?T:{...T,environmentId:((w=o[0])==null?void 0:w.id)??""}})},[o,s,m.environmentId]);const S=()=>{const T=KP(m);if(T){b(T),k(void 0);return}b(void 0),k(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,w=>{u("Workspace created","success"),p(Ti(w.id,w.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},w=>{k(w)}).catch(()=>{})},j=()=>{p(s?Oo(s):Uo,{replace:!0})};return i.jsxs("div",{className:qa.container,children:[i.jsxs("div",{className:qa.header,children:[i.jsx("div",{className:qa.headerTitle,children:i.jsx(pa,{segments:ZP})}),i.jsxs("div",{className:qa.headerActions,children:[i.jsx("button",{className:qa.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),i.jsx("button",{className:qa.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?i.jsx(C1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),i.jsxs("div",{className:qa.body,children:[i.jsx(c$,{values:m,onChange:T=>{g(T),b(void 0),k(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&i.jsx("div",{className:qa.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function u_(){const{workspaceId:t,environmentId:s}=fa(),[o]=km(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=pt(),{showToast:v}=fn();return i.jsx(P1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,k,S,j,T,w,C,D,A)=>{u(b,_,k,S,j,T,w,C,D,A).catch(()=>{})},onUpdateTask:(b,_,k,S,j)=>{p(b,_,k,S,j).catch(()=>{})},onShowToast:v})}function JP(){return i.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[i.jsx("div",{className:W.header,children:i.jsxs("span",{className:W.headerTitle,children:[i.jsx(Te,{width:"12rem",height:"1rem"}),i.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),i.jsx("span",{className:W.tab,children:"Stream"})]}),i.jsx("div",{className:W.overviewContent,children:i.jsxs("div",{className:W.overviewDashboard,children:[i.jsx("div",{className:W.overviewHero,children:i.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Description"}),i.jsx(tm,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Environment"}),i.jsxs("div",{className:W.envRow,children:[i.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),i.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),i.jsx(tm,{lines:2})]}),i.jsxs("div",{className:W.overviewSection,children:[i.jsx("div",{className:W.overviewLabel,children:"Timeline"}),i.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>i.jsxs("div",{className:W.timelineRow,children:[i.jsx(Te,{width:"4rem",height:"0.75rem"}),i.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function No(){const{taskId:t,workspaceId:s,environmentId:o}=fa(),r=dh(),c=Jt(),d=_t(),{showToast:u}=fn(),{sessions:{events:p,eventsDropped:m,sessions:g,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:k,spawn:S,kill:j},tasks:{tasks:T,tasksLoading:w,startTask:C,stopTask:D,resumeTask:A,deleteTask:E,createTask:R,updateTask:O},environments:{environments:M,provisionEnvironment:$},workspaces:{workspaces:Y},personas:{personas:V},usageCache:ne,loadUsage:le}=pt(),Z=y.useRef(void 0),se=y.useRef(void 0),H=y.useRef(void 0),B=y.useRef(void 0),F=y.useRef(void 0),ge=c.pathname.endsWith("/stream")?"stream":"overview",ee=c.pathname.endsWith("/edit"),[ce,me]=y.useState(ge),[xe,De]=y.useState(!1),[ot,yt]=y.useState(void 0),[lt,Pe]=y.useState(""),[ke,ct]=y.useState(ee),ue=y.useRef(ge),Re=y.useRef(ee),Q=T.find(Ne=>Ne.id===t),nt=(Q==null?void 0:Q.workspaceId)||void 0,re=Y.find(Ne=>Ne.id===nt);y.useEffect(()=>{ge!==ue.current&&(ue.current=ge,ge!==ce&&me(ge))},[ge,ce]),y.useEffect(()=>{ee!==Re.current&&(Re.current=ee,ee!==ke&&ct(ee))},[ee,ke]),y.useEffect(()=>{if(lt===""){if(re!=null&&re.linkedEnvironmentIds[0])Pe(re.linkedEnvironmentIds[0]);else if(M.length>0){const Ne=M.find(Ve=>Ve.status==="connected");Pe((Ne==null?void 0:Ne.id)??M[0].id)}}},[lt,re==null?void 0:re.linkedEnvironmentIds[0],M]);const ve=Q?b[Q.id]??[]:[];let et;ot&&ve.some(Ne=>Ne.id===ot)?et=ot:et=(Q==null?void 0:Q.latestSessionId)||void 0;const sn=()=>{De(!0)},_s=()=>{if(!Q)return;E(Q.id).catch(()=>{}),De(!1);const Ne=o??(re==null?void 0:re.linkedEnvironmentIds[0]);d(Q.workspaceId&&Ne?Ti(Q.workspaceId,Ne):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==se.current&&(se.current=Q==null?void 0:Q.id,yt(void 0),Pe(""),ct(ee))},[Q==null?void 0:Q.id,ee]),y.useEffect(()=>{if(!(Q!=null&&Q.id))return;const Ne=Q.id!==B.current,Ve=Q.latestSessionId!==F.current;(Ne||Ve)&&(B.current=Q.id,F.current=Q.latestSessionId,_(Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.latestSessionId,_]),y.useEffect(()=>{if((Q==null?void 0:Q.status)!==H.current){const Ne=H.current===void 0;H.current=Q==null?void 0:Q.status;const Ve=(Q==null?void 0:Q.status)==="not_started"?"overview":(Q==null?void 0:Q.status)==="working"||(Q==null?void 0:Q.status)==="paused"?"stream":(Q==null?void 0:Q.status)==="complete"?"overview":void 0;Ve&&Ve!==ce&&!(Ne&&ge!=="overview")&&me(Ve)}},[Q==null?void 0:Q.status,ce,ge]);const ls=y.useMemo(()=>new Map(T.map(Ne=>[Ne.id,Ne])),[T]),Bs=y.useMemo(()=>{const Ne=et?p.filter(Ve=>Ve.sessionId===et):[];return ch(lh(Ne))},[p,et]),ma=Q?Q.dependsOn.some(Ne=>{const Ve=ls.get(Ne);return Ve!==void 0&&Ve.status!=="complete"}):!1,Ri=y.useMemo(()=>C$(t,o,Y,M,ls),[t,o,Y,M,ls]);y.useEffect(()=>{et&&et!==Z.current&&(Z.current=et,v(et).catch(()=>{}))},[et,v]);const Wt=ve.reduce((Ne,Ve)=>Ne+(Ve.costMillicents??0),0);y.useEffect(()=>{Q&&(le("task",Q.id).catch(()=>{}),Q.childTaskIds.length>0&&le("task_tree",Q.id).catch(()=>{}))},[Q==null?void 0:Q.id,Q==null?void 0:Q.childTaskIds.length,le,Wt]);const Wa=Q?`task:${Q.id}`:"",Xa=Wa in ne?ne[Wa]:void 0,ha=Q?`task_tree:${Q.id}`:"",Ls=Q&&Q.childTaskIds.length>0&&ha in ne?ne[ha]:void 0,xs=Ne=>{me(Ne),d(os(t,Ne==="overview"?void 0:Ne,s,o))};return Fa({key:"1"},()=>xs("overview")),Fa({key:"2"},()=>xs("stream")),!Q&&w?i.jsx(JP,{}):i.jsxs("div",{className:W.panelContainer,children:[i.jsx(pa,{segments:Ri}),i.jsxs("div",{className:W.header,children:[i.jsxs("span",{className:W.headerTitle,children:[i.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&i.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&i.jsx("span",{className:W.taskBranch,children:Q.branch}),ma&&i.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),Q&&i.jsx(sL,{task:Q,sessionId:et,isBlocked:ma,onStart:()=>{C(Q.id,void 0,lt).catch(Ne=>{const Ve=Ne instanceof la?Ne.message:"Failed to start task";u(Ve,"error")})},onResume:()=>{A(Q.id).catch(()=>{})},onStop:()=>{D(Q.id).catch(()=>{})},onPause:()=>{et&&j(et).catch(()=>{})},onDelete:sn,onEdit:()=>ct(!0)})]}),i.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[i.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>xs("overview"),children:"Overview"}),i.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>xs("stream"),children:"Stream"})]}),i.jsxs(as,{mode:"wait",children:[ce==="overview"&&i.jsx(Ht.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:W.overviewContent,"data-testid":"task-overview",children:ke&&Q?i.jsx(P1,{mode:"edit",taskId:Q.id,workspaceId:nt,environmentId:o,tasks:T,workspaces:Y,personas:V,onCreateTask:(Ne,Ve,bn,pn,Pt,Nn,Xt,Ii,Oi,Bi)=>{R(Ne,Ve,bn,pn,Pt,Nn,Xt,Ii,Oi,Bi).catch(()=>{})},onUpdateTask:(Ne,Ve,bn,pn,Pt)=>{O(Ne,Ve,bn,pn,Pt).catch(()=>{})},onEditDone:()=>{ee?d(os(Q.id,void 0,s,o),{replace:!0}):ct(!1)},onShowToast:u}):Q?i.jsx(qL,{task:Q,tasksById:ls,environments:M,workspaces:Y,taskSessions:ve,selectedEnvId:lt,taskUsage:Xa,treeUsage:Ls}):i.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&i.jsxs(Ht.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[i.jsx(u6,{taskSessions:ve,selectedSessionId:et,onSelect:Ne=>yt(Ne)}),i.jsx(ih,{events:Bs,eventsDropped:m,sandboxProxyUrl:r,emptyState:!et&&Q?ma?i.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:i.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):i.jsxs("div",{className:W.emptyCta,children:[i.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(Q.id,void 0,lt).catch(Ne=>{const Ve=Ne instanceof la?Ne.message:"Failed to start task";u(Ve,"error")})},children:"Start Task"}),i.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):et&&Bs.length===0?i.jsx("div",{className:W.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream")]}),(()=>{if(!Q||Q.status!=="working"&&Q.status!=="paused")return;const Ne=et?g.find(Ve=>Ve.id===et):void 0;if(!(!Ne||Ne.status==="stopped"))return i.jsx(vd,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:V,environments:M,onSendInput:(Ve,bn)=>{k(Ve,bn).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ve,bn,pn)=>{S(Ve,bn,pn,void 0,nt).catch(()=>{})},onStartTask:(Ve,bn,pn)=>{C(Ve,bn,pn).catch(()=>{})},onProvisionEnvironment:Ve=>{$(Ve).catch(()=>{})},onShowToast:u})})(),Q&&i.jsx(ys,{isOpen:xe,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:_s,onCancel:()=>De(!1)})]})}function WP(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m},dockerContainers:{dockerContainers:g,dockerContainersError:v,listDockerContainers:b},githubAccounts:{githubAccounts:_}}=pt(),{showToast:k}=fn();return i.jsx(U1,{mode:"new",environments:t,githubAccounts:_,onAddEnvironment:(S,j,T,w)=>{s(S,j,T,w).catch(()=>{})},onUpdateEnvironment:(S,j)=>{o(S,j).catch(()=>{})},onListCodespaces:S=>{p(S).catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(S,j)=>{m(S,j).catch(()=>{})},onListDockerContainers:()=>{b().catch(()=>{})},dockerContainers:g,dockerContainersError:v,onShowToast:k})}function XP(){const{environmentId:t}=fa(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g},dockerContainers:{dockerContainers:v,dockerContainersError:b,listDockerContainers:_},githubAccounts:{githubAccounts:k}}=pt(),{showToast:S}=fn();return i.jsx(U1,{mode:"edit",environmentId:t,environments:s,githubAccounts:k,onAddEnvironment:(j,T,w,C)=>{o(j,T,w,C).catch(()=>{})},onUpdateEnvironment:(j,T)=>{r(j,T).catch(()=>{})},onListCodespaces:j=>{m(j).catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(j,T)=>{g(j,T).catch(()=>{})},onListDockerContainers:()=>{_().catch(()=>{})},dockerContainers:v,dockerContainersError:b,onShowToast:S})}const QP="_layout_11u79_1",eU="_content_11u79_8",tU="_tabPanel_11u79_14",Qr={layout:QP,content:eU,tabPanel:tU};function nU(){const t=j$();return i.jsxs("div",{className:Qr.layout,children:[i.jsx(pa,{segments:t}),i.jsx("div",{className:Qr.content,children:i.jsx(Ai,{})})]})}const sU="_container_144a4_1",aU="_envHeader_144a4_6",iU="_envTitleRow_144a4_10",oU="_statusDot_144a4_16",rU="_envName_144a4_21",lU="_statusBadge_144a4_27",cU="_envMeta_144a4_33",dU="_metaTag_144a4_39",uU="_actions_144a4_51",fU="_provisionMessage_144a4_59",pU="_errorMessage_144a4_64",mU="_section_144a4_69",hU="_sectionHeader_144a4_73",gU="_cardList_144a4_121",vU="_card_144a4_121",yU="_cardHeader_144a4_138",bU="_cardName_144a4_144",_U="_cardActions_144a4_149",xU="_cardDescription_144a4_154",kU="_cardMeta_144a4_160",SU="_repoLink_144a4_166",jU="_empty_144a4_174",TU="_errorHint_144a4_180",wU="_btnPrimary_144a4_186",NU="_btnOutline_144a4_220",CU="_btnSmall_144a4_247",EU="_btnDanger_144a4_273",Me={container:sU,envHeader:aU,envTitleRow:iU,statusDot:oU,envName:rU,statusBadge:lU,envMeta:cU,metaTag:dU,actions:uU,provisionMessage:fU,errorMessage:pU,section:mU,sectionHeader:hU,cardList:gU,card:vU,cardHeader:yU,cardName:bU,cardActions:_U,cardDescription:xU,cardMeta:kU,repoLink:SU,empty:jU,errorHint:TU,btnPrimary:wU,btnOutline:NU,btnSmall:CU,btnDanger:EU};function AU(){return i.jsxs("div",{className:Me.container,"aria-hidden":"true",children:[i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),i.jsx(Te,{width:"12rem",height:"1.5rem"}),i.jsx(Te,{width:"4rem",height:"0.875rem"})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),i.jsxs("div",{className:Me.actions,children:[i.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),i.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),i.jsxs("div",{className:Me.section,children:[i.jsx("div",{className:Me.sectionHeader,children:i.jsx("h3",{style:{margin:0},children:"Workspaces"})}),i.jsxs("div",{className:Me.cardList,children:[i.jsx(nm,{lines:2}),i.jsx(nm,{lines:2})]})]})]})}const DU={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function MU(){const{environmentId:t}=fa(),s=_t(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:_,clearLinkOperationError:k},sessions:{sessions:S}}=pt(),[j,T]=y.useState(!1),[w,C]=y.useState(!1),[D,A]=y.useState(void 0),E=o.find(B=>B.id===t);if(!E&&r)return i.jsx(AU,{});if(!t||!E)return i.jsx(zn,{to:Io,replace:!0});const R=m.filter(B=>B.linkedEnvironmentIds.includes(E.id)),O=S.filter(B=>B.environmentId===E.id),M=O.reduce((B,F)=>B+(F.costMillicents??0),0),$=DU[E.status]||"var(--text-tertiary)",Y=E.status==="connected",V=E.status==="connecting",ne=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",le=E.id in c?c[E.id]:void 0,Z=()=>{p(E.id).catch(()=>{}),T(!1),s(Io,{replace:!0})},se=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=B=>{g(B).catch(()=>{}),A(void 0)};return i.jsxs("div",{className:Me.container,children:[i.jsx(ys,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>T(!1)}),i.jsx(ys,{isOpen:w,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:se,onCancel:()=>C(!1)}),i.jsxs("div",{className:Me.envHeader,children:[i.jsxs("div",{className:Me.envTitleRow,children:[i.jsx("span",{className:Me.statusDot,style:{color:$},children:"●"}),i.jsx("h2",{className:Me.envName,children:E.displayName||E.id}),i.jsx("span",{className:Me.statusBadge,style:{color:$},children:E.status})]}),i.jsxs("div",{className:Me.envMeta,children:[i.jsxs("span",{className:Me.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&i.jsxs("span",{className:Me.metaTag,children:[O.length," session",O.length!==1?"s":""]}),M>0&&i.jsxs("span",{className:Me.metaTag,children:["Cost: ",Ds(M)]})]})]}),i.jsxs("div",{className:Me.actions,children:[Y&&i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(G_(E.id)),children:"New Chat"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),i.jsx("button",{className:Me.btnOutline,onClick:()=>C(!0),disabled:le!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ne&&i.jsx("button",{className:Me.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&le!==void 0&&i.jsx("span",{className:Me.provisionMessage,children:le.message}),E.status==="error"&&(le==null?void 0:le.stage)==="error"&&i.jsx("span",{className:Me.errorMessage,children:le.message}),i.jsx("button",{className:Me.btnOutline,onClick:()=>s($N(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),i.jsx("button",{className:Me.btnDanger,onClick:()=>T(!0),children:"Delete"})]}),i.jsxs("div",{className:Me.section,children:[i.jsxs("div",{className:Me.sectionHeader,children:[i.jsx("h3",{children:"Workspaces"}),i.jsx("button",{className:Me.btnPrimary,onClick:()=>s(`${Y_}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const B=m.filter(F=>!F.linkedEnvironmentIds.includes(E.id)&&F.status==="active");return B.length===0?null:i.jsxs("select",{className:Me.btnPrimary,value:"",onChange:F=>{F.target.value&&v(F.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[i.jsx("option",{value:"",children:"+ Link Workspace"}),B.map(F=>i.jsx("option",{value:F.id,children:F.name},F.id))]})})()]}),_&&i.jsxs("p",{className:Me.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,i.jsx("button",{className:Me.btnSmall,onClick:k,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),R.length===0&&i.jsx("p",{className:Me.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),i.jsx("div",{className:Me.cardList,"data-testid":"linked-workspaces-list",children:R.map(B=>i.jsx(RU,{workspace:B,confirmArchiveId:D,onOpen:()=>s(Ti(B.id,E.id)),onArchive:()=>A(B.id),onConfirmArchive:()=>H(B.id),onCancelArchive:()=>A(void 0),onUnlink:()=>{b(B.id,E.id).catch(()=>{})}},B.id))})]})]})}function RU({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const p=s===t.id,m=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return i.jsxs("div",{className:Me.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[i.jsxs("div",{className:Me.cardHeader,children:[i.jsx("strong",{className:Me.cardName,children:t.name}),i.jsxs("div",{className:Me.cardActions,children:[i.jsx("button",{className:Me.btnSmall,onClick:o,children:"Open"}),i.jsx("button",{className:Me.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:Me.btnDanger,onClick:c,children:"Confirm"}),i.jsx("button",{className:Me.btnSmall,onClick:d,children:"Cancel"})]}):i.jsx("button",{className:Me.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&i.jsx("p",{className:Me.cardDescription,children:t.description}),t.repoUrl&&i.jsx("div",{className:Me.cardMeta,children:m?i.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Me.repoLink,children:t.repoUrl}):i.jsx("span",{children:t.repoUrl})})]})}const IU={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function OU(){const s=Jt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=IU[s],r=S$(o);return i.jsxs("div",{className:Qr.layout,children:[i.jsx(pa,{segments:r}),i.jsx("div",{className:Qr.content,children:i.jsx("div",{className:Qr.tabPanel,children:i.jsx(Ai,{})},s)})]})}function BU(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=pt(),{showToast:d}=fn();return i.jsxs(i.Fragment,{children:[i.jsx(S8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),i.jsx(NB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function LU(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=pt(),{showToast:u}=fn();return i.jsx(FL,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function zU(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=pt(),{showToast:c}=fn(),d=_t();return i.jsx(B8,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(PN),onNavigateToPersona:u=>d(F_(u))})}const $U="_container_1ooin_1",HU="_form_1ooin_7",PU="_formActions_1ooin_75",UU="_editableSection_1ooin_82",VU="_defaultBadge_1ooin_93",qU="_typeToggle_1ooin_107",GU="_scriptEditor_1ooin_121",FU="_optional_1ooin_128",hs={container:$U,form:HU,formActions:PU,editableSection:UU,defaultBadge:VU,typeToggle:qU,scriptEditor:GU,optional:FU},f_=[{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)"}],p_=[{value:"genaiscript",label:"genaiscript"}],KU="0";function m_(){const{personaId:t}=fa(),s=_t(),{showToast:o}=fn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=pt(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return i.jsx(zn,{to:Yf,replace:!0});const b=[{label:"Settings",url:ki},{label:"Personas",url:Yf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return i.jsxs("div",{className:hs.container,children:[i.jsx(pa,{segments:b}),i.jsx(ZU,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Yf)},showToast:o})]})}function ZU({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=_t(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[T,w]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[A,E]=y.useState((t==null?void 0:t.maxTurns)??0),[R,O]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[M,$]=y.useState((t==null?void 0:t.script)??""),[Y,V]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[ne,le]=y.useState(!1),[Z,se]=y.useState(null),[H,B]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!H){B(!0),b(t.name),k(t.description),j(t.systemPrompt);const ue=t.type==="script"?"script":"agent";w(ue==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),O(ue),$(t.script||""),V(t.allowedMcpTools)}},[s,t,H]);const F=ue=>{O(ue),ue==="script"?w("genaiscript"):T==="genaiscript"&&w("claude-code")},ge=!s&&t===void 0,ee=v.trim().length>0&&!ge&&S.trim().length>0&&(R==="script"?M.trim().length>0:!!T&&!!C),ce=s&&ee,me=!s&&o===(t==null?void 0:t.id),xe=!s&&t&&!me&&R==="agent"&&!!T&&!!C,De=(ue,Re)=>{if(!ue.trim())return`${Re} is required`},ot=ue=>{if(ue.preventDefault(),!(ge||!ee)){if(t){c(t.id,v,_,S,T,C,A,R,M).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,S,T,C,A,R,M,Y).then(Re=>{m("Persona created","success"),g(F_(Re.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},yt=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},lt=async(ue,Re,Q,nt)=>ue().then(()=>{Re(),m(Q,"success")},()=>{m(nt,"error")}),Pe=(ue,Re)=>{if(!t)return;const Q=ue==="type"?String(Re):R,nt=ue==="runtime"?String(Re):ue==="type"?String(Re)==="script"?"genaiscript":T==="genaiscript"?"claude-code":T:T,re=ue==="model"?String(Re):C,ve=ue==="maxTurns"?Number(Re):A,et=ue==="systemPrompt"?String(Re):S,sn=ue==="script"?String(Re):M;lt(()=>c(t.id,ue==="name"?String(Re):v,ue==="description"?String(Re):_,et,nt,re,ve,Q,sn),()=>{if(ue==="type"){const _s=String(Re)==="script"?"script":"agent";O(_s),w(nt)}ue==="runtime"&&w(String(Re)),ue==="name"&&b(String(Re)),ue==="description"&&k(String(Re)),ue==="systemPrompt"&&j(String(Re)),ue==="model"&&D(String(Re)),ue==="maxTurns"&&E(Number(Re)),ue==="script"&&$(String(Re))},"Persona updated","Failed to update persona").catch(()=>{})},ke=ue=>{ot(ue)},ct=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return i.jsxs(i.Fragment,{children:[ge?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsx("p",{children:"Loading persona..."})]}):s?i.jsxs("form",{onSubmit:ke,className:hs.form,children:[i.jsx("h3",{children:"Create Persona"}),i.jsxs("div",{className:hs.typeToggle,"data-testid":"persona-type-toggle",children:[i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:R==="agent",onChange:()=>F("agent")}),"Agent"]}),i.jsxs("label",{children:[i.jsx("input",{type:"radio",name:"personaType",value:"script",checked:R==="script",onChange:()=>F("script")}),"Script"]})]}),i.jsxs("label",{children:["Name",i.jsx("input",{type:"text",value:v,onChange:ue=>b(ue.target.value),placeholder:R==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx("input",{type:"text",value:_,onChange:ue=>k(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Runtime",i.jsx("select",{value:T,onChange:ue=>w(ue.target.value),"data-testid":"persona-runtime-select",children:(R==="script"?p_:f_).map(ue=>i.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),R==="agent"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model",i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx("input",{type:"number",value:A,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),R==="script"&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{children:["Model ",i.jsx("span",{className:hs.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["System Prompt",i.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),i.jsxs("label",{children:["Script",i.jsx("textarea",{value:M,onChange:ue=>$(ue.target.value),placeholder:`script({ model: "openai:gpt-4o" });
742
742
 
743
743
  const grackle = await host.mcpServer({
744
744
  id: "grackle",
745
745
  url: env.vars.GRACKLE_MCP_URL,
746
746
  });
747
747
 
748
- $\`Summarize the current tasks.\`;`,rows:20,className:hs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),R==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Wb,{selectedTools:Y,onChange:V})]}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),ke&&i.jsx(sn,{type:"button",variant:"ghost",size:"md",onClick:Nt,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&i.jsx("span",{className:hs.defaultBadge,children:"App Default"}),i.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>le(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:hs.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(Bt,{value:v,onSave:ue=>{Oe("name",ue)},validate:ue=>De(ue,"Name"),fieldId:"persona-name",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(Bt,{value:_,onSave:ue=>{Oe("description",ue)},fieldId:"persona-description",activeFieldId:Z,onActivate:ae,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(pd,{value:R,onSave:ue=>{Oe("type",ue)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(pd,{value:j,onSave:ue=>{Oe("runtime",ue)},options:R==="script"?p_:f_,fieldId:"persona-runtime",activeFieldId:Z,onActivate:ae,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",R==="script"?" (optional)":"",i.jsx(Bt,{value:C,onSave:ue=>{Oe("model",ue)},validate:R==="agent"?ue=>De(ue,"Model"):void 0,fieldId:"persona-model",activeFieldId:Z,onActivate:ae,placeholder:R==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx(Bt,{value:String(A),onSave:ue=>{Oe("maxTurns",parseInt(ue,10)||0)},validate:ue=>/^\d+$/.test(ue.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:Z,onActivate:ae,placeholder:KU,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(sm,{value:S,onSave:ue=>{Oe("systemPrompt",ue)},validate:ue=>De(ue,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:Z,onActivate:ae,placeholder:R==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),R==="script"&&i.jsxs("label",{children:["Script",i.jsx(sm,{value:M,onSave:ue=>{Oe("script",ue)},validate:ue=>De(ue,"Script"),fieldId:"persona-script",activeFieldId:Z,onActivate:ae,placeholder:`script({ model: "openai:gpt-4o" });
748
+ $\`Summarize the current tasks.\`;`,rows:20,className:hs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),R==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Wb,{selectedTools:Y,onChange:V})]}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(nn,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),i.jsx(nn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:hs.form,children:[i.jsx("h3",{children:"Edit Persona"}),i.jsxs("div",{className:hs.formActions,children:[i.jsx(nn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),xe&&i.jsx(nn,{type:"button",variant:"ghost",size:"md",onClick:ct,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&i.jsx("span",{className:hs.defaultBadge,children:"App Default"}),i.jsx(nn,{type:"button",variant:"danger",size:"md",onClick:()=>le(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:hs.editableSection,children:[i.jsxs("label",{children:["Name",i.jsx(Lt,{value:v,onSave:ue=>{Pe("name",ue)},validate:ue=>De(ue,"Name"),fieldId:"persona-name",activeFieldId:Z,onActivate:se,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),i.jsxs("label",{children:["Description",i.jsx(Lt,{value:_,onSave:ue=>{Pe("description",ue)},fieldId:"persona-description",activeFieldId:Z,onActivate:se,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),i.jsxs("label",{children:["Type",i.jsx(pd,{value:R,onSave:ue=>{Pe("type",ue)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:Z,onActivate:se,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),i.jsxs("label",{children:["Runtime",i.jsx(pd,{value:T,onSave:ue=>{Pe("runtime",ue)},options:R==="script"?p_:f_,fieldId:"persona-runtime",activeFieldId:Z,onActivate:se,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),i.jsxs("label",{children:["Model",R==="script"?" (optional)":"",i.jsx(Lt,{value:C,onSave:ue=>{Pe("model",ue)},validate:R==="agent"?ue=>De(ue,"Model"):void 0,fieldId:"persona-model",activeFieldId:Z,onActivate:se,placeholder:R==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),i.jsxs("label",{children:["Max Turns",i.jsx(Lt,{value:String(A),onSave:ue=>{Pe("maxTurns",parseInt(ue,10)||0)},validate:ue=>/^\d+$/.test(ue.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:Z,onActivate:se,placeholder:KU,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),i.jsxs("label",{children:["System Prompt",i.jsx(sm,{value:S,onSave:ue=>{Pe("systemPrompt",ue)},validate:ue=>De(ue,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:Z,onActivate:se,placeholder:R==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),R==="script"&&i.jsxs("label",{children:["Script",i.jsx(sm,{value:M,onSave:ue=>{Pe("script",ue)},validate:ue=>De(ue,"Script"),fieldId:"persona-script",activeFieldId:Z,onActivate:se,placeholder:`script({ model: "openai:gpt-4o" });
749
749
 
750
750
  const grackle = await host.mcpServer({
751
751
  id: "grackle",
752
752
  url: env.vars.GRACKLE_MCP_URL,
753
753
  });
754
754
 
755
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),R==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Wb,{selectedTools:Y,onChange:ue=>{V(ue),_e(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ue),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!ke&&!me&&i.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,i.jsx(ys,{isOpen:ee,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:yt,onCancel:()=>le(!1)})]})}function YU(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=ut(),{showToast:c}=pn(),d=vt();return i.jsx(u7,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete schedule",{scheduleId:u,error:p}),c("Failed to delete schedule","error"),p}},onToggleEnabled:async(u,p)=>{try{return await o(u,p)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d(UN),onNavigateToSchedule:u=>d(K_(u))})}const JU="_container_1g4qh_1",WU="_form_1g4qh_7",XU="_formActions_1g4qh_66",QU="_editableSection_1g4qh_73",eV="_helperText_1g4qh_84",tV="_metaSection_1g4qh_90",nV="_optional_1g4qh_108",sV="_readonlyValue_1g4qh_113",Bn={container:JU,form:WU,formActions:XU,editableSection:QU,helperText:eV,metaSection:tV,optional:nV,readonlyValue:sV};function h_(){const{scheduleId:t}=ua(),s=vt(),{showToast:o}=pn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:p},personas:{personas:m},workspaces:{workspaces:g}}=ut(),v=t===void 0,b=v?void 0:r.find(k=>k.id===t);if(!v&&!c&&r.length>0&&!b)return i.jsx(zn,{to:Jf,replace:!0});const _=[{label:"Settings",url:ki},{label:"Schedules",url:Jf},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return i.jsxs("div",{className:Bn.container,children:[i.jsx(fa,{segments:_}),i.jsx(aV,{existing:b,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(Jf)},showToast:o})]})}function aV({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var H;const g=vt(),[v,b]=y.useState((t==null?void 0:t.title)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,T]=y.useState((t==null?void 0:t.scheduleExpression)??""),[j,w]=y.useState((t==null?void 0:t.personaId)??""),[C,D]=y.useState((t==null?void 0:t.workspaceId)??""),[A,E]=y.useState(!1),[R,O]=y.useState(null);y.useEffect(()=>{s||t&&R===null&&(b(t.title),k(t.description),T(t.scheduleExpression),w(t.personaId),D(t.workspaceId))},[s,t,R]);const M=!s&&t===void 0,$=s&&v.trim().length>0&&S.trim().length>0&&j.length>0,Y=o.map(B=>({value:B.id,label:B.name})),V=[{value:"",label:"System-level (no workspace)"},...r.map(B=>({value:B.id,label:B.name}))],ee=B=>{B.preventDefault(),$&&c(v,_,S,j,C||void 0).then(F=>{m("Schedule created","success"),g(K_(F.id),{replace:!0})},()=>{m("Failed to create schedule","error")})},le=(B,F)=>{t&&d(t.id,{[B]:F}).then(()=>{m("Schedule updated","success"),B==="title"&&b(String(F)),B==="description"&&k(String(F)),B==="scheduleExpression"&&T(String(F)),B==="personaId"&&w(String(F))},()=>{m("Failed to update schedule","error")})},Z=()=>{if(!t)return;const B=!t.enabled;d(t.id,{enabled:B}).then(()=>{m(B?"Schedule enabled":"Schedule disabled","success")},()=>{m("Failed to update schedule","error")})},ae=()=>{t&&u(t.id).then(()=>{m("Schedule deleted","success"),p()},()=>{m("Failed to delete schedule","error")})};return i.jsxs(i.Fragment,{children:[M?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsx("p",{children:"Loading schedule..."})]}):s?i.jsxs("form",{onSubmit:ee,className:Bn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:v,onChange:B=>b(B.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:_,onChange:B=>k(B.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:S,onChange:B=>T(B.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),i.jsxs("p",{className:Bn.helperText,children:["Interval: ",i.jsx("code",{children:"30s"}),", ",i.jsx("code",{children:"5m"}),", ",i.jsx("code",{children:"1h"}),", ",i.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",i.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),i.jsxs("label",{children:["Persona",i.jsxs("select",{value:j,onChange:B=>w(B.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),Y.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))]})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("select",{value:C,onChange:B=>D(B.target.value),"data-testid":"schedule-detail-workspace",children:V.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))})]}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),i.jsx(sn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),i.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:Bn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Bt,{value:v,onSave:B=>{le("title",B)},validate:B=>B.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:R,onActivate:O,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Bt,{value:_,onSave:B=>{le("description",B)},fieldId:"schedule-description",activeFieldId:R,onActivate:O,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Bt,{value:S,onSave:B=>{le("scheduleExpression",B)},validate:B=>B.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:R,onActivate:O,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),i.jsxs("label",{children:["Persona",i.jsx(pd,{value:j,onSave:B=>{le("personaId",B)},options:Y,fieldId:"schedule-persona",activeFieldId:R,onActivate:O,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional — set at creation)"}),i.jsx("span",{className:Bn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(B=>B.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),i.jsxs("div",{className:Bn.metaSection,children:[t.lastRunAt?i.jsxs("span",{children:["Last run: ",im(t.lastRunAt)]}):i.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?i.jsxs("span",{children:["Next run: ",V1(t.nextRunAt)]}):null,t.runCount>0&&i.jsxs("span",{children:["Total runs: ",t.runCount]}),i.jsxs("span",{children:["Created: ",im(t.createdAt)]})]})]}):null,i.jsx(ys,{isOpen:A,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:ae,onCancel:()=>E(!1)})]})}function iV(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=J1();return i.jsx(CB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function oV(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await ze.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function rV(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=ut(),r=oV();return i.jsxs(i.Fragment,{children:[r&&i.jsx($O,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(DB,{connectionStatus:t,environments:s,sessions:o})]})}function lV(){return i.jsx(x8,{})}function cV(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=ut();return i.jsx(GL,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const g_=Di();function dV(){const t=vt();return Fa({key:"?"},()=>{t(VN)}),Fa({key:"n"},()=>{t(g_)}),Fa({key:"N"},()=>{t(g_)}),i.jsx(i.Fragment,{})}function Dd(t){const s=y$();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function uV(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=ut(),o=y.useMemo(()=>i.jsx(hO,{workspaces:t,tasks:s}),[t,s]);return Dd(o),i.jsx(Ai,{})}function fV(){const{environments:{environments:t}}=ut(),s=y.useMemo(()=>i.jsx(BI,{environments:t}),[t]);return Dd(s),i.jsx(Ai,{})}function pV(){const t=y.useMemo(()=>i.jsx(g7,{}),[]);return Dd(t),i.jsx(Ai,{})}function mV(){const{knowledge:t,workspaces:{workspaces:s}}=ut(),o=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>i.jsx(G5,{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 Dd(u),i.jsx(Ai,{})}const hV="_wizard_1260s_1",gV="_container_1260s_10",vV="_stepContent_1260s_19",yV="_logoArea_1260s_28",bV="_logoImage_1260s_32",_V="_heading_1260s_41",xV="_tagline_1260s_49",kV="_subtitle_1260s_56",SV="_featureList_1260s_64",TV="_runtimeGrid_1260s_89",jV="_runtimeCard_1260s_101",wV="_runtimeName_1260s_133",NV="_runtimeDescription_1260s_139",CV="_buttonRow_1260s_144",EV="_primaryButton_1260s_151",AV="_ghostButton_1260s_185",DV="_dots_1260s_213",MV="_dot_1260s_213",We={wizard:hV,container:gV,stepContent:vV,logoArea:yV,logoImage:bV,heading:_V,tagline:xV,subtitle:kV,featureList:SV,runtimeGrid:TV,runtimeCard:jV,runtimeName:wV,runtimeDescription:NV,buttonRow:CV,primaryButton:EV,ghostButton:AV,dots:DV,dot:MV};function RV({onNext:t}){return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:We.logoArea,children:i.jsx("img",{src:Cd("grackle-logo.png"),alt:"Grackle",className:We.logoImage})}),i.jsx("h1",{className:We.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:We.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function IV({onNext:t,onBack:s}){return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:We.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:We.featureList,children:[i.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),i.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),i.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),i.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),i.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),i.jsxs("div",{className:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const OV=[{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 BV({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:We.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:We.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:We.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:We.runtimeGrid,children:OV.map(u=>i.jsxs("button",{type:"button",className:We.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[i.jsx("span",{className:We.runtimeName,children:u.name}),i.jsx("span",{className:We.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function LV(){return typeof Notification<"u"}function zV({onFinish:t,onBack:s,finishDisabled:o}){const r=LV(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:We.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:We.heading,children:"Stay in the Loop"}),i.jsx("p",{className:We.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?i.jsx("p",{className:We.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,i.jsxs("div",{className:We.buttonRow,children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:We.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:We.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:We.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const $V=4,v_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function HV(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=ut(),{showToast:c}=pn(),d=vt(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,b]=y.useState(!1),_=t.find(T=>T.id==="claude-code"),k=y.useCallback(T=>{g(T),p(3)},[]),S=y.useCallback(()=>{const T=m;b(!0);const j=[];if(_&&T!==_.runtime){const C=v_[T]??"sonnet";j.push(s(_.id,void 0,void 0,void 0,T,C))}const w=t.find(C=>C.id===ay);if(w&&T!==w.runtime){const C=v_[T]??"sonnet";j.push(s(ay,void 0,void 0,void 0,T,C))}Promise.all(j).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,_,t,s,o,d,c]);return r===!0?i.jsx(zn,{to:"/",replace:!0}):i.jsx("div",{className:We.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:We.container,children:[i.jsx(as,{mode:"wait",children:i.jsxs($t.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&i.jsx(RV,{onNext:()=>p(1)}),u===1&&i.jsx(IV,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(BV,{currentRuntime:m,onFinish:k,onBack:()=>p(1),finishDisabled:!_}),u===3&&i.jsx(zV,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:We.dots,children:Array.from({length:$V},(T,j)=>i.jsx("span",{className:We.dot,"data-active":j===u},j))})]})})}const PV="_root_zndgp_1",UV="_body_zndgp_7",VV="_main_zndgp_19",qV="_sidebarWrapper_zndgp_26",GV="_overlay_zndgp_51",Fr={root:PV,body:UV,main:VV,sidebarWrapper:qV,overlay:GV},FV=y.lazy(()=>k_(()=>import("./KnowledgePage-MWT_iA9F.js"),__vite__mapDeps([3,1,2,4,5])).then(t=>({default:t.KnowledgePage}))),lk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function KV({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=ut(),{toasts:d,dismissToast:u}=pn(),p=Jt(),m=v$(),g=m!==void 0,[v,b]=y.useState(!1),_=y.useCallback(()=>b(k=>!k),[]);return y.useEffect(()=>{b(!1)},[p.pathname]),y.useEffect(()=>{if(!v)return;const k=S=>{S.key==="Escape"&&b(!1)};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(aI,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?_:void 0,sidebarOpen:v}),i.jsx(fI,{tabs:t}),i.jsxs("div",{className:Fr.body,children:[g&&i.jsx("div",{className:Fr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(yI,{content:m})}),g&&v&&i.jsx("div",{className:Fr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),i.jsxs("div",{className:Fr.main,children:[i.jsx(Ai,{}),i.jsx(wI,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(CO,{toasts:d,onDismiss:u}),i.jsx(dV,{})]})}function ZV(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=ut(),{pluginNames:p}=Ad(),{showToast:m}=pn();N9(s,m),M9(c,m),C9(o,r,m);const g=vt(),v=Jt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Sm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return i.jsx(zn,{to:"/setup",replace:!0});const b=W$(p);return i.jsx(g$,{children:i.jsxs("div",{className:Fr.root,children:[lk&&i.jsx(yC,{}),i.jsx(KV,{tabs:b})]})})}function Mp(){const{workspaceId:t}=ua(),{workspaces:{workspaces:s}}=ut(),o=Jt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:i.jsx(zn,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,p=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(c)}/workspaces/${d}${p}${o.search}${o.hash}`;return i.jsx(zn,{to:m,replace:!0})}function YV(){const{pluginNames:t}=Ad(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(sN,{children:[i.jsx(Ee,{path:"setup",element:i.jsx(HV,{})}),i.jsxs(Ee,{element:i.jsx(ZV,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(gP,{})}),i.jsx(Ee,{path:"sessions/new",element:i.jsx(AP,{})}),i.jsx(Ee,{path:"chat",element:i.jsx(wP,{})}),i.jsx(Ee,{path:"chat/:streamId",element:i.jsx(zn,{to:"/coordination",replace:!0})}),i.jsx(Ee,{path:"coordination",element:i.jsx(EP,{})}),i.jsx(Ee,{path:"sessions/:sessionId",element:i.jsx(IP,{})}),o&&i.jsx(Ee,{element:i.jsx(mV,{}),children:i.jsx(Ee,{path:"knowledge",element:i.jsx(y.Suspense,{fallback:i.jsx(E1,{}),children:i.jsx(FV,{})})})}),s&&i.jsxs(Ee,{element:i.jsx(uV,{}),children:[i.jsx(Ee,{path:"tasks",element:i.jsx(mP,{})}),i.jsx(Ee,{path:"tasks/new",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"tasks/:taskId",element:i.jsx(wo,{})}),i.jsx(Ee,{path:"tasks/:taskId/edit",element:i.jsx(wo,{})}),i.jsx(Ee,{path:"tasks/:taskId/stream",element:i.jsx(wo,{})})]}),i.jsxs(Ee,{element:i.jsx(fV,{}),children:[i.jsx(Ee,{path:"workspaces",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"workspaces/new",element:i.jsx(YP,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(zP,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(wo,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(wo,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(wo,{})}),i.jsxs(Ee,{path:"environments",element:i.jsx(nU,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(hP,{})}),i.jsx(Ee,{path:"new",element:i.jsx(WP,{})}),i.jsx(Ee,{path:":environmentId",element:i.jsx(MU,{})}),i.jsx(Ee,{path:":environmentId/edit",element:i.jsx(XP,{})})]})]}),i.jsx(Ee,{element:i.jsx(pV,{}),children:i.jsxs(Ee,{path:"settings",element:i.jsx(OU,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(zn,{to:"credentials",replace:!0})}),i.jsx(Ee,{path:"environments",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"credentials",element:i.jsx(BU,{})}),i.jsx(Ee,{path:"github-accounts",element:i.jsx(LU,{})}),i.jsx(Ee,{path:"tokens",element:i.jsx(zn,{to:"../credentials",replace:!0})}),i.jsx(Ee,{path:"personas",element:i.jsx(zU,{})}),i.jsx(Ee,{path:"personas/new",element:i.jsx(m_,{})}),i.jsx(Ee,{path:"personas/:personaId",element:i.jsx(m_,{})}),i.jsx(Ee,{path:"schedules",element:i.jsx(YU,{})}),i.jsx(Ee,{path:"schedules/new",element:i.jsx(h_,{})}),i.jsx(Ee,{path:"schedules/:scheduleId",element:i.jsx(h_,{})}),i.jsx(Ee,{path:"appearance",element:i.jsx(iV,{})}),i.jsx(Ee,{path:"shortcuts",element:i.jsx(lV,{})}),i.jsx(Ee,{path:"plugins",element:i.jsx(cV,{})}),i.jsx(Ee,{path:"about",element:i.jsx(rV,{})})]})}),i.jsx(Ee,{path:"*",element:i.jsx(zn,{to:"/",replace:!0})})]})]})}const JV=1e4;function WV(){const{onboardingCompleted:t}=ut(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),JV);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(as,{mode:"wait",children:r?i.jsx($t.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(E1,{})},"splash"):i.jsx($t.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(CN,{basename:"/".replace(/\/$/,""),children:i.jsx(YV,{})})},"app")})}function XV(){const t=lk?q$:w9;return i.jsx(K$,{children:i.jsx(h$,{children:i.jsx(u$,{children:i.jsx(t,{children:i.jsx(WV,{})})})})})}Y2.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(XV,{})}));export{fa as B,J_ as K,ut as a,Sm as s,os as t,vt as u};
755
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),R==="agent"&&i.jsxs("div",{children:[i.jsx("label",{children:"Allowed MCP Tools"}),i.jsx(Wb,{selectedTools:Y,onChange:ue=>{V(ue),lt(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ue),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!xe&&!me&&i.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,i.jsx(ys,{isOpen:ne,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:yt,onCancel:()=>le(!1)})]})}function YU(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=pt(),{showToast:c}=fn(),d=_t();return i.jsx(u7,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete schedule",{scheduleId:u,error:p}),c("Failed to delete schedule","error"),p}},onToggleEnabled:async(u,p)=>{try{return await o(u,p)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d(UN),onNavigateToSchedule:u=>d(K_(u))})}const JU="_container_1g4qh_1",WU="_form_1g4qh_7",XU="_formActions_1g4qh_66",QU="_editableSection_1g4qh_73",eV="_helperText_1g4qh_84",tV="_metaSection_1g4qh_90",nV="_optional_1g4qh_108",sV="_readonlyValue_1g4qh_113",Bn={container:JU,form:WU,formActions:XU,editableSection:QU,helperText:eV,metaSection:tV,optional:nV,readonlyValue:sV};function h_(){const{scheduleId:t}=fa(),s=_t(),{showToast:o}=fn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:p},personas:{personas:m},workspaces:{workspaces:g}}=pt(),v=t===void 0,b=v?void 0:r.find(k=>k.id===t);if(!v&&!c&&r.length>0&&!b)return i.jsx(zn,{to:Jf,replace:!0});const _=[{label:"Settings",url:ki},{label:"Schedules",url:Jf},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return i.jsxs("div",{className:Bn.container,children:[i.jsx(pa,{segments:_}),i.jsx(aV,{existing:b,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(Jf)},showToast:o})]})}function aV({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var H;const g=_t(),[v,b]=y.useState((t==null?void 0:t.title)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[T,w]=y.useState((t==null?void 0:t.personaId)??""),[C,D]=y.useState((t==null?void 0:t.workspaceId)??""),[A,E]=y.useState(!1),[R,O]=y.useState(null);y.useEffect(()=>{s||t&&R===null&&(b(t.title),k(t.description),j(t.scheduleExpression),w(t.personaId),D(t.workspaceId))},[s,t,R]);const M=!s&&t===void 0,$=s&&v.trim().length>0&&S.trim().length>0&&T.length>0,Y=o.map(B=>({value:B.id,label:B.name})),V=[{value:"",label:"System-level (no workspace)"},...r.map(B=>({value:B.id,label:B.name}))],ne=B=>{B.preventDefault(),$&&c(v,_,S,T,C||void 0).then(F=>{m("Schedule created","success"),g(K_(F.id),{replace:!0})},()=>{m("Failed to create schedule","error")})},le=(B,F)=>{t&&d(t.id,{[B]:F}).then(()=>{m("Schedule updated","success"),B==="title"&&b(String(F)),B==="description"&&k(String(F)),B==="scheduleExpression"&&j(String(F)),B==="personaId"&&w(String(F))},()=>{m("Failed to update schedule","error")})},Z=()=>{if(!t)return;const B=!t.enabled;d(t.id,{enabled:B}).then(()=>{m(B?"Schedule enabled":"Schedule disabled","success")},()=>{m("Failed to update schedule","error")})},se=()=>{t&&u(t.id).then(()=>{m("Schedule deleted","success"),p()},()=>{m("Failed to delete schedule","error")})};return i.jsxs(i.Fragment,{children:[M?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsx("p",{children:"Loading schedule..."})]}):s?i.jsxs("form",{onSubmit:ne,className:Bn.form,children:[i.jsx("h3",{children:"Create Schedule"}),i.jsxs("label",{children:["Title",i.jsx("input",{type:"text",value:v,onChange:B=>b(B.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("input",{type:"text",value:_,onChange:B=>k(B.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx("input",{type:"text",value:S,onChange:B=>j(B.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),i.jsxs("p",{className:Bn.helperText,children:["Interval: ",i.jsx("code",{children:"30s"}),", ",i.jsx("code",{children:"5m"}),", ",i.jsx("code",{children:"1h"}),", ",i.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",i.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),i.jsxs("label",{children:["Persona",i.jsxs("select",{value:T,onChange:B=>w(B.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[i.jsx("option",{value:"",children:"Select a persona..."}),Y.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))]})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional)"}),i.jsx("select",{value:C,onChange:B=>D(B.target.value),"data-testid":"schedule-detail-workspace",children:V.map(B=>i.jsx("option",{value:B.value,children:B.label},B.value))})]}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(nn,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),i.jsx(nn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?i.jsxs("div",{className:Bn.form,children:[i.jsx("h3",{children:"Edit Schedule"}),i.jsxs("div",{className:Bn.formActions,children:[i.jsx(nn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),i.jsx(nn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),i.jsx(nn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),i.jsxs("div",{className:Bn.editableSection,children:[i.jsxs("label",{children:["Title",i.jsx(Lt,{value:v,onSave:B=>{le("title",B)},validate:B=>B.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:R,onActivate:O,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),i.jsxs("label",{children:["Description",i.jsx(Lt,{value:_,onSave:B=>{le("description",B)},fieldId:"schedule-description",activeFieldId:R,onActivate:O,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),i.jsxs("label",{children:["Schedule Expression",i.jsx(Lt,{value:S,onSave:B=>{le("scheduleExpression",B)},validate:B=>B.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:R,onActivate:O,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),i.jsxs("label",{children:["Persona",i.jsx(pd,{value:T,onSave:B=>{le("personaId",B)},options:Y,fieldId:"schedule-persona",activeFieldId:R,onActivate:O,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),i.jsxs("label",{children:["Workspace ",i.jsx("span",{className:Bn.optional,children:"(optional — set at creation)"}),i.jsx("span",{className:Bn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(B=>B.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),i.jsxs("div",{className:Bn.metaSection,children:[t.lastRunAt?i.jsxs("span",{children:["Last run: ",im(t.lastRunAt)]}):i.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?i.jsxs("span",{children:["Next run: ",V1(t.nextRunAt)]}):null,t.runCount>0&&i.jsxs("span",{children:["Total runs: ",t.runCount]}),i.jsxs("span",{children:["Created: ",im(t.createdAt)]})]})]}):null,i.jsx(ys,{isOpen:A,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:se,onCancel:()=>E(!1)})]})}function iV(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=J1();return i.jsx(CB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function oV(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Be.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function rV(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=pt(),r=oV();return i.jsxs(i.Fragment,{children:[r&&i.jsx($O,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),i.jsx(DB,{connectionStatus:t,environments:s,sessions:o})]})}function lV(){return i.jsx(x8,{})}function cV(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=pt();return i.jsx(GL,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const g_=Di();function dV(){const t=_t();return Fa({key:"?"},()=>{t(VN)}),Fa({key:"n"},()=>{t(g_)}),Fa({key:"N"},()=>{t(g_)}),i.jsx(i.Fragment,{})}function Dd(t){const s=y$();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function uV(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=pt(),o=y.useMemo(()=>i.jsx(hO,{workspaces:t,tasks:s}),[t,s]);return Dd(o),i.jsx(Ai,{})}function fV(){const{environments:{environments:t}}=pt(),s=y.useMemo(()=>i.jsx(BI,{environments:t}),[t]);return Dd(s),i.jsx(Ai,{})}function pV(){const t=y.useMemo(()=>i.jsx(g7,{}),[]);return Dd(t),i.jsx(Ai,{})}function mV(){const{knowledge:t,workspaces:{workspaces:s}}=pt(),o=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>i.jsx(G5,{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 Dd(u),i.jsx(Ai,{})}const hV="_wizard_1260s_1",gV="_container_1260s_10",vV="_stepContent_1260s_19",yV="_logoArea_1260s_28",bV="_logoImage_1260s_32",_V="_heading_1260s_41",xV="_tagline_1260s_49",kV="_subtitle_1260s_56",SV="_featureList_1260s_64",jV="_runtimeGrid_1260s_89",TV="_runtimeCard_1260s_101",wV="_runtimeName_1260s_133",NV="_runtimeDescription_1260s_139",CV="_buttonRow_1260s_144",EV="_primaryButton_1260s_151",AV="_ghostButton_1260s_185",DV="_dots_1260s_213",MV="_dot_1260s_213",Xe={wizard:hV,container:gV,stepContent:vV,logoArea:yV,logoImage:bV,heading:_V,tagline:xV,subtitle:kV,featureList:SV,runtimeGrid:jV,runtimeCard:TV,runtimeName:wV,runtimeDescription:NV,buttonRow:CV,primaryButton:EV,ghostButton:AV,dots:DV,dot:MV};function RV({onNext:t}){return i.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-welcome",children:[i.jsx("div",{className:Xe.logoArea,children:i.jsx("img",{src:Cd("grackle-logo.png"),alt:"Grackle",className:Xe.logoImage})}),i.jsx("h1",{className:Xe.heading,children:"Welcome to Grackle"}),i.jsx("p",{className:Xe.tagline,children:"Multi-agent orchestration for software teams"}),i.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function IV({onNext:t,onBack:s}){return i.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-about",children:[i.jsx("h2",{className:Xe.heading,children:"What is Grackle?"}),i.jsxs("ul",{className:Xe.featureList,children:[i.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),i.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),i.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),i.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),i.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),i.jsxs("div",{className:Xe.buttonRow,children:[i.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,children:"Back"}),i.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const OV=[{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 BV({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),i.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-runtime",children:[i.jsx("h2",{className:Xe.heading,children:"Choose Your Runtime"}),i.jsx("p",{className:Xe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),i.jsx("div",{className:Xe.runtimeGrid,children:OV.map(u=>i.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:[i.jsx("span",{className:Xe.runtimeName,children:u.name}),i.jsx("span",{className:Xe.runtimeDescription,children:u.description})]},u.id))}),i.jsxs("div",{className:Xe.buttonRow,children:[i.jsx("button",{type:"button",className:Xe.ghostButton,onClick:o,children:"Back"}),i.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function LV(){return typeof Notification<"u"}function zV({onFinish:t,onBack:s,finishDisabled:o}){const r=LV(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return i.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-notifications",children:[i.jsx("h2",{className:Xe.heading,children:"Stay in the Loop"}),i.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?i.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,i.jsxs("div",{className:Xe.buttonRow,children:[i.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:Xe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),i.jsx("button",{type:"button",className:Xe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):i.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const $V=4,v_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function HV(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=pt(),{showToast:c}=fn(),d=_t(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,b]=y.useState(!1),_=t.find(j=>j.id==="claude-code"),k=y.useCallback(j=>{g(j),p(3)},[]),S=y.useCallback(()=>{const j=m;b(!0);const T=[];if(_&&j!==_.runtime){const C=v_[j]??"sonnet";T.push(s(_.id,void 0,void 0,void 0,j,C))}const w=t.find(C=>C.id===ay);if(w&&j!==w.runtime){const C=v_[j]??"sonnet";T.push(s(ay,void 0,void 0,void 0,j,C))}Promise.all(T).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,_,t,s,o,d,c]);return r===!0?i.jsx(zn,{to:"/",replace:!0}):i.jsx("div",{className:Xe.wizard,"data-testid":"setup-wizard",children:i.jsxs("div",{className:Xe.container,children:[i.jsx(as,{mode:"wait",children:i.jsxs(Ht.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&i.jsx(RV,{onNext:()=>p(1)}),u===1&&i.jsx(IV,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&i.jsx(BV,{currentRuntime:m,onFinish:k,onBack:()=>p(1),finishDisabled:!_}),u===3&&i.jsx(zV,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),i.jsx("div",{className:Xe.dots,children:Array.from({length:$V},(j,T)=>i.jsx("span",{className:Xe.dot,"data-active":T===u},T))})]})})}const PV="_root_zndgp_1",UV="_body_zndgp_7",VV="_main_zndgp_19",qV="_sidebarWrapper_zndgp_26",GV="_overlay_zndgp_51",Kr={root:PV,body:UV,main:VV,sidebarWrapper:qV,overlay:GV},FV=y.lazy(()=>k_(()=>import("./KnowledgePage-Dlx-9yf1.js"),__vite__mapDeps([3,1,2,4,5])).then(t=>({default:t.KnowledgePage}))),lk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function KV({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=pt(),{toasts:d,dismissToast:u}=fn(),p=Jt(),m=v$(),g=m!==void 0,[v,b]=y.useState(!1),_=y.useCallback(()=>b(k=>!k),[]);return y.useEffect(()=>{b(!1)},[p.pathname]),y.useEffect(()=>{if(!v)return;const k=S=>{S.key==="Escape"&&b(!1)};return document.addEventListener("keydown",k),()=>{document.removeEventListener("keydown",k)}},[v]),i.jsxs(i.Fragment,{children:[i.jsx(aI,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?_:void 0,sidebarOpen:v}),i.jsx(fI,{tabs:t}),i.jsxs("div",{className:Kr.body,children:[g&&i.jsx("div",{className:Kr.sidebarWrapper,"data-sidebar-open":v,children:i.jsx(yI,{content:m})}),g&&v&&i.jsx("div",{className:Kr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),i.jsxs("div",{className:Kr.main,children:[i.jsx(Ai,{}),i.jsx(wI,{sessions:r,tasks:c,environments:o})]})]}),i.jsx(CO,{toasts:d,onDismiss:u}),i.jsx(dV,{})]})}function ZV(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=pt(),{pluginNames:p}=Ad(),{showToast:m}=fn();N9(s,m),M9(c,m),C9(o,r,m);const g=_t(),v=Jt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Sm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return i.jsx(zn,{to:"/setup",replace:!0});const b=W$(p);return i.jsx(g$,{children:i.jsxs("div",{className:Kr.root,children:[lk&&i.jsx(yC,{}),i.jsx(KV,{tabs:b})]})})}function Mp(){const{workspaceId:t}=fa(),{workspaces:{workspaces:s}}=pt(),o=Jt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:i.jsx(zn,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,p=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(c)}/workspaces/${d}${p}${o.search}${o.hash}`;return i.jsx(zn,{to:m,replace:!0})}function YV(){const{pluginNames:t}=Ad(),s=t.includes("orchestration"),o=t.includes("knowledge");return i.jsxs(sN,{children:[i.jsx(Ee,{path:"setup",element:i.jsx(HV,{})}),i.jsxs(Ee,{element:i.jsx(ZV,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(gP,{})}),i.jsx(Ee,{path:"sessions/new",element:i.jsx(AP,{})}),i.jsx(Ee,{path:"chat",element:i.jsx(wP,{})}),i.jsx(Ee,{path:"chat/:streamId",element:i.jsx(zn,{to:"/coordination",replace:!0})}),i.jsx(Ee,{path:"coordination",element:i.jsx(EP,{})}),i.jsx(Ee,{path:"sessions/:sessionId",element:i.jsx(IP,{})}),o&&i.jsx(Ee,{element:i.jsx(mV,{}),children:i.jsx(Ee,{path:"knowledge",element:i.jsx(y.Suspense,{fallback:i.jsx(E1,{}),children:i.jsx(FV,{})})})}),s&&i.jsxs(Ee,{element:i.jsx(uV,{}),children:[i.jsx(Ee,{path:"tasks",element:i.jsx(mP,{})}),i.jsx(Ee,{path:"tasks/new",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"tasks/:taskId",element:i.jsx(No,{})}),i.jsx(Ee,{path:"tasks/:taskId/edit",element:i.jsx(No,{})}),i.jsx(Ee,{path:"tasks/:taskId/stream",element:i.jsx(No,{})})]}),i.jsxs(Ee,{element:i.jsx(fV,{}),children:[i.jsx(Ee,{path:"workspaces",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"workspaces/new",element:i.jsx(YP,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:i.jsx(Mp,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId",element:i.jsx(zP,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:i.jsx(u_,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:i.jsx(No,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:i.jsx(No,{})}),i.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:i.jsx(No,{})}),i.jsxs(Ee,{path:"environments",element:i.jsx(nU,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(hP,{})}),i.jsx(Ee,{path:"new",element:i.jsx(WP,{})}),i.jsx(Ee,{path:":environmentId",element:i.jsx(MU,{})}),i.jsx(Ee,{path:":environmentId/edit",element:i.jsx(XP,{})})]})]}),i.jsx(Ee,{element:i.jsx(pV,{}),children:i.jsxs(Ee,{path:"settings",element:i.jsx(OU,{}),children:[i.jsx(Ee,{index:!0,element:i.jsx(zn,{to:"credentials",replace:!0})}),i.jsx(Ee,{path:"environments",element:i.jsx(zn,{to:"/environments",replace:!0})}),i.jsx(Ee,{path:"credentials",element:i.jsx(BU,{})}),i.jsx(Ee,{path:"github-accounts",element:i.jsx(LU,{})}),i.jsx(Ee,{path:"tokens",element:i.jsx(zn,{to:"../credentials",replace:!0})}),i.jsx(Ee,{path:"personas",element:i.jsx(zU,{})}),i.jsx(Ee,{path:"personas/new",element:i.jsx(m_,{})}),i.jsx(Ee,{path:"personas/:personaId",element:i.jsx(m_,{})}),i.jsx(Ee,{path:"schedules",element:i.jsx(YU,{})}),i.jsx(Ee,{path:"schedules/new",element:i.jsx(h_,{})}),i.jsx(Ee,{path:"schedules/:scheduleId",element:i.jsx(h_,{})}),i.jsx(Ee,{path:"appearance",element:i.jsx(iV,{})}),i.jsx(Ee,{path:"shortcuts",element:i.jsx(lV,{})}),i.jsx(Ee,{path:"plugins",element:i.jsx(cV,{})}),i.jsx(Ee,{path:"about",element:i.jsx(rV,{})})]})}),i.jsx(Ee,{path:"*",element:i.jsx(zn,{to:"/",replace:!0})})]})]})}const JV=1e4;function WV(){const{onboardingCompleted:t}=pt(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),JV);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return i.jsx(as,{mode:"wait",children:r?i.jsx(Ht.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:i.jsx(E1,{})},"splash"):i.jsx(Ht.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:i.jsx(CN,{basename:"/".replace(/\/$/,""),children:i.jsx(YV,{})})},"app")})}function XV(){const t=lk?q$:w9;return i.jsx(K$,{children:i.jsx(h$,{children:i.jsx(u$,{children:i.jsx(t,{children:i.jsx(WV,{})})})})})}Y2.createRoot(document.getElementById("root")).render(i.jsx(y.StrictMode,{children:i.jsx(XV,{})}));export{pa as B,J_ as K,pt as a,Sm as s,os as t,_t as u};