@grackle-ai/web 0.123.1 → 0.123.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-BRXtLl5r.js","assets/dagview-iuApGUdh.js","assets/grpc-BF7BKcvW.js","assets/KnowledgePage-C7xIczVk.js","assets/markdown-BTjAPjWv.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as z2,a as $2,b as y,j as a,d as cd,H as Bo,P as Lo,i as A_,B as M_,c as D_,C as R_,M as I_,e as H2,f as Dc}from"./dagview-iuApGUdh.js";import{c as P2,a as kd,G as U2,b as V2,d as q2,e as G2,f as F2,M as K2,D as O_,A as B_,W as Z2,O as Y2,g as J2,C as da,h as L_,i as z_,w as W2,t as X2,p as Rc,j as Q2,R as Ic,S as py}from"./grpc-BF7BKcvW.js";import{v as ej,r as tj,t as Oc,i as nj,f as sj,M as _m,a as xm}from"./markdown-BTjAPjWv.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 Yf={exports:{}},zr={},Jf={exports:{}},Wf={};/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-BTQyEJAZ.js","assets/dagview-B70jDsRo.js","assets/grpc-BF7BKcvW.js","assets/KnowledgePage-BnKWZKuh.js","assets/markdown-CPoGw-1N.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
+ import{r as $2,a as H2,b as y,j as a,d as cd,H as Bo,P as Lo,i as D_,B as M_,c as R_,C as I_,M as O_,e as P2,f as Mc,h as U2,k as V2}from"./dagview-B70jDsRo.js";import{c as q2,a as kd,G as G2,b as F2,d as K2,e as Z2,f as Y2,M as J2,D as B_,A as L_,W as W2,O as X2,g as Q2,C as da,h as z_,i as $_,w as ej,t as tj,p as Rc,j as nj,R as Ic,S as py}from"./grpc-BF7BKcvW.js";import{v as sj,r as aj,t as Oc,i as ij,f as oj,M as _m,a as xm}from"./markdown-CPoGw-1N.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 Yf={exports:{}},zr={},Jf={exports:{}},Wf={};/**
3
3
  * @license React
4
4
  * scheduler.production.js
5
5
  *
@@ -7,7 +7,7 @@ import{r as z2,a as $2,b as y,j as a,d as cd,H as Bo,P as Lo,i as A_,B as M_,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 my;function aj(){return my||(my=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],Me=me+1,ot=H[Me];if(0>c(xe,F))Me<ee&&0>c(ot,xe)?(H[ge]=ot,H[Me]=F,ge=Me):(H[ge]=xe,H[me]=F,ge=me);else if(Me<ee&&0>c(ot,F))H[ge]=ot,H[Me]=F,ge=Me;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,M=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,D=5,$=-1;function Y(){return T?!0:!(t.unstable_now()-$<D)}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 M=="function")ne=function(){M(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"):D=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}}}})(Wf)),Wf}var hy;function ij(){return hy||(hy=1,Jf.exports=aj()),Jf.exports}/**
10
+ */var my;function rj(){return my||(my=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,x=!1,S=!1,j=!1,T=!1,N=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),x=!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,x=!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(){N(V,0)};function se(H,B){O=N(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||x||(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}}}})(Wf)),Wf}var hy;function lj(){return hy||(hy=1,Jf.exports=rj()),Jf.exports}/**
11
11
  * @license React
12
12
  * react-dom-client.production.js
13
13
  *
@@ -15,255 +15,255 @@ import{r as z2,a as $2,b as y,j as a,d as cd,H as Bo,P as Lo,i as A_,B as M_,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 gy;function oj(){if(gy)return zr;gy=1;var t=ij(),s=z2(),o=$2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function 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 i=e,l=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){i=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(i.return!==l.return)i=f,l=h;else{for(var x=!1,N=f.child;N;){if(N===i){x=!0,i=f,l=h;break}if(N===l){x=!0,l=f,i=h;break}N=N.sibling}if(!x){for(N=h.child;N;){if(N===i){x=!0,i=h,l=f;break}if(N===l){x=!0,l=h,i=f;break}N=N.sibling}if(!x)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var 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"),M=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"),D=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 M: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 D: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 Me=ce(null),ot=ce(null),bt=ce(null),lt=ce(null);function Pe(e,n){switch(xe(bt,n),xe(ot,e),xe(Me,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?B0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=B0(n),e=L0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}me(Me),xe(Me,e)}function ke(){me(Me),me(ot),me(bt)}function ct(e){e.memoizedState!==null&&xe(lt,e);var n=Me.current,i=L0(n,e.type);n!==i&&(xe(ot,e),xe(Me,i))}function ue(e){ot.current===e&&(me(Me),me(ot)),lt.current===e&&(me(lt),Ir._currentValue=F)}var Re,Q;function nt(e){if(Re===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Q=-1<i.stack.indexOf(`
18
+ */var gy;function cj(){if(gy)return zr;gy=1;var t=lj(),s=$2(),o=H2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function 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 i=e,l=n;;){var f=i.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){i=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===i)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(i.return!==l.return)i=f,l=h;else{for(var k=!1,w=f.child;w;){if(w===i){k=!0,i=f,l=h;break}if(w===l){k=!0,l=f,i=h;break}w=w.sibling}if(!k){for(w=h.child;w;){if(w===i){k=!0,i=h,l=f;break}if(w===l){k=!0,l=h,i=f;break}w=w.sibling}if(!k)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),N=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 N: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),bt=ce(null),lt=ce(null);function Pe(e,n){switch(xe(bt,n),xe(ot,e),xe(De,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?B0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=B0(n),e=L0(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(bt)}function ct(e){e.memoizedState!==null&&xe(lt,e);var n=De.current,i=L0(n,e.type);n!==i&&(xe(ot,e),xe(De,i))}function ue(e){ot.current===e&&(me(De),me(ot)),lt.current===e&&(me(lt),Ir._currentValue=F)}var Re,Q;function nt(e){if(Re===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Q=-1<i.stack.indexOf(`
19
19
  at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Re+e+Q}var re=!1;function ve(e,n){if(!e||re)return"";re=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(J){var K=J}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(J){K=J}e.call(ie.prototype)}}else{try{throw Error()}catch(J){K=J}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(J){if(J&&K&&typeof J.stack=="string")return[J.stack,K.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),x=h[0],N=h[1];if(x&&N){var I=x.split(`
21
- `),G=N.split(`
20
+ `+Re+e+Q}var re=!1;function ve(e,n){if(!e||re)return"";re=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var 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(),k=h[0],w=h[1];if(k&&w){var I=k.split(`
21
+ `),G=w.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
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=i}return(i=e?e.displayName||e.name:"")?nt(i):""}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 an(e){try{var n="",i=null;do n+=et(e,i),i=e,e=e.return;while(e);return n}catch(l){return`
24
24
  Error generating stack: `+l.message+`
25
- `+l.stack}}var ks=Object.prototype.hasOwnProperty,ds=t.unstable_scheduleCallback,zs=t.unstable_cancelCallback,ga=t.unstable_shouldYield,Oi=t.unstable_requestPaint,Xt=t.unstable_now,Qa=t.unstable_getCurrentPriorityLevel,ei=t.unstable_ImmediatePriority,va=t.unstable_UserBlockingPriority,$s=t.unstable_NormalPriority,Ss=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Ve=t.log,_n=t.unstable_setDisableYieldValue,mn=null,Ut=null;function Cn(e){if(typeof Ve=="function"&&_n(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(mn,e)}catch{}}var Qt=Math.clz32?Math.clz32:zi,Bi=Math.log,Li=Math.LN2;function zi(e){return e>>>=0,e===0?32:31-(Bi(e)/Li|0)|0}var $i=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,i){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):i||(i=N&~e,i!==0&&(f=de(i))))):(N=l&~h,N!==0?f=de(N):x!==0?f=de(x):i||(i=l&~e,i!==0&&(f=de(i)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,i=n&-n,h>=i||h===32&&(i&4194048)!==0)?n:f}function 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=[],i=0;31>i;i++)n.push(e);return n}function Ue(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Mt(e,n,i,l,f,h){var x=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var N=e.entanglements,I=e.expirationTimes,G=e.hiddenUpdates;for(i=x&~i;0<i;){var X=31-Qt(i),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)}i&=~ie}l!==0&&qe(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function qe(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Qt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function on(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var l=31-Qt(i),f=1<<l;f&n|e[l]&n&&(e[l]|=n),i&=~f}}function En(e,n){var i=n&-n;return i=(i&42)!==0?1:_t(i),(i&(e.suspendedLanes|n))!==0?0:i}function _t(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 js(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Hi(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:oy(e.type))}function Ts(e,n){var i=B.p;try{return B.p=e,n()}finally{B.p=i}}var ws=Math.random().toString(36).slice(2),rn="__reactFiber$"+ws,xn="__reactProps$"+ws,Pi="__reactContainer$"+ws,$d="__reactEvents$"+ws,Nk="__reactListeners$"+ws,Ck="__reactHandles$"+ws,Sh="__reactResources$"+ws,Yo="__reactMarker$"+ws;function Hd(e){delete e[rn],delete e[xn],delete e[$d],delete e[Nk],delete e[Ck]}function Ui(e){var n=e[rn];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Pi]||i[rn]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=q0(e);e!==null;){if(i=e[rn])return i;e=q0(e)}return n}e=i,i=e.parentNode}return null}function Vi(e){if(e=e[rn]||e[Pi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Jo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function qi(e){var n=e[Sh];return n||(n=e[Sh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function en(e){e[Yo]=!0}var jh=new Set,Th={};function ti(e,n){Gi(e,n),Gi(e+"Capture",n)}function Gi(e,n){for(Th[e]=n,e=0;e<n.length;e++)jh.add(n[e])}var Ek=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]*$"),wh={},Nh={};function Ak(e){return ks.call(Nh,e)?!0:ks.call(wh,e)?!1:Ek.test(e)?Nh[e]=!0:(wh[e]=!0,!1)}function _l(e,n,i){if(Ak(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function xl(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function Hs(e,n,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+l)}}function Vn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ch(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Mk(e,n,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){i=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(x){i=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Pd(e){if(!e._valueTracker){var n=Ch(e)?"checked":"value";e._valueTracker=Mk(e,n,""+e[n])}}function Eh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return e&&(l=Ch(e)?e.checked?"true":"false":e.value),e=l,e!==i?(n.setValue(e),!0):!1}function kl(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 Dk=/[\n"\\]/g;function qn(e){return e.replace(Dk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ud(e,n,i,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=""+Vn(n)):e.value!==""+Vn(n)&&(e.value=""+Vn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Vd(e,x,Vn(n)):i!=null?Vd(e,x,Vn(i)):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=""+Vn(N):e.removeAttribute("name")}function Ah(e,n,i,l,f,h,x,N){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Pd(e);return}i=i!=null?""+Vn(i):"",n=n!=null?""+Vn(n):i,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),Pd(e)}function Vd(e,n,i){n==="number"&&kl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Fi(e,n,i,l){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Vn(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Mh(e,n,i){if(n!=null&&(n=""+Vn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Vn(i):""}function Dh(e,n,i,l){if(n==null){if(l!=null){if(i!=null)throw Error(r(92));if(se(l)){if(1<l.length)throw Error(r(93));l=l[0]}i=l}i==null&&(i=""),n=i}i=Vn(n),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Pd(e)}function Ki(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var Rk=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Rh(e,n,i){var l=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,i):typeof i!="number"||i===0||Rk.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function Ih(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&i[f]!==l&&Rh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&Rh(e,h,n[h])}function qd(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 Ik=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"]]),Ok=/^[\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 Sl(e){return Ok.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ps(){}var Gd=null;function Fd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zi=null,Yi=null;function Oh(e){var n=Vi(e);if(n&&(e=n.stateNode)){var i=e[xn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Ud(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+qn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var l=i[n];if(l!==e&&l.form===e.form){var f=l[xn]||null;if(!f)throw Error(r(90));Ud(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<i.length;n++)l=i[n],l.form===e.form&&Eh(l)}break e;case"textarea":Mh(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Fi(e,!!i.multiple,n,!1)}}}var Kd=!1;function Bh(e,n,i){if(Kd)return e(n,i);Kd=!0;try{var l=e(n);return l}finally{if(Kd=!1,(Zi!==null||Yi!==null)&&(dc(),Zi&&(n=Zi,e=Yi,Yi=Zi=null,Oh(n),e)))for(n=0;n<e.length;n++)Oh(e[n])}}function Wo(e,n){var i=e.stateNode;if(i===null)return null;var l=i[xn]||null;if(l===null)return null;i=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Us=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zd=!1;if(Us)try{var Xo={};Object.defineProperty(Xo,"passive",{get:function(){Zd=!0}}),window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{Zd=!1}var ya=null,Yd=null,jl=null;function Lh(){if(jl)return jl;var e,n=Yd,i=n.length,l,f="value"in ya?ya.value:ya.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var x=i-e;for(l=1;l<=x&&n[i-l]===f[h-l];l++);return jl=f.slice(e,1<l?1-l:void 0)}function Tl(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 wl(){return!0}function zh(){return!1}function kn(e){function n(i,l,f,h,x){this._reactName=i,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(i=e[N],this[N]=i?i(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?wl:zh,this.isPropagationStopped=zh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=wl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=wl)},persist:function(){},isPersistent:wl}),n}var ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nl=kn(ni),Qo=b({},ni,{view:0,detail:0}),Bk=kn(Qo),Jd,Wd,er,Cl=b({},Qo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==er&&(er&&e.type==="mousemove"?(Jd=e.screenX-er.screenX,Wd=e.screenY-er.screenY):Wd=Jd=0,er=e),Jd)},movementY:function(e){return"movementY"in e?e.movementY:Wd}}),$h=kn(Cl),Lk=b({},Cl,{dataTransfer:0}),zk=kn(Lk),$k=b({},Qo,{relatedTarget:0}),Xd=kn($k),Hk=b({},ni,{animationName:0,elapsedTime:0,pseudoElement:0}),Pk=kn(Hk),Uk=b({},ni,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Vk=kn(Uk),qk=b({},ni,{data:0}),Hh=kn(qk),Gk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fk={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"},Kk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Zk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Kk[e])?!!n[e]:!1}function Qd(){return Zk}var Yk=b({},Qo,{key:function(e){if(e.key){var n=Gk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Tl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Fk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qd,charCode:function(e){return e.type==="keypress"?Tl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Jk=kn(Yk),Wk=b({},Cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ph=kn(Wk),Xk=b({},Qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qd}),Qk=kn(Xk),eS=b({},ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),tS=kn(eS),nS=b({},Cl,{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}),sS=kn(nS),aS=b({},ni,{newState:0,oldState:0}),iS=kn(aS),oS=[9,13,27,32],eu=Us&&"CompositionEvent"in window,tr=null;Us&&"documentMode"in document&&(tr=document.documentMode);var rS=Us&&"TextEvent"in window&&!tr,Uh=Us&&(!eu||tr&&8<tr&&11>=tr),Vh=" ",qh=!1;function Gh(e,n){switch(e){case"keyup":return oS.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ji=!1;function lS(e,n){switch(e){case"compositionend":return Fh(n);case"keypress":return n.which!==32?null:(qh=!0,Vh);case"textInput":return e=n.data,e===Vh&&qh?null:e;default:return null}}function cS(e,n){if(Ji)return e==="compositionend"||!eu&&Gh(e,n)?(e=Lh(),jl=Yd=ya=null,Ji=!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 Uh&&n.locale!=="ko"?null:n.data;default:return null}}var dS={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 Kh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!dS[e.type]:n==="textarea"}function Zh(e,n,i,l){Zi?Yi?Yi.push(l):Yi=[l]:Zi=l,n=vc(n,"onChange"),0<n.length&&(i=new Nl("onChange","change",null,i,l),e.push({event:i,listeners:n}))}var nr=null,sr=null;function uS(e){A0(e,0)}function El(e){var n=Jo(e);if(Eh(n))return e}function Yh(e,n){if(e==="change")return n}var Jh=!1;if(Us){var tu;if(Us){var nu="oninput"in document;if(!nu){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),nu=typeof Wh.oninput=="function"}tu=nu}else tu=!1;Jh=tu&&(!document.documentMode||9<document.documentMode)}function Xh(){nr&&(nr.detachEvent("onpropertychange",Qh),sr=nr=null)}function Qh(e){if(e.propertyName==="value"&&El(sr)){var n=[];Zh(n,sr,e,Fd(e)),Bh(uS,n)}}function fS(e,n,i){e==="focusin"?(Xh(),nr=n,sr=i,nr.attachEvent("onpropertychange",Qh)):e==="focusout"&&Xh()}function pS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return El(sr)}function mS(e,n){if(e==="click")return El(n)}function hS(e,n){if(e==="input"||e==="change")return El(n)}function gS(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var An=typeof Object.is=="function"?Object.is:gS;function ar(e,n){if(An(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var f=i[l];if(!ks.call(n,f)||!An(e[f],n[f]))return!1}return!0}function eg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function tg(e,n){var i=eg(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=n&&l>=n)return{node:i,offset:n-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=eg(i)}}function ng(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?ng(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function sg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=kl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=kl(e.document)}return n}function su(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 vS=Us&&"documentMode"in document&&11>=document.documentMode,Wi=null,au=null,ir=null,iu=!1;function ag(e,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;iu||Wi==null||Wi!==kl(l)||(l=Wi,"selectionStart"in l&&su(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}),ir&&ar(ir,l)||(ir=l,l=vc(au,"onSelect"),0<l.length&&(n=new Nl("onSelect","select",null,n,i),e.push({event:n,listeners:l}),n.target=Wi)))}function si(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Xi={animationend:si("Animation","AnimationEnd"),animationiteration:si("Animation","AnimationIteration"),animationstart:si("Animation","AnimationStart"),transitionrun:si("Transition","TransitionRun"),transitionstart:si("Transition","TransitionStart"),transitioncancel:si("Transition","TransitionCancel"),transitionend:si("Transition","TransitionEnd")},ou={},ig={};Us&&(ig=document.createElement("div").style,"AnimationEvent"in window||(delete Xi.animationend.animation,delete Xi.animationiteration.animation,delete Xi.animationstart.animation),"TransitionEvent"in window||delete Xi.transitionend.transition);function ai(e){if(ou[e])return ou[e];if(!Xi[e])return e;var n=Xi[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in ig)return ou[e]=n[i];return e}var og=ai("animationend"),rg=ai("animationiteration"),lg=ai("animationstart"),yS=ai("transitionrun"),bS=ai("transitionstart"),_S=ai("transitioncancel"),cg=ai("transitionend"),dg=new Map,ru="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(" ");ru.push("scrollEnd");function us(e,n){dg.set(e,n),ti(n,[e])}var Al=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)},Gn=[],Qi=0,lu=0;function Ml(){for(var e=Qi,n=lu=Qi=0;n<e;){var i=Gn[n];Gn[n++]=null;var l=Gn[n];Gn[n++]=null;var f=Gn[n];Gn[n++]=null;var h=Gn[n];if(Gn[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&&ug(i,f,h)}}function Dl(e,n,i,l){Gn[Qi++]=e,Gn[Qi++]=n,Gn[Qi++]=i,Gn[Qi++]=l,lu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function cu(e,n,i,l){return Dl(e,n,i,l),Rl(e)}function ii(e,n){return Dl(e,null,null,n),Rl(e)}function ug(e,n,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var f=!1,h=e.return;h!==null;)h.childLanes|=i,l=h.alternate,l!==null&&(l.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Qt(i),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=i|536870912),h):null}function Rl(e){if(50<Nr)throw Nr=0,bf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var eo={};function xS(e,n,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mn(e,n,i,l){return new xS(e,n,i,l)}function du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vs(e,n){var i=e.alternate;return i===null?(i=Mn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function fg(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Il(e,n,i,l,f,h){var x=0;if(l=e,typeof e=="function")du(e)&&(x=1);else if(typeof e=="string")x=w2(e,i,Me.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=Mn(31,i,n,f),e.elementType=$,e.lanes=h,e;case j:return oi(i.children,f,h,n);case T:x=8,f|=24;break;case w:return e=Mn(12,i,n,f|2),e.elementType=w,e.lanes=h,e;case E:return e=Mn(13,i,n,f),e.elementType=E,e.lanes=h,e;case R:return e=Mn(19,i,n,f),e.elementType=R,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case M:x=10;break e;case C:x=9;break e;case A:x=11;break e;case O:x=14;break e;case D:x=16,l=null;break e}x=29,i=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Mn(x,i,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function oi(e,n,i,l){return e=Mn(7,e,l,n),e.lanes=i,e}function uu(e,n,i){return e=Mn(6,e,null,n),e.lanes=i,e}function pg(e){var n=Mn(18,null,null,0);return n.stateNode=e,n}function fu(e,n,i){return n=Mn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var mg=new WeakMap;function Fn(e,n){if(typeof e=="object"&&e!==null){var i=mg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:an(n)},mg.set(e,n),n)}return{value:e,source:n,stack:an(n)}}var to=[],no=0,Ol=null,or=0,Kn=[],Zn=0,ba=null,Ns=1,Cs="";function qs(e,n){to[no++]=or,to[no++]=Ol,Ol=e,or=n}function hg(e,n,i){Kn[Zn++]=Ns,Kn[Zn++]=Cs,Kn[Zn++]=ba,ba=e;var l=Ns;e=Cs;var f=32-Qt(l)-1;l&=~(1<<f),i+=1;var h=32-Qt(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,Ns=1<<32-Qt(n)+f|i<<f|l,Cs=h+e}else Ns=1<<h|i<<f|l,Cs=e}function pu(e){e.return!==null&&(qs(e,1),hg(e,1,0))}function mu(e){for(;e===Ol;)Ol=to[--no],to[no]=null,or=to[--no],to[no]=null;for(;e===ba;)ba=Kn[--Zn],Kn[Zn]=null,Cs=Kn[--Zn],Kn[Zn]=null,Ns=Kn[--Zn],Kn[Zn]=null}function gg(e,n){Kn[Zn++]=Ns,Kn[Zn++]=Cs,Kn[Zn++]=ba,Ns=n.id,Cs=n.overflow,ba=e}var ln=null,kt=null,Je=!1,_a=null,Yn=!1,hu=Error(r(519));function xa(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rr(Fn(n,e)),hu}function vg(e){var n=e.stateNode,i=e.type,l=e.memoizedProps;switch(n[rn]=e,n[xn]=l,i){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(i=0;i<Er.length;i++)Fe(Er[i],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Fe("invalid",n),Ah(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Fe("invalid",n);break;case"textarea":Fe("invalid",n),Dh(n,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||l.suppressHydrationWarning===!0||I0(n.textContent,i)?(l.popover!=null&&(Fe("beforetoggle",n),Fe("toggle",n)),l.onScroll!=null&&Fe("scroll",n),l.onScrollEnd!=null&&Fe("scrollend",n),l.onClick!=null&&(n.onclick=Ps),n=!0):n=!1,n||xa(e,!0)}function yg(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Yn=!1;return;case 27:case 3:Yn=!0;return;default:ln=ln.return}}function so(e){if(e!==ln)return!1;if(!Je)return yg(e),Je=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||If(e.type,e.memoizedProps)),i=!i),i&&kt&&xa(e),yg(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));kt=V0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));kt=V0(e)}else n===27?(n=kt,Oa(e.type)?(e=$f,$f=null,kt=e):kt=n):kt=ln?Wn(e.stateNode.nextSibling):null;return!0}function ri(){kt=ln=null,Je=!1}function gu(){var e=_a;return e!==null&&(wn===null?wn=e:wn.push.apply(wn,e),_a=null),e}function rr(e){_a===null?_a=[e]:_a.push(e)}var vu=ce(null),li=null,Gs=null;function ka(e,n,i){xe(vu,n._currentValue),n._currentValue=i}function Fs(e){e._currentValue=vu.current,me(vu)}function yu(e,n,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===i)break;e=e.return}}function bu(e,n,i,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|=i,N=h.alternate,N!==null&&(N.lanes|=i),yu(h.return,i,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|=i,h=x.alternate,h!==null&&(h.lanes|=i),yu(x,i,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 ao(e,n,i,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var N=f.type;An(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(Ir):e=[Ir])}f=f.return}e!==null&&bu(n,e,i,l),n.flags|=262144}function Bl(e){for(e=e.firstContext;e!==null;){if(!An(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ci(e){li=e,Gs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return bg(li,e)}function Ll(e,n){return li===null&&ci(e),bg(e,n)}function bg(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Gs===null){if(e===null)throw Error(r(308));Gs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Gs=Gs.next=n;return i}var kS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},SS=t.unstable_scheduleCallback,jS=t.unstable_NormalPriority,Vt={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _u(){return{controller:new kS,data:new Map,refCount:0}}function lr(e){e.refCount--,e.refCount===0&&SS(jS,function(){e.controller.abort()})}var cr=null,xu=0,io=0,oo=null;function TS(e,n){if(cr===null){var i=cr=[];xu=0,io=Tf(),oo={status:"pending",value:void 0,then:function(l){i.push(l)}}}return xu++,n.then(_g,_g),n}function _g(){if(--xu===0&&cr!==null){oo!==null&&(oo.status="fulfilled");var e=cr;cr=null,io=0,oo=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function wS(e,n){var i=[],l={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<i.length;f++)(0,i[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),l}var xg=H.S;H.S=function(e,n){a0=Xt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&TS(e,n),xg!==null&&xg(e,n)};var di=ce(null);function ku(){var e=di.current;return e!==null?e:vt.pooledCache}function zl(e,n){n===null?xe(di,di.current):xe(di,n.pool)}function kg(){var e=ku();return e===null?null:{parent:Vt._currentValue,pool:e}}var ro=Error(r(460)),Su=Error(r(474)),$l=Error(r(542)),Hl={then:function(){}};function Sg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jg(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Ps,Ps),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,wg(e),e;default:if(typeof n.status=="string")n.then(Ps,Ps);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,wg(e),e}throw fi=n,ro}}function ui(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(fi=i,ro):i}}var fi=null;function Tg(){if(fi===null)throw Error(r(459));var e=fi;return fi=null,e}function wg(e){if(e===ro||e===$l)throw Error(r(483))}var lo=null,dr=0;function Pl(e){var n=dr;return dr+=1,lo===null&&(lo=[]),jg(lo,e,n)}function ur(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ul(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 Ng(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function i(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=Vs(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=uu(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===D&&ui(we)===z.type)?(z=f(z,q.props),ur(z,q),z.return=P,z):(z=Il(q.type,q.key,q.props,null,P.mode,te),ur(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=fu(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=oi(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=uu(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return q=Il(z.type,z.key,z.props,null,P.mode,q),ur(q,z),q.return=P,q;case S:return z=fu(z,P.mode,q),z.return=P,z;case D:return z=ui(z),ie(P,z,q)}if(se(z)||ne(z))return z=oi(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ie(P,Pl(z),q);if(z.$$typeof===M)return ie(P,Ll(P,z),q);Ul(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 D:return q=ui(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,Pl(q),te);if(q.$$typeof===M)return K(P,z,Ll(P,q),te);Ul(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 D:return te=ui(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,Pl(te),we);if(te.$$typeof===M)return J(P,z,q,Ll(z,te),we);Ul(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 i(P,Se),Je&&qs(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&&qs(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(Ha){return n(P,Ha)}),Je&&qs(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 Ha=K(P,Se,at.value,te);if(Ha===null){Se===null&&(Se=Ze);break}e&&Se&&Ha.alternate===null&&n(P,Se),z=h(Ha,z,$e),st===null?we=Ha:st.sibling=Ha,st=Ha,Se=Ze}if(at.done)return i(P,Se),Je&&qs(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&&qs(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(L2){return n(P,L2)}),Je&&qs(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){i(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===D&&ui(we)===z.type){i(P,z.sibling),te=f(z,q.props),ur(te,q),te.return=P,P=te;break e}i(P,z);break}else n(P,z);z=z.sibling}q.type===j?(te=oi(q.props.children,P.mode,te,q.key),te.return=P,P=te):(te=Il(q.type,q.key,q.props,null,P.mode,te),ur(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){i(P,z.sibling),te=f(z,q.children||[]),te.return=P,P=te;break e}else{i(P,z);break}else n(P,z);z=z.sibling}te=fu(q,P.mode,te),te.return=P,P=te}return x(P);case D:return q=ui(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,Pl(q),te);if(q.$$typeof===M)return gt(P,z,Ll(P,q),te);Ul(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(i(P,z.sibling),te=f(z,q),te.return=P,P=te):(i(P,z),te=uu(q,P.mode,te),te.return=P,P=te),x(P)):i(P,z)}return function(P,z,q,te){try{dr=0;var we=gt(P,z,q,te);return lo=null,we}catch(Se){if(Se===ro||Se===$l)throw Se;var st=Mn(29,Se,null,P.mode);return st.lanes=te,st.return=P,st}finally{}}}var pi=Ng(!0),Cg=Ng(!1),Sa=!1;function ju(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tu(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 ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,n,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Rl(e),ug(e,null,i),n}return Dl(e,l,n,i),Rl(e)}function fr(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,on(e,i)}}function wu(e,n){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var f=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var x={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Nu=!1;function pr(){if(Nu){var e=oo;if(e!==null)throw e}}function mr(e,n,i,l){Nu=!1;var f=e.updateQueue;Sa=!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===io&&(Nu=!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=i;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:Sa=!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),Aa|=x,e.lanes=x,e.memoizedState=ie}}function Eg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Ag(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Eg(i[e],n)}var co=ce(null),Vl=ce(0);function Mg(e,n){e=ta,xe(Vl,e),xe(co,n),ta=e|n.baseLanes}function Cu(){xe(Vl,ta),xe(co,co.current)}function Eu(){ta=Vl.current,me(co),me(Vl)}var Dn=ce(null),Jn=null;function wa(e){var n=e.alternate;xe(Ot,Ot.current&1),xe(Dn,e),Jn===null&&(n===null||co.current!==null||n.memoizedState!==null)&&(Jn=e)}function Au(e){xe(Ot,Ot.current),xe(Dn,e),Jn===null&&(Jn=e)}function Dg(e){e.tag===22?(xe(Ot,Ot.current),xe(Dn,e),Jn===null&&(Jn=e)):Na()}function Na(){xe(Ot,Ot.current),xe(Dn,Dn.current)}function Rn(e){me(Dn),Jn===e&&(Jn=null),me(Ot)}var Ot=ce(0);function ql(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Lf(i)||zf(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ks=0,ze=null,mt=null,qt=null,Gl=!1,uo=!1,mi=!1,Fl=0,hr=0,fo=null,NS=0;function Dt(){throw Error(r(321))}function Mu(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!An(e[i],n[i]))return!1;return!0}function Du(e,n,i,l,f,h){return Ks=h,ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?hv:Ku,mi=!1,h=i(l,f),mi=!1,uo&&(h=Ig(n,i,l,f)),Rg(e),h}function Rg(e){H.H=yr;var n=mt!==null&&mt.next!==null;if(Ks=0,qt=mt=ze=null,Gl=!1,hr=0,fo=null,n)throw Error(r(300));e===null||Gt||(e=e.dependencies,e!==null&&Bl(e)&&(Gt=!0))}function Ig(e,n,i,l){ze=e;var f=0;do{if(uo&&(fo=null),hr=0,uo=!1,25<=f)throw Error(r(301));if(f+=1,qt=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=gv,h=n(i,l)}while(uo);return h}function CS(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?gr(n):n,e=e.useState()[0],(mt!==null?mt.memoizedState:null)!==e&&(ze.flags|=1024),n}function Ru(){var e=Fl!==0;return Fl=0,e}function Iu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function Ou(e){if(Gl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Gl=!1}Ks=0,qt=mt=ze=null,uo=!1,hr=Fl=0,fo=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?ze.memoizedState=qt=e:qt=qt.next=e,qt}function Bt(){if(mt===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=mt.next;var n=qt===null?ze.memoizedState:qt.next;if(n!==null)qt=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},qt===null?ze.memoizedState=qt=e:qt=qt.next=e}return qt}function Kl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gr(e){var n=hr;return hr+=1,fo===null&&(fo=[]),e=jg(fo,e,n),n=ze,(qt===null?n.memoizedState:qt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?hv:Ku),e}function Zl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return gr(e);if(e.$$typeof===M)return cn(e)}throw Error(r(438,String(e)))}function Bu(e){var n=null,i=ze.updateQueue;if(i!==null&&(n=i.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}),i===null&&(i=Kl(),ze.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),l=0;l<e;l++)i[l]=Y;return n.index++,i}function Zs(e,n){return typeof n=="function"?n(e):n}function Yl(e){var n=Bt();return Lu(n,mt,e)}function Lu(e,n,i){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var 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:(Ks&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===io&&(X=!0);else if((Ks&K)===K){G=G.next,K===io&&(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,Aa|=K;ie=G.action,mi&&i(h,ie),h=G.hasEagerState?G.eagerState:i(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,Aa|=ie;G=G.next}while(G!==null&&G!==n);if(I===null?x=h:I.next=N,!An(h,e.memoizedState)&&(Gt=!0,X&&(i=oo,i!==null)))throw i;e.memoizedState=h,e.baseState=x,e.baseQueue=I,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function zu(e){var n=Bt(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var l=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);An(h,n.memoizedState)||(Gt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,l]}function Og(e,n,i){var l=ze,f=Bt(),h=Je;if(h){if(i===void 0)throw Error(r(407));i=i()}else i=n();var x=!An((mt||f).memoizedState,i);if(x&&(f.memoizedState=i,Gt=!0),f=f.queue,Pu(zg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||qt!==null&&qt.memoizedState.tag&1){if(l.flags|=2048,po(9,{destroy:void 0},Lg.bind(null,l,f,i,n),null),vt===null)throw Error(r(349));h||(Ks&127)!==0||Bg(l,n,i)}return i}function Bg(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=ze.updateQueue,n===null?(n=Kl(),ze.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Lg(e,n,i,l){n.value=i,n.getSnapshot=l,$g(n)&&Hg(e)}function zg(e,n,i){return i(function(){$g(n)&&Hg(e)})}function $g(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!An(e,i)}catch{return!0}}function Hg(e){var n=ii(e,2);n!==null&&Nn(n,e,2)}function $u(e){var n=vn();if(typeof e=="function"){var i=e;if(e=i(),mi){Cn(!0);try{i()}finally{Cn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:e},n}function Pg(e,n,i,l){return e.baseState=i,Lu(e,mt,typeof l=="function"?l:Zs)}function ES(e,n,i,l,f){if(Xl(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?i(!0):h.isTransition=!1,l(h),i=n.pending,i===null?(h.next=n.pending=h,Ug(n,h)):(h.next=i.next,n.pending=i.next=h)}}function Ug(e,n){var i=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=H.T,x={};H.T=x;try{var N=i(f,l),I=H.S;I!==null&&I(x,N),Vg(e,n,N)}catch(G){Hu(e,n,G)}finally{h!==null&&x.types!==null&&(h.types=x.types),H.T=h}}else try{h=i(f,l),Vg(e,n,h)}catch(G){Hu(e,n,G)}}function Vg(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){qg(e,n,l)},function(l){return Hu(e,n,l)}):qg(e,n,i)}function qg(e,n,i){n.status="fulfilled",n.value=i,Gg(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Ug(e,i)))}function Hu(e,n,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=i,Gg(n),n=n.next;while(n!==l)}e.action=null}function Gg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Fg(e,n){return n}function Kg(e,n){if(Je){var i=vt.formState;if(i!==null){e:{var l=ze;if(Je){if(kt){t:{for(var f=kt,h=Yn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Wn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){kt=Wn(f.nextSibling),l=f.data==="F!";break e}}xa(l)}l=!1}l&&(n=i[0])}}return i=vn(),i.memoizedState=i.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fg,lastRenderedState:n},i.queue=l,i=fv.bind(null,ze,l),l.dispatch=i,l=$u(!1),h=Fu.bind(null,ze,!1,l.queue),l=vn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,i=ES.bind(null,ze,f,h,i),f.dispatch=i,l.memoizedState=e,[n,i,!1]}function Zg(e){var n=Bt();return Yg(n,mt,e)}function Yg(e,n,i){if(n=Lu(e,n,Fg)[0],e=Yl(Zs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=gr(n)}catch(x){throw x===ro?$l:x}else l=n;n=Bt();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(ze.flags|=2048,po(9,{destroy:void 0},AS.bind(null,f,i),null)),[l,h,e]}function AS(e,n){e.action=n}function Jg(e){var n=Bt(),i=mt;if(i!==null)return Yg(n,i,e);Bt(),n=n.memoizedState,i=Bt();var l=i.queue.dispatch;return i.memoizedState=e,[n,l,!1]}function po(e,n,i,l){return e={tag:e,create:i,deps:l,inst:n,next:null},n=ze.updateQueue,n===null&&(n=Kl(),ze.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,n.lastEffect=e),e}function Wg(){return Bt().memoizedState}function Jl(e,n,i,l){var f=vn();ze.flags|=e,f.memoizedState=po(1|n,{destroy:void 0},i,l===void 0?null:l)}function Wl(e,n,i,l){var f=Bt();l=l===void 0?null:l;var h=f.memoizedState.inst;mt!==null&&l!==null&&Mu(l,mt.memoizedState.deps)?f.memoizedState=po(n,h,i,l):(ze.flags|=e,f.memoizedState=po(1|n,h,i,l))}function Xg(e,n){Jl(8390656,8,e,n)}function Pu(e,n){Wl(2048,8,e,n)}function MS(e){ze.flags|=4;var n=ze.updateQueue;if(n===null)n=Kl(),ze.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function Qg(e){var n=Bt().memoizedState;return MS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function ev(e,n){return Wl(4,2,e,n)}function tv(e,n){return Wl(4,4,e,n)}function nv(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function sv(e,n,i){i=i!=null?i.concat([e]):null,Wl(4,4,nv.bind(null,n,e),i)}function Uu(){}function av(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;return n!==null&&Mu(n,l[1])?l[0]:(i.memoizedState=[e,n],e)}function iv(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;if(n!==null&&Mu(n,l[1]))return l[0];if(l=e(),mi){Cn(!0);try{e()}finally{Cn(!1)}}return i.memoizedState=[l,n],l}function Vu(e,n,i){return i===void 0||(Ks&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=o0(),ze.lanes|=e,Aa|=e,i)}function ov(e,n,i,l){return An(i,n)?i:co.current!==null?(e=Vu(e,i,l),An(e,n)||(Gt=!0),e):(Ks&42)===0||(Ks&1073741824)!==0&&(Ke&261930)===0?(Gt=!0,e.memoizedState=i):(e=o0(),ze.lanes|=e,Aa|=e,n)}function rv(e,n,i,l,f){var h=B.p;B.p=h!==0&&8>h?h:8;var x=H.T,N={};H.T=N,Fu(e,!1,n,i);try{var I=f(),G=H.S;if(G!==null&&G(N,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var X=wS(I,l);vr(e,n,X,Bn(e))}else vr(e,n,l,Bn(e))}catch(ie){vr(e,n,{then:function(){},status:"rejected",reason:ie},Bn())}finally{B.p=h,x!==null&&N.types!==null&&(x.types=N.types),H.T=x}}function DS(){}function qu(e,n,i,l){if(e.tag!==5)throw Error(r(476));var f=lv(e).queue;rv(e,f,n,F,i===null?DS:function(){return cv(e),i(l)})}function lv(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:Zs,lastRenderedState:F},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function cv(e){var n=lv(e);n.next===null&&(n=e.alternate.memoizedState),vr(e,n.next.queue,{},Bn())}function Gu(){return cn(Ir)}function dv(){return Bt().memoizedState}function uv(){return Bt().memoizedState}function RS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Bn();e=ja(i);var l=Ta(n,e,i);l!==null&&(Nn(l,n,i),fr(l,n,i)),n={cache:_u()},e.payload=n;return}n=n.return}}function IS(e,n,i){var l=Bn();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Xl(e)?pv(n,i):(i=cu(e,n,i,l),i!==null&&(Nn(i,e,l),mv(i,n,l)))}function fv(e,n,i){var l=Bn();vr(e,n,i,l)}function vr(e,n,i,l){var f={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xl(e))pv(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,i);if(f.hasEagerState=!0,f.eagerState=N,An(N,x))return Dl(e,n,f,0),vt===null&&Ml(),!1}catch{}finally{}if(i=cu(e,n,f,l),i!==null)return Nn(i,e,l),mv(i,n,l),!0}return!1}function Fu(e,n,i,l){if(l={lane:2,revertLane:Tf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Xl(e)){if(n)throw Error(r(479))}else n=cu(e,i,l,2),n!==null&&Nn(n,e,2)}function Xl(e){var n=e.alternate;return e===ze||n!==null&&n===ze}function pv(e,n){uo=Gl=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function mv(e,n,i){if((i&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,on(e,i)}}var yr={readContext:cn,use:Zl,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};yr.useEffectEvent=Dt;var hv={readContext:cn,use:Zl,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:Xg,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Jl(4194308,4,nv.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Jl(4194308,4,e,n)},useInsertionEffect:function(e,n){Jl(4,2,e,n)},useMemo:function(e,n){var i=vn();n=n===void 0?null:n;var l=e();if(mi){Cn(!0);try{e()}finally{Cn(!1)}}return i.memoizedState=[l,n],l},useReducer:function(e,n,i){var l=vn();if(i!==void 0){var f=i(n);if(mi){Cn(!0);try{i(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=IS.bind(null,ze,e),[l.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=$u(e);var n=e.queue,i=fv.bind(null,ze,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Uu,useDeferredValue:function(e,n){var i=vn();return Vu(i,e,n)},useTransition:function(){var e=$u(!1);return e=rv.bind(null,ze,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var l=ze,f=vn();if(Je){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),vt===null)throw Error(r(349));(Ke&127)!==0||Bg(l,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,Xg(zg.bind(null,l,h,e),[e]),l.flags|=2048,po(9,{destroy:void 0},Lg.bind(null,l,h,i,n),null),i},useId:function(){var e=vn(),n=vt.identifierPrefix;if(Je){var i=Cs,l=Ns;i=(l&~(1<<32-Qt(l)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Fl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=NS++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Gu,useFormState:Kg,useActionState:Kg,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=Fu.bind(null,ze,!0,i),i.dispatch=n,[e,n]},useMemoCache:Bu,useCacheRefresh:function(){return vn().memoizedState=RS.bind(null,ze)},useEffectEvent:function(e){var n=vn(),i={impl:e};return n.memoizedState=i,function(){if((rt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Ku={readContext:cn,use:Zl,useCallback:av,useContext:cn,useEffect:Pu,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:Yl,useRef:Wg,useState:function(){return Yl(Zs)},useDebugValue:Uu,useDeferredValue:function(e,n){var i=Bt();return ov(i,mt.memoizedState,e,n)},useTransition:function(){var e=Yl(Zs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:gr(e),n]},useSyncExternalStore:Og,useId:dv,useHostTransitionStatus:Gu,useFormState:Zg,useActionState:Zg,useOptimistic:function(e,n){var i=Bt();return Pg(i,mt,e,n)},useMemoCache:Bu,useCacheRefresh:uv};Ku.useEffectEvent=Qg;var gv={readContext:cn,use:Zl,useCallback:av,useContext:cn,useEffect:Pu,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:zu,useRef:Wg,useState:function(){return zu(Zs)},useDebugValue:Uu,useDeferredValue:function(e,n){var i=Bt();return mt===null?Vu(i,e,n):ov(i,mt.memoizedState,e,n)},useTransition:function(){var e=zu(Zs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:gr(e),n]},useSyncExternalStore:Og,useId:dv,useHostTransitionStatus:Gu,useFormState:Jg,useActionState:Jg,useOptimistic:function(e,n){var i=Bt();return mt!==null?Pg(i,mt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Bu,useCacheRefresh:uv};gv.useEffectEvent=Qg;function Zu(e,n,i,l){n=e.memoizedState,i=i(l,n),i=i==null?n:b({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Yu={enqueueSetState:function(e,n,i){e=e._reactInternals;var l=Bn(),f=ja(l);f.payload=n,i!=null&&(f.callback=i),n=Ta(e,f,l),n!==null&&(Nn(n,e,l),fr(n,e,l))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var l=Bn(),f=ja(l);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=Ta(e,f,l),n!==null&&(Nn(n,e,l),fr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Bn(),l=ja(i);l.tag=2,n!=null&&(l.callback=n),n=Ta(e,l,i),n!==null&&(Nn(n,e,i),fr(n,e,i))}};function vv(e,n,i,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!ar(i,l)||!ar(f,h):!0}function yv(e,n,i,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,l),n.state!==e&&Yu.enqueueReplaceState(n,n.state,null)}function hi(e,n){var i=n;if("ref"in n){i={};for(var l in n)l!=="ref"&&(i[l]=n[l])}if(e=e.defaultProps){i===n&&(i=b({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function bv(e){Al(e)}function _v(e){console.error(e)}function xv(e){Al(e)}function Ql(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function kv(e,n,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Ju(e,n,i){return i=ja(i),i.tag=3,i.payload={element:null},i.callback=function(){Ql(e,n)},i}function Sv(e){return e=ja(e),e.tag=3,e}function jv(e,n,i,l){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){kv(n,i,l)}}var x=i.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){kv(n,i,l),typeof f!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var N=l.stack;this.componentDidCatch(l.value,{componentStack:N!==null?N:""})})}function OS(e,n,i,l,f){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=i.alternate,n!==null&&ao(n,i,f,!0),i=Dn.current,i!==null){switch(i.tag){case 31:case 13:return Jn===null?uc():i.alternate===null&&Rt===0&&(Rt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,l===Hl?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([l]):n.add(l),kf(e,l,f)),!1;case 22:return i.flags|=65536,l===Hl?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([l]):i.add(l)),kf(e,l,f)),!1}throw Error(r(435,i.tag))}return kf(e,l,f),uc(),!1}if(Je)return n=Dn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==hu&&(e=Error(r(422),{cause:l}),rr(Fn(e,i)))):(l!==hu&&(n=Error(r(423),{cause:l}),rr(Fn(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Fn(l,i),f=Ju(e.stateNode,l,f),wu(e,f),Rt!==4&&(Rt=2)),!1;var h=Error(r(520),{cause:l});if(h=Fn(h,i),wr===null?wr=[h]:wr.push(h),Rt!==4&&(Rt=2),n===null)return!0;l=Fn(l,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=f&-f,i.lanes|=e,e=Ju(i.stateNode,l,e),wu(i,e),!1;case 1:if(n=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ma===null||!Ma.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=Sv(f),jv(f,e,i,l),wu(i,f),!1}i=i.return}while(i!==null);return!1}var Wu=Error(r(461)),Gt=!1;function dn(e,n,i,l){n.child=e===null?Cg(n,null,i,l):pi(n,e.child,i,l)}function Tv(e,n,i,l,f){i=i.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 ci(n),l=Du(e,n,i,x,h,f),N=Ru(),e!==null&&!Gt?(Iu(e,n,f),Ys(e,n,f)):(Je&&N&&pu(n),n.flags|=1,dn(e,n,l,f),n.child)}function wv(e,n,i,l,f){if(e===null){var h=i.type;return typeof h=="function"&&!du(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,Nv(e,n,h,l,f)):(e=Il(i.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!of(e,f)){var x=h.memoizedProps;if(i=i.compare,i=i!==null?i:ar,i(x,l)&&e.ref===n.ref)return Ys(e,n,f)}return n.flags|=1,e=Vs(h,l),e.ref=n.ref,e.return=n,n.child=e}function Nv(e,n,i,l,f){if(e!==null){var h=e.memoizedProps;if(ar(h,l)&&e.ref===n.ref)if(Gt=!1,n.pendingProps=l=h,of(e,f))(e.flags&131072)!==0&&(Gt=!0);else return n.lanes=e.lanes,Ys(e,n,f)}return Xu(e,n,i,l,f)}function Cv(e,n,i,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return Ev(e,n,h,i,l)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&zl(n,h!==null?h.cachePool:null),h!==null?Mg(n,h):Cu(),Dg(n);else return l=n.lanes=536870912,Ev(e,n,h!==null?h.baseLanes|i:i,i,l)}else h!==null?(zl(n,h.cachePool),Mg(n,h),Na(),n.memoizedState=null):(e!==null&&zl(n,null),Cu(),Na());return dn(e,n,f,i),n.child}function br(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Ev(e,n,i,l,f){var h=ku();return h=h===null?null:{parent:Vt._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&zl(n,null),Cu(),Dg(n),e!==null&&ao(e,n,l,!0),n.childLanes=f,null}function ec(e,n){return n=nc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Av(e,n,i){return pi(n,e.child,null,i),e=ec(n,n.pendingProps),e.flags|=2,Rn(n),n.memoizedState=null,e}function BS(e,n,i){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=ec(n,l),n.lanes=536870912,br(null,e);if(Au(n),(e=kt)?(e=U0(e,Yn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ba!==null?{id:Ns,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=pg(e),i.return=n,n.child=i,ln=n,kt=null)):e=null,e===null)throw xa(n);return n.lanes=536870912,null}return ec(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(Au(n),f)if(n.flags&256)n.flags&=-257,n=Av(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Gt||ao(e,n,i,!1),f=(i&e.childLanes)!==0,Gt||f){if(l=vt,l!==null&&(x=En(l,i),x!==0&&x!==h.retryLane))throw h.retryLane=x,ii(e,x),Nn(l,e,x),Wu;uc(),n=Av(e,n,i)}else e=h.treeContext,kt=Wn(x.nextSibling),ln=n,Je=!0,_a=null,Yn=!1,e!==null&&gg(n,e),n=ec(n,l),n.flags|=4096;return n}return e=Vs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function tc(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function Xu(e,n,i,l,f){return ci(n),i=Du(e,n,i,l,void 0,f),l=Ru(),e!==null&&!Gt?(Iu(e,n,f),Ys(e,n,f)):(Je&&l&&pu(n),n.flags|=1,dn(e,n,i,f),n.child)}function Mv(e,n,i,l,f,h){return ci(n),n.updateQueue=null,i=Ig(n,l,i,f),Rg(e),l=Ru(),e!==null&&!Gt?(Iu(e,n,h),Ys(e,n,h)):(Je&&l&&pu(n),n.flags|=1,dn(e,n,i,h),n.child)}function Dv(e,n,i,l,f){if(ci(n),n.stateNode===null){var h=eo,x=i.contextType;typeof x=="object"&&x!==null&&(h=cn(x)),h=new i(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Yu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},ju(n),x=i.contextType,h.context=typeof x=="object"&&x!==null?cn(x):eo,h.state=n.memoizedState,x=i.getDerivedStateFromProps,typeof x=="function"&&(Zu(n,i,x,l),h.state=n.memoizedState),typeof i.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&&Yu.enqueueReplaceState(h,h.state,null),mr(n,l,h,f),pr(),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=hi(i,N);h.props=I;var G=h.context,X=i.contextType;x=eo,typeof X=="object"&&X!==null&&(x=cn(X));var ie=i.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)&&yv(n,h,l,x),Sa=!1;var K=n.memoizedState;h.state=K,mr(n,l,h,f),pr(),G=n.memoizedState,N||K!==G||Sa?(typeof ie=="function"&&(Zu(n,i,ie,l),G=n.memoizedState),(I=Sa||vv(n,i,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,Tu(e,n),x=n.memoizedProps,X=hi(i,x),h.props=X,ie=n.pendingProps,K=h.context,G=i.contextType,I=eo,typeof G=="object"&&G!==null&&(I=cn(G)),N=i.getDerivedStateFromProps,(G=typeof N=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==ie||K!==I)&&yv(n,h,l,I),Sa=!1,K=n.memoizedState,h.state=K,mr(n,l,h,f),pr();var J=n.memoizedState;x!==ie||K!==J||Sa||e!==null&&e.dependencies!==null&&Bl(e.dependencies)?(typeof N=="function"&&(Zu(n,i,N,l),J=n.memoizedState),(X=Sa||vv(n,i,X,l,K,J,I)||e!==null&&e.dependencies!==null&&Bl(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,tc(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=pi(n,e.child,null,f),n.child=pi(n,null,i,f)):dn(e,n,i,f),n.memoizedState=h.state,e=n.child):e=Ys(e,n,f),e}function Rv(e,n,i,l){return ri(),n.flags|=256,dn(e,n,i,l),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ef(e){return{baseLanes:e,cachePool:kg()}}function tf(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=On),e}function Iv(e,n,i){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Je){if(f?wa(n):Na(),(e=kt)?(e=U0(e,Yn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ba!==null?{id:Ns,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=pg(e),i.return=n,n.child=i,ln=n,kt=null)):e=null,e===null)throw xa(n);return zf(e)?n.lanes=32:n.lanes=536870912,null}var N=l.children;return l=l.fallback,f?(Na(),f=n.mode,N=nc({mode:"hidden",children:N},f),l=oi(l,f,i,null),N.return=n,l.return=n,N.sibling=l,n.child=N,l=n.child,l.memoizedState=ef(i),l.childLanes=tf(e,x,i),n.memoizedState=Qu,br(null,l)):(wa(n),nf(n,N))}var I=e.memoizedState;if(I!==null&&(N=I.dehydrated,N!==null)){if(h)n.flags&256?(wa(n),n.flags&=-257,n=sf(e,n,i)):n.memoizedState!==null?(Na(),n.child=e.child,n.flags|=128,n=null):(Na(),N=l.fallback,f=n.mode,l=nc({mode:"visible",children:l.children},f),N=oi(N,f,i,null),N.flags|=2,l.return=n,N.return=n,l.sibling=N,n.child=l,pi(n,e.child,null,i),l=n.child,l.memoizedState=ef(i),l.childLanes=tf(e,x,i),n.memoizedState=Qu,n=br(null,l));else if(wa(n),zf(N)){if(x=N.nextSibling&&N.nextSibling.dataset,x)var G=x.dgst;x=G,l=Error(r(419)),l.stack="",l.digest=x,rr({value:l,source:null,stack:null}),n=sf(e,n,i)}else if(Gt||ao(e,n,i,!1),x=(i&e.childLanes)!==0,Gt||x){if(x=vt,x!==null&&(l=En(x,i),l!==0&&l!==I.retryLane))throw I.retryLane=l,ii(e,l),Nn(x,e,l),Wu;Lf(N)||uc(),n=sf(e,n,i)}else Lf(N)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,kt=Wn(N.nextSibling),ln=n,Je=!0,_a=null,Yn=!1,e!==null&&gg(n,e),n=nf(n,l.children),n.flags|=4096);return n}return f?(Na(),N=l.fallback,f=n.mode,I=e.child,G=I.sibling,l=Vs(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,G!==null?N=Vs(G,N):(N=oi(N,f,i,null),N.flags|=2),N.return=n,l.return=n,l.sibling=N,n.child=l,br(null,l),l=n.child,N=e.child.memoizedState,N===null?N=ef(i):(f=N.cachePool,f!==null?(I=Vt._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=kg(),N={baseLanes:N.baseLanes|i,cachePool:f}),l.memoizedState=N,l.childLanes=tf(e,x,i),n.memoizedState=Qu,br(e.child,l)):(wa(n),i=e.child,e=i.sibling,i=Vs(i,{mode:"visible",children:l.children}),i.return=n,i.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=i,n.memoizedState=null,i)}function nf(e,n){return n=nc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function nc(e,n){return e=Mn(22,e,null,n),e.lanes=0,e}function sf(e,n,i){return pi(n,e.child,null,i),e=nf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ov(e,n,i){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),yu(e.return,n,i)}function af(e,n,i,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=i,x.tailMode=f,x.treeForkCount=h)}function Bv(e,n,i){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=Ot.current,N=(x&2)!==0;if(N?(x=x&1|2,n.flags|=128):x&=1,xe(Ot,x),dn(e,n,l,i),l=Je?or:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ov(e,i,n);else if(e.tag===19)Ov(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(i=n.child,f=null;i!==null;)e=i.alternate,e!==null&&ql(e)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),af(n,!1,f,i,h,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&ql(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}af(n,!0,i,null,h,l);break;case"together":af(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ys(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Aa|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(ao(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Vs(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Vs(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function of(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Bl(e)))}function LS(e,n,i){switch(n.tag){case 3:Pe(n,n.stateNode.containerInfo),ka(n,Vt,e.memoizedState.cache),ri();break;case 27:case 5:ct(n);break;case 4:Pe(n,n.stateNode.containerInfo);break;case 10:ka(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Au(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(wa(n),n.flags|=128,null):(i&n.child.childLanes)!==0?Iv(e,n,i):(wa(n),e=Ys(e,n,i),e!==null?e.sibling:null);wa(n);break;case 19:var f=(e.flags&128)!==0;if(l=(i&n.childLanes)!==0,l||(ao(e,n,i,!1),l=(i&n.childLanes)!==0),f){if(l)return Bv(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),xe(Ot,Ot.current),l)break;return null;case 22:return n.lanes=0,Cv(e,n,i,n.pendingProps);case 24:ka(n,Vt,e.memoizedState.cache)}return Ys(e,n,i)}function Lv(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Gt=!0;else{if(!of(e,i)&&(n.flags&128)===0)return Gt=!1,LS(e,n,i);Gt=(e.flags&131072)!==0}else Gt=!1,Je&&(n.flags&1048576)!==0&&hg(n,or,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ui(n.elementType),n.type=e,typeof e=="function")du(e)?(l=hi(e,l),n.tag=1,n=Dv(null,n,e,l,i)):(n.tag=0,n=Xu(null,n,e,l,i));else{if(e!=null){var f=e.$$typeof;if(f===A){n.tag=11,n=Tv(null,n,e,l,i);break e}else if(f===O){n.tag=14,n=wv(null,n,e,l,i);break e}}throw n=Z(e)||e,Error(r(306,n,""))}}return n;case 0:return Xu(e,n,n.type,n.pendingProps,i);case 1:return l=n.type,f=hi(l,n.pendingProps),Dv(e,n,l,f,i);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,Tu(e,n),mr(n,l,null,i);var x=n.memoizedState;if(l=x.cache,ka(n,Vt,l),l!==h.cache&&bu(n,[Vt],i,!0),pr(),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=Rv(e,n,l,i);break e}else if(l!==f){f=Fn(Error(r(424)),n),rr(f),n=Rv(e,n,l,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(kt=Wn(e.firstChild),ln=n,Je=!0,_a=null,Yn=!0,i=Cg(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(ri(),l===f){n=Ys(e,n,i);break e}dn(e,n,l,i)}n=n.child}return n;case 26:return tc(e,n),e===null?(i=Z0(n.type,null,n.pendingProps,null))?n.memoizedState=i:Je||(i=n.type,e=n.pendingProps,l=yc(bt.current).createElement(i),l[rn]=n,l[xn]=e,un(l,i,e),en(l),n.stateNode=l):n.memoizedState=Z0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ct(n),e===null&&Je&&(l=n.stateNode=G0(n.type,n.pendingProps,bt.current),ln=n,Yn=!0,f=kt,Oa(n.type)?($f=f,kt=Wn(l.firstChild)):kt=f),dn(e,n,n.pendingProps.children,i),tc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Je&&((f=l=kt)&&(l=p2(l,n.type,n.pendingProps,Yn),l!==null?(n.stateNode=l,ln=n,kt=Wn(l.firstChild),Yn=!1,f=!0):f=!1),f||xa(n)),ct(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,If(f,h)?l=null:x!==null&&If(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=Du(e,n,CS,null,null,i),Ir._currentValue=f),tc(e,n),dn(e,n,l,i),n.child;case 6:return e===null&&Je&&((e=i=kt)&&(i=m2(i,n.pendingProps,Yn),i!==null?(n.stateNode=i,ln=n,kt=null,e=!0):e=!1),e||xa(n)),null;case 13:return Iv(e,n,i);case 4:return Pe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=pi(n,null,l,i):dn(e,n,l,i),n.child;case 11:return Tv(e,n,n.type,n.pendingProps,i);case 7:return dn(e,n,n.pendingProps,i),n.child;case 8:return dn(e,n,n.pendingProps.children,i),n.child;case 12:return dn(e,n,n.pendingProps.children,i),n.child;case 10:return l=n.pendingProps,ka(n,n.type,l.value),dn(e,n,l.children,i),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ci(n),f=cn(f),l=l(f),n.flags|=1,dn(e,n,l,i),n.child;case 14:return wv(e,n,n.type,n.pendingProps,i);case 15:return Nv(e,n,n.type,n.pendingProps,i);case 19:return Bv(e,n,i);case 31:return BS(e,n,i);case 22:return Cv(e,n,i,n.pendingProps);case 24:return ci(n),l=cn(Vt),e===null?(f=ku(),f===null&&(f=vt,h=_u(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:l,cache:f},ju(n),ka(n,Vt,f)):((e.lanes&i)!==0&&(Tu(e,n),mr(n,null,null,i),pr()),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),ka(n,Vt,l)):(l=h.cache,ka(n,Vt,l),l!==f.cache&&bu(n,[Vt],i,!0))),dn(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Js(e){e.flags|=4}function rf(e,n,i,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(d0())e.flags|=8192;else throw fi=Hl,Su}else e.flags&=-16777217}function zv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Q0(n))if(d0())e.flags|=8192;else throw fi=Hl,Su}function sc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?je():536870912,e.lanes|=n,vo|=n)}function _r(e,n){if(!Je)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function St(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=i,n}function zS(e,n,i){var l=n.pendingProps;switch(mu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return i=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Fs(Vt),ke(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(so(n)?Js(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,gu())),St(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Js(n),h!==null?(St(n),zv(n,h)):(St(n),rf(n,f,null,l,i))):h?h!==e.memoizedState?(Js(n),St(n),zv(n,h)):(St(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Js(n),St(n),rf(n,f,e,l,i)),null;case 27:if(ue(n),i=bt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return St(n),null}e=Me.current,so(n)?vg(n):(e=G0(f,l,i),n.stateNode=e,Js(n))}return St(n),null;case 5:if(ue(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return St(n),null}if(h=Me.current,so(n))vg(n);else{var x=yc(bt.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&&Js(n)}}return St(n),rf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=bt.current,so(n)){if(e=n.stateNode,i=n.memoizedProps,l=null,f=ln,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[rn]=n,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||I0(e.nodeValue,i)),e||xa(n,!0)}else e=yc(e).createTextNode(l),e[rn]=n,n.stateNode=e}return St(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(l=so(n),i!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[rn]=n}else ri(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),e=!1}else i=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Rn(n),n):(Rn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return St(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=so(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 ri(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),f=!1}else f=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Rn(n),n):(Rn(n),null)}return Rn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),sc(n,n.updateQueue),St(n),null);case 4:return ke(),e===null&&Ef(n.stateNode.containerInfo),St(n),null;case 10:return Fs(n.type),St(n),null;case 19:if(me(Ot),l=n.memoizedState,l===null)return St(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)_r(l,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=ql(e),h!==null){for(n.flags|=128,_r(l,!1),e=h.updateQueue,n.updateQueue=e,sc(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)fg(i,e),i=i.sibling;return xe(Ot,Ot.current&1|2),Je&&qs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Xt()>lc&&(n.flags|=128,f=!0,_r(l,!1),n.lanes=4194304)}else{if(!f)if(e=ql(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,sc(n,e),_r(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return St(n),null}else 2*Xt()-l.renderingStartTime>lc&&i!==536870912&&(n.flags|=128,f=!0,_r(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=Xt(),e.sibling=null,i=Ot.current,xe(Ot,f?i&1|2:i&1),Je&&qs(n,l.treeForkCount),e):(St(n),null);case 22:case 23:return Rn(n),Eu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(i&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),i=n.updateQueue,i!==null&&sc(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==i&&(n.flags|=2048),e!==null&&me(di),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Fs(Vt),St(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function $S(e,n){switch(mu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Fs(Vt),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(Rn(n),n.alternate===null)throw Error(r(340));ri()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Rn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ri()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(Ot),null;case 4:return ke(),null;case 10:return Fs(n.type),null;case 22:case 23:return Rn(n),Eu(),e!==null&&me(di),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Fs(Vt),null;case 25:return null;default:return null}}function $v(e,n){switch(mu(n),n.tag){case 3:Fs(Vt),ke();break;case 26:case 27:case 5:ue(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&Rn(n);break;case 13:Rn(n);break;case 19:me(Ot);break;case 10:Fs(n.type);break;case 22:case 23:Rn(n),Eu(),e!==null&&me(di);break;case 24:Fs(Vt)}}function xr(e,n){try{var i=n.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var f=l.next;i=f;do{if((i.tag&e)===e){l=void 0;var h=i.create,x=i.inst;l=h(),x.destroy=l}i=i.next}while(i!==f)}}catch(N){ft(n,n.return,N)}}function Ca(e,n,i){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var x=l.inst,N=x.destroy;if(N!==void 0){x.destroy=void 0,f=n;var I=i,G=N;try{G()}catch(X){ft(f,I,X)}}}l=l.next}while(l!==h)}}catch(X){ft(n,n.return,X)}}function Hv(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Ag(n,i)}catch(l){ft(e,e.return,l)}}}function Pv(e,n,i){i.props=hi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){ft(e,n,l)}}function kr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(f){ft(e,n,f)}}function Es(e,n){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(f){ft(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){ft(e,n,f)}else i.current=null}function Uv(e){var n=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(f){ft(e,e.return,f)}}function lf(e,n,i){try{var l=e.stateNode;r2(l,e.type,i,n),l[xn]=n}catch(f){ft(e,e.return,f)}}function Vv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Oa(e.type)||e.tag===4}function cf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vv(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&&Oa(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 df(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Ps));else if(l!==4&&(l===27&&Oa(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(df(e,n,i),e=e.sibling;e!==null;)df(e,n,i),e=e.sibling}function ac(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(l!==4&&(l===27&&Oa(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(ac(e,n,i),e=e.sibling;e!==null;)ac(e,n,i),e=e.sibling}function qv(e){var n=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,l,i),n[rn]=e,n[xn]=i}catch(h){ft(e,e.return,h)}}var Ws=!1,Ft=!1,uf=!1,Gv=typeof WeakSet=="function"?WeakSet:Set,tn=null;function HS(e,n){if(e=e.containerInfo,Df=Tc,e=sg(e),su(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var x=0,N=-1,I=-1,G=0,X=0,ie=e,K=null;t:for(;;){for(var J;ie!==i||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===i&&++G===f&&(N=x),K===h&&++X===l&&(I=x),(J=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=J}i=N===-1||I===-1?null:{start:N,end:I}}else i=null}i=i||{start:0,end:0}}else i=null;for(Rf={focusedElem:e,selectionRange:i},Tc=!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(i=0;i<e.length;i++)f=e[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,i=n,f=h.memoizedProps,h=h.memoizedState,l=i.stateNode;try{var _e=hi(i.type,f);e=l.getSnapshotBeforeUpdate(_e,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){ft(i,i.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)Bf(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bf(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 Fv(e,n,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:Qs(e,i),l&4&&xr(5,i);break;case 1:if(Qs(e,i),l&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(x){ft(i,i.return,x)}else{var f=hi(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){ft(i,i.return,x)}}l&64&&Hv(i),l&512&&kr(i,i.return);break;case 3:if(Qs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Ag(e,n)}catch(x){ft(i,i.return,x)}}break;case 27:n===null&&l&4&&qv(i);case 26:case 5:Qs(e,i),n===null&&l&4&&Uv(i),l&512&&kr(i,i.return);break;case 12:Qs(e,i);break;case 31:Qs(e,i),l&4&&Yv(e,i);break;case 13:Qs(e,i),l&4&&Jv(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=YS.bind(null,i),h2(e,i))));break;case 22:if(l=i.memoizedState!==null||Ws,!l){n=n!==null&&n.memoizedState!==null||Ft,f=Ws;var h=Ft;Ws=l,(Ft=n)&&!h?ea(e,i,(i.subtreeFlags&8772)!==0):Qs(e,i),Ws=f,Ft=h}break;case 30:break;default:Qs(e,i)}}function Kv(e){var n=e.alternate;n!==null&&(e.alternate=null,Kv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Hd(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 Nt=null,Sn=!1;function Xs(e,n,i){for(i=i.child;i!==null;)Zv(e,n,i),i=i.sibling}function Zv(e,n,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(mn,i)}catch{}switch(i.tag){case 26:Ft||Es(i,n),Xs(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ft||Es(i,n);var l=Nt,f=Sn;Oa(i.type)&&(Nt=i.stateNode,Sn=!1),Xs(e,n,i),Mr(i.stateNode),Nt=l,Sn=f;break;case 5:Ft||Es(i,n);case 6:if(l=Nt,f=Sn,Nt=null,Xs(e,n,i),Nt=l,Sn=f,Nt!==null)if(Sn)try{(Nt.nodeType===9?Nt.body:Nt.nodeName==="HTML"?Nt.ownerDocument.body:Nt).removeChild(i.stateNode)}catch(h){ft(i,n,h)}else try{Nt.removeChild(i.stateNode)}catch(h){ft(i,n,h)}break;case 18:Nt!==null&&(Sn?(e=Nt,H0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),To(e)):H0(Nt,i.stateNode));break;case 4:l=Nt,f=Sn,Nt=i.stateNode.containerInfo,Sn=!0,Xs(e,n,i),Nt=l,Sn=f;break;case 0:case 11:case 14:case 15:Ca(2,i,n),Ft||Ca(4,i,n),Xs(e,n,i);break;case 1:Ft||(Es(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Pv(i,n,l)),Xs(e,n,i);break;case 21:Xs(e,n,i);break;case 22:Ft=(l=Ft)||i.memoizedState!==null,Xs(e,n,i),Ft=l;break;default:Xs(e,n,i)}}function Yv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{To(e)}catch(i){ft(n,n.return,i)}}}function Jv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{To(e)}catch(i){ft(n,n.return,i)}}function PS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Gv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Gv),n;default:throw Error(r(435,e.tag))}}function ic(e,n){var i=PS(e);n.forEach(function(l){if(!i.has(l)){i.add(l);var f=JS.bind(null,e,l);l.then(f,f)}})}function jn(e,n){var i=n.deletions;if(i!==null)for(var l=0;l<i.length;l++){var f=i[l],h=e,x=n,N=x;e:for(;N!==null;){switch(N.tag){case 27:if(Oa(N.type)){Nt=N.stateNode,Sn=!1;break e}break;case 5:Nt=N.stateNode,Sn=!1;break e;case 3:case 4:Nt=N.stateNode.containerInfo,Sn=!0;break e}N=N.return}if(Nt===null)throw Error(r(160));Zv(h,x,f),Nt=null,Sn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Wv(n,e),n=n.sibling}var fs=null;function Wv(e,n){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jn(n,e),Tn(e),l&4&&(Ca(3,e,e.return),xr(3,e),Ca(5,e,e.return));break;case 1:jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&64&&Ws&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var f=fs;if(jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&4){var h=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Yo]||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,i),h[rn]=e,en(h),l=h;break e;case"link":var x=W0("link","href",f).get(l+(i.href||""));if(x){for(var N=0;N<x.length;N++)if(h=x[N],h.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&h.getAttribute("rel")===(i.rel==null?null:i.rel)&&h.getAttribute("title")===(i.title==null?null:i.title)&&h.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;case"meta":if(x=W0("meta","content",f).get(l+(i.content||""))){for(N=0;N<x.length;N++)if(h=x[N],h.getAttribute("content")===(i.content==null?null:""+i.content)&&h.getAttribute("name")===(i.name==null?null:i.name)&&h.getAttribute("property")===(i.property==null?null:i.property)&&h.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&h.getAttribute("charset")===(i.charSet==null?null:i.charSet)){x.splice(N,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[rn]=e,en(h),l=h}e.stateNode=l}else X0(f,e.type,e.stateNode);else e.stateNode=J0(f,l,e.memoizedProps);else h!==l?(h===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):h.count--,l===null?X0(f,e.type,e.stateNode):J0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&lf(e,e.memoizedProps,i.memoizedProps)}break;case 27:jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),i!==null&&l&4&&lf(e,e.memoizedProps,i.memoizedProps);break;case 5:if(jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),e.flags&32){f=e.stateNode;try{Ki(f,"")}catch(_e){ft(e,e.return,_e)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,lf(e,f,i!==null?i.memoizedProps:f)),l&1024&&(uf=!0);break;case 6:if(jn(n,e),Tn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(_e){ft(e,e.return,_e)}}break;case 3:if(xc=null,f=fs,fs=bc(n.containerInfo),jn(n,e),fs=f,Tn(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{To(n.containerInfo)}catch(_e){ft(e,e.return,_e)}uf&&(uf=!1,Xv(e));break;case 4:l=fs,fs=bc(e.stateNode.containerInfo),jn(n,e),Tn(e),fs=l;break;case 12:jn(n,e),Tn(e);break;case 31:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 13:jn(n,e),Tn(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(rc=Xt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 22:f=e.memoizedState!==null;var I=i!==null&&i.memoizedState!==null,G=Ws,X=Ft;if(Ws=G||f,Ft=X||I,jn(n,e),Ft=X,Ws=G,Tn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(i===null||I||Ws||Ft||gi(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){I=i=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(i===null){I=n;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===18){if(i===null){I=n;try{var J=I.stateNode;f?P0(J,!0):P0(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;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,ic(e,i))));break;case 19:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 30:break;case 21:break;default:jn(n,e),Tn(e)}}function Tn(e){var n=e.flags;if(n&2){try{for(var i,l=e.return;l!==null;){if(Vv(l)){i=l;break}l=l.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var f=i.stateNode,h=cf(e);ac(e,h,f);break;case 5:var x=i.stateNode;i.flags&32&&(Ki(x,""),i.flags&=-33);var N=cf(e);ac(e,N,x);break;case 3:case 4:var I=i.stateNode.containerInfo,G=cf(e);df(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 Xv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Xv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Qs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Fv(e,n.alternate,n),n=n.sibling}function gi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ca(4,n,n.return),gi(n);break;case 1:Es(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Pv(n,n.return,i),gi(n);break;case 27:Mr(n.stateNode);case 26:case 5:Es(n,n.return),gi(n);break;case 22:n.memoizedState===null&&gi(n);break;case 30:gi(n);break;default:gi(n)}e=e.sibling}}function ea(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:ea(f,h,i),xr(4,h);break;case 1:if(ea(f,h,i),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++)Eg(I[f],N)}catch(G){ft(l,l.return,G)}}i&&x&64&&Hv(h),kr(h,h.return);break;case 27:qv(h);case 26:case 5:ea(f,h,i),i&&l===null&&x&4&&Uv(h),kr(h,h.return);break;case 12:ea(f,h,i);break;case 31:ea(f,h,i),i&&x&4&&Yv(f,h);break;case 13:ea(f,h,i),i&&x&4&&Jv(f,h);break;case 22:h.memoizedState===null&&ea(f,h,i),kr(h,h.return);break;case 30:break;default:ea(f,h,i)}n=n.sibling}}function ff(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&lr(i))}function pf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&lr(e))}function ps(e,n,i,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Qv(e,n,i,l),n=n.sibling}function Qv(e,n,i,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ps(e,n,i,l),f&2048&&xr(9,n);break;case 1:ps(e,n,i,l);break;case 3:ps(e,n,i,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&lr(e)));break;case 12:if(f&2048){ps(e,n,i,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 ps(e,n,i,l);break;case 31:ps(e,n,i,l);break;case 13:ps(e,n,i,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?ps(e,n,i,l):Sr(e,n):h._visibility&2?ps(e,n,i,l):(h._visibility|=2,mo(e,n,i,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&ff(x,n);break;case 24:ps(e,n,i,l),f&2048&&pf(n.alternate,n);break;default:ps(e,n,i,l)}}function mo(e,n,i,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,N=i,I=l,G=x.flags;switch(x.tag){case 0:case 11:case 15:mo(h,x,N,I,f),xr(8,x);break;case 23:break;case 22:var X=x.stateNode;x.memoizedState!==null?X._visibility&2?mo(h,x,N,I,f):Sr(h,x):(X._visibility|=2,mo(h,x,N,I,f)),f&&G&2048&&ff(x.alternate,x);break;case 24:mo(h,x,N,I,f),f&&G&2048&&pf(x.alternate,x);break;default:mo(h,x,N,I,f)}n=n.sibling}}function Sr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,l=n,f=l.flags;switch(l.tag){case 22:Sr(i,l),f&2048&&ff(l.alternate,l);break;case 24:Sr(i,l),f&2048&&pf(l.alternate,l);break;default:Sr(i,l)}n=n.sibling}}var jr=8192;function ho(e,n,i){if(e.subtreeFlags&jr)for(e=e.child;e!==null;)e0(e,n,i),e=e.sibling}function e0(e,n,i){switch(e.tag){case 26:ho(e,n,i),e.flags&jr&&e.memoizedState!==null&&N2(i,fs,e.memoizedState,e.memoizedProps);break;case 5:ho(e,n,i);break;case 3:case 4:var l=fs;fs=bc(e.stateNode.containerInfo),ho(e,n,i),fs=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=jr,jr=16777216,ho(e,n,i),jr=l):ho(e,n,i));break;default:ho(e,n,i)}}function t0(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 Tr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];tn=l,s0(l,e)}t0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)n0(e),e=e.sibling}function n0(e){switch(e.tag){case 0:case 11:case 15:Tr(e),e.flags&2048&&Ca(9,e,e.return);break;case 3:Tr(e);break;case 12:Tr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,oc(e)):Tr(e);break;default:Tr(e)}}function oc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];tn=l,s0(l,e)}t0(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ca(8,n,n.return),oc(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,oc(n));break;default:oc(n)}e=e.sibling}}function s0(e,n){for(;tn!==null;){var i=tn;switch(i.tag){case 0:case 11:case 15:Ca(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:lr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,tn=l;else e:for(i=e;tn!==null;){l=tn;var f=l.sibling,h=l.return;if(Kv(l),l===i){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var US={getCacheForType:function(e){var n=cn(Vt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return cn(Vt).controller.signal}},VS=typeof WeakMap=="function"?WeakMap:Map,rt=0,vt=null,Ge=null,Ke=0,ut=0,In=null,Ea=!1,go=!1,mf=!1,ta=0,Rt=0,Aa=0,vi=0,hf=0,On=0,vo=0,wr=null,wn=null,gf=!1,rc=0,a0=0,lc=1/0,cc=null,Ma=null,Kt=0,Da=null,yo=null,na=0,vf=0,yf=null,i0=null,Nr=0,bf=null;function Bn(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:H.T!==null?Tf():Hi()}function o0(){if(On===0)if((Ke&536870912)===0||Je){var e=U;U<<=1,(U&3932160)===0&&(U=262144),On=e}else On=536870912;return e=Dn.current,e!==null&&(e.flags|=32),On}function Nn(e,n,i){(e===vt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&(bo(e,0),Ra(e,Ke,On,!1)),Ue(e,i),((rt&2)===0||e!==vt)&&(e===vt&&((rt&2)===0&&(vi|=i),Rt===4&&Ra(e,Ke,On,!1)),As(e))}function r0(e,n,i){if((rt&6)!==0)throw Error(r(327));var l=!i&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),f=l?FS(e,n):xf(e,n,!0),h=l;do{if(f===0){go&&!l&&Ra(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!qS(i)){f=xf(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=wr;var I=N.current.memoizedState.isDehydrated;if(I&&(bo(N,x).flags|=256),x=xf(N,x,!1),x!==2){if(mf&&!I){N.errorRecoveryDisabledLanes|=h,vi|=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){bo(e,0),Ra(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:Ra(l,n,On,!Ea);break e;case 2:wn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=rc+300-Xt(),10<f)){if(Ra(l,n,On,!Ea),pe(l,0,!0)!==0)break e;na=n,l.timeoutHandle=z0(l0.bind(null,l,i,wn,cc,gf,n,On,vi,vo,Ea,h,"Throttled",-0,0),f);break e}l0(l,i,wn,cc,gf,n,On,vi,vo,Ea,h,null,-0,0)}}break}while(!0);As(e)}function l0(e,n,i,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:Ps},e0(n,h,ie);var _e=(h&62914560)===h?rc-Xt():(h&4194048)===h?a0-Xt():0;if(_e=C2(ie,_e),_e!==null){na=h,e.cancelPendingCommit=_e(g0.bind(null,e,n,h,i,l,f,x,N,I,X,ie,null,K,J)),Ra(e,h,x,!G);return}}g0(e,n,h,i,l,f,x,N,I)}function qS(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var f=i[l],h=f.getSnapshot;f=f.value;try{if(!An(h(),f))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ra(e,n,i,l){n&=~hf,n&=~vi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Qt(f),x=1<<h;l[h]=-1,f&=~x}i!==0&&qe(e,i,n)}function dc(){return(rt&6)===0?(Cr(0),!1):!0}function _f(){if(Ge!==null){if(ut===0)var e=Ge.return;else e=Ge,Gs=li=null,Ou(e),lo=null,dr=0,e=Ge;for(;e!==null;)$v(e.alternate,e),e=e.return;Ge=null}}function bo(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,d2(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),na=0,_f(),vt=e,Ge=i=Vs(e.current,null),Ke=n,ut=0,In=null,Ea=!1,go=ye(e,n),mf=!1,vo=On=hf=vi=Aa=Rt=0,wn=wr=null,gf=!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-Qt(l),h=1<<f;n|=e[f],l&=~h}return ta=n,Ml(),i}function c0(e,n){ze=null,H.H=yr,n===ro||n===$l?(n=Tg(),ut=3):n===Su?(n=Tg(),ut=4):ut=n===Wu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,Ge===null&&(Rt=1,Ql(e,Fn(n,e.current)))}function d0(){var e=Dn.current;return e===null?!0:(Ke&4194048)===Ke?Jn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Jn:!1}function u0(){var e=H.H;return H.H=yr,e===null?yr:e}function f0(){var e=H.A;return H.A=US,e}function uc(){Rt=4,Ea||(Ke&4194048)!==Ke&&Dn.current!==null||(go=!0),(Aa&134217727)===0&&(vi&134217727)===0||vt===null||Ra(vt,Ke,On,!1)}function xf(e,n,i){var l=rt;rt|=2;var f=u0(),h=f0();(vt!==e||Ke!==n)&&(cc=null,bo(e,n)),n=!1;var x=Rt;e:do try{if(ut!==0&&Ge!==null){var N=Ge,I=In;switch(ut){case 8:_f(),x=6;break e;case 3:case 2:case 9:case 6:Dn.current===null&&(n=!0);var G=ut;if(ut=0,In=null,_o(e,N,I,G),i&&go){x=0;break e}break;default:G=ut,ut=0,In=null,_o(e,N,I,G)}}GS(),x=Rt;break}catch(X){c0(e,X)}while(!0);return n&&e.shellSuspendCounter++,Gs=li=null,rt=l,H.H=f,H.A=h,Ge===null&&(vt=null,Ke=0,Ml()),x}function GS(){for(;Ge!==null;)p0(Ge)}function FS(e,n){var i=rt;rt|=2;var l=u0(),f=f0();vt!==e||Ke!==n?(cc=null,lc=Xt()+500,bo(e,n)):go=ye(e,n);e:do try{if(ut!==0&&Ge!==null){n=Ge;var h=In;t:switch(ut){case 1:ut=0,In=null,_o(e,n,h,1);break;case 2:case 9:if(Sg(h)){ut=0,In=null,m0(n);break}n=function(){ut!==2&&ut!==9||vt!==e||(ut=7),As(e)},h.then(n,n);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:Sg(h)?(ut=0,In=null,m0(n)):(ut=0,In=null,_o(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?Q0(x):N.stateNode.complete){ut=0,In=null;var I=N.sibling;if(I!==null)Ge=I;else{var G=N.return;G!==null?(Ge=G,fc(G)):Ge=null}break t}}ut=0,In=null,_o(e,n,h,5);break;case 6:ut=0,In=null,_o(e,n,h,6);break;case 8:_f(),Rt=6;break e;default:throw Error(r(462))}}KS();break}catch(X){c0(e,X)}while(!0);return Gs=li=null,H.H=l,H.A=f,rt=i,Ge!==null?0:(vt=null,Ke=0,Ml(),Rt)}function KS(){for(;Ge!==null&&!ga();)p0(Ge)}function p0(e){var n=Lv(e.alternate,e,ta);e.memoizedProps=e.pendingProps,n===null?fc(e):Ge=n}function m0(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Mv(i,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Mv(i,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Ou(n);default:$v(i,n),n=Ge=fg(n,ta),n=Lv(i,n,ta)}e.memoizedProps=e.pendingProps,n===null?fc(e):Ge=n}function _o(e,n,i,l){Gs=li=null,Ou(n),lo=null,dr=0;var f=n.return;try{if(OS(e,f,n,i,Ke)){Rt=1,Ql(e,Fn(i,e.current)),Ge=null;return}}catch(h){if(f!==null)throw Ge=f,h;Rt=1,Ql(e,Fn(i,e.current)),Ge=null;return}n.flags&32768?(Je||l===1?e=!0:go||(Ke&536870912)!==0?e=!1:(Ea=e=!0,(l===2||l===9||l===3||l===6)&&(l=Dn.current,l!==null&&l.tag===13&&(l.flags|=16384))),h0(n,e)):fc(n)}function fc(e){var n=e;do{if((n.flags&32768)!==0){h0(n,Ea);return}e=n.return;var i=zS(n.alternate,n,ta);if(i!==null){Ge=i;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);Rt===0&&(Rt=5)}function h0(e,n){do{var i=$S(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);Rt=6,Ge=null}function g0(e,n,i,l,f,h,x,N,I){e.cancelPendingCommit=null;do pc();while(Kt!==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|=lu,Mt(e,i,h,x,N,I),e===vt&&(Ge=vt=null,Ke=0),yo=n,Da=e,na=i,vf=h,yf=f,i0=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,WS($s,function(){return x0(),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{HS(e,n,i)}finally{rt=x,B.p=f,H.T=l}}Kt=1,v0(),y0(),b0()}}function v0(){if(Kt===1){Kt=0;var e=Da,n=yo,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Wv(n,e);var h=Rf,x=sg(e.containerInfo),N=h.focusedElem,I=h.selectionRange;if(x!==N&&N&&N.ownerDocument&&ng(N.ownerDocument.documentElement,N)){if(I!==null&&su(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=tg(N,Ce),z=tg(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}}Tc=!!Df,Rf=Df=null}finally{rt=f,B.p=l,H.T=i}}e.current=n,Kt=2}}function y0(){if(Kt===2){Kt=0;var e=Da,n=yo,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Fv(e,n.alternate,n)}finally{rt=f,B.p=l,H.T=i}}Kt=3}}function b0(){if(Kt===4||Kt===3){Kt=0,Oi();var e=Da,n=yo,i=na,l=i0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Kt=5:(Kt=0,yo=Da=null,_0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Ma=null),js(i),n=n.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.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}}(na&3)!==0&&pc(),As(e),f=e.pendingLanes,(i&261930)!==0&&(f&42)!==0?e===bf?Nr++:(Nr=0,bf=e):Nr=0,Cr(0)}}function _0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,lr(n)))}function pc(){return v0(),y0(),b0(),x0()}function x0(){if(Kt!==5)return!1;var e=Da,n=vf;vf=0;var i=js(na),l=H.T,f=B.p;try{B.p=32>i?32:i,H.T=null,i=yf,yf=null;var h=Da,x=na;if(Kt=0,yo=Da=null,na=0,(rt&6)!==0)throw Error(r(331));var N=rt;if(rt|=4,n0(h.current),Qv(h,h.current,x,i),rt=N,Cr(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(mn,h)}catch{}return!0}finally{B.p=f,H.T=l,_0(e,n)}}function k0(e,n,i){n=Fn(i,n),n=Ju(e.stateNode,n,2),e=Ta(e,n,2),e!==null&&(Ue(e,2),As(e))}function ft(e,n,i){if(e.tag===3)k0(e,e,i);else for(;n!==null;){if(n.tag===3){k0(n,e,i);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ma===null||!Ma.has(l))){e=Fn(i,e),i=Sv(2),l=Ta(n,i,2),l!==null&&(jv(i,l,n,e),Ue(l,2),As(l));break}}n=n.return}}function kf(e,n,i){var l=e.pingCache;if(l===null){l=e.pingCache=new VS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(i)||(mf=!0,f.add(i),e=ZS.bind(null,e,n,i),n.then(e,e))}function ZS(e,n,i){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,vt===e&&(Ke&i)===i&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>Xt()-rc?(rt&2)===0&&bo(e,0):hf|=i,vo===Ke&&(vo=0)),As(e)}function S0(e,n){n===0&&(n=je()),e=ii(e,n),e!==null&&(Ue(e,n),As(e))}function YS(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),S0(e,i)}function JS(e,n){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),S0(e,i)}function WS(e,n){return ds(e,n)}var mc=null,xo=null,Sf=!1,hc=!1,jf=!1,Ia=0;function As(e){e!==xo&&e.next===null&&(xo===null?mc=xo=e:xo=xo.next=e),hc=!0,Sf||(Sf=!0,QS())}function Cr(e,n){if(!jf&&hc){jf=!0;do for(var i=!1,l=mc;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-Qt(42|e)+1)-1,h&=f&~(x&~N),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,N0(l,h))}else h=Ke,h=pe(l,l===vt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ye(l,h)||(i=!0,N0(l,h));l=l.next}while(i);jf=!1}}function XS(){j0()}function j0(){hc=Sf=!1;var e=0;Ia!==0&&c2()&&(e=Ia);for(var n=Xt(),i=null,l=mc;l!==null;){var f=l.next,h=T0(l,n);h===0?(l.next=null,i===null?mc=f:i.next=f,f===null&&(xo=i)):(i=l,(e!==0||(h&3)!==0)&&(hc=!0)),l=f}Kt!==0&&Kt!==5||Cr(e),Ia!==0&&(Ia=0)}function T0(e,n){for(var i=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-Qt(h),N=1<<x,I=f[x];I===-1?((N&i)===0||(N&l)!==0)&&(f[x]=tt(N,n)):I<=n&&(e.expiredLanes|=N),h&=~N}if(n=vt,i=Ke,i=pe(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===n&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&zs(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ye(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(l!==null&&zs(l),js(i)){case 2:case 8:i=va;break;case 32:i=$s;break;case 268435456:i=Ne;break;default:i=$s}return l=w0.bind(null,e),i=ds(i,l),e.callbackPriority=n,e.callbackNode=i,n}return l!==null&&l!==null&&zs(l),e.callbackPriority=2,e.callbackNode=null,2}function w0(e,n){if(Kt!==0&&Kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(pc()&&e.callbackNode!==i)return null;var l=Ke;return l=pe(e,e===vt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(r0(e,l,n),T0(e,Xt()),e.callbackNode!=null&&e.callbackNode===i?w0.bind(null,e):null)}function N0(e,n){if(pc())return null;r0(e,n,!0)}function QS(){u2(function(){(rt&6)!==0?ds(ei,XS):j0()})}function Tf(){if(Ia===0){var e=io;e===0&&(e=$i,$i<<=1,($i&261888)===0&&($i=256)),Ia=e}return Ia}function C0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Sl(""+e)}function E0(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function e2(e,n,i,l,f){if(n==="submit"&&i&&i.stateNode===f){var h=C0((f[xn]||null).action),x=l.submitter;x&&(n=(n=x[xn]||null)?C0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var N=new Nl("action","action",null,l,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ia!==0){var I=x?E0(f,x):new FormData(f);qu(i,{pending:!0,data:I,method:f.method,action:h},null,I)}}else typeof h=="function"&&(N.preventDefault(),I=x?E0(f,x):new FormData(f),qu(i,{pending:!0,data:I,method:f.method,action:h},h,I))},currentTarget:f}]})}}for(var wf=0;wf<ru.length;wf++){var Nf=ru[wf],t2=Nf.toLowerCase(),n2=Nf[0].toUpperCase()+Nf.slice(1);us(t2,"on"+n2)}us(og,"onAnimationEnd"),us(rg,"onAnimationIteration"),us(lg,"onAnimationStart"),us("dblclick","onDoubleClick"),us("focusin","onFocus"),us("focusout","onBlur"),us(yS,"onTransitionRun"),us(bS,"onTransitionStart"),us(_S,"onTransitionCancel"),us(cg,"onTransitionEnd"),Gi("onMouseEnter",["mouseout","mouseover"]),Gi("onMouseLeave",["mouseout","mouseover"]),Gi("onPointerEnter",["pointerout","pointerover"]),Gi("onPointerLeave",["pointerout","pointerover"]),ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Er="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(" "),s2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Er));function A0(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var 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){Al(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){Al(X)}f.currentTarget=null,h=I}}}}function Fe(e,n){var i=n[$d];i===void 0&&(i=n[$d]=new Set);var l=e+"__bubble";i.has(l)||(M0(n,e,2,!1),i.add(l))}function Cf(e,n,i){var l=0;n&&(l|=4),M0(i,e,l,n)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[gc]){e[gc]=!0,jh.forEach(function(i){i!=="selectionchange"&&(s2.has(i)||Cf(i,!1,e),Cf(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[gc]||(n[gc]=!0,Cf("selectionchange",!1,n))}}function M0(e,n,i,l){switch(oy(n)){case 2:var f=M2;break;case 8:f=D2;break;default:f=qf}i=f.bind(null,n,i,e),f=void 0,!Zd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function Af(e,n,i,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=Ui(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}Bh(function(){var G=h,X=Fd(i),ie=[];e:{var K=dg.get(e);if(K!==void 0){var J=Nl,_e=e;switch(e){case"keypress":if(Tl(i)===0)break e;case"keydown":case"keyup":J=Jk;break;case"focusin":_e="focus",J=Xd;break;case"focusout":_e="blur",J=Xd;break;case"beforeblur":case"afterblur":J=Xd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=$h;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=zk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Qk;break;case og:case rg:case lg:J=Pk;break;case cg:J=tS;break;case"scroll":case"scrollend":J=Bk;break;case"wheel":J=sS;break;case"copy":case"cut":case"paste":J=Vk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Ph;break;case"toggle":case"beforetoggle":J=iS}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=Wo(z,P),te!=null&&Ce.push(Ar(z,te,q))),gt)break;z=z.return}0<Ce.length&&(K=new J(K,_e,null,i,X),ie.push({event:K,listeners:Ce}))}}if((n&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",K&&i!==Gd&&(_e=i.relatedTarget||i.fromElement)&&(Ui(_e)||_e[Pi]))break e;if((J||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,J?(_e=i.relatedTarget||i.toElement,J=G,_e=_e?Ui(_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=$h,te="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Ph,te="onPointerLeave",P="onPointerEnter",z="pointer"),gt=J==null?K:Jo(J),q=_e==null?K:Jo(_e),K=new Ce(te,z+"leave",J,i,X),K.target=gt,K.relatedTarget=q,te=null,Ui(X)===G&&(Ce=new Ce(P,z+"enter",_e,i,X),Ce.target=q,Ce.relatedTarget=gt,te=Ce),gt=te,J&&_e)t:{for(Ce=a2,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&&D0(ie,K,J,Ce,!1),_e!==null&&gt!==null&&D0(ie,gt,_e,Ce,!0)}}e:{if(K=G?Jo(G):window,J=K.nodeName&&K.nodeName.toLowerCase(),J==="select"||J==="input"&&K.type==="file")var st=Yh;else if(Kh(K))if(Jh)st=hS;else{st=pS;var Se=fS}else J=K.nodeName,!J||J.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&qd(G.elementType)&&(st=Yh):st=mS;if(st&&(st=st(e,G))){Zh(ie,st,i,X);break e}Se&&Se(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&Vd(K,"number",K.value)}switch(Se=G?Jo(G):window,e){case"focusin":(Kh(Se)||Se.contentEditable==="true")&&(Wi=Se,au=G,ir=null);break;case"focusout":ir=au=Wi=null;break;case"mousedown":iu=!0;break;case"contextmenu":case"mouseup":case"dragend":iu=!1,ag(ie,i,X);break;case"selectionchange":if(vS)break;case"keydown":case"keyup":ag(ie,i,X)}var $e;if(eu)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 Ji?Gh(e,i)&&(Ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ze="onCompositionStart");Ze&&(Uh&&i.locale!=="ko"&&(Ji||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Ji&&($e=Lh()):(ya=X,Yd="value"in ya?ya.value:ya.textContent,Ji=!0)),Se=vc(G,Ze),0<Se.length&&(Ze=new Hh(Ze,e,null,i,X),ie.push({event:Ze,listeners:Se}),$e?Ze.data=$e:($e=Fh(i),$e!==null&&(Ze.data=$e)))),($e=rS?lS(e,i):cS(e,i))&&(Ze=vc(G,"onBeforeInput"),0<Ze.length&&(Se=new Hh("onBeforeInput","beforeinput",null,i,X),ie.push({event:Se,listeners:Ze}),Se.data=$e)),e2(ie,e,G,i,X)}A0(ie,n)})}function Ar(e,n,i){return{instance:e,listener:n,currentTarget:i}}function vc(e,n){for(var i=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Wo(e,i),f!=null&&l.unshift(Ar(e,f,h)),f=Wo(e,n),f!=null&&l.push(Ar(e,f,h))),e.tag===3)return l;e=e.return}return[]}function a2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function D0(e,n,i,l,f){for(var h=n._reactName,x=[];i!==null&&i!==l;){var N=i,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=Wo(i,h),G!=null&&x.unshift(Ar(i,G,I))):f||(G=Wo(i,h),G!=null&&x.push(Ar(i,G,I)))),i=i.return}x.length!==0&&e.push({event:n,listeners:x})}var i2=/\r\n?/g,o2=/\u0000|\uFFFD/g;function R0(e){return(typeof e=="string"?e:""+e).replace(i2,`
26
- `).replace(o2,"")}function I0(e,n){return n=R0(n),R0(e)===n}function ht(e,n,i,l,f,h){switch(i){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ki(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ki(e,""+l);break;case"className":xl(e,"class",l);break;case"tabIndex":xl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":xl(e,i,l);break;case"style":Ih(e,l,h);break;case"data":if(n!=="object"){xl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=Sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(i==="formAction"?(n!=="input"&&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(i);break}l=Sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=Sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),_l(e,"popover",l);break;case"xlinkActuate":Hs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Hs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Hs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Hs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Hs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Hs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_l(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=Ik.get(i)||i,_l(e,i,l))}}function Mf(e,n,i,l,f,h){switch(i){case"style":Ih(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ki(e,l):(typeof l=="number"||typeof l=="bigint")&&Ki(e,""+l);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Th.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),n=i.slice(2,f?i.length-7:void 0),h=e[xn]||null,h=h!=null?h[i]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,l,f);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):_l(e,i,l)}}}function un(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var l=!1,f=!1,h;for(h in i)if(i.hasOwnProperty(h)){var x=i[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,i,null)}}f&&ht(e,n,"srcSet",i.srcSet,i,null),l&&ht(e,n,"src",i.src,i,null);return;case"input":Fe("invalid",e);var N=h=x=f=null,I=null,G=null;for(l in i)if(i.hasOwnProperty(l)){var X=i[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,i,null)}}Ah(e,h,N,I,G,x,f,!1);return;case"select":Fe("invalid",e),l=x=h=null;for(f in i)if(i.hasOwnProperty(f)&&(N=i[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,i,null)}n=h,i=x,e.multiple=!!l,n!=null?Fi(e,!!l,n,!1):i!=null&&Fi(e,!!l,i,!0);return;case"textarea":Fe("invalid",e),h=f=l=null;for(x in i)if(i.hasOwnProperty(x)&&(N=i[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,i,null)}Dh(e,l,f,h);return;case"option":for(I in i)if(i.hasOwnProperty(I)&&(l=i[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ht(e,n,I,l,i,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(l=0;l<Er.length;l++)Fe(Er[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 i)if(i.hasOwnProperty(G)&&(l=i[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ht(e,n,G,l,i,null)}return;default:if(qd(n)){for(X in i)i.hasOwnProperty(X)&&(l=i[X],l!==void 0&&Mf(e,n,X,l,i,void 0));return}}for(N in i)i.hasOwnProperty(N)&&(l=i[N],l!=null&&ht(e,n,N,l,i,null))}function r2(e,n,i,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,N=null,I=null,G=null,X=null;for(J in i){var ie=i[J];if(i.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=i[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)}}Ud(e,x,N,I,G,X,h,f);return;case"select":J=x=N=K=null;for(h in i)if(I=i[h],i.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=i[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,i=x,l=J,K!=null?Fi(e,!!i,K,!1):!!l!=!!i&&(n!=null?Fi(e,!!i,n,!0):Fi(e,!!i,i?[]:"",!1));return;case"textarea":J=K=null;for(N in i)if(f=i[N],i.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=i[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)}Mh(e,K,J);return;case"option":for(var _e in i)if(K=i[_e],i.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=i[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 i)K=i[Ce],i.hasOwnProperty(Ce)&&K!=null&&!l.hasOwnProperty(Ce)&&ht(e,n,Ce,null,l,K);for(G in l)if(K=l[G],J=i[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(qd(n)){for(var gt in i)K=i[gt],i.hasOwnProperty(gt)&&K!==void 0&&!l.hasOwnProperty(gt)&&Mf(e,n,gt,void 0,l,K);for(X in l)K=l[X],J=i[X],!l.hasOwnProperty(X)||K===J||K===void 0&&J===void 0||Mf(e,n,X,K,l,J);return}}for(var P in i)K=i[P],i.hasOwnProperty(P)&&K!=null&&!l.hasOwnProperty(P)&&ht(e,n,P,null,l,K);for(ie in l)K=l[ie],J=i[ie],!l.hasOwnProperty(ie)||K===J||K==null&&J==null||ht(e,n,ie,K,l,J)}function O0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function l2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var f=i[l],h=f.transferSize,x=f.initiatorType,N=f.duration;if(h&&N&&O0(x)){for(x=0,N=f.responseEnd,l+=1;l<i.length;l++){var I=i[l],G=I.startTime;if(G>N)break;var X=I.transferSize,ie=I.initiatorType;X&&O0(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 Df=null,Rf=null;function yc(e){return e.nodeType===9?e:e.ownerDocument}function B0(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function L0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function If(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 Of=null;function c2(){var e=window.event;return e&&e.type==="popstate"?e===Of?!1:(Of=e,!0):(Of=null,!1)}var z0=typeof setTimeout=="function"?setTimeout:void 0,d2=typeof clearTimeout=="function"?clearTimeout:void 0,$0=typeof Promise=="function"?Promise:void 0,u2=typeof queueMicrotask=="function"?queueMicrotask:typeof $0<"u"?function(e){return $0.resolve(null).then(e).catch(f2)}:z0;function f2(e){setTimeout(function(){throw e})}function Oa(e){return e==="head"}function H0(e,n){var i=n,l=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(f),To(n);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")Mr(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Mr(i);for(var h=i.firstChild;h;){var x=h.nextSibling,N=h.nodeName;h[Yo]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=x}}else i==="body"&&Mr(e.ownerDocument.body);i=f}while(i);To(n)}function P0(e,n){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Bf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Bf(i),Hd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function p2(e,n,i,l){for(;e.nodeType===1;){var f=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Yo])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=Wn(e.nextSibling),e===null)break}return null}function m2(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Wn(e.nextSibling),e===null))return null;return e}function U0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Wn(e.nextSibling),e===null))return null;return e}function Lf(e){return e.data==="$?"||e.data==="$~"}function zf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function h2(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var l=function(){n(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Wn(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 $f=null;function V0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return Wn(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function q0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function G0(e,n,i){switch(n=yc(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Mr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Hd(e)}var Xn=new Map,F0=new Set;function bc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var sa=B.d;B.d={f:g2,r:v2,D:y2,C:b2,L:_2,m:x2,X:S2,S:k2,M:j2};function g2(){var e=sa.f(),n=dc();return e||n}function v2(e){var n=Vi(e);n!==null&&n.tag===5&&n.type==="form"?cv(n):sa.r(e)}var ko=typeof document>"u"?null:document;function K0(e,n,i){var l=ko;if(l&&typeof n=="string"&&n){var f=qn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),F0.has(f)||(F0.add(f),e={rel:e,crossOrigin:i,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function y2(e){sa.D(e),K0("dns-prefetch",e,null)}function b2(e,n){sa.C(e,n),K0("preconnect",e,n)}function _2(e,n,i){sa.L(e,n,i);var l=ko;if(l&&e&&n){var f='link[rel="preload"][as="'+qn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+qn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+qn(i.imageSizes)+'"]')):f+='[href="'+qn(e)+'"]';var h=f;switch(n){case"style":h=So(e);break;case"script":h=jo(e)}Xn.has(h)||(e=b({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),Xn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Dr(h))||n==="script"&&l.querySelector(Rr(h))||(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function x2(e,n){sa.m(e,n);var i=ko;if(i&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+qn(l)+'"][href="'+qn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=jo(e)}if(!Xn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Xn.set(h,e),i.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Rr(h)))return}l=i.createElement("link"),un(l,"link",e),en(l),i.head.appendChild(l)}}}function k2(e,n,i){sa.S(e,n,i);var l=ko;if(l&&e){var f=qi(l).hoistableStyles,h=So(e);n=n||"default";var x=f.get(h);if(!x){var N={loading:0,preload:null};if(x=l.querySelector(Dr(h)))N.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},i),(i=Xn.get(h))&&Hf(e,i);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,_c(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:N},f.set(h,x)}}}function S2(e,n){sa.X(e,n);var i=ko;if(i&&e){var l=qi(i).hoistableScripts,f=jo(e),h=l.get(f);h||(h=i.querySelector(Rr(f)),h||(e=b({src:e,async:!0},n),(n=Xn.get(f))&&Pf(e,n),h=i.createElement("script"),en(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function j2(e,n){sa.M(e,n);var i=ko;if(i&&e){var l=qi(i).hoistableScripts,f=jo(e),h=l.get(f);h||(h=i.querySelector(Rr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Xn.get(f))&&Pf(e,n),h=i.createElement("script"),en(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function Z0(e,n,i,l){var f=(f=bt.current)?bc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=So(i.href),i=qi(f).hoistableStyles,l=i.get(n),l||(l={type:"style",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=So(i.href);var h=qi(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(Dr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),Xn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Xn.set(e,i),h||T2(f,e,i,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=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=jo(i),i=qi(f).hoistableScripts,l=i.get(n),l||(l={type:"script",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function So(e){return'href="'+qn(e)+'"'}function Dr(e){return'link[rel="stylesheet"]['+e+"]"}function Y0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function T2(e,n,i,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),un(n,"link",i),en(n),e.head.appendChild(n))}function jo(e){return'[src="'+qn(e)+'"]'}function Rr(e){return"script[async]"+e}function J0(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+qn(i.href)+'"]');if(l)return n.instance=l,en(l),l;var f=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),en(l),un(l,"style",f),_c(l,i.precedence,e),n.instance=l;case"stylesheet":f=So(i.href);var h=e.querySelector(Dr(f));if(h)return n.state.loading|=4,n.instance=h,en(h),h;l=Y0(i),(f=Xn.get(f))&&Hf(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,_c(h,i.precedence,e),n.instance=h;case"script":return h=jo(i.src),(f=e.querySelector(Rr(h)))?(n.instance=f,en(f),f):(l=i,(f=Xn.get(h))&&(l=b({},i),Pf(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,_c(l,i.precedence,e));return n.instance}function _c(e,n,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,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=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Hf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Pf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var xc=null;function W0(e,n,i){if(xc===null){var l=new Map,f=xc=new Map;f.set(i,l)}else f=xc,l=f.get(i),l||(l=new Map,f.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),f=0;f<i.length;f++){var h=i[f];if(!(h[Yo]||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 X0(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function w2(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Q0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function N2(e,n,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=So(l.href),h=n.querySelector(Dr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=kc.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,en(h);return}h=n.ownerDocument||n,l=Y0(l),(f=Xn.get(f))&&Hf(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),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=kc.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Uf=0;function C2(e,n){return e.stylesheets&&e.count===0&&jc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Uf===0&&(Uf=62500*l2());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Uf?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function kc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Sc=null;function jc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Sc=new Map,n.forEach(E2,e),Sc=null,kc.call(e))}function E2(e,n){if(!(n.state.loading&4)){var i=Sc.get(e);if(i)var l=i.get(null);else{i=new Map,Sc.set(e,i);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")&&(i.set(x.dataset.precedence,x),l=x)}l&&i.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=i.get(x)||l,h===l&&i.set(null,f),i.set(x,f),this.count++,l=kc.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 Ir={$$typeof:M,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function A2(e,n,i,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 ey(e,n,i,l,f,h,x,N,I,G,X,ie){return e=new A2(e,n,i,x,I,G,X,ie,N),n=1,h===!0&&(n|=24),h=Mn(3,null,null,n),e.current=h,h.stateNode=e,n=_u(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:i,cache:n},ju(h),e}function ty(e){return e?(e=eo,e):eo}function ny(e,n,i,l,f,h){f=ty(f),l.context===null?l.context=f:l.pendingContext=f,l=ja(n),l.payload={element:i},h=h===void 0?null:h,h!==null&&(l.callback=h),i=Ta(e,l,n),i!==null&&(Nn(i,e,n),fr(i,e,n))}function sy(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Vf(e,n){sy(e,n),(e=e.alternate)&&sy(e,n)}function ay(e){if(e.tag===13||e.tag===31){var n=ii(e,67108864);n!==null&&Nn(n,e,67108864),Vf(e,67108864)}}function iy(e){if(e.tag===13||e.tag===31){var n=Bn();n=_t(n);var i=ii(e,n);i!==null&&Nn(i,e,n),Vf(e,n)}}var Tc=!0;function M2(e,n,i,l){var f=H.T;H.T=null;var h=B.p;try{B.p=2,qf(e,n,i,l)}finally{B.p=h,H.T=f}}function D2(e,n,i,l){var f=H.T;H.T=null;var h=B.p;try{B.p=8,qf(e,n,i,l)}finally{B.p=h,H.T=f}}function qf(e,n,i,l){if(Tc){var f=Gf(l);if(f===null)Af(e,n,l,wc,i),ry(e,l);else if(I2(f,e,n,i,l))l.stopPropagation();else if(ry(e,l),n&4&&-1<R2.indexOf(e)){for(;f!==null;){var h=Vi(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-Qt(x);N.entanglements[1]|=I,x&=~I}As(h),(rt&6)===0&&(lc=Xt()+500,Cr(0))}}break;case 31:case 13:N=ii(h,2),N!==null&&Nn(N,h,2),dc(),Vf(h,2)}if(h=Gf(l),h===null&&Af(e,n,l,wc,i),h===f)break;f=h}f!==null&&l.stopPropagation()}else Af(e,n,l,null,i)}}function Gf(e){return e=Fd(e),Ff(e)}var wc=null;function Ff(e){if(wc=null,e=Ui(e),e!==null){var n=d(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=p(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return wc=e,null}function oy(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(Qa()){case ei:return 2;case va:return 8;case $s:case Ss:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var Kf=!1,Ba=null,La=null,za=null,Or=new Map,Br=new Map,$a=[],R2="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 ry(e,n){switch(e){case"focusin":case"focusout":Ba=null;break;case"dragenter":case"dragleave":La=null;break;case"mouseover":case"mouseout":za=null;break;case"pointerover":case"pointerout":Or.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Br.delete(n.pointerId)}}function Lr(e,n,i,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Vi(n),n!==null&&ay(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function I2(e,n,i,l,f){switch(n){case"focusin":return Ba=Lr(Ba,e,n,i,l,f),!0;case"dragenter":return La=Lr(La,e,n,i,l,f),!0;case"mouseover":return za=Lr(za,e,n,i,l,f),!0;case"pointerover":var h=f.pointerId;return Or.set(h,Lr(Or.get(h)||null,e,n,i,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Br.set(h,Lr(Br.get(h)||null,e,n,i,l,f)),!0}return!1}function ly(e){var n=Ui(e.target);if(n!==null){var i=d(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){iy(i)});return}}else if(n===31){if(n=p(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){iy(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Nc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Gf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Gd=l,i.target.dispatchEvent(l),Gd=null}else return n=Vi(i),n!==null&&ay(n),e.blockedOn=i,!1;n.shift()}return!0}function cy(e,n,i){Nc(e)&&i.delete(n)}function O2(){Kf=!1,Ba!==null&&Nc(Ba)&&(Ba=null),La!==null&&Nc(La)&&(La=null),za!==null&&Nc(za)&&(za=null),Or.forEach(cy),Br.forEach(cy)}function Cc(e,n){e.blockedOn===n&&(e.blockedOn=null,Kf||(Kf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,O2)))}var Ec=null;function dy(e){Ec!==e&&(Ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ec===e&&(Ec=null);for(var n=0;n<e.length;n+=3){var i=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Ff(l||i)===null)continue;break}var h=Vi(i);h!==null&&(e.splice(n,3),n-=3,qu(h,{pending:!0,data:f,method:i.method,action:l},l,f))}}))}function To(e){function n(I){return Cc(I,e)}Ba!==null&&Cc(Ba,e),La!==null&&Cc(La,e),za!==null&&Cc(za,e),Or.forEach(n),Br.forEach(n);for(var i=0;i<$a.length;i++){var l=$a[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$a.length&&(i=$a[0],i.blockedOn===null);)ly(i),i.blockedOn===null&&$a.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var f=i[l],h=i[l+1],x=f[xn]||null;if(typeof h=="function")x||dy(i);else if(x){var N=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[xn]||null)N=x.formAction;else if(Ff(f)!==null)continue}else N=x.action;typeof N=="function"?i[l+1]=N:(i.splice(l,3),l-=3),dy(i)}}}function uy(){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(i,20)}function i(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Zf(e){this._internalRoot=e}Ac.prototype.render=Zf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,l=Bn();ny(i,l,e,n,null,null)},Ac.prototype.unmount=Zf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;ny(e.current,2,null,e,null,null),dc(),n[Pi]=null}};function Ac(e){this._internalRoot=e}Ac.prototype.unstable_scheduleHydration=function(e){if(e){var n=Hi();e={blockedOn:null,target:e,priority:n};for(var i=0;i<$a.length&&n!==0&&n<$a[i].priority;i++);$a.splice(i,0,e),i===0&&ly(e)}};var fy=s.version;if(fy!=="19.2.4")throw Error(r(527,fy,"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 B2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Mc.isDisabled&&Mc.supportsFiber)try{mn=Mc.inject(B2),Ut=Mc}catch{}}return zr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var i=!1,l="",f=bv,h=_v,x=xv;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=ey(e,1,!1,null,null,i,l,null,f,h,x,uy),e[Pi]=n.current,Ef(e),new Zf(n)},zr.hydrateRoot=function(e,n,i){if(!c(e))throw Error(r(299));var l=!1,f="",h=bv,x=_v,N=xv,I=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(N=i.onRecoverableError),i.formState!==void 0&&(I=i.formState)),n=ey(e,1,!0,n,i??null,l,f,I,h,x,N,uy),n.context=ty(null),i=n.current,l=Bn(),l=_t(l),f=ja(l),f.callback=null,Ta(i,f,l),i=l,n.current.lanes=i,Ue(n,i),As(n),e[Pi]=n.current,Ef(e),new Ac(n)},zr.version="19.2.4",zr}var vy;function rj(){if(vy)return Yf.exports;vy=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(),Yf.exports=oj(),Yf.exports}var lj=rj();const cj="modulepreload",dj=function(t){return"/"+t},yy={},$_=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=dj(g),g in yy)return;yy[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":cj,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)})},uj=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),Sd=P2({baseUrl:"/",fetch:uj}),Be=kd(U2,Sd),zn=kd(V2,Sd),Bc=kd(q2,Sd),Lc=kd(G2,Sd),fj="_bar_1xlm9_1",pj="_textarea_1xlm9_32",mj="_select_1xlm9_73",hj="_btnPrimary_1xlm9_109",gj="_btnGhost_1xlm9_179",vj="_badge_1xlm9_201",yj="_disconnectHint_1xlm9_211",bs={bar:fj,textarea:pj,select:mj,btnPrimary:hj,btnGhost:gj,badge:vj,disconnectHint:yj},bj=200;function _j(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 xj({environmentId:t,onReconnect:s}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:bs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),a.jsx("button",{type:"button",onClick:()=>s(t),className:bs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Xf({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,bj)}px`)},[t]);const m=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.nativeEvent.isComposing&&(g.preventDefault(),o())};return a.jsx("textarea",{ref:p,rows:1,value:t,onChange:g=>s(g.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:bs.textarea,"aria-label":u})}function jd({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=_j(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=M=>{M.preventDefault(),w()};return t==="spawn"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx("span",{className:bs.badge,children:"new chat"}),a.jsx(Xf,{value:_,onChange:k,onSubmit:w,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&a.jsxs("select",{value:S,onChange:M=>j(M.target.value),className:bs.select,"aria-label":"Select persona",children:[a.jsx("option",{value:"",children:"(Default)"}),d.map(M=>a.jsx("option",{value:M.id,children:M.name},M.id))]}),a.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:bs.btnPrimary,children:"Go"})]}):t==="start"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx(Xf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),a.jsx("button",{type:"submit",disabled:!_.trim(),className:bs.btnPrimary,children:"Send"})]}):a.jsxs("form",{onSubmit:C,className:bs.bar,children:[T&&o&&a.jsx(xj,{environmentId:o,onReconnect:v}),a.jsx(Xf,{value:_,onChange:k,onSubmit:w,placeholder:"Type a message...",autoFocus:!T,disabled:T,ariaLabel:"Type a message"}),a.jsx("span",{title:T?"Environment is unavailable — reconnect first":void 0,children:a.jsx("button",{type:"submit",disabled:!_.trim()||T,className:bs.btnPrimary,children:"Send"})})]})}const by=220,_y=70,kj=40,Sj=60,jj="hierarchy",Tj="dependency";function wj(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new cd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:kj,ranksep:Sj});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:by,height:_y});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:jj},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:Tj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return cd.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-by/2,y:p.y-_y/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 ks=Object.prototype.hasOwnProperty,ds=t.unstable_scheduleCallback,zs=t.unstable_cancelCallback,ga=t.unstable_shouldYield,Oi=t.unstable_requestPaint,Xt=t.unstable_now,Qa=t.unstable_getCurrentPriorityLevel,ei=t.unstable_ImmediatePriority,va=t.unstable_UserBlockingPriority,$s=t.unstable_NormalPriority,Ss=t.unstable_LowPriority,we=t.unstable_IdlePriority,Ve=t.log,_n=t.unstable_setDisableYieldValue,mn=null,Ut=null;function Cn(e){if(typeof Ve=="function"&&_n(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(mn,e)}catch{}}var Qt=Math.clz32?Math.clz32:zi,Bi=Math.log,Li=Math.LN2;function zi(e){return e>>>=0,e===0?32:31-(Bi(e)/Li|0)|0}var $i=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,i){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,k=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=de(l):(k&=w,k!==0?f=de(k):i||(i=w&~e,i!==0&&(f=de(i))))):(w=l&~h,w!==0?f=de(w):k!==0?f=de(k):i||(i=l&~e,i!==0&&(f=de(i)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,i=n&-n,h>=i||h===32&&(i&4194048)!==0)?n:f}function 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=[],i=0;31>i;i++)n.push(e);return n}function Ue(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dt(e,n,i,l,f,h){var k=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,I=e.expirationTimes,G=e.hiddenUpdates;for(i=k&~i;0<i;){var X=31-Qt(i),ie=1<<X;w[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)}i&=~ie}l!==0&&qe(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(k&~n))}function qe(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-Qt(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function on(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var l=31-Qt(i),f=1<<l;f&n|e[l]&n&&(e[l]|=n),i&=~f}}function En(e,n){var i=n&-n;return i=(i&42)!==0?1:_t(i),(i&(e.suspendedLanes|n))!==0?0:i}function _t(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 js(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Hi(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:oy(e.type))}function Ts(e,n){var i=B.p;try{return B.p=e,n()}finally{B.p=i}}var Ns=Math.random().toString(36).slice(2),rn="__reactFiber$"+Ns,xn="__reactProps$"+Ns,Pi="__reactContainer$"+Ns,$d="__reactEvents$"+Ns,Ck="__reactListeners$"+Ns,Ek="__reactHandles$"+Ns,Sh="__reactResources$"+Ns,Yo="__reactMarker$"+Ns;function Hd(e){delete e[rn],delete e[xn],delete e[$d],delete e[Ck],delete e[Ek]}function Ui(e){var n=e[rn];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Pi]||i[rn]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=q0(e);e!==null;){if(i=e[rn])return i;e=q0(e)}return n}e=i,i=e.parentNode}return null}function Vi(e){if(e=e[rn]||e[Pi]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Jo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function qi(e){var n=e[Sh];return n||(n=e[Sh]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function en(e){e[Yo]=!0}var jh=new Set,Th={};function ti(e,n){Gi(e,n),Gi(e+"Capture",n)}function Gi(e,n){for(Th[e]=n,e=0;e<n.length;e++)jh.add(n[e])}var Ak=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]*$"),Nh={},wh={};function Dk(e){return ks.call(wh,e)?!0:ks.call(Nh,e)?!1:Ak.test(e)?wh[e]=!0:(Nh[e]=!0,!1)}function _l(e,n,i){if(Dk(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function xl(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function Hs(e,n,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+l)}}function Vn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ch(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Mk(e,n,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(k){i=""+k,h.call(this,k)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(k){i=""+k},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Pd(e){if(!e._valueTracker){var n=Ch(e)?"checked":"value";e._valueTracker=Mk(e,n,""+e[n])}}function Eh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return e&&(l=Ch(e)?e.checked?"true":"false":e.value),e=l,e!==i?(n.setValue(e),!0):!1}function kl(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 Rk=/[\n"\\]/g;function qn(e){return e.replace(Rk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Ud(e,n,i,l,f,h,k,w){e.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.type=k:e.removeAttribute("type"),n!=null?k==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Vn(n)):e.value!==""+Vn(n)&&(e.value=""+Vn(n)):k!=="submit"&&k!=="reset"||e.removeAttribute("value"),n!=null?Vd(e,k,Vn(n)):i!=null?Vd(e,k,Vn(i)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Vn(w):e.removeAttribute("name")}function Ah(e,n,i,l,f,h,k,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||i!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){Pd(e);return}i=i!=null?""+Vn(i):"",n=n!=null?""+Vn(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(e.name=k),Pd(e)}function Vd(e,n,i){n==="number"&&kl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Fi(e,n,i,l){if(e=e.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<e.length;i++)f=n.hasOwnProperty("$"+e[i].value),e[i].selected!==f&&(e[i].selected=f),f&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Vn(i),n=null,f=0;f<e.length;f++){if(e[f].value===i){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Dh(e,n,i){if(n!=null&&(n=""+Vn(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Vn(i):""}function Mh(e,n,i,l){if(n==null){if(l!=null){if(i!=null)throw Error(r(92));if(se(l)){if(1<l.length)throw Error(r(93));l=l[0]}i=l}i==null&&(i=""),n=i}i=Vn(n),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),Pd(e)}function Ki(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var Ik=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Rh(e,n,i){var l=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,i):typeof i!="number"||i===0||Ik.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function Ih(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&i[f]!==l&&Rh(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&Rh(e,h,n[h])}function qd(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 Ok=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"]]),Bk=/^[\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 Sl(e){return Bk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ps(){}var Gd=null;function Fd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zi=null,Yi=null;function Oh(e){var n=Vi(e);if(n&&(e=n.stateNode)){var i=e[xn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Ud(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+qn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var l=i[n];if(l!==e&&l.form===e.form){var f=l[xn]||null;if(!f)throw Error(r(90));Ud(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<i.length;n++)l=i[n],l.form===e.form&&Eh(l)}break e;case"textarea":Dh(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Fi(e,!!i.multiple,n,!1)}}}var Kd=!1;function Bh(e,n,i){if(Kd)return e(n,i);Kd=!0;try{var l=e(n);return l}finally{if(Kd=!1,(Zi!==null||Yi!==null)&&(dc(),Zi&&(n=Zi,e=Yi,Yi=Zi=null,Oh(n),e)))for(n=0;n<e.length;n++)Oh(e[n])}}function Wo(e,n){var i=e.stateNode;if(i===null)return null;var l=i[xn]||null;if(l===null)return null;i=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Us=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zd=!1;if(Us)try{var Xo={};Object.defineProperty(Xo,"passive",{get:function(){Zd=!0}}),window.addEventListener("test",Xo,Xo),window.removeEventListener("test",Xo,Xo)}catch{Zd=!1}var ya=null,Yd=null,jl=null;function Lh(){if(jl)return jl;var e,n=Yd,i=n.length,l,f="value"in ya?ya.value:ya.textContent,h=f.length;for(e=0;e<i&&n[e]===f[e];e++);var k=i-e;for(l=1;l<=k&&n[i-l]===f[h-l];l++);return jl=f.slice(e,1<l?1-l:void 0)}function Tl(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 Nl(){return!0}function zh(){return!1}function kn(e){function n(i,l,f,h,k){this._reactName=i,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=k,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Nl:zh,this.isPropagationStopped=zh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Nl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Nl)},persist:function(){},isPersistent:Nl}),n}var ni={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wl=kn(ni),Qo=b({},ni,{view:0,detail:0}),Lk=kn(Qo),Jd,Wd,er,Cl=b({},Qo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qd,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==er&&(er&&e.type==="mousemove"?(Jd=e.screenX-er.screenX,Wd=e.screenY-er.screenY):Wd=Jd=0,er=e),Jd)},movementY:function(e){return"movementY"in e?e.movementY:Wd}}),$h=kn(Cl),zk=b({},Cl,{dataTransfer:0}),$k=kn(zk),Hk=b({},Qo,{relatedTarget:0}),Xd=kn(Hk),Pk=b({},ni,{animationName:0,elapsedTime:0,pseudoElement:0}),Uk=kn(Pk),Vk=b({},ni,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qk=kn(Vk),Gk=b({},ni,{data:0}),Hh=kn(Gk),Fk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kk={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"},Zk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Zk[e])?!!n[e]:!1}function Qd(){return Yk}var Jk=b({},Qo,{key:function(e){if(e.key){var n=Fk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Tl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qd,charCode:function(e){return e.type==="keypress"?Tl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Wk=kn(Jk),Xk=b({},Cl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ph=kn(Xk),Qk=b({},Qo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qd}),eS=kn(Qk),tS=b({},ni,{propertyName:0,elapsedTime:0,pseudoElement:0}),nS=kn(tS),sS=b({},Cl,{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}),aS=kn(sS),iS=b({},ni,{newState:0,oldState:0}),oS=kn(iS),rS=[9,13,27,32],eu=Us&&"CompositionEvent"in window,tr=null;Us&&"documentMode"in document&&(tr=document.documentMode);var lS=Us&&"TextEvent"in window&&!tr,Uh=Us&&(!eu||tr&&8<tr&&11>=tr),Vh=" ",qh=!1;function Gh(e,n){switch(e){case"keyup":return rS.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ji=!1;function cS(e,n){switch(e){case"compositionend":return Fh(n);case"keypress":return n.which!==32?null:(qh=!0,Vh);case"textInput":return e=n.data,e===Vh&&qh?null:e;default:return null}}function dS(e,n){if(Ji)return e==="compositionend"||!eu&&Gh(e,n)?(e=Lh(),jl=Yd=ya=null,Ji=!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 Uh&&n.locale!=="ko"?null:n.data;default:return null}}var uS={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 Kh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!uS[e.type]:n==="textarea"}function Zh(e,n,i,l){Zi?Yi?Yi.push(l):Yi=[l]:Zi=l,n=vc(n,"onChange"),0<n.length&&(i=new wl("onChange","change",null,i,l),e.push({event:i,listeners:n}))}var nr=null,sr=null;function fS(e){A0(e,0)}function El(e){var n=Jo(e);if(Eh(n))return e}function Yh(e,n){if(e==="change")return n}var Jh=!1;if(Us){var tu;if(Us){var nu="oninput"in document;if(!nu){var Wh=document.createElement("div");Wh.setAttribute("oninput","return;"),nu=typeof Wh.oninput=="function"}tu=nu}else tu=!1;Jh=tu&&(!document.documentMode||9<document.documentMode)}function Xh(){nr&&(nr.detachEvent("onpropertychange",Qh),sr=nr=null)}function Qh(e){if(e.propertyName==="value"&&El(sr)){var n=[];Zh(n,sr,e,Fd(e)),Bh(fS,n)}}function pS(e,n,i){e==="focusin"?(Xh(),nr=n,sr=i,nr.attachEvent("onpropertychange",Qh)):e==="focusout"&&Xh()}function mS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return El(sr)}function hS(e,n){if(e==="click")return El(n)}function gS(e,n){if(e==="input"||e==="change")return El(n)}function vS(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var An=typeof Object.is=="function"?Object.is:vS;function ar(e,n){if(An(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var f=i[l];if(!ks.call(n,f)||!An(e[f],n[f]))return!1}return!0}function eg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function tg(e,n){var i=eg(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=n&&l>=n)return{node:i,offset:n-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=eg(i)}}function ng(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?ng(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function sg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=kl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=kl(e.document)}return n}function su(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 yS=Us&&"documentMode"in document&&11>=document.documentMode,Wi=null,au=null,ir=null,iu=!1;function ag(e,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;iu||Wi==null||Wi!==kl(l)||(l=Wi,"selectionStart"in l&&su(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}),ir&&ar(ir,l)||(ir=l,l=vc(au,"onSelect"),0<l.length&&(n=new wl("onSelect","select",null,n,i),e.push({event:n,listeners:l}),n.target=Wi)))}function si(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Xi={animationend:si("Animation","AnimationEnd"),animationiteration:si("Animation","AnimationIteration"),animationstart:si("Animation","AnimationStart"),transitionrun:si("Transition","TransitionRun"),transitionstart:si("Transition","TransitionStart"),transitioncancel:si("Transition","TransitionCancel"),transitionend:si("Transition","TransitionEnd")},ou={},ig={};Us&&(ig=document.createElement("div").style,"AnimationEvent"in window||(delete Xi.animationend.animation,delete Xi.animationiteration.animation,delete Xi.animationstart.animation),"TransitionEvent"in window||delete Xi.transitionend.transition);function ai(e){if(ou[e])return ou[e];if(!Xi[e])return e;var n=Xi[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in ig)return ou[e]=n[i];return e}var og=ai("animationend"),rg=ai("animationiteration"),lg=ai("animationstart"),bS=ai("transitionrun"),_S=ai("transitionstart"),xS=ai("transitioncancel"),cg=ai("transitionend"),dg=new Map,ru="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(" ");ru.push("scrollEnd");function us(e,n){dg.set(e,n),ti(n,[e])}var Al=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)},Gn=[],Qi=0,lu=0;function Dl(){for(var e=Qi,n=lu=Qi=0;n<e;){var i=Gn[n];Gn[n++]=null;var l=Gn[n];Gn[n++]=null;var f=Gn[n];Gn[n++]=null;var h=Gn[n];if(Gn[n++]=null,l!==null&&f!==null){var k=l.pending;k===null?f.next=f:(f.next=k.next,k.next=f),l.pending=f}h!==0&&ug(i,f,h)}}function Ml(e,n,i,l){Gn[Qi++]=e,Gn[Qi++]=n,Gn[Qi++]=i,Gn[Qi++]=l,lu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function cu(e,n,i,l){return Ml(e,n,i,l),Rl(e)}function ii(e,n){return Ml(e,null,null,n),Rl(e)}function ug(e,n,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var f=!1,h=e.return;h!==null;)h.childLanes|=i,l=h.alternate,l!==null&&(l.childLanes|=i),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-Qt(i),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=i|536870912),h):null}function Rl(e){if(50<wr)throw wr=0,bf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var eo={};function kS(e,n,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(e,n,i,l){return new kS(e,n,i,l)}function du(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vs(e,n){var i=e.alternate;return i===null?(i=Dn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function fg(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Il(e,n,i,l,f,h){var k=0;if(l=e,typeof e=="function")du(e)&&(k=1);else if(typeof e=="string")k=w2(e,i,De.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=Dn(31,i,n,f),e.elementType=$,e.lanes=h,e;case j:return oi(i.children,f,h,n);case T:k=8,f|=24;break;case N:return e=Dn(12,i,n,f|2),e.elementType=N,e.lanes=h,e;case E:return e=Dn(13,i,n,f),e.elementType=E,e.lanes=h,e;case R:return e=Dn(19,i,n,f),e.elementType=R,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:k=10;break e;case C:k=9;break e;case A:k=11;break e;case O:k=14;break e;case M:k=16,l=null;break e}k=29,i=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Dn(k,i,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function oi(e,n,i,l){return e=Dn(7,e,l,n),e.lanes=i,e}function uu(e,n,i){return e=Dn(6,e,null,n),e.lanes=i,e}function pg(e){var n=Dn(18,null,null,0);return n.stateNode=e,n}function fu(e,n,i){return n=Dn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var mg=new WeakMap;function Fn(e,n){if(typeof e=="object"&&e!==null){var i=mg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:an(n)},mg.set(e,n),n)}return{value:e,source:n,stack:an(n)}}var to=[],no=0,Ol=null,or=0,Kn=[],Zn=0,ba=null,ws=1,Cs="";function qs(e,n){to[no++]=or,to[no++]=Ol,Ol=e,or=n}function hg(e,n,i){Kn[Zn++]=ws,Kn[Zn++]=Cs,Kn[Zn++]=ba,ba=e;var l=ws;e=Cs;var f=32-Qt(l)-1;l&=~(1<<f),i+=1;var h=32-Qt(n)+f;if(30<h){var k=f-f%5;h=(l&(1<<k)-1).toString(32),l>>=k,f-=k,ws=1<<32-Qt(n)+f|i<<f|l,Cs=h+e}else ws=1<<h|i<<f|l,Cs=e}function pu(e){e.return!==null&&(qs(e,1),hg(e,1,0))}function mu(e){for(;e===Ol;)Ol=to[--no],to[no]=null,or=to[--no],to[no]=null;for(;e===ba;)ba=Kn[--Zn],Kn[Zn]=null,Cs=Kn[--Zn],Kn[Zn]=null,ws=Kn[--Zn],Kn[Zn]=null}function gg(e,n){Kn[Zn++]=ws,Kn[Zn++]=Cs,Kn[Zn++]=ba,ws=n.id,Cs=n.overflow,ba=e}var ln=null,kt=null,Je=!1,_a=null,Yn=!1,hu=Error(r(519));function xa(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rr(Fn(n,e)),hu}function vg(e){var n=e.stateNode,i=e.type,l=e.memoizedProps;switch(n[rn]=e,n[xn]=l,i){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(i=0;i<Er.length;i++)Fe(Er[i],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Fe("invalid",n),Ah(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),Mh(n,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||l.suppressHydrationWarning===!0||I0(n.textContent,i)?(l.popover!=null&&(Fe("beforetoggle",n),Fe("toggle",n)),l.onScroll!=null&&Fe("scroll",n),l.onScrollEnd!=null&&Fe("scrollend",n),l.onClick!=null&&(n.onclick=Ps),n=!0):n=!1,n||xa(e,!0)}function yg(e){for(ln=e.return;ln;)switch(ln.tag){case 5:case 31:case 13:Yn=!1;return;case 27:case 3:Yn=!0;return;default:ln=ln.return}}function so(e){if(e!==ln)return!1;if(!Je)return yg(e),Je=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||If(e.type,e.memoizedProps)),i=!i),i&&kt&&xa(e),yg(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));kt=V0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));kt=V0(e)}else n===27?(n=kt,Oa(e.type)?(e=$f,$f=null,kt=e):kt=n):kt=ln?Wn(e.stateNode.nextSibling):null;return!0}function ri(){kt=ln=null,Je=!1}function gu(){var e=_a;return e!==null&&(Nn===null?Nn=e:Nn.push.apply(Nn,e),_a=null),e}function rr(e){_a===null?_a=[e]:_a.push(e)}var vu=ce(null),li=null,Gs=null;function ka(e,n,i){xe(vu,n._currentValue),n._currentValue=i}function Fs(e){e._currentValue=vu.current,me(vu)}function yu(e,n,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===i)break;e=e.return}}function bu(e,n,i,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var k=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var I=0;I<n.length;I++)if(w.context===n[I]){h.lanes|=i,w=h.alternate,w!==null&&(w.lanes|=i),yu(h.return,i,e),l||(k=null);break e}h=w.next}}else if(f.tag===18){if(k=f.return,k===null)throw Error(r(341));k.lanes|=i,h=k.alternate,h!==null&&(h.lanes|=i),yu(k,i,e),k=null}else k=f.child;if(k!==null)k.return=f;else for(k=f;k!==null;){if(k===e){k=null;break}if(f=k.sibling,f!==null){f.return=k.return,k=f;break}k=k.return}f=k}}function ao(e,n,i,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var k=f.alternate;if(k===null)throw Error(r(387));if(k=k.memoizedProps,k!==null){var w=f.type;An(f.pendingProps.value,k.value)||(e!==null?e.push(w):e=[w])}}else if(f===lt.current){if(k=f.alternate,k===null)throw Error(r(387));k.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Ir):e=[Ir])}f=f.return}e!==null&&bu(n,e,i,l),n.flags|=262144}function Bl(e){for(e=e.firstContext;e!==null;){if(!An(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ci(e){li=e,Gs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function cn(e){return bg(li,e)}function Ll(e,n){return li===null&&ci(e),bg(e,n)}function bg(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Gs===null){if(e===null)throw Error(r(308));Gs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Gs=Gs.next=n;return i}var SS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},jS=t.unstable_scheduleCallback,TS=t.unstable_NormalPriority,Vt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _u(){return{controller:new SS,data:new Map,refCount:0}}function lr(e){e.refCount--,e.refCount===0&&jS(TS,function(){e.controller.abort()})}var cr=null,xu=0,io=0,oo=null;function NS(e,n){if(cr===null){var i=cr=[];xu=0,io=Tf(),oo={status:"pending",value:void 0,then:function(l){i.push(l)}}}return xu++,n.then(_g,_g),n}function _g(){if(--xu===0&&cr!==null){oo!==null&&(oo.status="fulfilled");var e=cr;cr=null,io=0,oo=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function wS(e,n){var i=[],l={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<i.length;f++)(0,i[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),l}var xg=H.S;H.S=function(e,n){a0=Xt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&NS(e,n),xg!==null&&xg(e,n)};var di=ce(null);function ku(){var e=di.current;return e!==null?e:yt.pooledCache}function zl(e,n){n===null?xe(di,di.current):xe(di,n.pool)}function kg(){var e=ku();return e===null?null:{parent:Vt._currentValue,pool:e}}var ro=Error(r(460)),Su=Error(r(474)),$l=Error(r(542)),Hl={then:function(){}};function Sg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jg(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(Ps,Ps),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Ng(e),e;default:if(typeof n.status=="string")n.then(Ps,Ps);else{if(e=yt,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,Ng(e),e}throw fi=n,ro}}function ui(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(fi=i,ro):i}}var fi=null;function Tg(){if(fi===null)throw Error(r(459));var e=fi;return fi=null,e}function Ng(e){if(e===ro||e===$l)throw Error(r(483))}var lo=null,dr=0;function Pl(e){var n=dr;return dr+=1,lo===null&&(lo=[]),jg(lo,e,n)}function ur(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ul(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 wg(e){function n(P,z){if(e){var q=P.deletions;q===null?(P.deletions=[z],P.flags|=16):q.push(z)}}function i(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=Vs(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 k(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function w(P,z,q,te){return z===null||z.tag!==6?(z=uu(q,P.mode,te),z.return=P,z):(z=f(z,q),z.return=P,z)}function I(P,z,q,te){var Ne=q.type;return Ne===j?X(P,z,q.props.children,te,q.key):z!==null&&(z.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===M&&ui(Ne)===z.type)?(z=f(z,q.props),ur(z,q),z.return=P,z):(z=Il(q.type,q.key,q.props,null,P.mode,te),ur(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=fu(q,P.mode,te),z.return=P,z):(z=f(z,q.children||[]),z.return=P,z)}function X(P,z,q,te,Ne){return z===null||z.tag!==7?(z=oi(q,P.mode,te,Ne),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=uu(""+z,P.mode,q),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case x:return q=Il(z.type,z.key,z.props,null,P.mode,q),ur(q,z),q.return=P,q;case S:return z=fu(z,P.mode,q),z.return=P,z;case M:return z=ui(z),ie(P,z,q)}if(se(z)||ne(z))return z=oi(z,P.mode,q,null),z.return=P,z;if(typeof z.then=="function")return ie(P,Pl(z),q);if(z.$$typeof===D)return ie(P,Ll(P,z),q);Ul(P,z)}return null}function K(P,z,q,te){var Ne=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Ne!==null?null:w(P,z,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case x:return q.key===Ne?I(P,z,q,te):null;case S:return q.key===Ne?G(P,z,q,te):null;case M:return q=ui(q),K(P,z,q,te)}if(se(q)||ne(q))return Ne!==null?null:X(P,z,q,te,null);if(typeof q.then=="function")return K(P,z,Pl(q),te);if(q.$$typeof===D)return K(P,z,Ll(P,q),te);Ul(P,q)}return null}function J(P,z,q,te,Ne){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return P=P.get(q)||null,w(z,P,""+te,Ne);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return P=P.get(te.key===null?q:te.key)||null,I(z,P,te,Ne);case S:return P=P.get(te.key===null?q:te.key)||null,G(z,P,te,Ne);case M:return te=ui(te),J(P,z,q,te,Ne)}if(se(te)||ne(te))return P=P.get(q)||null,X(z,P,te,Ne,null);if(typeof te.then=="function")return J(P,z,q,Pl(te),Ne);if(te.$$typeof===D)return J(P,z,q,Ll(z,te),Ne);Ul(z,te)}return null}function _e(P,z,q,te){for(var Ne=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?Ne=at:st.sibling=at,st=at,Se=Ze}if($e===q.length)return i(P,Se),Je&&qs(P,$e),Ne;if(Se===null){for(;$e<q.length;$e++)Se=ie(P,q[$e],te),Se!==null&&(z=h(Se,z,$e),st===null?Ne=Se:st.sibling=Se,st=Se);return Je&&qs(P,$e),Ne}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?Ne=Ze:st.sibling=Ze,st=Ze);return e&&Se.forEach(function(Ha){return n(P,Ha)}),Je&&qs(P,$e),Ne}function Ce(P,z,q,te){if(q==null)throw Error(r(151));for(var Ne=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 Ha=K(P,Se,at.value,te);if(Ha===null){Se===null&&(Se=Ze);break}e&&Se&&Ha.alternate===null&&n(P,Se),z=h(Ha,z,$e),st===null?Ne=Ha:st.sibling=Ha,st=Ha,Se=Ze}if(at.done)return i(P,Se),Je&&qs(P,$e),Ne;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?Ne=at:st.sibling=at,st=at);return Je&&qs(P,$e),Ne}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?Ne=at:st.sibling=at,st=at);return e&&Se.forEach(function(z2){return n(P,z2)}),Je&&qs(P,$e),Ne}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 x:e:{for(var Ne=q.key;z!==null;){if(z.key===Ne){if(Ne=q.type,Ne===j){if(z.tag===7){i(P,z.sibling),te=f(z,q.props.children),te.return=P,P=te;break e}}else if(z.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===M&&ui(Ne)===z.type){i(P,z.sibling),te=f(z,q.props),ur(te,q),te.return=P,P=te;break e}i(P,z);break}else n(P,z);z=z.sibling}q.type===j?(te=oi(q.props.children,P.mode,te,q.key),te.return=P,P=te):(te=Il(q.type,q.key,q.props,null,P.mode,te),ur(te,q),te.return=P,P=te)}return k(P);case S:e:{for(Ne=q.key;z!==null;){if(z.key===Ne)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){i(P,z.sibling),te=f(z,q.children||[]),te.return=P,P=te;break e}else{i(P,z);break}else n(P,z);z=z.sibling}te=fu(q,P.mode,te),te.return=P,P=te}return k(P);case M:return q=ui(q),gt(P,z,q,te)}if(se(q))return _e(P,z,q,te);if(ne(q)){if(Ne=ne(q),typeof Ne!="function")throw Error(r(150));return q=Ne.call(q),Ce(P,z,q,te)}if(typeof q.then=="function")return gt(P,z,Pl(q),te);if(q.$$typeof===D)return gt(P,z,Ll(P,q),te);Ul(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(i(P,z.sibling),te=f(z,q),te.return=P,P=te):(i(P,z),te=uu(q,P.mode,te),te.return=P,P=te),k(P)):i(P,z)}return function(P,z,q,te){try{dr=0;var Ne=gt(P,z,q,te);return lo=null,Ne}catch(Se){if(Se===ro||Se===$l)throw Se;var st=Dn(29,Se,null,P.mode);return st.lanes=te,st.return=P,st}finally{}}}var pi=wg(!0),Cg=wg(!1),Sa=!1;function ju(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Tu(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 ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,n,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Rl(e),ug(e,null,i),n}return Ml(e,l,n,i),Rl(e)}function fr(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,on(e,i)}}function Nu(e,n){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var f=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var k={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};h===null?f=h=k:h=h.next=k,i=i.next}while(i!==null);h===null?f=h=n:h=h.next=n}else f=h=n;i={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var wu=!1;function pr(){if(wu){var e=oo;if(e!==null)throw e}}function mr(e,n,i,l){wu=!1;var f=e.updateQueue;Sa=!1;var h=f.firstBaseUpdate,k=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var I=w,G=I.next;I.next=null,k===null?h=G:k.next=G,k=I;var X=e.alternate;X!==null&&(X=X.updateQueue,w=X.lastBaseUpdate,w!==k&&(w===null?X.firstBaseUpdate=G:w.next=G,X.lastBaseUpdate=I))}if(h!==null){var ie=f.baseState;k=0,X=G=I=null,w=h;do{var K=w.lane&-536870913,J=K!==w.lane;if(J?(Ke&K)===K:(l&K)===K){K!==0&&K===io&&(wu=!0),X!==null&&(X=X.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var _e=e,Ce=w;K=n;var gt=i;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:Sa=!0}}K=w.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:w.tag,payload:w.payload,callback:w.callback,next:null},X===null?(G=X=J,I=ie):X=X.next=J,k|=K;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;J=w,w=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),Aa|=k,e.lanes=k,e.memoizedState=ie}}function Eg(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Ag(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Eg(i[e],n)}var co=ce(null),Vl=ce(0);function Dg(e,n){e=ta,xe(Vl,e),xe(co,n),ta=e|n.baseLanes}function Cu(){xe(Vl,ta),xe(co,co.current)}function Eu(){ta=Vl.current,me(co),me(Vl)}var Mn=ce(null),Jn=null;function Na(e){var n=e.alternate;xe(Ot,Ot.current&1),xe(Mn,e),Jn===null&&(n===null||co.current!==null||n.memoizedState!==null)&&(Jn=e)}function Au(e){xe(Ot,Ot.current),xe(Mn,e),Jn===null&&(Jn=e)}function Mg(e){e.tag===22?(xe(Ot,Ot.current),xe(Mn,e),Jn===null&&(Jn=e)):wa()}function wa(){xe(Ot,Ot.current),xe(Mn,Mn.current)}function Rn(e){me(Mn),Jn===e&&(Jn=null),me(Ot)}var Ot=ce(0);function ql(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Lf(i)||zf(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ks=0,ze=null,mt=null,qt=null,Gl=!1,uo=!1,mi=!1,Fl=0,hr=0,fo=null,CS=0;function Mt(){throw Error(r(321))}function Du(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!An(e[i],n[i]))return!1;return!0}function Mu(e,n,i,l,f,h){return Ks=h,ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?hv:Ku,mi=!1,h=i(l,f),mi=!1,uo&&(h=Ig(n,i,l,f)),Rg(e),h}function Rg(e){H.H=yr;var n=mt!==null&&mt.next!==null;if(Ks=0,qt=mt=ze=null,Gl=!1,hr=0,fo=null,n)throw Error(r(300));e===null||Gt||(e=e.dependencies,e!==null&&Bl(e)&&(Gt=!0))}function Ig(e,n,i,l){ze=e;var f=0;do{if(uo&&(fo=null),hr=0,uo=!1,25<=f)throw Error(r(301));if(f+=1,qt=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=gv,h=n(i,l)}while(uo);return h}function ES(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?gr(n):n,e=e.useState()[0],(mt!==null?mt.memoizedState:null)!==e&&(ze.flags|=1024),n}function Ru(){var e=Fl!==0;return Fl=0,e}function Iu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function Ou(e){if(Gl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Gl=!1}Ks=0,qt=mt=ze=null,uo=!1,hr=Fl=0,fo=null}function vn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?ze.memoizedState=qt=e:qt=qt.next=e,qt}function Bt(){if(mt===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=mt.next;var n=qt===null?ze.memoizedState:qt.next;if(n!==null)qt=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},qt===null?ze.memoizedState=qt=e:qt=qt.next=e}return qt}function Kl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function gr(e){var n=hr;return hr+=1,fo===null&&(fo=[]),e=jg(fo,e,n),n=ze,(qt===null?n.memoizedState:qt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?hv:Ku),e}function Zl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return gr(e);if(e.$$typeof===D)return cn(e)}throw Error(r(438,String(e)))}function Bu(e){var n=null,i=ze.updateQueue;if(i!==null&&(n=i.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}),i===null&&(i=Kl(),ze.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),l=0;l<e;l++)i[l]=Y;return n.index++,i}function Zs(e,n){return typeof n=="function"?n(e):n}function Yl(e){var n=Bt();return Lu(n,mt,e)}function Lu(e,n,i){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var k=f.next;f.next=h.next,h.next=k}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=k=null,I=null,G=n,X=!1;do{var ie=G.lane&-536870913;if(ie!==G.lane?(Ke&ie)===ie:(Ks&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===io&&(X=!0);else if((Ks&K)===K){G=G.next,K===io&&(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?(w=I=ie,k=h):I=I.next=ie,ze.lanes|=K,Aa|=K;ie=G.action,mi&&i(h,ie),h=G.hasEagerState?G.eagerState:i(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?(w=I=K,k=h):I=I.next=K,ze.lanes|=ie,Aa|=ie;G=G.next}while(G!==null&&G!==n);if(I===null?k=h:I.next=w,!An(h,e.memoizedState)&&(Gt=!0,X&&(i=oo,i!==null)))throw i;e.memoizedState=h,e.baseState=k,e.baseQueue=I,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function zu(e){var n=Bt(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var l=i.dispatch,f=i.pending,h=n.memoizedState;if(f!==null){i.pending=null;var k=f=f.next;do h=e(h,k.action),k=k.next;while(k!==f);An(h,n.memoizedState)||(Gt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,l]}function Og(e,n,i){var l=ze,f=Bt(),h=Je;if(h){if(i===void 0)throw Error(r(407));i=i()}else i=n();var k=!An((mt||f).memoizedState,i);if(k&&(f.memoizedState=i,Gt=!0),f=f.queue,Pu(zg.bind(null,l,f,e),[e]),f.getSnapshot!==n||k||qt!==null&&qt.memoizedState.tag&1){if(l.flags|=2048,po(9,{destroy:void 0},Lg.bind(null,l,f,i,n),null),yt===null)throw Error(r(349));h||(Ks&127)!==0||Bg(l,n,i)}return i}function Bg(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=ze.updateQueue,n===null?(n=Kl(),ze.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Lg(e,n,i,l){n.value=i,n.getSnapshot=l,$g(n)&&Hg(e)}function zg(e,n,i){return i(function(){$g(n)&&Hg(e)})}function $g(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!An(e,i)}catch{return!0}}function Hg(e){var n=ii(e,2);n!==null&&wn(n,e,2)}function $u(e){var n=vn();if(typeof e=="function"){var i=e;if(e=i(),mi){Cn(!0);try{i()}finally{Cn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:e},n}function Pg(e,n,i,l){return e.baseState=i,Lu(e,mt,typeof l=="function"?l:Zs)}function AS(e,n,i,l,f){if(Xl(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(k){h.listeners.push(k)}};H.T!==null?i(!0):h.isTransition=!1,l(h),i=n.pending,i===null?(h.next=n.pending=h,Ug(n,h)):(h.next=i.next,n.pending=i.next=h)}}function Ug(e,n){var i=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=H.T,k={};H.T=k;try{var w=i(f,l),I=H.S;I!==null&&I(k,w),Vg(e,n,w)}catch(G){Hu(e,n,G)}finally{h!==null&&k.types!==null&&(h.types=k.types),H.T=h}}else try{h=i(f,l),Vg(e,n,h)}catch(G){Hu(e,n,G)}}function Vg(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){qg(e,n,l)},function(l){return Hu(e,n,l)}):qg(e,n,i)}function qg(e,n,i){n.status="fulfilled",n.value=i,Gg(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Ug(e,i)))}function Hu(e,n,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=i,Gg(n),n=n.next;while(n!==l)}e.action=null}function Gg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Fg(e,n){return n}function Kg(e,n){if(Je){var i=yt.formState;if(i!==null){e:{var l=ze;if(Je){if(kt){t:{for(var f=kt,h=Yn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Wn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){kt=Wn(f.nextSibling),l=f.data==="F!";break e}}xa(l)}l=!1}l&&(n=i[0])}}return i=vn(),i.memoizedState=i.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fg,lastRenderedState:n},i.queue=l,i=fv.bind(null,ze,l),l.dispatch=i,l=$u(!1),h=Fu.bind(null,ze,!1,l.queue),l=vn(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,i=AS.bind(null,ze,f,h,i),f.dispatch=i,l.memoizedState=e,[n,i,!1]}function Zg(e){var n=Bt();return Yg(n,mt,e)}function Yg(e,n,i){if(n=Lu(e,n,Fg)[0],e=Yl(Zs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=gr(n)}catch(k){throw k===ro?$l:k}else l=n;n=Bt();var f=n.queue,h=f.dispatch;return i!==n.memoizedState&&(ze.flags|=2048,po(9,{destroy:void 0},DS.bind(null,f,i),null)),[l,h,e]}function DS(e,n){e.action=n}function Jg(e){var n=Bt(),i=mt;if(i!==null)return Yg(n,i,e);Bt(),n=n.memoizedState,i=Bt();var l=i.queue.dispatch;return i.memoizedState=e,[n,l,!1]}function po(e,n,i,l){return e={tag:e,create:i,deps:l,inst:n,next:null},n=ze.updateQueue,n===null&&(n=Kl(),ze.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,n.lastEffect=e),e}function Wg(){return Bt().memoizedState}function Jl(e,n,i,l){var f=vn();ze.flags|=e,f.memoizedState=po(1|n,{destroy:void 0},i,l===void 0?null:l)}function Wl(e,n,i,l){var f=Bt();l=l===void 0?null:l;var h=f.memoizedState.inst;mt!==null&&l!==null&&Du(l,mt.memoizedState.deps)?f.memoizedState=po(n,h,i,l):(ze.flags|=e,f.memoizedState=po(1|n,h,i,l))}function Xg(e,n){Jl(8390656,8,e,n)}function Pu(e,n){Wl(2048,8,e,n)}function MS(e){ze.flags|=4;var n=ze.updateQueue;if(n===null)n=Kl(),ze.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function Qg(e){var n=Bt().memoizedState;return MS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function ev(e,n){return Wl(4,2,e,n)}function tv(e,n){return Wl(4,4,e,n)}function nv(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function sv(e,n,i){i=i!=null?i.concat([e]):null,Wl(4,4,nv.bind(null,n,e),i)}function Uu(){}function av(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;return n!==null&&Du(n,l[1])?l[0]:(i.memoizedState=[e,n],e)}function iv(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;if(n!==null&&Du(n,l[1]))return l[0];if(l=e(),mi){Cn(!0);try{e()}finally{Cn(!1)}}return i.memoizedState=[l,n],l}function Vu(e,n,i){return i===void 0||(Ks&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=o0(),ze.lanes|=e,Aa|=e,i)}function ov(e,n,i,l){return An(i,n)?i:co.current!==null?(e=Vu(e,i,l),An(e,n)||(Gt=!0),e):(Ks&42)===0||(Ks&1073741824)!==0&&(Ke&261930)===0?(Gt=!0,e.memoizedState=i):(e=o0(),ze.lanes|=e,Aa|=e,n)}function rv(e,n,i,l,f){var h=B.p;B.p=h!==0&&8>h?h:8;var k=H.T,w={};H.T=w,Fu(e,!1,n,i);try{var I=f(),G=H.S;if(G!==null&&G(w,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var X=wS(I,l);vr(e,n,X,Bn(e))}else vr(e,n,l,Bn(e))}catch(ie){vr(e,n,{then:function(){},status:"rejected",reason:ie},Bn())}finally{B.p=h,k!==null&&w.types!==null&&(k.types=w.types),H.T=k}}function RS(){}function qu(e,n,i,l){if(e.tag!==5)throw Error(r(476));var f=lv(e).queue;rv(e,f,n,F,i===null?RS:function(){return cv(e),i(l)})}function lv(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:Zs,lastRenderedState:F},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zs,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function cv(e){var n=lv(e);n.next===null&&(n=e.alternate.memoizedState),vr(e,n.next.queue,{},Bn())}function Gu(){return cn(Ir)}function dv(){return Bt().memoizedState}function uv(){return Bt().memoizedState}function IS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Bn();e=ja(i);var l=Ta(n,e,i);l!==null&&(wn(l,n,i),fr(l,n,i)),n={cache:_u()},e.payload=n;return}n=n.return}}function OS(e,n,i){var l=Bn();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Xl(e)?pv(n,i):(i=cu(e,n,i,l),i!==null&&(wn(i,e,l),mv(i,n,l)))}function fv(e,n,i){var l=Bn();vr(e,n,i,l)}function vr(e,n,i,l){var f={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xl(e))pv(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var k=n.lastRenderedState,w=h(k,i);if(f.hasEagerState=!0,f.eagerState=w,An(w,k))return Ml(e,n,f,0),yt===null&&Dl(),!1}catch{}finally{}if(i=cu(e,n,f,l),i!==null)return wn(i,e,l),mv(i,n,l),!0}return!1}function Fu(e,n,i,l){if(l={lane:2,revertLane:Tf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Xl(e)){if(n)throw Error(r(479))}else n=cu(e,i,l,2),n!==null&&wn(n,e,2)}function Xl(e){var n=e.alternate;return e===ze||n!==null&&n===ze}function pv(e,n){uo=Gl=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function mv(e,n,i){if((i&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,on(e,i)}}var yr={readContext:cn,use:Zl,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};yr.useEffectEvent=Mt;var hv={readContext:cn,use:Zl,useCallback:function(e,n){return vn().memoizedState=[e,n===void 0?null:n],e},useContext:cn,useEffect:Xg,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,Jl(4194308,4,nv.bind(null,n,e),i)},useLayoutEffect:function(e,n){return Jl(4194308,4,e,n)},useInsertionEffect:function(e,n){Jl(4,2,e,n)},useMemo:function(e,n){var i=vn();n=n===void 0?null:n;var l=e();if(mi){Cn(!0);try{e()}finally{Cn(!1)}}return i.memoizedState=[l,n],l},useReducer:function(e,n,i){var l=vn();if(i!==void 0){var f=i(n);if(mi){Cn(!0);try{i(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=OS.bind(null,ze,e),[l.memoizedState,e]},useRef:function(e){var n=vn();return e={current:e},n.memoizedState=e},useState:function(e){e=$u(e);var n=e.queue,i=fv.bind(null,ze,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Uu,useDeferredValue:function(e,n){var i=vn();return Vu(i,e,n)},useTransition:function(){var e=$u(!1);return e=rv.bind(null,ze,e.queue,!0,!1),vn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var l=ze,f=vn();if(Je){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),yt===null)throw Error(r(349));(Ke&127)!==0||Bg(l,n,i)}f.memoizedState=i;var h={value:i,getSnapshot:n};return f.queue=h,Xg(zg.bind(null,l,h,e),[e]),l.flags|=2048,po(9,{destroy:void 0},Lg.bind(null,l,h,i,n),null),i},useId:function(){var e=vn(),n=yt.identifierPrefix;if(Je){var i=Cs,l=ws;i=(l&~(1<<32-Qt(l)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Fl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=CS++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Gu,useFormState:Kg,useActionState:Kg,useOptimistic:function(e){var n=vn();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=Fu.bind(null,ze,!0,i),i.dispatch=n,[e,n]},useMemoCache:Bu,useCacheRefresh:function(){return vn().memoizedState=IS.bind(null,ze)},useEffectEvent:function(e){var n=vn(),i={impl:e};return n.memoizedState=i,function(){if((rt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Ku={readContext:cn,use:Zl,useCallback:av,useContext:cn,useEffect:Pu,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:Yl,useRef:Wg,useState:function(){return Yl(Zs)},useDebugValue:Uu,useDeferredValue:function(e,n){var i=Bt();return ov(i,mt.memoizedState,e,n)},useTransition:function(){var e=Yl(Zs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:gr(e),n]},useSyncExternalStore:Og,useId:dv,useHostTransitionStatus:Gu,useFormState:Zg,useActionState:Zg,useOptimistic:function(e,n){var i=Bt();return Pg(i,mt,e,n)},useMemoCache:Bu,useCacheRefresh:uv};Ku.useEffectEvent=Qg;var gv={readContext:cn,use:Zl,useCallback:av,useContext:cn,useEffect:Pu,useImperativeHandle:sv,useInsertionEffect:ev,useLayoutEffect:tv,useMemo:iv,useReducer:zu,useRef:Wg,useState:function(){return zu(Zs)},useDebugValue:Uu,useDeferredValue:function(e,n){var i=Bt();return mt===null?Vu(i,e,n):ov(i,mt.memoizedState,e,n)},useTransition:function(){var e=zu(Zs)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:gr(e),n]},useSyncExternalStore:Og,useId:dv,useHostTransitionStatus:Gu,useFormState:Jg,useActionState:Jg,useOptimistic:function(e,n){var i=Bt();return mt!==null?Pg(i,mt,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Bu,useCacheRefresh:uv};gv.useEffectEvent=Qg;function Zu(e,n,i,l){n=e.memoizedState,i=i(l,n),i=i==null?n:b({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Yu={enqueueSetState:function(e,n,i){e=e._reactInternals;var l=Bn(),f=ja(l);f.payload=n,i!=null&&(f.callback=i),n=Ta(e,f,l),n!==null&&(wn(n,e,l),fr(n,e,l))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var l=Bn(),f=ja(l);f.tag=1,f.payload=n,i!=null&&(f.callback=i),n=Ta(e,f,l),n!==null&&(wn(n,e,l),fr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Bn(),l=ja(i);l.tag=2,n!=null&&(l.callback=n),n=Ta(e,l,i),n!==null&&(wn(n,e,i),fr(n,e,i))}};function vv(e,n,i,l,f,h,k){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,k):n.prototype&&n.prototype.isPureReactComponent?!ar(i,l)||!ar(f,h):!0}function yv(e,n,i,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,l),n.state!==e&&Yu.enqueueReplaceState(n,n.state,null)}function hi(e,n){var i=n;if("ref"in n){i={};for(var l in n)l!=="ref"&&(i[l]=n[l])}if(e=e.defaultProps){i===n&&(i=b({},i));for(var f in e)i[f]===void 0&&(i[f]=e[f])}return i}function bv(e){Al(e)}function _v(e){console.error(e)}function xv(e){Al(e)}function Ql(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function kv(e,n,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Ju(e,n,i){return i=ja(i),i.tag=3,i.payload={element:null},i.callback=function(){Ql(e,n)},i}function Sv(e){return e=ja(e),e.tag=3,e}function jv(e,n,i,l){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){kv(n,i,l)}}var k=i.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(e.callback=function(){kv(n,i,l),typeof f!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function BS(e,n,i,l,f){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=i.alternate,n!==null&&ao(n,i,f,!0),i=Mn.current,i!==null){switch(i.tag){case 31:case 13:return Jn===null?uc():i.alternate===null&&Rt===0&&(Rt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,l===Hl?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([l]):n.add(l),kf(e,l,f)),!1;case 22:return i.flags|=65536,l===Hl?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([l]):i.add(l)),kf(e,l,f)),!1}throw Error(r(435,i.tag))}return kf(e,l,f),uc(),!1}if(Je)return n=Mn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==hu&&(e=Error(r(422),{cause:l}),rr(Fn(e,i)))):(l!==hu&&(n=Error(r(423),{cause:l}),rr(Fn(n,i))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Fn(l,i),f=Ju(e.stateNode,l,f),Nu(e,f),Rt!==4&&(Rt=2)),!1;var h=Error(r(520),{cause:l});if(h=Fn(h,i),Nr===null?Nr=[h]:Nr.push(h),Rt!==4&&(Rt=2),n===null)return!0;l=Fn(l,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=f&-f,i.lanes|=e,e=Ju(i.stateNode,l,e),Nu(i,e),!1;case 1:if(n=i.type,h=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Da===null||!Da.has(h))))return i.flags|=65536,f&=-f,i.lanes|=f,f=Sv(f),jv(f,e,i,l),Nu(i,f),!1}i=i.return}while(i!==null);return!1}var Wu=Error(r(461)),Gt=!1;function dn(e,n,i,l){n.child=e===null?Cg(n,null,i,l):pi(n,e.child,i,l)}function Tv(e,n,i,l,f){i=i.render;var h=n.ref;if("ref"in l){var k={};for(var w in l)w!=="ref"&&(k[w]=l[w])}else k=l;return ci(n),l=Mu(e,n,i,k,h,f),w=Ru(),e!==null&&!Gt?(Iu(e,n,f),Ys(e,n,f)):(Je&&w&&pu(n),n.flags|=1,dn(e,n,l,f),n.child)}function Nv(e,n,i,l,f){if(e===null){var h=i.type;return typeof h=="function"&&!du(h)&&h.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=h,wv(e,n,h,l,f)):(e=Il(i.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!of(e,f)){var k=h.memoizedProps;if(i=i.compare,i=i!==null?i:ar,i(k,l)&&e.ref===n.ref)return Ys(e,n,f)}return n.flags|=1,e=Vs(h,l),e.ref=n.ref,e.return=n,n.child=e}function wv(e,n,i,l,f){if(e!==null){var h=e.memoizedProps;if(ar(h,l)&&e.ref===n.ref)if(Gt=!1,n.pendingProps=l=h,of(e,f))(e.flags&131072)!==0&&(Gt=!0);else return n.lanes=e.lanes,Ys(e,n,f)}return Xu(e,n,i,l,f)}function Cv(e,n,i,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(h=h!==null?h.baseLanes|i:i,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return Ev(e,n,h,i,l)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&zl(n,h!==null?h.cachePool:null),h!==null?Dg(n,h):Cu(),Mg(n);else return l=n.lanes=536870912,Ev(e,n,h!==null?h.baseLanes|i:i,i,l)}else h!==null?(zl(n,h.cachePool),Dg(n,h),wa(),n.memoizedState=null):(e!==null&&zl(n,null),Cu(),wa());return dn(e,n,f,i),n.child}function br(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Ev(e,n,i,l,f){var h=ku();return h=h===null?null:{parent:Vt._currentValue,pool:h},n.memoizedState={baseLanes:i,cachePool:h},e!==null&&zl(n,null),Cu(),Mg(n),e!==null&&ao(e,n,l,!0),n.childLanes=f,null}function ec(e,n){return n=nc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Av(e,n,i){return pi(n,e.child,null,i),e=ec(n,n.pendingProps),e.flags|=2,Rn(n),n.memoizedState=null,e}function LS(e,n,i){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=ec(n,l),n.lanes=536870912,br(null,e);if(Au(n),(e=kt)?(e=U0(e,Yn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ba!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=pg(e),i.return=n,n.child=i,ln=n,kt=null)):e=null,e===null)throw xa(n);return n.lanes=536870912,null}return ec(n,l)}var h=e.memoizedState;if(h!==null){var k=h.dehydrated;if(Au(n),f)if(n.flags&256)n.flags&=-257,n=Av(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Gt||ao(e,n,i,!1),f=(i&e.childLanes)!==0,Gt||f){if(l=yt,l!==null&&(k=En(l,i),k!==0&&k!==h.retryLane))throw h.retryLane=k,ii(e,k),wn(l,e,k),Wu;uc(),n=Av(e,n,i)}else e=h.treeContext,kt=Wn(k.nextSibling),ln=n,Je=!0,_a=null,Yn=!1,e!==null&&gg(n,e),n=ec(n,l),n.flags|=4096;return n}return e=Vs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function tc(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function Xu(e,n,i,l,f){return ci(n),i=Mu(e,n,i,l,void 0,f),l=Ru(),e!==null&&!Gt?(Iu(e,n,f),Ys(e,n,f)):(Je&&l&&pu(n),n.flags|=1,dn(e,n,i,f),n.child)}function Dv(e,n,i,l,f,h){return ci(n),n.updateQueue=null,i=Ig(n,l,i,f),Rg(e),l=Ru(),e!==null&&!Gt?(Iu(e,n,h),Ys(e,n,h)):(Je&&l&&pu(n),n.flags|=1,dn(e,n,i,h),n.child)}function Mv(e,n,i,l,f){if(ci(n),n.stateNode===null){var h=eo,k=i.contextType;typeof k=="object"&&k!==null&&(h=cn(k)),h=new i(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Yu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},ju(n),k=i.contextType,h.context=typeof k=="object"&&k!==null?cn(k):eo,h.state=n.memoizedState,k=i.getDerivedStateFromProps,typeof k=="function"&&(Zu(n,i,k,l),h.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(k=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),k!==h.state&&Yu.enqueueReplaceState(h,h.state,null),mr(n,l,h,f),pr(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,I=hi(i,w);h.props=I;var G=h.context,X=i.contextType;k=eo,typeof X=="object"&&X!==null&&(k=cn(X));var ie=i.getDerivedStateFromProps;X=typeof ie=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,X||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||G!==k)&&yv(n,h,l,k),Sa=!1;var K=n.memoizedState;h.state=K,mr(n,l,h,f),pr(),G=n.memoizedState,w||K!==G||Sa?(typeof ie=="function"&&(Zu(n,i,ie,l),G=n.memoizedState),(I=Sa||vv(n,i,I,l,K,G,k))?(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=k,l=I):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,Tu(e,n),k=n.memoizedProps,X=hi(i,k),h.props=X,ie=n.pendingProps,K=h.context,G=i.contextType,I=eo,typeof G=="object"&&G!==null&&(I=cn(G)),w=i.getDerivedStateFromProps,(G=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(k!==ie||K!==I)&&yv(n,h,l,I),Sa=!1,K=n.memoizedState,h.state=K,mr(n,l,h,f),pr();var J=n.memoizedState;k!==ie||K!==J||Sa||e!==null&&e.dependencies!==null&&Bl(e.dependencies)?(typeof w=="function"&&(Zu(n,i,w,l),J=n.memoizedState),(X=Sa||vv(n,i,X,l,K,J,I)||e!==null&&e.dependencies!==null&&Bl(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"||k===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||k===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"||k===e.memoizedProps&&K===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||k===e.memoizedProps&&K===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,tc(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=pi(n,e.child,null,f),n.child=pi(n,null,i,f)):dn(e,n,i,f),n.memoizedState=h.state,e=n.child):e=Ys(e,n,f),e}function Rv(e,n,i,l){return ri(),n.flags|=256,dn(e,n,i,l),n.child}var Qu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ef(e){return{baseLanes:e,cachePool:kg()}}function tf(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=On),e}function Iv(e,n,i){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,k;if((k=h)||(k=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),k&&(f=!0,n.flags&=-129),k=(n.flags&32)!==0,n.flags&=-33,e===null){if(Je){if(f?Na(n):wa(),(e=kt)?(e=U0(e,Yn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:ba!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=pg(e),i.return=n,n.child=i,ln=n,kt=null)):e=null,e===null)throw xa(n);return zf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(wa(),f=n.mode,w=nc({mode:"hidden",children:w},f),l=oi(l,f,i,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=ef(i),l.childLanes=tf(e,k,i),n.memoizedState=Qu,br(null,l)):(Na(n),nf(n,w))}var I=e.memoizedState;if(I!==null&&(w=I.dehydrated,w!==null)){if(h)n.flags&256?(Na(n),n.flags&=-257,n=sf(e,n,i)):n.memoizedState!==null?(wa(),n.child=e.child,n.flags|=128,n=null):(wa(),w=l.fallback,f=n.mode,l=nc({mode:"visible",children:l.children},f),w=oi(w,f,i,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,pi(n,e.child,null,i),l=n.child,l.memoizedState=ef(i),l.childLanes=tf(e,k,i),n.memoizedState=Qu,n=br(null,l));else if(Na(n),zf(w)){if(k=w.nextSibling&&w.nextSibling.dataset,k)var G=k.dgst;k=G,l=Error(r(419)),l.stack="",l.digest=k,rr({value:l,source:null,stack:null}),n=sf(e,n,i)}else if(Gt||ao(e,n,i,!1),k=(i&e.childLanes)!==0,Gt||k){if(k=yt,k!==null&&(l=En(k,i),l!==0&&l!==I.retryLane))throw I.retryLane=l,ii(e,l),wn(k,e,l),Wu;Lf(w)||uc(),n=sf(e,n,i)}else Lf(w)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,kt=Wn(w.nextSibling),ln=n,Je=!0,_a=null,Yn=!1,e!==null&&gg(n,e),n=nf(n,l.children),n.flags|=4096);return n}return f?(wa(),w=l.fallback,f=n.mode,I=e.child,G=I.sibling,l=Vs(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,G!==null?w=Vs(G,w):(w=oi(w,f,i,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,br(null,l),l=n.child,w=e.child.memoizedState,w===null?w=ef(i):(f=w.cachePool,f!==null?(I=Vt._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=kg(),w={baseLanes:w.baseLanes|i,cachePool:f}),l.memoizedState=w,l.childLanes=tf(e,k,i),n.memoizedState=Qu,br(e.child,l)):(Na(n),i=e.child,e=i.sibling,i=Vs(i,{mode:"visible",children:l.children}),i.return=n,i.sibling=null,e!==null&&(k=n.deletions,k===null?(n.deletions=[e],n.flags|=16):k.push(e)),n.child=i,n.memoizedState=null,i)}function nf(e,n){return n=nc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function nc(e,n){return e=Dn(22,e,null,n),e.lanes=0,e}function sf(e,n,i){return pi(n,e.child,null,i),e=nf(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ov(e,n,i){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),yu(e.return,n,i)}function af(e,n,i,l,f,h){var k=e.memoizedState;k===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:f,treeForkCount:h}:(k.isBackwards=n,k.rendering=null,k.renderingStartTime=0,k.last=l,k.tail=i,k.tailMode=f,k.treeForkCount=h)}function Bv(e,n,i){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var k=Ot.current,w=(k&2)!==0;if(w?(k=k&1|2,n.flags|=128):k&=1,xe(Ot,k),dn(e,n,l,i),l=Je?or:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ov(e,i,n);else if(e.tag===19)Ov(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(i=n.child,f=null;i!==null;)e=i.alternate,e!==null&&ql(e)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),af(n,!1,f,i,h,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&ql(e)===null){n.child=f;break}e=f.sibling,f.sibling=i,i=f,f=e}af(n,!0,i,null,h,l);break;case"together":af(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ys(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Aa|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(ao(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Vs(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Vs(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function of(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Bl(e)))}function zS(e,n,i){switch(n.tag){case 3:Pe(n,n.stateNode.containerInfo),ka(n,Vt,e.memoizedState.cache),ri();break;case 27:case 5:ct(n);break;case 4:Pe(n,n.stateNode.containerInfo);break;case 10:ka(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Au(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Na(n),n.flags|=128,null):(i&n.child.childLanes)!==0?Iv(e,n,i):(Na(n),e=Ys(e,n,i),e!==null?e.sibling:null);Na(n);break;case 19:var f=(e.flags&128)!==0;if(l=(i&n.childLanes)!==0,l||(ao(e,n,i,!1),l=(i&n.childLanes)!==0),f){if(l)return Bv(e,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),xe(Ot,Ot.current),l)break;return null;case 22:return n.lanes=0,Cv(e,n,i,n.pendingProps);case 24:ka(n,Vt,e.memoizedState.cache)}return Ys(e,n,i)}function Lv(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Gt=!0;else{if(!of(e,i)&&(n.flags&128)===0)return Gt=!1,zS(e,n,i);Gt=(e.flags&131072)!==0}else Gt=!1,Je&&(n.flags&1048576)!==0&&hg(n,or,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ui(n.elementType),n.type=e,typeof e=="function")du(e)?(l=hi(e,l),n.tag=1,n=Mv(null,n,e,l,i)):(n.tag=0,n=Xu(null,n,e,l,i));else{if(e!=null){var f=e.$$typeof;if(f===A){n.tag=11,n=Tv(null,n,e,l,i);break e}else if(f===O){n.tag=14,n=Nv(null,n,e,l,i);break e}}throw n=Z(e)||e,Error(r(306,n,""))}}return n;case 0:return Xu(e,n,n.type,n.pendingProps,i);case 1:return l=n.type,f=hi(l,n.pendingProps),Mv(e,n,l,f,i);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,Tu(e,n),mr(n,l,null,i);var k=n.memoizedState;if(l=k.cache,ka(n,Vt,l),l!==h.cache&&bu(n,[Vt],i,!0),pr(),l=k.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:k.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=Rv(e,n,l,i);break e}else if(l!==f){f=Fn(Error(r(424)),n),rr(f),n=Rv(e,n,l,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(kt=Wn(e.firstChild),ln=n,Je=!0,_a=null,Yn=!0,i=Cg(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(ri(),l===f){n=Ys(e,n,i);break e}dn(e,n,l,i)}n=n.child}return n;case 26:return tc(e,n),e===null?(i=Z0(n.type,null,n.pendingProps,null))?n.memoizedState=i:Je||(i=n.type,e=n.pendingProps,l=yc(bt.current).createElement(i),l[rn]=n,l[xn]=e,un(l,i,e),en(l),n.stateNode=l):n.memoizedState=Z0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ct(n),e===null&&Je&&(l=n.stateNode=G0(n.type,n.pendingProps,bt.current),ln=n,Yn=!0,f=kt,Oa(n.type)?($f=f,kt=Wn(l.firstChild)):kt=f),dn(e,n,n.pendingProps.children,i),tc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Je&&((f=l=kt)&&(l=m2(l,n.type,n.pendingProps,Yn),l!==null?(n.stateNode=l,ln=n,kt=Wn(l.firstChild),Yn=!1,f=!0):f=!1),f||xa(n)),ct(n),f=n.type,h=n.pendingProps,k=e!==null?e.memoizedProps:null,l=h.children,If(f,h)?l=null:k!==null&&If(f,k)&&(n.flags|=32),n.memoizedState!==null&&(f=Mu(e,n,ES,null,null,i),Ir._currentValue=f),tc(e,n),dn(e,n,l,i),n.child;case 6:return e===null&&Je&&((e=i=kt)&&(i=h2(i,n.pendingProps,Yn),i!==null?(n.stateNode=i,ln=n,kt=null,e=!0):e=!1),e||xa(n)),null;case 13:return Iv(e,n,i);case 4:return Pe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=pi(n,null,l,i):dn(e,n,l,i),n.child;case 11:return Tv(e,n,n.type,n.pendingProps,i);case 7:return dn(e,n,n.pendingProps,i),n.child;case 8:return dn(e,n,n.pendingProps.children,i),n.child;case 12:return dn(e,n,n.pendingProps.children,i),n.child;case 10:return l=n.pendingProps,ka(n,n.type,l.value),dn(e,n,l.children,i),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,ci(n),f=cn(f),l=l(f),n.flags|=1,dn(e,n,l,i),n.child;case 14:return Nv(e,n,n.type,n.pendingProps,i);case 15:return wv(e,n,n.type,n.pendingProps,i);case 19:return Bv(e,n,i);case 31:return LS(e,n,i);case 22:return Cv(e,n,i,n.pendingProps);case 24:return ci(n),l=cn(Vt),e===null?(f=ku(),f===null&&(f=yt,h=_u(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=i),f=h),n.memoizedState={parent:l,cache:f},ju(n),ka(n,Vt,f)):((e.lanes&i)!==0&&(Tu(e,n),mr(n,null,null,i),pr()),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),ka(n,Vt,l)):(l=h.cache,ka(n,Vt,l),l!==f.cache&&bu(n,[Vt],i,!0))),dn(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Js(e){e.flags|=4}function rf(e,n,i,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(d0())e.flags|=8192;else throw fi=Hl,Su}else e.flags&=-16777217}function zv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Q0(n))if(d0())e.flags|=8192;else throw fi=Hl,Su}function sc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?je():536870912,e.lanes|=n,vo|=n)}function _r(e,n){if(!Je)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function St(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(n)for(var f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)i|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=i,n}function $S(e,n,i){var l=n.pendingProps;switch(mu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return St(n),null;case 1:return St(n),null;case 3:return i=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Fs(Vt),ke(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(so(n)?Js(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,gu())),St(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Js(n),h!==null?(St(n),zv(n,h)):(St(n),rf(n,f,null,l,i))):h?h!==e.memoizedState?(Js(n),St(n),zv(n,h)):(St(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Js(n),St(n),rf(n,f,e,l,i)),null;case 27:if(ue(n),i=bt.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return St(n),null}e=De.current,so(n)?vg(n):(e=G0(f,l,i),n.stateNode=e,Js(n))}return St(n),null;case 5:if(ue(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return St(n),null}if(h=De.current,so(n))vg(n);else{var k=yc(bt.current);switch(h){case 1:h=k.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=k.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=k.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=k.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=k.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?k.createElement("select",{is:l.is}):k.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?k.createElement(f,{is:l.is}):k.createElement(f)}}h[rn]=n,h[xn]=l;e:for(k=n.child;k!==null;){if(k.tag===5||k.tag===6)h.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===n)break e;for(;k.sibling===null;){if(k.return===null||k.return===n)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}n.stateNode=h;e:switch(un(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Js(n)}}return St(n),rf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Js(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=bt.current,so(n)){if(e=n.stateNode,i=n.memoizedProps,l=null,f=ln,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[rn]=n,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||I0(e.nodeValue,i)),e||xa(n,!0)}else e=yc(e).createTextNode(l),e[rn]=n,n.stateNode=e}return St(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(l=so(n),i!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[rn]=n}else ri(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),e=!1}else i=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Rn(n),n):(Rn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return St(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=so(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 ri(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;St(n),f=!1}else f=gu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Rn(n),n):(Rn(n),null)}return Rn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),sc(n,n.updateQueue),St(n),null);case 4:return ke(),e===null&&Ef(n.stateNode.containerInfo),St(n),null;case 10:return Fs(n.type),St(n),null;case 19:if(me(Ot),l=n.memoizedState,l===null)return St(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)_r(l,!1);else{if(Rt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=ql(e),h!==null){for(n.flags|=128,_r(l,!1),e=h.updateQueue,n.updateQueue=e,sc(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)fg(i,e),i=i.sibling;return xe(Ot,Ot.current&1|2),Je&&qs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Xt()>lc&&(n.flags|=128,f=!0,_r(l,!1),n.lanes=4194304)}else{if(!f)if(e=ql(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,sc(n,e),_r(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return St(n),null}else 2*Xt()-l.renderingStartTime>lc&&i!==536870912&&(n.flags|=128,f=!0,_r(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=Xt(),e.sibling=null,i=Ot.current,xe(Ot,f?i&1|2:i&1),Je&&qs(n,l.treeForkCount),e):(St(n),null);case 22:case 23:return Rn(n),Eu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(i&536870912)!==0&&(n.flags&128)===0&&(St(n),n.subtreeFlags&6&&(n.flags|=8192)):St(n),i=n.updateQueue,i!==null&&sc(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==i&&(n.flags|=2048),e!==null&&me(di),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Fs(Vt),St(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function HS(e,n){switch(mu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Fs(Vt),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(Rn(n),n.alternate===null)throw Error(r(340));ri()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Rn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ri()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(Ot),null;case 4:return ke(),null;case 10:return Fs(n.type),null;case 22:case 23:return Rn(n),Eu(),e!==null&&me(di),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Fs(Vt),null;case 25:return null;default:return null}}function $v(e,n){switch(mu(n),n.tag){case 3:Fs(Vt),ke();break;case 26:case 27:case 5:ue(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&Rn(n);break;case 13:Rn(n);break;case 19:me(Ot);break;case 10:Fs(n.type);break;case 22:case 23:Rn(n),Eu(),e!==null&&me(di);break;case 24:Fs(Vt)}}function xr(e,n){try{var i=n.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var f=l.next;i=f;do{if((i.tag&e)===e){l=void 0;var h=i.create,k=i.inst;l=h(),k.destroy=l}i=i.next}while(i!==f)}}catch(w){ft(n,n.return,w)}}function Ca(e,n,i){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var k=l.inst,w=k.destroy;if(w!==void 0){k.destroy=void 0,f=n;var I=i,G=w;try{G()}catch(X){ft(f,I,X)}}}l=l.next}while(l!==h)}}catch(X){ft(n,n.return,X)}}function Hv(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Ag(n,i)}catch(l){ft(e,e.return,l)}}}function Pv(e,n,i){i.props=hi(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){ft(e,n,l)}}function kr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(f){ft(e,n,f)}}function Es(e,n){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(f){ft(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){ft(e,n,f)}else i.current=null}function Uv(e){var n=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(f){ft(e,e.return,f)}}function lf(e,n,i){try{var l=e.stateNode;l2(l,e.type,i,n),l[xn]=n}catch(f){ft(e,e.return,f)}}function Vv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Oa(e.type)||e.tag===4}function cf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vv(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&&Oa(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 df(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Ps));else if(l!==4&&(l===27&&Oa(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(df(e,n,i),e=e.sibling;e!==null;)df(e,n,i),e=e.sibling}function ac(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(l!==4&&(l===27&&Oa(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(ac(e,n,i),e=e.sibling;e!==null;)ac(e,n,i),e=e.sibling}function qv(e){var n=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);un(n,l,i),n[rn]=e,n[xn]=i}catch(h){ft(e,e.return,h)}}var Ws=!1,Ft=!1,uf=!1,Gv=typeof WeakSet=="function"?WeakSet:Set,tn=null;function PS(e,n){if(e=e.containerInfo,Mf=Tc,e=sg(e),su(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var k=0,w=-1,I=-1,G=0,X=0,ie=e,K=null;t:for(;;){for(var J;ie!==i||f!==0&&ie.nodeType!==3||(w=k+f),ie!==h||l!==0&&ie.nodeType!==3||(I=k+l),ie.nodeType===3&&(k+=ie.nodeValue.length),(J=ie.firstChild)!==null;)K=ie,ie=J;for(;;){if(ie===e)break t;if(K===i&&++G===f&&(w=k),K===h&&++X===l&&(I=k),(J=ie.nextSibling)!==null)break;ie=K,K=ie.parentNode}ie=J}i=w===-1||I===-1?null:{start:w,end:I}}else i=null}i=i||{start:0,end:0}}else i=null;for(Rf={focusedElem:e,selectionRange:i},Tc=!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(i=0;i<e.length;i++)f=e[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,i=n,f=h.memoizedProps,h=h.memoizedState,l=i.stateNode;try{var _e=hi(i.type,f);e=l.getSnapshotBeforeUpdate(_e,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ce){ft(i,i.return,Ce)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)Bf(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bf(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 Fv(e,n,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:Qs(e,i),l&4&&xr(5,i);break;case 1:if(Qs(e,i),l&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(k){ft(i,i.return,k)}else{var f=hi(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(k){ft(i,i.return,k)}}l&64&&Hv(i),l&512&&kr(i,i.return);break;case 3:if(Qs(e,i),l&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Ag(e,n)}catch(k){ft(i,i.return,k)}}break;case 27:n===null&&l&4&&qv(i);case 26:case 5:Qs(e,i),n===null&&l&4&&Uv(i),l&512&&kr(i,i.return);break;case 12:Qs(e,i);break;case 31:Qs(e,i),l&4&&Yv(e,i);break;case 13:Qs(e,i),l&4&&Jv(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=JS.bind(null,i),g2(e,i))));break;case 22:if(l=i.memoizedState!==null||Ws,!l){n=n!==null&&n.memoizedState!==null||Ft,f=Ws;var h=Ft;Ws=l,(Ft=n)&&!h?ea(e,i,(i.subtreeFlags&8772)!==0):Qs(e,i),Ws=f,Ft=h}break;case 30:break;default:Qs(e,i)}}function Kv(e){var n=e.alternate;n!==null&&(e.alternate=null,Kv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Hd(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,Sn=!1;function Xs(e,n,i){for(i=i.child;i!==null;)Zv(e,n,i),i=i.sibling}function Zv(e,n,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(mn,i)}catch{}switch(i.tag){case 26:Ft||Es(i,n),Xs(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ft||Es(i,n);var l=wt,f=Sn;Oa(i.type)&&(wt=i.stateNode,Sn=!1),Xs(e,n,i),Dr(i.stateNode),wt=l,Sn=f;break;case 5:Ft||Es(i,n);case 6:if(l=wt,f=Sn,wt=null,Xs(e,n,i),wt=l,Sn=f,wt!==null)if(Sn)try{(wt.nodeType===9?wt.body:wt.nodeName==="HTML"?wt.ownerDocument.body:wt).removeChild(i.stateNode)}catch(h){ft(i,n,h)}else try{wt.removeChild(i.stateNode)}catch(h){ft(i,n,h)}break;case 18:wt!==null&&(Sn?(e=wt,H0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),To(e)):H0(wt,i.stateNode));break;case 4:l=wt,f=Sn,wt=i.stateNode.containerInfo,Sn=!0,Xs(e,n,i),wt=l,Sn=f;break;case 0:case 11:case 14:case 15:Ca(2,i,n),Ft||Ca(4,i,n),Xs(e,n,i);break;case 1:Ft||(Es(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Pv(i,n,l)),Xs(e,n,i);break;case 21:Xs(e,n,i);break;case 22:Ft=(l=Ft)||i.memoizedState!==null,Xs(e,n,i),Ft=l;break;default:Xs(e,n,i)}}function Yv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{To(e)}catch(i){ft(n,n.return,i)}}}function Jv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{To(e)}catch(i){ft(n,n.return,i)}}function US(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Gv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Gv),n;default:throw Error(r(435,e.tag))}}function ic(e,n){var i=US(e);n.forEach(function(l){if(!i.has(l)){i.add(l);var f=WS.bind(null,e,l);l.then(f,f)}})}function jn(e,n){var i=n.deletions;if(i!==null)for(var l=0;l<i.length;l++){var f=i[l],h=e,k=n,w=k;e:for(;w!==null;){switch(w.tag){case 27:if(Oa(w.type)){wt=w.stateNode,Sn=!1;break e}break;case 5:wt=w.stateNode,Sn=!1;break e;case 3:case 4:wt=w.stateNode.containerInfo,Sn=!0;break e}w=w.return}if(wt===null)throw Error(r(160));Zv(h,k,f),wt=null,Sn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Wv(n,e),n=n.sibling}var fs=null;function Wv(e,n){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jn(n,e),Tn(e),l&4&&(Ca(3,e,e.return),xr(3,e),Ca(5,e,e.return));break;case 1:jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&64&&Ws&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var f=fs;if(jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&4){var h=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Yo]||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,i),h[rn]=e,en(h),l=h;break e;case"link":var k=W0("link","href",f).get(l+(i.href||""));if(k){for(var w=0;w<k.length;w++)if(h=k[w],h.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&h.getAttribute("rel")===(i.rel==null?null:i.rel)&&h.getAttribute("title")===(i.title==null?null:i.title)&&h.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){k.splice(w,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;case"meta":if(k=W0("meta","content",f).get(l+(i.content||""))){for(w=0;w<k.length;w++)if(h=k[w],h.getAttribute("content")===(i.content==null?null:""+i.content)&&h.getAttribute("name")===(i.name==null?null:i.name)&&h.getAttribute("property")===(i.property==null?null:i.property)&&h.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&h.getAttribute("charset")===(i.charSet==null?null:i.charSet)){k.splice(w,1);break t}}h=f.createElement(l),un(h,l,i),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[rn]=e,en(h),l=h}e.stateNode=l}else X0(f,e.type,e.stateNode);else e.stateNode=J0(f,l,e.memoizedProps);else h!==l?(h===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):h.count--,l===null?X0(f,e.type,e.stateNode):J0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&lf(e,e.memoizedProps,i.memoizedProps)}break;case 27:jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),i!==null&&l&4&&lf(e,e.memoizedProps,i.memoizedProps);break;case 5:if(jn(n,e),Tn(e),l&512&&(Ft||i===null||Es(i,i.return)),e.flags&32){f=e.stateNode;try{Ki(f,"")}catch(_e){ft(e,e.return,_e)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,lf(e,f,i!==null?i.memoizedProps:f)),l&1024&&(uf=!0);break;case 6:if(jn(n,e),Tn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(_e){ft(e,e.return,_e)}}break;case 3:if(xc=null,f=fs,fs=bc(n.containerInfo),jn(n,e),fs=f,Tn(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{To(n.containerInfo)}catch(_e){ft(e,e.return,_e)}uf&&(uf=!1,Xv(e));break;case 4:l=fs,fs=bc(e.stateNode.containerInfo),jn(n,e),Tn(e),fs=l;break;case 12:jn(n,e),Tn(e);break;case 31:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 13:jn(n,e),Tn(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(rc=Xt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 22:f=e.memoizedState!==null;var I=i!==null&&i.memoizedState!==null,G=Ws,X=Ft;if(Ws=G||f,Ft=X||I,jn(n,e),Ft=X,Ws=G,Tn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(i===null||I||Ws||Ft||gi(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){I=i=n;try{if(h=I.stateNode,f)k=h.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{w=I.stateNode;var ie=I.memoizedProps.style,K=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;w.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===6){if(i===null){I=n;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===18){if(i===null){I=n;try{var J=I.stateNode;f?P0(J,!0):P0(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;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,ic(e,i))));break;case 19:jn(n,e),Tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,ic(e,l)));break;case 30:break;case 21:break;default:jn(n,e),Tn(e)}}function Tn(e){var n=e.flags;if(n&2){try{for(var i,l=e.return;l!==null;){if(Vv(l)){i=l;break}l=l.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var f=i.stateNode,h=cf(e);ac(e,h,f);break;case 5:var k=i.stateNode;i.flags&32&&(Ki(k,""),i.flags&=-33);var w=cf(e);ac(e,w,k);break;case 3:case 4:var I=i.stateNode.containerInfo,G=cf(e);df(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 Xv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Xv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Qs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Fv(e,n.alternate,n),n=n.sibling}function gi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ca(4,n,n.return),gi(n);break;case 1:Es(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Pv(n,n.return,i),gi(n);break;case 27:Dr(n.stateNode);case 26:case 5:Es(n,n.return),gi(n);break;case 22:n.memoizedState===null&&gi(n);break;case 30:gi(n);break;default:gi(n)}e=e.sibling}}function ea(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,k=h.flags;switch(h.tag){case 0:case 11:case 15:ea(f,h,i),xr(4,h);break;case 1:if(ea(f,h,i),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 w=l.stateNode;try{var I=f.shared.hiddenCallbacks;if(I!==null)for(f.shared.hiddenCallbacks=null,f=0;f<I.length;f++)Eg(I[f],w)}catch(G){ft(l,l.return,G)}}i&&k&64&&Hv(h),kr(h,h.return);break;case 27:qv(h);case 26:case 5:ea(f,h,i),i&&l===null&&k&4&&Uv(h),kr(h,h.return);break;case 12:ea(f,h,i);break;case 31:ea(f,h,i),i&&k&4&&Yv(f,h);break;case 13:ea(f,h,i),i&&k&4&&Jv(f,h);break;case 22:h.memoizedState===null&&ea(f,h,i),kr(h,h.return);break;case 30:break;default:ea(f,h,i)}n=n.sibling}}function ff(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&lr(i))}function pf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&lr(e))}function ps(e,n,i,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Qv(e,n,i,l),n=n.sibling}function Qv(e,n,i,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ps(e,n,i,l),f&2048&&xr(9,n);break;case 1:ps(e,n,i,l);break;case 3:ps(e,n,i,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&lr(e)));break;case 12:if(f&2048){ps(e,n,i,l),e=n.stateNode;try{var h=n.memoizedProps,k=h.id,w=h.onPostCommit;typeof w=="function"&&w(k,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){ft(n,n.return,I)}}else ps(e,n,i,l);break;case 31:ps(e,n,i,l);break;case 13:ps(e,n,i,l);break;case 23:break;case 22:h=n.stateNode,k=n.alternate,n.memoizedState!==null?h._visibility&2?ps(e,n,i,l):Sr(e,n):h._visibility&2?ps(e,n,i,l):(h._visibility|=2,mo(e,n,i,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&ff(k,n);break;case 24:ps(e,n,i,l),f&2048&&pf(n.alternate,n);break;default:ps(e,n,i,l)}}function mo(e,n,i,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,k=n,w=i,I=l,G=k.flags;switch(k.tag){case 0:case 11:case 15:mo(h,k,w,I,f),xr(8,k);break;case 23:break;case 22:var X=k.stateNode;k.memoizedState!==null?X._visibility&2?mo(h,k,w,I,f):Sr(h,k):(X._visibility|=2,mo(h,k,w,I,f)),f&&G&2048&&ff(k.alternate,k);break;case 24:mo(h,k,w,I,f),f&&G&2048&&pf(k.alternate,k);break;default:mo(h,k,w,I,f)}n=n.sibling}}function Sr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,l=n,f=l.flags;switch(l.tag){case 22:Sr(i,l),f&2048&&ff(l.alternate,l);break;case 24:Sr(i,l),f&2048&&pf(l.alternate,l);break;default:Sr(i,l)}n=n.sibling}}var jr=8192;function ho(e,n,i){if(e.subtreeFlags&jr)for(e=e.child;e!==null;)e0(e,n,i),e=e.sibling}function e0(e,n,i){switch(e.tag){case 26:ho(e,n,i),e.flags&jr&&e.memoizedState!==null&&C2(i,fs,e.memoizedState,e.memoizedProps);break;case 5:ho(e,n,i);break;case 3:case 4:var l=fs;fs=bc(e.stateNode.containerInfo),ho(e,n,i),fs=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=jr,jr=16777216,ho(e,n,i),jr=l):ho(e,n,i));break;default:ho(e,n,i)}}function t0(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 Tr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];tn=l,s0(l,e)}t0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)n0(e),e=e.sibling}function n0(e){switch(e.tag){case 0:case 11:case 15:Tr(e),e.flags&2048&&Ca(9,e,e.return);break;case 3:Tr(e);break;case 12:Tr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,oc(e)):Tr(e);break;default:Tr(e)}}function oc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];tn=l,s0(l,e)}t0(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ca(8,n,n.return),oc(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,oc(n));break;default:oc(n)}e=e.sibling}}function s0(e,n){for(;tn!==null;){var i=tn;switch(i.tag){case 0:case 11:case 15:Ca(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:lr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,tn=l;else e:for(i=e;tn!==null;){l=tn;var f=l.sibling,h=l.return;if(Kv(l),l===i){tn=null;break e}if(f!==null){f.return=h,tn=f;break e}tn=h}}}var VS={getCacheForType:function(e){var n=cn(Vt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return cn(Vt).controller.signal}},qS=typeof WeakMap=="function"?WeakMap:Map,rt=0,yt=null,Ge=null,Ke=0,ut=0,In=null,Ea=!1,go=!1,mf=!1,ta=0,Rt=0,Aa=0,vi=0,hf=0,On=0,vo=0,Nr=null,Nn=null,gf=!1,rc=0,a0=0,lc=1/0,cc=null,Da=null,Kt=0,Ma=null,yo=null,na=0,vf=0,yf=null,i0=null,wr=0,bf=null;function Bn(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:H.T!==null?Tf():Hi()}function o0(){if(On===0)if((Ke&536870912)===0||Je){var e=U;U<<=1,(U&3932160)===0&&(U=262144),On=e}else On=536870912;return e=Mn.current,e!==null&&(e.flags|=32),On}function wn(e,n,i){(e===yt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&(bo(e,0),Ra(e,Ke,On,!1)),Ue(e,i),((rt&2)===0||e!==yt)&&(e===yt&&((rt&2)===0&&(vi|=i),Rt===4&&Ra(e,Ke,On,!1)),As(e))}function r0(e,n,i){if((rt&6)!==0)throw Error(r(327));var l=!i&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),f=l?KS(e,n):xf(e,n,!0),h=l;do{if(f===0){go&&!l&&Ra(e,n,0,!1);break}else{if(i=e.current.alternate,h&&!GS(i)){f=xf(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var k=0;else k=e.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){n=k;e:{var w=e;f=Nr;var I=w.current.memoizedState.isDehydrated;if(I&&(bo(w,k).flags|=256),k=xf(w,k,!1),k!==2){if(mf&&!I){w.errorRecoveryDisabledLanes|=h,vi|=h,f=4;break e}h=Nn,Nn=f,h!==null&&(Nn===null?Nn=h:Nn.push.apply(Nn,h))}f=k}if(h=!1,f!==2)continue}}if(f===1){bo(e,0),Ra(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:Ra(l,n,On,!Ea);break e;case 2:Nn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=rc+300-Xt(),10<f)){if(Ra(l,n,On,!Ea),pe(l,0,!0)!==0)break e;na=n,l.timeoutHandle=z0(l0.bind(null,l,i,Nn,cc,gf,n,On,vi,vo,Ea,h,"Throttled",-0,0),f);break e}l0(l,i,Nn,cc,gf,n,On,vi,vo,Ea,h,null,-0,0)}}break}while(!0);As(e)}function l0(e,n,i,l,f,h,k,w,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:Ps},e0(n,h,ie);var _e=(h&62914560)===h?rc-Xt():(h&4194048)===h?a0-Xt():0;if(_e=E2(ie,_e),_e!==null){na=h,e.cancelPendingCommit=_e(g0.bind(null,e,n,h,i,l,f,k,w,I,X,ie,null,K,J)),Ra(e,h,k,!G);return}}g0(e,n,h,i,l,f,k,w,I)}function GS(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var f=i[l],h=f.getSnapshot;f=f.value;try{if(!An(h(),f))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ra(e,n,i,l){n&=~hf,n&=~vi,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-Qt(f),k=1<<h;l[h]=-1,f&=~k}i!==0&&qe(e,i,n)}function dc(){return(rt&6)===0?(Cr(0),!1):!0}function _f(){if(Ge!==null){if(ut===0)var e=Ge.return;else e=Ge,Gs=li=null,Ou(e),lo=null,dr=0,e=Ge;for(;e!==null;)$v(e.alternate,e),e=e.return;Ge=null}}function bo(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,u2(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),na=0,_f(),yt=e,Ge=i=Vs(e.current,null),Ke=n,ut=0,In=null,Ea=!1,go=ye(e,n),mf=!1,vo=On=hf=vi=Aa=Rt=0,Nn=Nr=null,gf=!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-Qt(l),h=1<<f;n|=e[f],l&=~h}return ta=n,Dl(),i}function c0(e,n){ze=null,H.H=yr,n===ro||n===$l?(n=Tg(),ut=3):n===Su?(n=Tg(),ut=4):ut=n===Wu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,Ge===null&&(Rt=1,Ql(e,Fn(n,e.current)))}function d0(){var e=Mn.current;return e===null?!0:(Ke&4194048)===Ke?Jn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Jn:!1}function u0(){var e=H.H;return H.H=yr,e===null?yr:e}function f0(){var e=H.A;return H.A=VS,e}function uc(){Rt=4,Ea||(Ke&4194048)!==Ke&&Mn.current!==null||(go=!0),(Aa&134217727)===0&&(vi&134217727)===0||yt===null||Ra(yt,Ke,On,!1)}function xf(e,n,i){var l=rt;rt|=2;var f=u0(),h=f0();(yt!==e||Ke!==n)&&(cc=null,bo(e,n)),n=!1;var k=Rt;e:do try{if(ut!==0&&Ge!==null){var w=Ge,I=In;switch(ut){case 8:_f(),k=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(n=!0);var G=ut;if(ut=0,In=null,_o(e,w,I,G),i&&go){k=0;break e}break;default:G=ut,ut=0,In=null,_o(e,w,I,G)}}FS(),k=Rt;break}catch(X){c0(e,X)}while(!0);return n&&e.shellSuspendCounter++,Gs=li=null,rt=l,H.H=f,H.A=h,Ge===null&&(yt=null,Ke=0,Dl()),k}function FS(){for(;Ge!==null;)p0(Ge)}function KS(e,n){var i=rt;rt|=2;var l=u0(),f=f0();yt!==e||Ke!==n?(cc=null,lc=Xt()+500,bo(e,n)):go=ye(e,n);e:do try{if(ut!==0&&Ge!==null){n=Ge;var h=In;t:switch(ut){case 1:ut=0,In=null,_o(e,n,h,1);break;case 2:case 9:if(Sg(h)){ut=0,In=null,m0(n);break}n=function(){ut!==2&&ut!==9||yt!==e||(ut=7),As(e)},h.then(n,n);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:Sg(h)?(ut=0,In=null,m0(n)):(ut=0,In=null,_o(e,n,h,7));break;case 5:var k=null;switch(Ge.tag){case 26:k=Ge.memoizedState;case 5:case 27:var w=Ge;if(k?Q0(k):w.stateNode.complete){ut=0,In=null;var I=w.sibling;if(I!==null)Ge=I;else{var G=w.return;G!==null?(Ge=G,fc(G)):Ge=null}break t}}ut=0,In=null,_o(e,n,h,5);break;case 6:ut=0,In=null,_o(e,n,h,6);break;case 8:_f(),Rt=6;break e;default:throw Error(r(462))}}ZS();break}catch(X){c0(e,X)}while(!0);return Gs=li=null,H.H=l,H.A=f,rt=i,Ge!==null?0:(yt=null,Ke=0,Dl(),Rt)}function ZS(){for(;Ge!==null&&!ga();)p0(Ge)}function p0(e){var n=Lv(e.alternate,e,ta);e.memoizedProps=e.pendingProps,n===null?fc(e):Ge=n}function m0(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Dv(i,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Dv(i,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:Ou(n);default:$v(i,n),n=Ge=fg(n,ta),n=Lv(i,n,ta)}e.memoizedProps=e.pendingProps,n===null?fc(e):Ge=n}function _o(e,n,i,l){Gs=li=null,Ou(n),lo=null,dr=0;var f=n.return;try{if(BS(e,f,n,i,Ke)){Rt=1,Ql(e,Fn(i,e.current)),Ge=null;return}}catch(h){if(f!==null)throw Ge=f,h;Rt=1,Ql(e,Fn(i,e.current)),Ge=null;return}n.flags&32768?(Je||l===1?e=!0:go||(Ke&536870912)!==0?e=!1:(Ea=e=!0,(l===2||l===9||l===3||l===6)&&(l=Mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),h0(n,e)):fc(n)}function fc(e){var n=e;do{if((n.flags&32768)!==0){h0(n,Ea);return}e=n.return;var i=$S(n.alternate,n,ta);if(i!==null){Ge=i;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);Rt===0&&(Rt=5)}function h0(e,n){do{var i=HS(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);Rt=6,Ge=null}function g0(e,n,i,l,f,h,k,w,I){e.cancelPendingCommit=null;do pc();while(Kt!==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|=lu,Dt(e,i,h,k,w,I),e===yt&&(Ge=yt=null,Ke=0),yo=n,Ma=e,na=i,vf=h,yf=f,i0=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,XS($s,function(){return x0(),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,k=rt,rt|=4;try{PS(e,n,i)}finally{rt=k,B.p=f,H.T=l}}Kt=1,v0(),y0(),b0()}}function v0(){if(Kt===1){Kt=0;var e=Ma,n=yo,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Wv(n,e);var h=Rf,k=sg(e.containerInfo),w=h.focusedElem,I=h.selectionRange;if(k!==w&&w&&w.ownerDocument&&ng(w.ownerDocument.documentElement,w)){if(I!==null&&su(w)){var G=I.start,X=I.end;if(X===void 0&&(X=G),"selectionStart"in w)w.selectionStart=G,w.selectionEnd=Math.min(X,w.value.length);else{var ie=w.ownerDocument||document,K=ie&&ie.defaultView||window;if(K.getSelection){var J=K.getSelection(),_e=w.textContent.length,Ce=Math.min(I.start,_e),gt=I.end===void 0?Ce:Math.min(I.end,_e);!J.extend&&Ce>gt&&(k=gt,gt=Ce,Ce=k);var P=tg(w,Ce),z=tg(w,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=w;J=J.parentNode;)J.nodeType===1&&ie.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ie.length;w++){var te=ie[w];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Tc=!!Mf,Rf=Mf=null}finally{rt=f,B.p=l,H.T=i}}e.current=n,Kt=2}}function y0(){if(Kt===2){Kt=0;var e=Ma,n=yo,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=H.T,H.T=null;var l=B.p;B.p=2;var f=rt;rt|=4;try{Fv(e,n.alternate,n)}finally{rt=f,B.p=l,H.T=i}}Kt=3}}function b0(){if(Kt===4||Kt===3){Kt=0,Oi();var e=Ma,n=yo,i=na,l=i0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Kt=5:(Kt=0,yo=Ma=null,_0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(Da=null),js(i),n=n.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.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,k=0;k<l.length;k++){var w=l[k];h(w.value,{componentStack:w.stack})}}finally{H.T=n,B.p=f}}(na&3)!==0&&pc(),As(e),f=e.pendingLanes,(i&261930)!==0&&(f&42)!==0?e===bf?wr++:(wr=0,bf=e):wr=0,Cr(0)}}function _0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,lr(n)))}function pc(){return v0(),y0(),b0(),x0()}function x0(){if(Kt!==5)return!1;var e=Ma,n=vf;vf=0;var i=js(na),l=H.T,f=B.p;try{B.p=32>i?32:i,H.T=null,i=yf,yf=null;var h=Ma,k=na;if(Kt=0,yo=Ma=null,na=0,(rt&6)!==0)throw Error(r(331));var w=rt;if(rt|=4,n0(h.current),Qv(h,h.current,k,i),rt=w,Cr(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(mn,h)}catch{}return!0}finally{B.p=f,H.T=l,_0(e,n)}}function k0(e,n,i){n=Fn(i,n),n=Ju(e.stateNode,n,2),e=Ta(e,n,2),e!==null&&(Ue(e,2),As(e))}function ft(e,n,i){if(e.tag===3)k0(e,e,i);else for(;n!==null;){if(n.tag===3){k0(n,e,i);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Da===null||!Da.has(l))){e=Fn(i,e),i=Sv(2),l=Ta(n,i,2),l!==null&&(jv(i,l,n,e),Ue(l,2),As(l));break}}n=n.return}}function kf(e,n,i){var l=e.pingCache;if(l===null){l=e.pingCache=new qS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(i)||(mf=!0,f.add(i),e=YS.bind(null,e,n,i),n.then(e,e))}function YS(e,n,i){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,yt===e&&(Ke&i)===i&&(Rt===4||Rt===3&&(Ke&62914560)===Ke&&300>Xt()-rc?(rt&2)===0&&bo(e,0):hf|=i,vo===Ke&&(vo=0)),As(e)}function S0(e,n){n===0&&(n=je()),e=ii(e,n),e!==null&&(Ue(e,n),As(e))}function JS(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),S0(e,i)}function WS(e,n){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(i=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),S0(e,i)}function XS(e,n){return ds(e,n)}var mc=null,xo=null,Sf=!1,hc=!1,jf=!1,Ia=0;function As(e){e!==xo&&e.next===null&&(xo===null?mc=xo=e:xo=xo.next=e),hc=!0,Sf||(Sf=!0,e2())}function Cr(e,n){if(!jf&&hc){jf=!0;do for(var i=!1,l=mc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var k=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-Qt(42|e)+1)-1,h&=f&~(k&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(i=!0,w0(l,h))}else h=Ke,h=pe(l,l===yt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ye(l,h)||(i=!0,w0(l,h));l=l.next}while(i);jf=!1}}function QS(){j0()}function j0(){hc=Sf=!1;var e=0;Ia!==0&&d2()&&(e=Ia);for(var n=Xt(),i=null,l=mc;l!==null;){var f=l.next,h=T0(l,n);h===0?(l.next=null,i===null?mc=f:i.next=f,f===null&&(xo=i)):(i=l,(e!==0||(h&3)!==0)&&(hc=!0)),l=f}Kt!==0&&Kt!==5||Cr(e),Ia!==0&&(Ia=0)}function T0(e,n){for(var i=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var k=31-Qt(h),w=1<<k,I=f[k];I===-1?((w&i)===0||(w&l)!==0)&&(f[k]=tt(w,n)):I<=n&&(e.expiredLanes|=w),h&=~w}if(n=yt,i=Ke,i=pe(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===n&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&zs(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ye(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(l!==null&&zs(l),js(i)){case 2:case 8:i=va;break;case 32:i=$s;break;case 268435456:i=we;break;default:i=$s}return l=N0.bind(null,e),i=ds(i,l),e.callbackPriority=n,e.callbackNode=i,n}return l!==null&&l!==null&&zs(l),e.callbackPriority=2,e.callbackNode=null,2}function N0(e,n){if(Kt!==0&&Kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(pc()&&e.callbackNode!==i)return null;var l=Ke;return l=pe(e,e===yt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(r0(e,l,n),T0(e,Xt()),e.callbackNode!=null&&e.callbackNode===i?N0.bind(null,e):null)}function w0(e,n){if(pc())return null;r0(e,n,!0)}function e2(){f2(function(){(rt&6)!==0?ds(ei,QS):j0()})}function Tf(){if(Ia===0){var e=io;e===0&&(e=$i,$i<<=1,($i&261888)===0&&($i=256)),Ia=e}return Ia}function C0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Sl(""+e)}function E0(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function t2(e,n,i,l,f){if(n==="submit"&&i&&i.stateNode===f){var h=C0((f[xn]||null).action),k=l.submitter;k&&(n=(n=k[xn]||null)?C0(n.formAction):k.getAttribute("formAction"),n!==null&&(h=n,k=null));var w=new wl("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Ia!==0){var I=k?E0(f,k):new FormData(f);qu(i,{pending:!0,data:I,method:f.method,action:h},null,I)}}else typeof h=="function"&&(w.preventDefault(),I=k?E0(f,k):new FormData(f),qu(i,{pending:!0,data:I,method:f.method,action:h},h,I))},currentTarget:f}]})}}for(var Nf=0;Nf<ru.length;Nf++){var wf=ru[Nf],n2=wf.toLowerCase(),s2=wf[0].toUpperCase()+wf.slice(1);us(n2,"on"+s2)}us(og,"onAnimationEnd"),us(rg,"onAnimationIteration"),us(lg,"onAnimationStart"),us("dblclick","onDoubleClick"),us("focusin","onFocus"),us("focusout","onBlur"),us(bS,"onTransitionRun"),us(_S,"onTransitionStart"),us(xS,"onTransitionCancel"),us(cg,"onTransitionEnd"),Gi("onMouseEnter",["mouseout","mouseover"]),Gi("onMouseLeave",["mouseout","mouseover"]),Gi("onPointerEnter",["pointerout","pointerover"]),Gi("onPointerLeave",["pointerout","pointerover"]),ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ti("onBeforeInput",["compositionend","keypress","textInput","paste"]),ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Er="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(" "),a2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Er));function A0(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var k=l.length-1;0<=k;k--){var w=l[k],I=w.instance,G=w.currentTarget;if(w=w.listener,I!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=G;try{h(f)}catch(X){Al(X)}f.currentTarget=null,h=I}else for(k=0;k<l.length;k++){if(w=l[k],I=w.instance,G=w.currentTarget,w=w.listener,I!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=G;try{h(f)}catch(X){Al(X)}f.currentTarget=null,h=I}}}}function Fe(e,n){var i=n[$d];i===void 0&&(i=n[$d]=new Set);var l=e+"__bubble";i.has(l)||(D0(n,e,2,!1),i.add(l))}function Cf(e,n,i){var l=0;n&&(l|=4),D0(i,e,l,n)}var gc="_reactListening"+Math.random().toString(36).slice(2);function Ef(e){if(!e[gc]){e[gc]=!0,jh.forEach(function(i){i!=="selectionchange"&&(a2.has(i)||Cf(i,!1,e),Cf(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[gc]||(n[gc]=!0,Cf("selectionchange",!1,n))}}function D0(e,n,i,l){switch(oy(n)){case 2:var f=M2;break;case 8:f=R2;break;default:f=qf}i=f.bind(null,n,i,e),f=void 0,!Zd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,i,{capture:!0,passive:f}):e.addEventListener(n,i,!0):f!==void 0?e.addEventListener(n,i,{passive:f}):e.addEventListener(n,i,!1)}function Af(e,n,i,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var k=l.tag;if(k===3||k===4){var w=l.stateNode.containerInfo;if(w===f)break;if(k===4)for(k=l.return;k!==null;){var I=k.tag;if((I===3||I===4)&&k.stateNode.containerInfo===f)return;k=k.return}for(;w!==null;){if(k=Ui(w),k===null)return;if(I=k.tag,I===5||I===6||I===26||I===27){l=h=k;continue e}w=w.parentNode}}l=l.return}Bh(function(){var G=h,X=Fd(i),ie=[];e:{var K=dg.get(e);if(K!==void 0){var J=wl,_e=e;switch(e){case"keypress":if(Tl(i)===0)break e;case"keydown":case"keyup":J=Wk;break;case"focusin":_e="focus",J=Xd;break;case"focusout":_e="blur",J=Xd;break;case"beforeblur":case"afterblur":J=Xd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=$h;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=eS;break;case og:case rg:case lg:J=Uk;break;case cg:J=nS;break;case"scroll":case"scrollend":J=Lk;break;case"wheel":J=aS;break;case"copy":case"cut":case"paste":J=qk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Ph;break;case"toggle":case"beforetoggle":J=oS}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=Wo(z,P),te!=null&&Ce.push(Ar(z,te,q))),gt)break;z=z.return}0<Ce.length&&(K=new J(K,_e,null,i,X),ie.push({event:K,listeners:Ce}))}}if((n&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",K&&i!==Gd&&(_e=i.relatedTarget||i.fromElement)&&(Ui(_e)||_e[Pi]))break e;if((J||K)&&(K=X.window===X?X:(K=X.ownerDocument)?K.defaultView||K.parentWindow:window,J?(_e=i.relatedTarget||i.toElement,J=G,_e=_e?Ui(_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=$h,te="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ce=Ph,te="onPointerLeave",P="onPointerEnter",z="pointer"),gt=J==null?K:Jo(J),q=_e==null?K:Jo(_e),K=new Ce(te,z+"leave",J,i,X),K.target=gt,K.relatedTarget=q,te=null,Ui(X)===G&&(Ce=new Ce(P,z+"enter",_e,i,X),Ce.target=q,Ce.relatedTarget=gt,te=Ce),gt=te,J&&_e)t:{for(Ce=i2,P=J,z=_e,q=0,te=P;te;te=Ce(te))q++;te=0;for(var Ne=z;Ne;Ne=Ce(Ne))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&&M0(ie,K,J,Ce,!1),_e!==null&&gt!==null&&M0(ie,gt,_e,Ce,!0)}}e:{if(K=G?Jo(G):window,J=K.nodeName&&K.nodeName.toLowerCase(),J==="select"||J==="input"&&K.type==="file")var st=Yh;else if(Kh(K))if(Jh)st=gS;else{st=mS;var Se=pS}else J=K.nodeName,!J||J.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?G&&qd(G.elementType)&&(st=Yh):st=hS;if(st&&(st=st(e,G))){Zh(ie,st,i,X);break e}Se&&Se(e,K,G),e==="focusout"&&G&&K.type==="number"&&G.memoizedProps.value!=null&&Vd(K,"number",K.value)}switch(Se=G?Jo(G):window,e){case"focusin":(Kh(Se)||Se.contentEditable==="true")&&(Wi=Se,au=G,ir=null);break;case"focusout":ir=au=Wi=null;break;case"mousedown":iu=!0;break;case"contextmenu":case"mouseup":case"dragend":iu=!1,ag(ie,i,X);break;case"selectionchange":if(yS)break;case"keydown":case"keyup":ag(ie,i,X)}var $e;if(eu)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 Ji?Gh(e,i)&&(Ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ze="onCompositionStart");Ze&&(Uh&&i.locale!=="ko"&&(Ji||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Ji&&($e=Lh()):(ya=X,Yd="value"in ya?ya.value:ya.textContent,Ji=!0)),Se=vc(G,Ze),0<Se.length&&(Ze=new Hh(Ze,e,null,i,X),ie.push({event:Ze,listeners:Se}),$e?Ze.data=$e:($e=Fh(i),$e!==null&&(Ze.data=$e)))),($e=lS?cS(e,i):dS(e,i))&&(Ze=vc(G,"onBeforeInput"),0<Ze.length&&(Se=new Hh("onBeforeInput","beforeinput",null,i,X),ie.push({event:Se,listeners:Ze}),Se.data=$e)),t2(ie,e,G,i,X)}A0(ie,n)})}function Ar(e,n,i){return{instance:e,listener:n,currentTarget:i}}function vc(e,n){for(var i=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Wo(e,i),f!=null&&l.unshift(Ar(e,f,h)),f=Wo(e,n),f!=null&&l.push(Ar(e,f,h))),e.tag===3)return l;e=e.return}return[]}function i2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function M0(e,n,i,l,f){for(var h=n._reactName,k=[];i!==null&&i!==l;){var w=i,I=w.alternate,G=w.stateNode;if(w=w.tag,I!==null&&I===l)break;w!==5&&w!==26&&w!==27||G===null||(I=G,f?(G=Wo(i,h),G!=null&&k.unshift(Ar(i,G,I))):f||(G=Wo(i,h),G!=null&&k.push(Ar(i,G,I)))),i=i.return}k.length!==0&&e.push({event:n,listeners:k})}var o2=/\r\n?/g,r2=/\u0000|\uFFFD/g;function R0(e){return(typeof e=="string"?e:""+e).replace(o2,`
26
+ `).replace(r2,"")}function I0(e,n){return n=R0(n),R0(e)===n}function ht(e,n,i,l,f,h){switch(i){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ki(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ki(e,""+l);break;case"className":xl(e,"class",l);break;case"tabIndex":xl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":xl(e,i,l);break;case"style":Ih(e,l,h);break;case"data":if(n!=="object"){xl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=Sl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(i==="formAction"?(n!=="input"&&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(i);break}l=Sl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=Sl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),_l(e,"popover",l);break;case"xlinkActuate":Hs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Hs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Hs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Hs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Hs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Hs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Hs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_l(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=Ok.get(i)||i,_l(e,i,l))}}function Df(e,n,i,l,f,h){switch(i){case"style":Ih(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Ki(e,l):(typeof l=="number"||typeof l=="bigint")&&Ki(e,""+l);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Th.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),n=i.slice(2,f?i.length-7:void 0),h=e[xn]||null,h=h!=null?h[i]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,l,f);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):_l(e,i,l)}}}function un(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var l=!1,f=!1,h;for(h in i)if(i.hasOwnProperty(h)){var k=i[h];if(k!=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,k,i,null)}}f&&ht(e,n,"srcSet",i.srcSet,i,null),l&&ht(e,n,"src",i.src,i,null);return;case"input":Fe("invalid",e);var w=h=k=f=null,I=null,G=null;for(l in i)if(i.hasOwnProperty(l)){var X=i[l];if(X!=null)switch(l){case"name":f=X;break;case"type":k=X;break;case"checked":I=X;break;case"defaultChecked":G=X;break;case"value":h=X;break;case"defaultValue":w=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:ht(e,n,l,X,i,null)}}Ah(e,h,w,I,G,k,f,!1);return;case"select":Fe("invalid",e),l=k=h=null;for(f in i)if(i.hasOwnProperty(f)&&(w=i[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":k=w;break;case"multiple":l=w;default:ht(e,n,f,w,i,null)}n=h,i=k,e.multiple=!!l,n!=null?Fi(e,!!l,n,!1):i!=null&&Fi(e,!!l,i,!0);return;case"textarea":Fe("invalid",e),h=f=l=null;for(k in i)if(i.hasOwnProperty(k)&&(w=i[k],w!=null))switch(k){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:ht(e,n,k,w,i,null)}Mh(e,l,f,h);return;case"option":for(I in i)if(i.hasOwnProperty(I)&&(l=i[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ht(e,n,I,l,i,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(l=0;l<Er.length;l++)Fe(Er[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 i)if(i.hasOwnProperty(G)&&(l=i[G],l!=null))switch(G){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ht(e,n,G,l,i,null)}return;default:if(qd(n)){for(X in i)i.hasOwnProperty(X)&&(l=i[X],l!==void 0&&Df(e,n,X,l,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(l=i[w],l!=null&&ht(e,n,w,l,i,null))}function l2(e,n,i,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,k=null,w=null,I=null,G=null,X=null;for(J in i){var ie=i[J];if(i.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=i[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":k=J;break;case"defaultValue":w=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)}}Ud(e,k,w,I,G,X,h,f);return;case"select":J=k=w=K=null;for(h in i)if(I=i[h],i.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=i[f],l.hasOwnProperty(f)&&(h!=null||I!=null))switch(f){case"value":K=h;break;case"defaultValue":w=h;break;case"multiple":k=h;default:h!==I&&ht(e,n,f,h,l,I)}n=w,i=k,l=J,K!=null?Fi(e,!!i,K,!1):!!l!=!!i&&(n!=null?Fi(e,!!i,n,!0):Fi(e,!!i,i?[]:"",!1));return;case"textarea":J=K=null;for(w in i)if(f=i[w],i.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ht(e,n,w,null,l,f)}for(k in l)if(f=l[k],h=i[k],l.hasOwnProperty(k)&&(f!=null||h!=null))switch(k){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,k,f,l,h)}Dh(e,K,J);return;case"option":for(var _e in i)if(K=i[_e],i.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=i[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 i)K=i[Ce],i.hasOwnProperty(Ce)&&K!=null&&!l.hasOwnProperty(Ce)&&ht(e,n,Ce,null,l,K);for(G in l)if(K=l[G],J=i[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(qd(n)){for(var gt in i)K=i[gt],i.hasOwnProperty(gt)&&K!==void 0&&!l.hasOwnProperty(gt)&&Df(e,n,gt,void 0,l,K);for(X in l)K=l[X],J=i[X],!l.hasOwnProperty(X)||K===J||K===void 0&&J===void 0||Df(e,n,X,K,l,J);return}}for(var P in i)K=i[P],i.hasOwnProperty(P)&&K!=null&&!l.hasOwnProperty(P)&&ht(e,n,P,null,l,K);for(ie in l)K=l[ie],J=i[ie],!l.hasOwnProperty(ie)||K===J||K==null&&J==null||ht(e,n,ie,K,l,J)}function O0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var f=i[l],h=f.transferSize,k=f.initiatorType,w=f.duration;if(h&&w&&O0(k)){for(k=0,w=f.responseEnd,l+=1;l<i.length;l++){var I=i[l],G=I.startTime;if(G>w)break;var X=I.transferSize,ie=I.initiatorType;X&&O0(ie)&&(I=I.responseEnd,k+=X*(I<w?1:(w-G)/(I-G)))}if(--l,n+=8*(h+k)/(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 Mf=null,Rf=null;function yc(e){return e.nodeType===9?e:e.ownerDocument}function B0(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function L0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function If(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 Of=null;function d2(){var e=window.event;return e&&e.type==="popstate"?e===Of?!1:(Of=e,!0):(Of=null,!1)}var z0=typeof setTimeout=="function"?setTimeout:void 0,u2=typeof clearTimeout=="function"?clearTimeout:void 0,$0=typeof Promise=="function"?Promise:void 0,f2=typeof queueMicrotask=="function"?queueMicrotask:typeof $0<"u"?function(e){return $0.resolve(null).then(e).catch(p2)}:z0;function p2(e){setTimeout(function(){throw e})}function Oa(e){return e==="head"}function H0(e,n){var i=n,l=0;do{var f=i.nextSibling;if(e.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(f),To(n);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")Dr(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Dr(i);for(var h=i.firstChild;h;){var k=h.nextSibling,w=h.nodeName;h[Yo]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||i.removeChild(h),h=k}}else i==="body"&&Dr(e.ownerDocument.body);i=f}while(i);To(n)}function P0(e,n){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function Bf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Bf(i),Hd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function m2(e,n,i,l){for(;e.nodeType===1;){var f=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Yo])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=Wn(e.nextSibling),e===null)break}return null}function h2(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Wn(e.nextSibling),e===null))return null;return e}function U0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Wn(e.nextSibling),e===null))return null;return e}function Lf(e){return e.data==="$?"||e.data==="$~"}function zf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function g2(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var l=function(){n(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Wn(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 $f=null;function V0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return Wn(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function q0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function G0(e,n,i){switch(n=yc(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Dr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Hd(e)}var Xn=new Map,F0=new Set;function bc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var sa=B.d;B.d={f:v2,r:y2,D:b2,C:_2,L:x2,m:k2,X:j2,S:S2,M:T2};function v2(){var e=sa.f(),n=dc();return e||n}function y2(e){var n=Vi(e);n!==null&&n.tag===5&&n.type==="form"?cv(n):sa.r(e)}var ko=typeof document>"u"?null:document;function K0(e,n,i){var l=ko;if(l&&typeof n=="string"&&n){var f=qn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),F0.has(f)||(F0.add(f),e={rel:e,crossOrigin:i,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function b2(e){sa.D(e),K0("dns-prefetch",e,null)}function _2(e,n){sa.C(e,n),K0("preconnect",e,n)}function x2(e,n,i){sa.L(e,n,i);var l=ko;if(l&&e&&n){var f='link[rel="preload"][as="'+qn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+qn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+qn(i.imageSizes)+'"]')):f+='[href="'+qn(e)+'"]';var h=f;switch(n){case"style":h=So(e);break;case"script":h=jo(e)}Xn.has(h)||(e=b({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),Xn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(Mr(h))||n==="script"&&l.querySelector(Rr(h))||(n=l.createElement("link"),un(n,"link",e),en(n),l.head.appendChild(n)))}}function k2(e,n){sa.m(e,n);var i=ko;if(i&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+qn(l)+'"][href="'+qn(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=jo(e)}if(!Xn.has(h)&&(e=b({rel:"modulepreload",href:e},n),Xn.set(h,e),i.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Rr(h)))return}l=i.createElement("link"),un(l,"link",e),en(l),i.head.appendChild(l)}}}function S2(e,n,i){sa.S(e,n,i);var l=ko;if(l&&e){var f=qi(l).hoistableStyles,h=So(e);n=n||"default";var k=f.get(h);if(!k){var w={loading:0,preload:null};if(k=l.querySelector(Mr(h)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},i),(i=Xn.get(h))&&Hf(e,i);var I=k=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(){w.loading|=1}),I.addEventListener("error",function(){w.loading|=2}),w.loading|=4,_c(k,n,l)}k={type:"stylesheet",instance:k,count:1,state:w},f.set(h,k)}}}function j2(e,n){sa.X(e,n);var i=ko;if(i&&e){var l=qi(i).hoistableScripts,f=jo(e),h=l.get(f);h||(h=i.querySelector(Rr(f)),h||(e=b({src:e,async:!0},n),(n=Xn.get(f))&&Pf(e,n),h=i.createElement("script"),en(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function T2(e,n){sa.M(e,n);var i=ko;if(i&&e){var l=qi(i).hoistableScripts,f=jo(e),h=l.get(f);h||(h=i.querySelector(Rr(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=Xn.get(f))&&Pf(e,n),h=i.createElement("script"),en(h),un(h,"link",e),i.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function Z0(e,n,i,l){var f=(f=bt.current)?bc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=So(i.href),i=qi(f).hoistableStyles,l=i.get(n),l||(l={type:"style",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=So(i.href);var h=qi(f).hoistableStyles,k=h.get(e);if(k||(f=f.ownerDocument||f,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,k),(h=f.querySelector(Mr(e)))&&!h._p&&(k.instance=h,k.state.loading=5),Xn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Xn.set(e,i),h||N2(f,e,i,k.state))),n&&l===null)throw Error(r(528,""));return k}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=jo(i),i=qi(f).hoistableScripts,l=i.get(n),l||(l={type:"script",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function So(e){return'href="'+qn(e)+'"'}function Mr(e){return'link[rel="stylesheet"]['+e+"]"}function Y0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function N2(e,n,i,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),un(n,"link",i),en(n),e.head.appendChild(n))}function jo(e){return'[src="'+qn(e)+'"]'}function Rr(e){return"script[async]"+e}function J0(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+qn(i.href)+'"]');if(l)return n.instance=l,en(l),l;var f=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),en(l),un(l,"style",f),_c(l,i.precedence,e),n.instance=l;case"stylesheet":f=So(i.href);var h=e.querySelector(Mr(f));if(h)return n.state.loading|=4,n.instance=h,en(h),h;l=Y0(i),(f=Xn.get(f))&&Hf(l,f),h=(e.ownerDocument||e).createElement("link"),en(h);var k=h;return k._p=new Promise(function(w,I){k.onload=w,k.onerror=I}),un(h,"link",l),n.state.loading|=4,_c(h,i.precedence,e),n.instance=h;case"script":return h=jo(i.src),(f=e.querySelector(Rr(h)))?(n.instance=f,en(f),f):(l=i,(f=Xn.get(h))&&(l=b({},i),Pf(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,_c(l,i.precedence,e));return n.instance}function _c(e,n,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,k=0;k<l.length;k++){var w=l[k];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Hf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Pf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var xc=null;function W0(e,n,i){if(xc===null){var l=new Map,f=xc=new Map;f.set(i,l)}else f=xc,l=f.get(i),l||(l=new Map,f.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),f=0;f<i.length;f++){var h=i[f];if(!(h[Yo]||h[rn]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var k=h.getAttribute(n)||"";k=e+k;var w=l.get(k);w?w.push(h):l.set(k,[h])}}return l}function X0(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function w2(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Q0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function C2(e,n,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=So(l.href),h=n.querySelector(Mr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=kc.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=h,en(h);return}h=n.ownerDocument||n,l=Y0(l),(f=Xn.get(f))&&Hf(l,f),h=h.createElement("link"),en(h);var k=h;k._p=new Promise(function(w,I){k.onload=w,k.onerror=I}),un(h,"link",l),i.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=kc.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Uf=0;function E2(e,n){return e.stylesheets&&e.count===0&&jc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&Uf===0&&(Uf=62500*c2());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&jc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Uf?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function kc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)jc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Sc=null;function jc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Sc=new Map,n.forEach(A2,e),Sc=null,kc.call(e))}function A2(e,n){if(!(n.state.loading&4)){var i=Sc.get(e);if(i)var l=i.get(null);else{i=new Map,Sc.set(e,i);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var k=f[h];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(i.set(k.dataset.precedence,k),l=k)}l&&i.set(null,l)}f=n.instance,k=f.getAttribute("data-precedence"),h=i.get(k)||l,h===l&&i.set(null,f),i.set(k,f),this.count++,l=kc.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 Ir={$$typeof:D,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function D2(e,n,i,l,f,h,k,w,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=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function ey(e,n,i,l,f,h,k,w,I,G,X,ie){return e=new D2(e,n,i,k,I,G,X,ie,w),n=1,h===!0&&(n|=24),h=Dn(3,null,null,n),e.current=h,h.stateNode=e,n=_u(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:i,cache:n},ju(h),e}function ty(e){return e?(e=eo,e):eo}function ny(e,n,i,l,f,h){f=ty(f),l.context===null?l.context=f:l.pendingContext=f,l=ja(n),l.payload={element:i},h=h===void 0?null:h,h!==null&&(l.callback=h),i=Ta(e,l,n),i!==null&&(wn(i,e,n),fr(i,e,n))}function sy(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Vf(e,n){sy(e,n),(e=e.alternate)&&sy(e,n)}function ay(e){if(e.tag===13||e.tag===31){var n=ii(e,67108864);n!==null&&wn(n,e,67108864),Vf(e,67108864)}}function iy(e){if(e.tag===13||e.tag===31){var n=Bn();n=_t(n);var i=ii(e,n);i!==null&&wn(i,e,n),Vf(e,n)}}var Tc=!0;function M2(e,n,i,l){var f=H.T;H.T=null;var h=B.p;try{B.p=2,qf(e,n,i,l)}finally{B.p=h,H.T=f}}function R2(e,n,i,l){var f=H.T;H.T=null;var h=B.p;try{B.p=8,qf(e,n,i,l)}finally{B.p=h,H.T=f}}function qf(e,n,i,l){if(Tc){var f=Gf(l);if(f===null)Af(e,n,l,Nc,i),ry(e,l);else if(O2(f,e,n,i,l))l.stopPropagation();else if(ry(e,l),n&4&&-1<I2.indexOf(e)){for(;f!==null;){var h=Vi(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var k=de(h.pendingLanes);if(k!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;k;){var I=1<<31-Qt(k);w.entanglements[1]|=I,k&=~I}As(h),(rt&6)===0&&(lc=Xt()+500,Cr(0))}}break;case 31:case 13:w=ii(h,2),w!==null&&wn(w,h,2),dc(),Vf(h,2)}if(h=Gf(l),h===null&&Af(e,n,l,Nc,i),h===f)break;f=h}f!==null&&l.stopPropagation()}else Af(e,n,l,null,i)}}function Gf(e){return e=Fd(e),Ff(e)}var Nc=null;function Ff(e){if(Nc=null,e=Ui(e),e!==null){var n=d(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=p(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Nc=e,null}function oy(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(Qa()){case ei:return 2;case va:return 8;case $s:case Ss:return 32;case we:return 268435456;default:return 32}default:return 32}}var Kf=!1,Ba=null,La=null,za=null,Or=new Map,Br=new Map,$a=[],I2="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 ry(e,n){switch(e){case"focusin":case"focusout":Ba=null;break;case"dragenter":case"dragleave":La=null;break;case"mouseover":case"mouseout":za=null;break;case"pointerover":case"pointerout":Or.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Br.delete(n.pointerId)}}function Lr(e,n,i,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Vi(n),n!==null&&ay(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function O2(e,n,i,l,f){switch(n){case"focusin":return Ba=Lr(Ba,e,n,i,l,f),!0;case"dragenter":return La=Lr(La,e,n,i,l,f),!0;case"mouseover":return za=Lr(za,e,n,i,l,f),!0;case"pointerover":var h=f.pointerId;return Or.set(h,Lr(Or.get(h)||null,e,n,i,l,f)),!0;case"gotpointercapture":return h=f.pointerId,Br.set(h,Lr(Br.get(h)||null,e,n,i,l,f)),!0}return!1}function ly(e){var n=Ui(e.target);if(n!==null){var i=d(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){iy(i)});return}}else if(n===31){if(n=p(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){iy(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function wc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Gf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Gd=l,i.target.dispatchEvent(l),Gd=null}else return n=Vi(i),n!==null&&ay(n),e.blockedOn=i,!1;n.shift()}return!0}function cy(e,n,i){wc(e)&&i.delete(n)}function B2(){Kf=!1,Ba!==null&&wc(Ba)&&(Ba=null),La!==null&&wc(La)&&(La=null),za!==null&&wc(za)&&(za=null),Or.forEach(cy),Br.forEach(cy)}function Cc(e,n){e.blockedOn===n&&(e.blockedOn=null,Kf||(Kf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,B2)))}var Ec=null;function dy(e){Ec!==e&&(Ec=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ec===e&&(Ec=null);for(var n=0;n<e.length;n+=3){var i=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Ff(l||i)===null)continue;break}var h=Vi(i);h!==null&&(e.splice(n,3),n-=3,qu(h,{pending:!0,data:f,method:i.method,action:l},l,f))}}))}function To(e){function n(I){return Cc(I,e)}Ba!==null&&Cc(Ba,e),La!==null&&Cc(La,e),za!==null&&Cc(za,e),Or.forEach(n),Br.forEach(n);for(var i=0;i<$a.length;i++){var l=$a[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<$a.length&&(i=$a[0],i.blockedOn===null);)ly(i),i.blockedOn===null&&$a.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var f=i[l],h=i[l+1],k=f[xn]||null;if(typeof h=="function")k||dy(i);else if(k){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,k=h[xn]||null)w=k.formAction;else if(Ff(f)!==null)continue}else w=k.action;typeof w=="function"?i[l+1]=w:(i.splice(l,3),l-=3),dy(i)}}}function uy(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(k){return f=k})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Zf(e){this._internalRoot=e}Ac.prototype.render=Zf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,l=Bn();ny(i,l,e,n,null,null)},Ac.prototype.unmount=Zf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;ny(e.current,2,null,e,null,null),dc(),n[Pi]=null}};function Ac(e){this._internalRoot=e}Ac.prototype.unstable_scheduleHydration=function(e){if(e){var n=Hi();e={blockedOn:null,target:e,priority:n};for(var i=0;i<$a.length&&n!==0&&n<$a[i].priority;i++);$a.splice(i,0,e),i===0&&ly(e)}};var fy=s.version;if(fy!=="19.2.4")throw Error(r(527,fy,"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 L2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dc.isDisabled&&Dc.supportsFiber)try{mn=Dc.inject(L2),Ut=Dc}catch{}}return zr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var i=!1,l="",f=bv,h=_v,k=xv;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(k=n.onRecoverableError)),n=ey(e,1,!1,null,null,i,l,null,f,h,k,uy),e[Pi]=n.current,Ef(e),new Zf(n)},zr.hydrateRoot=function(e,n,i){if(!c(e))throw Error(r(299));var l=!1,f="",h=bv,k=_v,w=xv,I=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(k=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(I=i.formState)),n=ey(e,1,!0,n,i??null,l,f,I,h,k,w,uy),n.context=ty(null),i=n.current,l=Bn(),l=_t(l),f=ja(l),f.callback=null,Ta(i,f,l),i=l,n.current.lanes=i,Ue(n,i),As(n),e[Pi]=n.current,Ef(e),new Ac(n)},zr.version="19.2.4",zr}var vy;function dj(){if(vy)return Yf.exports;vy=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(),Yf.exports=cj(),Yf.exports}var uj=dj();const fj="modulepreload",pj=function(t){return"/"+t},yy={},H_=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=pj(g),g in yy)return;yy[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":fj,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((x,S)=>{_.addEventListener("load",x),_.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)})},mj=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),Sd=q2({baseUrl:"/",fetch:mj}),Be=kd(G2,Sd),zn=kd(F2,Sd),Bc=kd(K2,Sd),Lc=kd(Z2,Sd),hj="_bar_1xlm9_1",gj="_textarea_1xlm9_32",vj="_select_1xlm9_73",yj="_btnPrimary_1xlm9_109",bj="_btnGhost_1xlm9_179",_j="_badge_1xlm9_201",xj="_disconnectHint_1xlm9_211",bs={bar:hj,textarea:gj,select:vj,btnPrimary:yj,btnGhost:bj,badge:_j,disconnectHint:xj},kj=200;function Sj(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 jj({environmentId:t,onReconnect:s}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:bs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),a.jsx("button",{type:"button",onClick:()=>s(t),className:bs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Xf({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,kj)}px`)},[t]);const m=g=>{g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.nativeEvent.isComposing&&(g.preventDefault(),o())};return a.jsx("textarea",{ref:p,rows:1,value:t,onChange:g=>s(g.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:bs.textarea,"aria-label":u})}function jd({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,x]=y.useState(""),[S,j]=y.useState(""),T=Sj(o,u),N=()=>{if(_.trim())if(t==="send"){if(!s||T)return;p(s,_),x("")}else if(t==="spawn"){if(!o)return;m(o,_,S),b==null||b("Session started","success"),x(""),j("")}else{if(!r)return;g(r,void 0,o,_),x("")}},C=D=>{D.preventDefault(),N()};return t==="spawn"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx("span",{className:bs.badge,children:"new chat"}),a.jsx(Xf,{value:_,onChange:x,onSubmit:N,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&a.jsxs("select",{value:S,onChange:D=>j(D.target.value),className:bs.select,"aria-label":"Select persona",children:[a.jsx("option",{value:"",children:"(Default)"}),d.map(D=>a.jsx("option",{value:D.id,children:D.name},D.id))]}),a.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:bs.btnPrimary,children:"Go"})]}):t==="start"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx(Xf,{value:_,onChange:x,onSubmit:N,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),a.jsx("button",{type:"submit",disabled:!_.trim(),className:bs.btnPrimary,children:"Send"})]}):a.jsxs("form",{onSubmit:C,className:bs.bar,children:[T&&o&&a.jsx(jj,{environmentId:o,onReconnect:v}),a.jsx(Xf,{value:_,onChange:x,onSubmit:N,placeholder:"Type a message...",autoFocus:!T,disabled:T,ariaLabel:"Type a message"}),a.jsx("span",{title:T?"Environment is unavailable — reconnect first":void 0,children:a.jsx("button",{type:"submit",disabled:!_.trim()||T,className:bs.btnPrimary,children:"Send"})})]})}const by=220,_y=70,Tj=40,Nj=60,wj="hierarchy",Cj="dependency";function Ej(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new cd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:Tj,ranksep:Nj});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:by,height:_y});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:wj},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(o.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:Cj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return cd.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-by/2,y:p.y-_y/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 Nj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H_=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
31
+ */const Aj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),P_=(...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 Cj={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 Dj={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 Ej=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,...Cj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:H_("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,v)),...Array.isArray(d)?d:[d]]));/**
41
+ */const Mj=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,...Dj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:P_("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(Ej,{ref:d,iconNode:s,className:H_(`lucide-${Nj(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
46
+ */const Ie=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(Mj,{ref:d,iconNode:s,className:P_(`lucide-${Aj(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 Aj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],xy=Ie("ArrowDown",Aj);/**
51
+ */const Rj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],xy=Ie("ArrowDown",Rj);/**
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 Mj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ky=Ie("ArrowUp",Mj);/**
56
+ */const Ij=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ky=Ie("ArrowUp",Ij);/**
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 Dj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],Rj=Ie("Ban",Dj);/**
61
+ */const Oj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],Bj=Ie("Ban",Oj);/**
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 Ij=[["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"}]],Oj=Ie("Brain",Ij);/**
66
+ */const Lj=[["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"}]],zj=Ie("Brain",Lj);/**
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 Bj=[["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"}]],Lj=Ie("CalendarClock",Bj);/**
71
+ */const $j=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],Hj=Ie("CalendarClock",$j);/**
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 zj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ai=Ie("Check",zj);/**
76
+ */const Pj=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ai=Ie("Check",Pj);/**
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 $j=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],P_=Ie("ChevronDown",$j);/**
81
+ */const Uj=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],U_=Ie("ChevronDown",Uj);/**
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 Hj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pa=Ie("ChevronRight",Hj);/**
86
+ */const Vj=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pa=Ie("ChevronRight",Vj);/**
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 Pj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wi=Ie("Circle",Pj);/**
91
+ */const qj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ni=Ie("Circle",qj);/**
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 Uj=[["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"}]],Vj=Ie("ClipboardList",Uj);/**
96
+ */const Gj=[["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"}]],Fj=Ie("ClipboardList",Gj);/**
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 qj=[["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"}]],U_=Ie("Clipboard",qj);/**
101
+ */const Kj=[["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"}]],V_=Ie("Clipboard",Kj);/**
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 Gj=[["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"}]],Fj=Ie("Cog",Gj);/**
106
+ */const Zj=[["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"}]],Yj=Ie("Cog",Zj);/**
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 Kj=[["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"}]],Zj=Ie("Copy",Kj);/**
111
+ */const Jj=[["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"}]],Wj=Ie("Copy",Jj);/**
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 Yj=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Jj=Ie("CornerDownRight",Yj);/**
116
+ */const Xj=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],Qj=Ie("CornerDownRight",Xj);/**
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 Wj=[["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"}]],Xj=Ie("FilePen",Wj);/**
121
+ */const eT=[["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"}]],tT=Ie("FilePen",eT);/**
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 Qj=[["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"}]],eT=Ie("FileText",Qj);/**
126
+ */const nT=[["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"}]],sT=Ie("FileText",nT);/**
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 tT=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],nT=Ie("Forward",tT);/**
131
+ */const aT=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],iT=Ie("Forward",aT);/**
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 sT=[["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"}]],aT=Ie("GitBranch",sT);/**
136
+ */const oT=[["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"}]],rT=Ie("GitBranch",oT);/**
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 iT=[["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"}]],oT=Ie("Github",iT);/**
141
+ */const lT=[["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"}]],cT=Ie("Github",lT);/**
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 rT=[["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"}]],lT=Ie("Hash",rT);/**
146
+ */const dT=[["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"}]],uT=Ie("Hash",dT);/**
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 cT=[["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"}]],dT=Ie("House",cT);/**
151
+ */const fT=[["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"}]],pT=Ie("House",fT);/**
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 uT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],km=Ie("Info",uT);/**
156
+ */const mT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],km=Ie("Info",mT);/**
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 fT=[["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"}]],pT=Ie("Key",fT);/**
161
+ */const hT=[["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"}]],gT=Ie("Key",hT);/**
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 mT=[["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"}]],hT=Ie("Keyboard",mT);/**
166
+ */const vT=[["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"}]],yT=Ie("Keyboard",vT);/**
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 gT=[["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"}]],vT=Ie("ListChecks",gT);/**
171
+ */const bT=[["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"}]],_T=Ie("ListChecks",bT);/**
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 yT=[["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"}]],bT=Ie("List",yT);/**
176
+ */const xT=[["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"}]],kT=Ie("List",xT);/**
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 _T=[["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"}]],xT=Ie("Loader",_T);/**
181
+ */const ST=[["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"}]],jT=Ie("Loader",ST);/**
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 kT=[["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"}]],ST=Ie("Menu",kT);/**
186
+ */const TT=[["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"}]],NT=Ie("Menu",TT);/**
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 jT=[["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"}]],TT=Ie("MessageSquare",jT);/**
191
+ */const wT=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],CT=Ie("MessageSquare",wT);/**
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 wT=[["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"}]],NT=Ie("MessagesSquare",wT);/**
196
+ */const ET=[["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"}]],AT=Ie("MessagesSquare",ET);/**
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 CT=[["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"}]],ET=Ie("Monitor",CT);/**
201
+ */const DT=[["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"}]],MT=Ie("Monitor",DT);/**
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 AT=[["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"}]],MT=Ie("Network",AT);/**
206
+ */const RT=[["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"}]],IT=Ie("Network",RT);/**
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 DT=[["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"}]],RT=Ie("Palette",DT);/**
211
+ */const OT=[["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"}]],BT=Ie("Palette",OT);/**
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 IT=[["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"}]],OT=Ie("Pause",IT);/**
216
+ */const LT=[["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"}]],zT=Ie("Pause",LT);/**
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 BT=[["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"}]],LT=Ie("Pencil",BT);/**
221
+ */const $T=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],HT=Ie("Pencil",$T);/**
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 zT=[["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"}]],$T=Ie("Puzzle",zT);/**
226
+ */const PT=[["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"}]],UT=Ie("Puzzle",PT);/**
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 HT=[["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"}]],PT=Ie("RefreshCw",HT);/**
231
+ */const VT=[["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"}]],qT=Ie("RefreshCw",VT);/**
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 UT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Up=Ie("Search",UT);/**
236
+ */const GT=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Up=Ie("Search",GT);/**
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 VT=[["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"}]],qT=Ie("Settings",VT);/**
241
+ */const FT=[["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"}]],KT=Ie("Settings",FT);/**
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 GT=[["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"}]],FT=Ie("SquareCheckBig",GT);/**
246
+ */const ZT=[["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"}]],YT=Ie("SquareCheckBig",ZT);/**
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 KT=[["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"}]],ZT=Ie("Star",KT);/**
251
+ */const JT=[["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"}]],WT=Ie("Star",JT);/**
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 YT=[["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"}]],Sm=Ie("TriangleAlert",YT);/**
256
+ */const XT=[["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"}]],Sm=Ie("TriangleAlert",XT);/**
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 JT=[["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"}]],WT=Ie("User",JT);/**
261
+ */const QT=[["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"}]],eN=Ie("User",QT);/**
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 XT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ls=Ie("X",XT),V_=8,Ye=12,Ht=14,Et=16,Vp={not_started:{color:"var(--text-tertiary)",icon:a.jsx(wi,{size:Ye}),label:"Not Started"},working:{color:"var(--accent-green)",icon:a.jsx(wi,{size:Ye,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:a.jsx(OT,{size:Ye}),label:"Paused"},complete:{color:"var(--accent-green)",icon:a.jsx(Ai,{size:Ye}),label:"Complete"},failed:{color:"var(--accent-red)",icon:a.jsx(Ls,{size:Ye}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:a.jsx(Rj,{size:Ye}),label:"Blocked"}};function Ya(t){return t==="blocked"?Vp.blocked:Vp[fl(t)]}const QT={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function ew(t){return QT[fl(t)]??"statusPending"}const tw=["working","paused","failed","not_started","blocked","complete"],Sy=["not_started","working","paused","complete","failed"],nw={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function fl(t){return t in Vp&&t!=="blocked"?t:nw[t]??"not_started"}const sw={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"},aw="_dagContainer_js4w6_1",iw="_taskNode_js4w6_26",ow="_taskNodeBorder_js4w6_54",rw="_taskNodeContent_js4w6_60",lw="_taskNodeHeader_js4w6_70",cw="_taskNodeIcon_js4w6_77",dw="_taskNodeTitle_js4w6_82",uw="_taskNodeBadges_js4w6_90",fw="_childBadge_js4w6_95",pw="_depBadge_js4w6_107",mw="_handle_js4w6_119",hw="_emptyCta_js4w6_126",gw="_ctaDescription_js4w6_137",vw="_ctaButton_js4w6_144",bn={dagContainer:aw,taskNode:iw,taskNodeBorder:ow,taskNodeContent:rw,taskNodeHeader:lw,taskNodeIcon:cw,taskNodeTitle:dw,taskNodeBadges:uw,childBadge:fw,depBadge:pw,handle:mw,emptyCta:hw,ctaDescription:gw,ctaButton:vw};function yw({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Ya(s.status);return a.jsxs("div",{className:bn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[a.jsx(Bo,{type:"target",position:Lo.Top,className:bn.handle}),a.jsx("div",{className:bn.taskNodeBorder,style:{backgroundColor:d.color}}),a.jsxs("div",{className:bn.taskNodeContent,children:[a.jsxs("div",{className:bn.taskNodeHeader,children:[a.jsx("span",{className:bn.taskNodeIcon,style:{color:d.color},children:d.icon}),a.jsx("span",{className:bn.taskNodeTitle,children:s.title})]}),a.jsxs("div",{className:bn.taskNodeBadges,children:[o>0&&a.jsxs("span",{className:bn.childBadge,children:[r,"/",o]}),c&&a.jsx("span",{className:bn.depBadge,children:"dep"})]})]}),a.jsx(Bo,{type:"source",position:Lo.Bottom,className:bn.handle})]})}/**
266
+ */const tN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ls=Ie("X",tN),q_=8,Ye=12,Ht=14,Et=16,Vp={not_started:{color:"var(--text-tertiary)",icon:a.jsx(Ni,{size:Ye}),label:"Not Started"},working:{color:"var(--accent-green)",icon:a.jsx(Ni,{size:Ye,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:a.jsx(zT,{size:Ye}),label:"Paused"},complete:{color:"var(--accent-green)",icon:a.jsx(Ai,{size:Ye}),label:"Complete"},failed:{color:"var(--accent-red)",icon:a.jsx(Ls,{size:Ye}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:a.jsx(Bj,{size:Ye}),label:"Blocked"}};function Ya(t){return t==="blocked"?Vp.blocked:Vp[fl(t)]}const nN={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function sN(t){return nN[fl(t)]??"statusPending"}const aN=["working","paused","failed","not_started","blocked","complete"],Sy=["not_started","working","paused","complete","failed"],iN={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function fl(t){return t in Vp&&t!=="blocked"?t:iN[t]??"not_started"}const oN={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"},rN="_dagContainer_js4w6_1",lN="_taskNode_js4w6_26",cN="_taskNodeBorder_js4w6_54",dN="_taskNodeContent_js4w6_60",uN="_taskNodeHeader_js4w6_70",fN="_taskNodeIcon_js4w6_77",pN="_taskNodeTitle_js4w6_82",mN="_taskNodeBadges_js4w6_90",hN="_childBadge_js4w6_95",gN="_depBadge_js4w6_107",vN="_handle_js4w6_119",yN="_emptyCta_js4w6_126",bN="_ctaDescription_js4w6_137",_N="_ctaButton_js4w6_144",bn={dagContainer:rN,taskNode:lN,taskNodeBorder:cN,taskNodeContent:dN,taskNodeHeader:uN,taskNodeIcon:fN,taskNodeTitle:pN,taskNodeBadges:mN,childBadge:hN,depBadge:gN,handle:vN,emptyCta:yN,ctaDescription:bN,ctaButton:_N};function xN({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Ya(s.status);return a.jsxs("div",{className:bn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[a.jsx(Bo,{type:"target",position:Lo.Top,className:bn.handle}),a.jsx("div",{className:bn.taskNodeBorder,style:{backgroundColor:d.color}}),a.jsxs("div",{className:bn.taskNodeContent,children:[a.jsxs("div",{className:bn.taskNodeHeader,children:[a.jsx("span",{className:bn.taskNodeIcon,style:{color:d.color},children:d.icon}),a.jsx("span",{className:bn.taskNodeTitle,children:s.title})]}),a.jsxs("div",{className:bn.taskNodeBadges,children:[o>0&&a.jsxs("span",{className:bn.childBadge,children:[r,"/",o]}),c&&a.jsx("span",{className:bn.depBadge,children:"dep"})]})]}),a.jsx(Bo,{type:"source",position:Lo.Bottom,className:bn.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 jy="popstate";function Ty(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function bw(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 qp("",{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:al(c)}return xw(s,o,null,t)}function Tt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function rs(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function _w(){return Math.random().toString(36).substring(2,10)}function wy(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 qp(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?qo(s):s,state:o,key:s&&s.key||r||_w(),unstable_mask:c}}function al({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function qo(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function xw(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=Ty(T)?T:qp(j.location,T,w);g=v()+1;let M=wy(C,g),A=j.createHref(C.unstable_mask||C);try{u.pushState(M,"",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=Ty(T)?T:qp(j.location,T,w);g=v();let M=wy(C,g),A=j.createHref(C.unstable_mask||C);u.replaceState(M,"",A),d&&m&&m({action:p,location:j.location,delta:0})}function S(T){return kw(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(jy,b),m=T,()=>{c.removeEventListener(jy,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 kw(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),Tt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:al(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function q_(t,s,o="/"){return Sw(t,s,o,!1)}function Sw(t,s,o,r){let c=typeof s=="string"?qo(s):s,d=ua(c.pathname||"/",o);if(d==null)return null;let u=G_(t);jw(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=K_(d);p=Rw(u[m],g,r)}return p}function G_(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;Tt(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=Is([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(Tt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),G_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Mw(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 F_(u.path))d(u,p,!0,g)}),s}function F_(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=F_(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 jw(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:Dw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var Tw=/^:[\w-]+$/,ww=3,Nw=2,Cw=1,Ew=10,Aw=-2,Ny=t=>t==="*";function Mw(t,s){let o=t.split("/"),r=o.length;return o.some(Ny)&&(r+=Aw),s&&(r+=Nw),o.filter(c=>!Ny(c)).reduce((c,d)=>c+(Tw.test(d)?ww:d===""?Cw:Ew),r)}function Dw(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 Rw(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=il({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=il({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Is([d,b.pathname]),pathnameBase:zw(Is([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Is([d,b.pathnameBase]))}return u}function il(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=Iw(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 Iw(t,s=!1,o=!0){rs(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 K_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return rs(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function ua(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var Ow=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Bw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?qo(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=Cy(o.substring(1),"/"):d=Cy(o,s)):d=s,{pathname:d,search:$w(r),hash:Hw(c)}}function Cy(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function Qf(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Lw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function jm(t){let s=Lw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function Td(t,s,o,r=!1){let c;typeof t=="string"?c=qo(t):(c={...t},Tt(!c.pathname||!c.pathname.includes("?"),Qf("?","pathname","search",c)),Tt(!c.pathname||!c.pathname.includes("#"),Qf("#","pathname","hash",c)),Tt(!c.search||!c.search.includes("#"),Qf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Bw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Is=t=>t.join("/").replace(/\/\/+/g,"/"),zw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),$w=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Hw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Pw=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 Uw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Vw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Z_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Y_(t,s){let o=t;if(typeof o!="string"||!Ow.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(Z_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=ua(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{rs(!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 J_=["POST","PUT","PATCH","DELETE"];new Set(J_);var qw=["GET",...J_];new Set(qw);var Go=y.createContext(null);Go.displayName="DataRouter";var wd=y.createContext(null);wd.displayName="DataRouterState";var Gw=y.createContext(!1),W_=y.createContext({isTransitioning:!1});W_.displayName="ViewTransition";var Fw=y.createContext(new Map);Fw.displayName="Fetchers";var Kw=y.createContext(null);Kw.displayName="Await";var Un=y.createContext(null);Un.displayName="Navigation";var pl=y.createContext(null);pl.displayName="Location";var cs=y.createContext({outlet:null,matches:[],isDataRoute:!1});cs.displayName="Route";var Tm=y.createContext(null);Tm.displayName="RouteError";var X_="REACT_ROUTER_ERROR",Zw="REDIRECT",Yw="ROUTE_ERROR_RESPONSE";function Jw(t){if(t.startsWith(`${X_}:${Zw}:{`))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 Ww(t){if(t.startsWith(`${X_}:${Yw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Pw(s.status,s.statusText,s.data)}catch{}}function Xw(t,{relative:s}={}){Tt(Mi(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Un),{hash:c,pathname:d,search:u}=ml(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Is([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Mi(){return y.useContext(pl)!=null}function Wt(){return Tt(Mi(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(pl).location}function nn(t){Tt(Mi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Wt();return y.useMemo(()=>il(t,K_(s)),[s,t])}var Q_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ex(t){y.useContext(Un).static||y.useLayoutEffect(t)}function Nd(){let{isDataRoute:t}=y.useContext(cs);return t?pN():Qw()}function Qw(){Tt(Mi(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Go),{basename:s,navigator:o}=y.useContext(Un),{matches:r}=y.useContext(cs),{pathname:c}=Wt(),d=JSON.stringify(jm(r)),u=y.useRef(!1);return ex(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(rs(u.current,Q_),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=Td(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Is([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var eN=y.createContext(null);function tN(t){let s=y.useContext(cs).outlet;return y.useMemo(()=>s&&y.createElement(eN.Provider,{value:t},s),[s,t])}function ma(){let{matches:t}=y.useContext(cs),s=t[t.length-1];return s?s.params:{}}function ml(t,{relative:s}={}){let{matches:o}=y.useContext(cs),{pathname:r}=Wt(),c=JSON.stringify(jm(o));return y.useMemo(()=>Td(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function nN(t,s){return tx(t,s)}function tx(t,s,o){var T;Tt(Mi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Un),{matches:c}=y.useContext(cs),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||"";sx(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 jy="popstate";function Ty(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function kN(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 qp("",{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:al(c)}return jN(s,o,null,t)}function Tt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function rs(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function SN(){return Math.random().toString(36).substring(2,10)}function Ny(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 qp(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?qo(s):s,state:o,key:s&&s.key||r||SN(),unstable_mask:c}}function al({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function qo(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function jN(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(),N=T==null?null:T-g;g=T,m&&m({action:p,location:j.location,delta:N})}function _(T,N){p="PUSH";let C=Ty(T)?T:qp(j.location,T,N);g=v()+1;let D=Ny(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 x(T,N){p="REPLACE";let C=Ty(T)?T:qp(j.location,T,N);g=v();let D=Ny(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 TN(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(jy,b),m=T,()=>{c.removeEventListener(jy,b),m=null}},createHref(T){return s(c,T)},createURL:S,encodeLocation(T){let N=S(T);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:_,replace:x,go(T){return u.go(T)}};return j}function TN(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),Tt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:al(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function G_(t,s,o="/"){return NN(t,s,o,!1)}function NN(t,s,o,r){let c=typeof s=="string"?qo(s):s,d=ua(c.pathname||"/",o);if(d==null)return null;let u=F_(t);wN(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=Z_(d);p=BN(u[m],g,r)}return p}function F_(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;Tt(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=Is([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(Tt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),F_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:IN(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 K_(u.path))d(u,p,!0,g)}),s}function K_(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=K_(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 wN(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:ON(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var CN=/^:[\w-]+$/,EN=3,AN=2,DN=1,MN=10,RN=-2,wy=t=>t==="*";function IN(t,s){let o=t.split("/"),r=o.length;return o.some(wy)&&(r+=RN),s&&(r+=AN),o.filter(c=>!wy(c)).reduce((c,d)=>c+(CN.test(d)?EN:d===""?DN:MN),r)}function ON(t,s){return t.length===s.length&&t.slice(0,-1).every((r,c)=>r===s[c])?t[t.length-1]-s[s.length-1]:0}function BN(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=il({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&o&&!r[r.length-1].route.index&&(b=il({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Is([d,b.pathname]),pathnameBase:PN(Is([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Is([d,b.pathnameBase]))}return u}function il(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=LN(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 x=p[_];return b&&!x?g[v]=void 0:g[v]=(x||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function LN(t,s=!1,o=!0){rs(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 Z_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return rs(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function ua(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var zN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $N(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?qo(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=Cy(o.substring(1),"/"):d=Cy(o,s)):d=s,{pathname:d,search:UN(r),hash:VN(c)}}function Cy(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function Qf(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function HN(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function jm(t){let s=HN(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function Td(t,s,o,r=!1){let c;typeof t=="string"?c=qo(t):(c={...t},Tt(!c.pathname||!c.pathname.includes("?"),Qf("?","pathname","search",c)),Tt(!c.pathname||!c.pathname.includes("#"),Qf("#","pathname","hash",c)),Tt(!c.search||!c.search.includes("#"),Qf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=$N(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var Is=t=>t.join("/").replace(/\/\/+/g,"/"),PN=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),UN=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,VN=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,qN=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 GN(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function FN(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Y_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function J_(t,s){let o=t;if(typeof o!="string"||!zN.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(Y_)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),p=ua(u.pathname,s);u.origin===d.origin&&p!=null?o=p+u.search+u.hash:c=!0}catch{rs(!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 W_=["POST","PUT","PATCH","DELETE"];new Set(W_);var KN=["GET",...W_];new Set(KN);var Go=y.createContext(null);Go.displayName="DataRouter";var Nd=y.createContext(null);Nd.displayName="DataRouterState";var ZN=y.createContext(!1),X_=y.createContext({isTransitioning:!1});X_.displayName="ViewTransition";var YN=y.createContext(new Map);YN.displayName="Fetchers";var JN=y.createContext(null);JN.displayName="Await";var Un=y.createContext(null);Un.displayName="Navigation";var pl=y.createContext(null);pl.displayName="Location";var cs=y.createContext({outlet:null,matches:[],isDataRoute:!1});cs.displayName="Route";var Tm=y.createContext(null);Tm.displayName="RouteError";var Q_="REACT_ROUTER_ERROR",WN="REDIRECT",XN="ROUTE_ERROR_RESPONSE";function QN(t){if(t.startsWith(`${Q_}:${WN}:{`))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 ew(t){if(t.startsWith(`${Q_}:${XN}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new qN(s.status,s.statusText,s.data)}catch{}}function tw(t,{relative:s}={}){Tt(Di(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Un),{hash:c,pathname:d,search:u}=ml(t,{relative:s}),p=d;return o!=="/"&&(p=d==="/"?o:Is([o,d])),r.createHref({pathname:p,search:u,hash:c})}function Di(){return y.useContext(pl)!=null}function Wt(){return Tt(Di(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(pl).location}function nn(t){Tt(Di(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Wt();return y.useMemo(()=>il(t,Z_(s)),[s,t])}var ex="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function tx(t){y.useContext(Un).static||y.useLayoutEffect(t)}function wd(){let{isDataRoute:t}=y.useContext(cs);return t?gw():nw()}function nw(){Tt(Di(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Go),{basename:s,navigator:o}=y.useContext(Un),{matches:r}=y.useContext(cs),{pathname:c}=Wt(),d=JSON.stringify(jm(r)),u=y.useRef(!1);return tx(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(rs(u.current,ex),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=Td(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Is([s,v.pathname])),(g.replace?o.replace:o.push)(v,g.state,g)},[s,o,d,c,t])}var sw=y.createContext(null);function aw(t){let s=y.useContext(cs).outlet;return y.useMemo(()=>s&&y.createElement(sw.Provider,{value:t},s),[s,t])}function ma(){let{matches:t}=y.useContext(cs),s=t[t.length-1];return s?s.params:{}}function ml(t,{relative:s}={}){let{matches:o}=y.useContext(cs),{pathname:r}=Wt(),c=JSON.stringify(jm(o));return y.useMemo(()=>Td(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function iw(t,s){return nx(t,s)}function nx(t,s,o){var T;Tt(Di(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Un),{matches:c}=y.useContext(cs),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let N=g&&g.path||"";ax(p,!g||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${N}">) 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=Wt(),b;if(s){let w=typeof s=="string"?qo(s):s;Tt(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=q_(t,{pathname:k});rs(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),rs(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=rN(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},u,w.params),pathname:Is([m,r.encodeLocation?r.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Is([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(pl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function sN(){let t=fN(),s=Uw(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 aN=y.createElement(sN,null),nx=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=Ww(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(cs.Provider,{value:this.props.routeContext},y.createElement(Tm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(iN,{error:t},s):s}};nx.contextType=Gw;var ep=new WeakMap;function iN({children:t,error:s}){let{basename:o}=y.useContext(Un);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Jw(s.digest);if(r){let c=ep.get(s);if(c)throw c;let d=Y_(r.location,o);if(Z_&&!ep.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 ep.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function oN({routeContext:t,match:s,children:o}){let r=y.useContext(Go);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(cs.Provider,{value:t},o)}function rN(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);Tt(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:Vw(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||aN,u&&(p<0&&_===0?(sx("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 M;return k?M=j:S?M=T:b.route.Component?M=y.createElement(b.route.Component,null):b.route.element?M=b.route.element:M=v,y.createElement(oN,{match:b,routeContext:{outlet:v,matches:w,isDataRoute:r!=null},children:M})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(nx,{location:r.location,revalidation:r.revalidation,component:j,error:k,children:C(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:g}):C()},null)}function wm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lN(t){let s=y.useContext(Go);return Tt(s,wm(t)),s}function cN(t){let s=y.useContext(wd);return Tt(s,wm(t)),s}function dN(t){let s=y.useContext(cs);return Tt(s,wm(t)),s}function Nm(t){let s=dN(t),o=s.matches[s.matches.length-1];return Tt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function uN(){return Nm("useRouteId")}function fN(){var r;let t=y.useContext(Tm),s=cN("useRouteError"),o=Nm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function pN(){let{router:t}=lN("useNavigate"),s=Nm("useNavigate"),o=y.useRef(!1);return ex(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{rs(o.current,Q_),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var Ey={};function sx(t,s,o){!s&&!Ey[t]&&(Ey[t]=!0,rs(!1,o))}y.memo(mN);function mN({routes:t,future:s,state:o,isStatic:r,onError:c}){return tx(t,void 0,{state:o,isStatic:r,onError:c})}function $n({to:t,replace:s,state:o,relative:r}){Tt(Mi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Un);rs(!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(cs),{pathname:u}=Wt(),p=Nd(),m=Td(t,jm(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 Di(t){return tN(t.context)}function Ee(t){Tt(!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 hN({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){Tt(!Mi(),"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=qo(o));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:k="default",unstable_mask:S}=o,j=y.useMemo(()=>{let T=ua(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 rs(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(Un.Provider,{value:m},y.createElement(pl.Provider,{children:s,value:j}))}function gN({children:t,location:s}){return nN(Gp(t),s)}function Gp(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,Gp(r.props.children,d));return}Tt(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>`),Tt(!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=Gp(r.props.children,d)),o.push(u)}),o}var ed="get",td="application/x-www-form-urlencoded";function Cd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function vN(t){return Cd(t)&&t.tagName.toLowerCase()==="button"}function yN(t){return Cd(t)&&t.tagName.toLowerCase()==="form"}function bN(t){return Cd(t)&&t.tagName.toLowerCase()==="input"}function _N(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function xN(t,s){return t.button===0&&(!s||s==="_self")&&!_N(t)}function Fp(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 kN(t,s){let o=Fp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var zc=null;function SN(){if(zc===null)try{new FormData(document.createElement("form"),0),zc=!1}catch{zc=!0}return zc}var jN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tp(t){return t!=null&&!jN.has(t)?(rs(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${td}"`),null):t}function TN(t,s){let o,r,c,d,u;if(yN(t)){let p=t.getAttribute("action");r=p?ua(p,s):null,o=t.getAttribute("method")||ed,c=tp(t.getAttribute("enctype"))||td,d=new FormData(t)}else if(vN(t)||bN(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?ua(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||ed,c=tp(t.getAttribute("formenctype"))||tp(p.getAttribute("enctype"))||td,d=new FormData(p,t),!SN()){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(Cd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=ed,r=null,c=td,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 Cm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function wN(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ua(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function NN(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 CN(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 EN(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await NN(d,o);return u.links?u.links():[]}return[]}));return RN(r.flat(1).filter(CN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ay(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 AN(t,s,{includeHydrateFallback:o}={}){return MN(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 MN(t){return[...new Set(t)]}function DN(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function RN(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(DN(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function ax(){let t=y.useContext(Go);return Cm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function IN(){let t=y.useContext(wd);return Cm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Em=y.createContext(void 0);Em.displayName="FrameworkContext";function ix(){let t=y.useContext(Em);return Cm(t,"You must render this element inside a <HydratedRouter> element"),t}function ON(t,s){let o=y.useContext(Em),[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:$r(p,k),onBlur:$r(m,S),onMouseEnter:$r(g,k),onMouseLeave:$r(v,S),onTouchStart:$r(b,k)}]:[!1,_,{}]}function $r(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function BN({page:t,...s}){let{router:o}=ax(),r=y.useMemo(()=>q_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(zN,{page:t,matches:r,...s}):null}function LN(t){let{manifest:s,routeModules:o}=ix(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return EN(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function zN({page:t,matches:s,...o}){let r=Wt(),{future:c,manifest:d,routeModules:u}=ix(),{basename:p}=ax(),{loaderData:m,matches:g}=IN(),v=y.useMemo(()=>Ay(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>Ay(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 M=d.routes[C.route.id];!M||!M.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((A=u[C.route.id])!=null&&A.shouldRevalidate)||M.hasClientLoader?T=!0:j.add(C.route.id))}),j.size===0)return[];let w=wN(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(()=>AN(b,d),[b,d]),S=LN(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 $N(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var HN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{HN&&(window.__reactRouterVersion="7.13.2")}catch{}function PN({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=bw({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(hN,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var ox=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Am=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(Un),M=typeof v=="string"&&ox.test(v),A=Y_(v,T);v=A.to;let E=Xw(v,{relative:c}),R=Wt(),O=null;if(p){let se=Td(p,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);T!=="/"&&(se.pathname=se.pathname==="/"?T:Is([T,se.pathname])),O=w.createHref(se)}let[D,$,Y]=ON(r,S),V=GN(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:$N(j,$),target:g,"data-discover":!M&&o==="render"?"true":void 0});return D&&!M?y.createElement(y.Fragment,null,Z,y.createElement(BN,{page:E})):Z});Am.displayName="Link";var UN=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=ml(u,{relative:g.relative}),_=Wt(),k=y.useContext(wd),{navigator:S,basename:j}=y.useContext(Un),T=k!=null&&JN(b)&&p===!0,w=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,M=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;o||(C=C.toLowerCase(),M=M?M.toLowerCase():null,w=w.toLowerCase()),M&&j&&(M=ua(M,j)||M);const A=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let E=C===w||!c&&C.startsWith(w)&&C.charAt(A)==="/",R=M!=null&&(M===w||!c&&M.startsWith(w)&&M.charAt(w.length)==="/"),O={isActive:E,isPending:R,isTransitioning:T},D=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(Am,{...g,"aria-current":D,className:$,ref:v,style:Y,to:u,viewTransition:p},typeof m=="function"?m(O):m)});UN.displayName="NavLink";var VN=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=ed,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...k},S)=>{let{unstable_useTransitions:j}=y.useContext(Un),T=ZN(),w=YN(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",M=typeof p=="string"&&ox.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,D=()=>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(()=>D()):D()};return y.createElement("form",{ref:S,method:C,action:w,onSubmit:r?m:A,...k,"data-discover":!M&&t==="render"?"true":void 0})});VN.displayName="Form";function qN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rx(t){let s=y.useContext(Go);return Tt(s,qN(t)),s}function GN(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=Nd(),b=Wt(),_=ml(t,{relative:u});return y.useCallback(k=>{if(xN(k,s)){k.preventDefault();let S=o!==void 0?o:al(b)===al(_),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 Mm(t){rs(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(Fp(t)),o=y.useRef(!1),r=Wt(),c=y.useMemo(()=>kN(r.search,o.current?null:s.current),[r.search]),d=Nd(),u=y.useCallback((p,m)=>{const g=Fp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var FN=0,KN=()=>`__${String(++FN)}__`;function ZN(){let{router:t}=rx("useSubmit"),{basename:s}=y.useContext(Un),o=uN(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=TN(d,s);if(u.navigate===!1){let _=u.fetcherKey||KN();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 YN(t,{relative:s}={}){let{basename:o}=y.useContext(Un),r=y.useContext(cs);Tt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...ml(t||".",{relative:s})},u=Wt();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:Is([o,d.pathname])),al(d)}function JN(t,{relative:s}={}){let o=y.useContext(W_);Tt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=rx("useViewTransitionState"),c=ml(t,{relative:s});if(!o.isTransitioning)return!1;let d=ua(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ua(o.nextLocation.pathname,r)||o.nextLocation.pathname;return il(c.pathname,u)!=null||il(c.pathname,d)!=null}function xt(){const t=Nd();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Dm(t){return`/sessions/${encodeURIComponent(t)}`}function Ni(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function ls(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ri(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function lx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const zo="/environments",WN="/environments/new";function $o(t){return`/environments/${encodeURIComponent(t)}`}function XN(t){return`/environments/${encodeURIComponent(t)}/edit`}const ji="/settings",QN="/settings/credentials",np="/settings/personas",eC="/settings/personas/new";function cx(t){return`/settings/personas/${encodeURIComponent(t)}`}const sp="/settings/schedules",tC="/settings/schedules/new";function dx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const nC="/settings/shortcuts",sC="/pair",aC="/chat",ux="/coordination",Fo="/",iC="/tasks",fx="/workspaces/new",px="/knowledge",oC=sw,rC={task:yw};function lC({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=xt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=wj(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(oC))_[k]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(ls(_.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?a.jsxs("div",{className:bn.emptyCta,children:[a.jsx("button",{className:bn.ctaButton,onClick:()=>c(Ri(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:bn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):a.jsx("div",{className:bn.dagContainer,children:a.jsxs(A_,{nodes:u,edges:p,nodeTypes:rC,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(M_,{variant:D_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(R_,{showInteractive:!1}),a.jsx(I_,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const cC="_breadcrumbs_17or2_1",dC="_list_17or2_11",uC="_item_17or2_21",fC="_separator_17or2_28",pC="_link_17or2_34",mC="_current_17or2_57",wo={breadcrumbs:cC,list:dC,item:uC,separator:fC,link:pC,current:mC};function ha({segments:t}){return a.jsx("nav",{className:wo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:a.jsx("ol",{className:wo.list,children:t.map((s,o)=>{const r=o===t.length-1;return a.jsxs("li",{className:wo.item,children:[o>0&&a.jsx("span",{className:wo.separator,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),s.url&&!r?a.jsx(Am,{className:wo.link,to:s.url,title:s.label,children:s.label}):a.jsx("span",{className:wo.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const hC="_btn_dwk2o_1",gC="_sm_dwk2o_22",vC="_md_dwk2o_28",yC="_lg_dwk2o_34",bC="_primary_dwk2o_40",_C="_danger_dwk2o_55",xC="_outline_dwk2o_70",kC="_ghost_dwk2o_80",ap={btn:hC,sm:gC,md:vC,lg:yC,primary:bC,danger:_C,outline:xC,ghost:kC},sn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[ap.btn,ap[s],ap[o],r].filter(Boolean).join(" ");return a.jsx("button",{ref:u,className:p,...d,children:c})}),SC="_copyButton_1bqk0_1",jC={copyButton:SC},TC=2e3;function wC({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},TC)}catch{}},[t]);return a.jsx("button",{type:"button",className:`${jC.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?a.jsx(Ai,{size:Ht,"aria-hidden":"true"}):a.jsx(U_,{size:Ht,"aria-hidden":"true"})})}const NC="_banner_bxqlh_1",CC="_label_bxqlh_15",EC="_text_bxqlh_25",AC="_link_bxqlh_29",$c={banner:NC,label:CC,text:EC,link:AC};function MC(){return a.jsxs("div",{className:$c.banner,"data-testid":"demo-banner",children:[a.jsx("span",{className:$c.label,children:"DEMO"}),a.jsxs("span",{className:$c.text,children:["This is an interactive demo with mock data."," ",a.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:$c.link,children:"Install Grackle"})," ","to use it for real."]})]})}const DC="_container_og0yp_1",RC="_chevronButton_og0yp_6",IC="_mainButton_og0yp_6",OC="_sm_og0yp_34",BC="_md_og0yp_34",LC="_lg_og0yp_34",zC="_primary_og0yp_57",$C="_danger_og0yp_70",HC="_outline_og0yp_83",PC="_ghost_og0yp_92",UC="_dropdown_og0yp_100",VC="_option_og0yp_113",qC="_optionLabel_og0yp_130",GC="_optionDesc_og0yp_135",aa={container:DC,chevronButton:RC,mainButton:IC,sm:OC,md:BC,lg:LC,primary:zC,danger:$C,outline:HC,ghost:PC,dropdown:UC,option:VC,optionLabel:qC,optionDesc:GC};function mx({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=aa[r]||"",v=aa[c]||"",b=()=>{u&&p(!1),s()};return a.jsxs("div",{ref:m,className:aa.container,"data-testid":d,children:[a.jsx("button",{type:"button",className:`${aa.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),a.jsx("button",{type:"button",className:`${aa.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:a.jsx(P_,{size:Ht,"aria-hidden":"true"})}),u&&a.jsx("div",{className:aa.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,k)=>a.jsxs("button",{type:"button",className:aa.option,onClick:()=>{_.onClick(),p(!1)},children:[a.jsx("span",{className:aa.optionLabel,children:_.label}),_.description&&a.jsx("span",{className:aa.optionDesc,children:_.description})]},k))})]})}function Kp(){Kp=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)),dd(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&&dd(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)},Kp.apply(this,arguments)}function dd(t,s){return dd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},dd(t,s)}function My(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function ip(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return My(c,d);var u=Object.prototype.toString.call(c).slice(8,-1);return u==="Object"&&c.constructor&&(u=c.constructor.name),u==="Map"||u==="Set"?Array.from(c):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?My(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
278
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var FC=(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){ej(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=ip(E.properties.className);!(R=O()).done;){var D=R.value;if(D.slice(0,9)==="language-")return D.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(Oc(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,D){if(D.type==="text"){var $=D.value,Y=($.match(/\n/g)||"").length;if(Y===0)D.position={start:{line:v,column:1},end:{line:v,column:1}},O.push(D);else for(var V,ne=$.split(`
277
+ Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let v=Wt(),b;if(s){let N=typeof s=="string"?qo(s):s;Tt(m==="/"||((T=N.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 "${N.pathname}" was given in the \`location\` prop.`),b=N}else b=v;let _=b.pathname||"/",x=_;if(m!=="/"){let N=m.replace(/^\//,"").split("/");x="/"+_.replace(/^\//,"").split("/").slice(N.length).join("/")}let S=G_(t,{pathname:x});rs(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),rs(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=dw(S&&S.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:Is([m,r.encodeLocation?r.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?m:Is([m,r.encodeLocation?r.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),c,o);return s&&j?y.createElement(pl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function ow(){let t=hw(),s=GN(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 rw=y.createElement(ow,null),sx=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=ew(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(cs.Provider,{value:this.props.routeContext},y.createElement(Tm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(lw,{error:t},s):s}};sx.contextType=ZN;var ep=new WeakMap;function lw({children:t,error:s}){let{basename:o}=y.useContext(Un);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=QN(s.digest);if(r){let c=ep.get(s);if(c)throw c;let d=J_(r.location,o);if(Y_&&!ep.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 ep.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function cw({routeContext:t,match:s,children:o}){let r=y.useContext(Go);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(cs.Provider,{value:t},o)}function dw(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);Tt(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:x}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!x||x[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 _,x;m(v,{location:r.location,params:((x=(_=r.matches)==null?void 0:_[0])==null?void 0:x.params)??{},unstable_pattern:FN(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let x,S=!1,j=null,T=null;r&&(x=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||rw,u&&(p<0&&_===0?(ax("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 N=s.concat(c.slice(0,_+1)),C=()=>{let D;return x?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(cw,{match:b,routeContext:{outlet:v,matches:N,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(sx,{location:r.location,revalidation:r.revalidation,component:j,error:x,children:C(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:g}):C()},null)}function Nm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function uw(t){let s=y.useContext(Go);return Tt(s,Nm(t)),s}function fw(t){let s=y.useContext(Nd);return Tt(s,Nm(t)),s}function pw(t){let s=y.useContext(cs);return Tt(s,Nm(t)),s}function wm(t){let s=pw(t),o=s.matches[s.matches.length-1];return Tt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function mw(){return wm("useRouteId")}function hw(){var r;let t=y.useContext(Tm),s=fw("useRouteError"),o=wm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function gw(){let{router:t}=uw("useNavigate"),s=wm("useNavigate"),o=y.useRef(!1);return tx(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{rs(o.current,ex),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var Ey={};function ax(t,s,o){!s&&!Ey[t]&&(Ey[t]=!0,rs(!1,o))}y.memo(vw);function vw({routes:t,future:s,state:o,isStatic:r,onError:c}){return nx(t,void 0,{state:o,isStatic:r,onError:c})}function $n({to:t,replace:s,state:o,relative:r}){Tt(Di(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Un);rs(!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(cs),{pathname:u}=Wt(),p=wd(),m=Td(t,jm(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 Mi(t){return aw(t.context)}function Ee(t){Tt(!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 yw({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){Tt(!Di(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof o=="string"&&(o=qo(o));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:x="default",unstable_mask:S}=o,j=y.useMemo(()=>{let T=ua(g,p);return T==null?null:{location:{pathname:T,search:v,hash:b,state:_,key:x,unstable_mask:S},navigationType:r}},[p,g,v,b,_,x,r,S]);return rs(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(Un.Provider,{value:m},y.createElement(pl.Provider,{children:s,value:j}))}function bw({children:t,location:s}){return iw(Gp(t),s)}function Gp(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,Gp(r.props.children,d));return}Tt(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>`),Tt(!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=Gp(r.props.children,d)),o.push(u)}),o}var ed="get",td="application/x-www-form-urlencoded";function Cd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function _w(t){return Cd(t)&&t.tagName.toLowerCase()==="button"}function xw(t){return Cd(t)&&t.tagName.toLowerCase()==="form"}function kw(t){return Cd(t)&&t.tagName.toLowerCase()==="input"}function Sw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function jw(t,s){return t.button===0&&(!s||s==="_self")&&!Sw(t)}function Fp(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 Tw(t,s){let o=Fp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var zc=null;function Nw(){if(zc===null)try{new FormData(document.createElement("form"),0),zc=!1}catch{zc=!0}return zc}var ww=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tp(t){return t!=null&&!ww.has(t)?(rs(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${td}"`),null):t}function Cw(t,s){let o,r,c,d,u;if(xw(t)){let p=t.getAttribute("action");r=p?ua(p,s):null,o=t.getAttribute("method")||ed,c=tp(t.getAttribute("enctype"))||td,d=new FormData(t)}else if(_w(t)||kw(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?ua(m,s):null,o=t.getAttribute("formmethod")||p.getAttribute("method")||ed,c=tp(t.getAttribute("formenctype"))||tp(p.getAttribute("enctype"))||td,d=new FormData(p,t),!Nw()){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(Cd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=ed,r=null,c=td,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 Cm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Ew(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ua(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Aw(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 Dw(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 Mw(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Aw(d,o);return u.links?u.links():[]}return[]}));return Bw(r.flat(1).filter(Dw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ay(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 Rw(t,s,{includeHydrateFallback:o}={}){return Iw(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 Iw(t){return[...new Set(t)]}function Ow(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function Bw(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Ow(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function ix(){let t=y.useContext(Go);return Cm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Lw(){let t=y.useContext(Nd);return Cm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Em=y.createContext(void 0);Em.displayName="FrameworkContext";function ox(){let t=y.useContext(Em);return Cm(t,"You must render this element inside a <HydratedRouter> element"),t}function zw(t,s){let o=y.useContext(Em),[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=N=>{N.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 x=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,_,{}]:[d,_,{onFocus:$r(p,x),onBlur:$r(m,S),onMouseEnter:$r(g,x),onMouseLeave:$r(v,S),onTouchStart:$r(b,x)}]:[!1,_,{}]}function $r(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function $w({page:t,...s}){let{router:o}=ix(),r=y.useMemo(()=>G_(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(Pw,{page:t,matches:r,...s}):null}function Hw(t){let{manifest:s,routeModules:o}=ox(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return Mw(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function Pw({page:t,matches:s,...o}){let r=Wt(),{future:c,manifest:d,routeModules:u}=ox(),{basename:p}=ix(),{loaderData:m,matches:g}=Lw(),v=y.useMemo(()=>Ay(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>Ay(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 N=Ew(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return T&&j.size>0&&N.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[N.pathname+N.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),x=y.useMemo(()=>Rw(b,d),[b,d]),S=Hw(b);return y.createElement(y.Fragment,null,_.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),x.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),S.map(({key:j,link:T})=>y.createElement("link",{key:j,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function Uw(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var Vw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Vw&&(window.__reactRouterVersion="7.13.2")}catch{}function qw({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=kN({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(yw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var rx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Am=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:x,...S},j){let{basename:T,navigator:N,unstable_useTransitions:C}=y.useContext(Un),D=typeof v=="string"&&rx.test(v),A=J_(v,T);v=A.to;let E=tw(v,{relative:c}),R=Wt(),O=null;if(p){let se=Td(p,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);T!=="/"&&(se.pathname=se.pathname==="/"?T:Is([T,se.pathname])),O=N.createHref(se)}let[M,$,Y]=zw(r,S),V=Zw(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:x,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:Uw(j,$),target:g,"data-discover":!D&&o==="render"?"true":void 0});return M&&!D?y.createElement(y.Fragment,null,Z,y.createElement($w,{page:E})):Z});Am.displayName="Link";var Gw=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=ml(u,{relative:g.relative}),_=Wt(),x=y.useContext(Nd),{navigator:S,basename:j}=y.useContext(Un),T=x!=null&&Qw(b)&&p===!0,N=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,N=N.toLowerCase()),D&&j&&(D=ua(D,j)||D);const A=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let E=C===N||!c&&C.startsWith(N)&&C.charAt(A)==="/",R=D!=null&&(D===N||!c&&D.startsWith(N)&&D.charAt(N.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(Am,{...g,"aria-current":M,className:$,ref:v,style:Y,to:u,viewTransition:p},typeof m=="function"?m(O):m)});Gw.displayName="NavLink";var Fw=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=ed,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...x},S)=>{let{unstable_useTransitions:j}=y.useContext(Un),T=Ww(),N=Xw(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",D=typeof p=="string"&&rx.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:N,onSubmit:r?m:A,...x,"data-discover":!D&&t==="render"?"true":void 0})});Fw.displayName="Form";function Kw(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lx(t){let s=y.useContext(Go);return Tt(s,Kw(t)),s}function Zw(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=wd(),b=Wt(),_=ml(t,{relative:u});return y.useCallback(x=>{if(jw(x,s)){x.preventDefault();let S=o!==void 0?o:al(b)===al(_),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 Dm(t){rs(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(Fp(t)),o=y.useRef(!1),r=Wt(),c=y.useMemo(()=>Tw(r.search,o.current?null:s.current),[r.search]),d=wd(),u=y.useCallback((p,m)=>{const g=Fp(typeof p=="function"?p(new URLSearchParams(c)):p);o.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var Yw=0,Jw=()=>`__${String(++Yw)}__`;function Ww(){let{router:t}=lx("useSubmit"),{basename:s}=y.useContext(Un),o=mw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=Cw(d,s);if(u.navigate===!1){let _=u.fetcherKey||Jw();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 Xw(t,{relative:s}={}){let{basename:o}=y.useContext(Un),r=y.useContext(cs);Tt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...ml(t||".",{relative:s})},u=Wt();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:Is([o,d.pathname])),al(d)}function Qw(t,{relative:s}={}){let o=y.useContext(X_);Tt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lx("useViewTransitionState"),c=ml(t,{relative:s});if(!o.isTransitioning)return!1;let d=ua(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ua(o.nextLocation.pathname,r)||o.nextLocation.pathname;return il(c.pathname,u)!=null||il(c.pathname,d)!=null}function xt(){const t=wd();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function Mm(t){return`/sessions/${encodeURIComponent(t)}`}function wi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function ls(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Ri(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function cx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const zo="/environments",eC="/environments/new";function $o(t){return`/environments/${encodeURIComponent(t)}`}function tC(t){return`/environments/${encodeURIComponent(t)}/edit`}const ji="/settings",nC="/settings/credentials",np="/settings/personas",sC="/settings/personas/new";function dx(t){return`/settings/personas/${encodeURIComponent(t)}`}const sp="/settings/schedules",aC="/settings/schedules/new";function ux(t){return`/settings/schedules/${encodeURIComponent(t)}`}const iC="/settings/shortcuts",oC="/pair",rC="/chat",fx="/coordination",Fo="/",lC="/tasks",px="/workspaces/new",mx="/knowledge",cC=oN,dC={task:xN};function uC({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=xt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:p}=Ej(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[x,S]of Object.entries(cC))_[x]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(ls(_.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?a.jsxs("div",{className:bn.emptyCta,children:[a.jsx("button",{className:bn.ctaButton,onClick:()=>c(Ri(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:bn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):a.jsx("div",{className:bn.dagContainer,children:a.jsxs(D_,{nodes:u,edges:p,nodeTypes:dC,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(M_,{variant:R_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(I_,{showInteractive:!1}),a.jsx(O_,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const fC="_breadcrumbs_17or2_1",pC="_list_17or2_11",mC="_item_17or2_21",hC="_separator_17or2_28",gC="_link_17or2_34",vC="_current_17or2_57",No={breadcrumbs:fC,list:pC,item:mC,separator:hC,link:gC,current:vC};function ha({segments:t}){return a.jsx("nav",{className:No.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:a.jsx("ol",{className:No.list,children:t.map((s,o)=>{const r=o===t.length-1;return a.jsxs("li",{className:No.item,children:[o>0&&a.jsx("span",{className:No.separator,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),s.url&&!r?a.jsx(Am,{className:No.link,to:s.url,title:s.label,children:s.label}):a.jsx("span",{className:No.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const yC="_btn_dwk2o_1",bC="_sm_dwk2o_22",_C="_md_dwk2o_28",xC="_lg_dwk2o_34",kC="_primary_dwk2o_40",SC="_danger_dwk2o_55",jC="_outline_dwk2o_70",TC="_ghost_dwk2o_80",ap={btn:yC,sm:bC,md:_C,lg:xC,primary:kC,danger:SC,outline:jC,ghost:TC},sn=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const p=[ap.btn,ap[s],ap[o],r].filter(Boolean).join(" ");return a.jsx("button",{ref:u,className:p,...d,children:c})}),NC="_copyButton_1bqk0_1",wC={copyButton:NC},CC=2e3;function EC({text:t,className:s,"data-testid":o}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},CC)}catch{}},[t]);return a.jsx("button",{type:"button",className:`${wC.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?a.jsx(Ai,{size:Ht,"aria-hidden":"true"}):a.jsx(V_,{size:Ht,"aria-hidden":"true"})})}const AC="_banner_bxqlh_1",DC="_label_bxqlh_15",MC="_text_bxqlh_25",RC="_link_bxqlh_29",$c={banner:AC,label:DC,text:MC,link:RC};function IC(){return a.jsxs("div",{className:$c.banner,"data-testid":"demo-banner",children:[a.jsx("span",{className:$c.label,children:"DEMO"}),a.jsxs("span",{className:$c.text,children:["This is an interactive demo with mock data."," ",a.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:$c.link,children:"Install Grackle"})," ","to use it for real."]})]})}const OC="_container_og0yp_1",BC="_chevronButton_og0yp_6",LC="_mainButton_og0yp_6",zC="_sm_og0yp_34",$C="_md_og0yp_34",HC="_lg_og0yp_34",PC="_primary_og0yp_57",UC="_danger_og0yp_70",VC="_outline_og0yp_83",qC="_ghost_og0yp_92",GC="_dropdown_og0yp_100",FC="_option_og0yp_113",KC="_optionLabel_og0yp_130",ZC="_optionDesc_og0yp_135",aa={container:OC,chevronButton:BC,mainButton:LC,sm:zC,md:$C,lg:HC,primary:PC,danger:UC,outline:VC,ghost:qC,dropdown:GC,option:FC,optionLabel:KC,optionDesc:ZC};function hx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(x){m.current&&x.target instanceof Node&&!m.current.contains(x.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(x){x.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=aa[r]||"",v=aa[c]||"",b=()=>{u&&p(!1),s()};return a.jsxs("div",{ref:m,className:aa.container,"data-testid":d,children:[a.jsx("button",{type:"button",className:`${aa.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),a.jsx("button",{type:"button",className:`${aa.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:a.jsx(U_,{size:Ht,"aria-hidden":"true"})}),u&&a.jsx("div",{className:aa.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,x)=>a.jsxs("button",{type:"button",className:aa.option,onClick:()=>{_.onClick(),p(!1)},children:[a.jsx("span",{className:aa.optionLabel,children:_.label}),_.description&&a.jsx("span",{className:aa.optionDesc,children:_.description})]},x))})]})}function Kp(){Kp=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)),dd(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&&dd(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)},Kp.apply(this,arguments)}function dd(t,s){return dd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},dd(t,s)}function Dy(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 ip(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 Dy(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)?Dy(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 YC=(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){sj(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=ip(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 _,x;x=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Oc(r),x),d.properties.className=(d.properties.className||[]).concat("language-"+x)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;g=r}else g=r;g.children=(v=1,function E(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
279
  `),le=ip(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(D,"children")){var B=v;return D.children=E(D.children),O.push(D),D.position={start:{line:B,column:1},end:{line:v,column:1}},O}return O.push(D),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 D=R.exec(O)[1],$=nj(D);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),T=(function(E){var R=Kp(/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}"],M=function(){var E,R,O=S.value,D=O[0],$=O[1];$.properties.className=["code-line"];var Y=sj(g,function(V){return V.position.start.line<=D+1&&V.position.end.line>=D+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=[(D+T).toString()],$.properties.className.push("line-number")),j(D)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&Oc($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&Oc($).substring(0,1)==="+"&&$.properties.className.push("inserted")},A=ip(w.entries());!(S=A()).done;)M();w.length>0&&Oc(w[w.length-1]).trim()===""&&w.pop(),r.children=w}}}})(tj);function Ho(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 Rs(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 Dy=new Set(["grackle"]);function hl(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(Dy.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(Dy.has(o))return t.slice(s+1)}return t}const KC={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 ZC(t){const s=hl(t);return KC[s.toLowerCase()]??"generic"}const YC="_card_qkm9i_2",JC="_cardBlue_qkm9i_20",WC="_cardOrange_qkm9i_24",XC="_cardGreen_qkm9i_28",QC="_cardPurple_qkm9i_32",eE="_cardNeutral_qkm9i_36",tE="_cardRed_qkm9i_40",nE="_cardTeal_qkm9i_44",sE="_header_qkm9i_48",aE="_icon_qkm9i_55",iE="_toolName_qkm9i_64",oE="_fileName_qkm9i_71",rE="_badge_qkm9i_80",lE="_spacer_qkm9i_87",cE="_bodyToggle_qkm9i_91",dE="_chevron_qkm9i_109",uE="_chevronExpanded_qkm9i_115",fE="_pre_qkm9i_119",pE="_diffAdd_qkm9i_143",mE="_diffRemove_qkm9i_155",hE="_diffContext_qkm9i_167",gE="_diffHeader_qkm9i_176",vE="_diffLine_qkm9i_182",yE="_exitOk_qkm9i_188",bE="_exitError_qkm9i_194",_E="_exitPending_qkm9i_200",xE="_inProgress_qkm9i_228",kE="_metadata_qkm9i_232",SE="_metadataPrefix_qkm9i_239",L={card:YC,cardBlue:JC,cardOrange:WC,cardGreen:XC,cardPurple:QC,cardNeutral:eE,cardRed:tE,cardTeal:nE,header:sE,icon:aE,toolName:iE,fileName:oE,badge:rE,spacer:lE,bodyToggle:cE,chevron:dE,chevronExpanded:uE,pre:fE,diffAdd:pE,diffRemove:mE,diffContext:hE,diffHeader:gE,diffLine:vE,exitOk:yE,exitError:bE,exitPending:_E,inProgress:xE,metadata:kE,metadataPrefix:SE};function jE(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 TE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const op=5;function Ry({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=jE(s),m=TE(p),g=o===void 0,v=r?L.cardRed:c?L.cardGreen:L.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?a.jsx(Xj,{size:Ht}):a.jsx(eT,{size:Ht}),k=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
281
- `))??[],j=S.length>op,T=d?S:S.slice(0,op);return a.jsxs("div",{className:`${L.card} ${v} ${g?L.inProgress:""}`,"data-testid":k,children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:_}),a.jsx("span",{className:L.toolName,style:{color:b},children:t}),m&&a.jsx("span",{className:L.fileName,title:p,children:m}),!g&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,children:[S.length," lines"]})]})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:T.map((w,C)=>a.jsxs("span",{className:L.diffLine,children:[a.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),w]},C))}),j&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),d?"collapse":`${S.length-op} more lines`]})]})]})}function wE(t){const s=t.split(`
282
- `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function NE(t,s){const o=t.split(`
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],$=ij(M);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),T=(function(E){var R=Kp(/showLineNumbers=(\d+)/i,{lines:1});if(R.test(E)){var O=R.exec(E);return Number(O.groups.lines)}return 1})(m),N=(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=oj(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-"))&&Oc($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&Oc($).substring(0,1)==="+"&&$.properties.className.push("inserted")},A=ip(N.entries());!(S=A()).done;)D();N.length>0&&Oc(N[N.length-1]).trim()===""&&N.pop(),r.children=N}}}})(aj);function Ho(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 Rs(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 My=new Set(["grackle"]);function hl(t){if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(My.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(My.has(o))return t.slice(s+1)}return t}const JC={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 WC(t){const s=hl(t);return JC[s.toLowerCase()]??"generic"}const XC="_card_qkm9i_2",QC="_cardBlue_qkm9i_20",eE="_cardOrange_qkm9i_24",tE="_cardGreen_qkm9i_28",nE="_cardPurple_qkm9i_32",sE="_cardNeutral_qkm9i_36",aE="_cardRed_qkm9i_40",iE="_cardTeal_qkm9i_44",oE="_header_qkm9i_48",rE="_icon_qkm9i_55",lE="_toolName_qkm9i_64",cE="_fileName_qkm9i_71",dE="_badge_qkm9i_80",uE="_spacer_qkm9i_87",fE="_bodyToggle_qkm9i_91",pE="_chevron_qkm9i_109",mE="_chevronExpanded_qkm9i_115",hE="_pre_qkm9i_119",gE="_diffAdd_qkm9i_143",vE="_diffRemove_qkm9i_155",yE="_diffContext_qkm9i_167",bE="_diffHeader_qkm9i_176",_E="_diffLine_qkm9i_182",xE="_exitOk_qkm9i_188",kE="_exitError_qkm9i_194",SE="_exitPending_qkm9i_200",jE="_inProgress_qkm9i_228",TE="_metadata_qkm9i_232",NE="_metadataPrefix_qkm9i_239",L={card:XC,cardBlue:QC,cardOrange:eE,cardGreen:tE,cardPurple:nE,cardNeutral:sE,cardRed:aE,cardTeal:iE,header:oE,icon:rE,toolName:lE,fileName:cE,badge:dE,spacer:uE,bodyToggle:fE,chevron:pE,chevronExpanded:mE,pre:hE,diffAdd:gE,diffRemove:vE,diffContext:yE,diffHeader:bE,diffLine:_E,exitOk:xE,exitError:kE,exitPending:SE,inProgress:jE,metadata:TE,metadataPrefix:NE};function wE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function CE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const op=5;function Ry({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=wE(s),m=CE(p),g=o===void 0,v=r?L.cardRed:c?L.cardGreen:L.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?a.jsx(tT,{size:Ht}):a.jsx(sT,{size:Ht}),x=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
281
+ `))??[],j=S.length>op,T=d?S:S.slice(0,op);return a.jsxs("div",{className:`${L.card} ${v} ${g?L.inProgress:""}`,"data-testid":x,children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:_}),a.jsx("span",{className:L.toolName,style:{color:b},children:t}),m&&a.jsx("span",{className:L.fileName,title:p,children:m}),!g&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,children:[S.length," lines"]})]})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:T.map((N,C)=>a.jsxs("span",{className:L.diffLine,children:[a.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),N]},C))}),j&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),d?"collapse":`${S.length-op} more lines`]})]})]})}function EE(t){const s=t.split(`
282
+ `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function AE(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 CE(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 EE(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 AE(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 ME(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function DE(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=wE(r);if(c.length>0)return c}}const o=AE(t);if(o)return NE(o.oldStr,o.newStr)}const rp=5;function RE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=EE(s),m=ME(p),g=o===void 0,v=DE(s,c),b=v?CE(v):null,_=((v==null?void 0:v.length)??0)>rp,k=d?v:v==null?void 0:v.slice(0,rp);return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${g?L.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(LT,{size:Ht})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&a.jsx("span",{className:L.fileName,title:p,children:m}),b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-diff-stats",children:[a.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",a.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&k&&k.length>0&&a.jsxs(a.Fragment,{children:[a.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),a.jsx("span",{className:`${L.diffLine} ${T}`,children:S.content},j)})}),_&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),d?"collapse":`${((v==null?void 0:v.length)??0)-rp} more lines`]})]}),!r&&!v&&!g&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:o})]})}const IE=/^\[exit (\d+)\]\s*/;function OE(t){const s=IE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function BE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function LE(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 lp=3;function zE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=BE(s),p=LE(u),m=o===void 0,g=o?OE(o):null,v=(g==null?void 0:g.output.split(`
285
- `))??[],b=v.length>lp,_=c?v:v.slice(0,lp),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return a.jsxs("div",{className:`${L.card} ${S?L.cardRed:L.cardNeutral}`,"data-testid":"tool-card-shell",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),a.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&&a.jsxs("span",{className:k===0?L.exitOk:L.exitError,"data-testid":"tool-card-exit-code",children:[k===0?a.jsx(Ai,{size:Ye,"aria-hidden":"true"}):a.jsx(Ls,{size:Ye,"aria-hidden":"true"})," ","exit ",k]}),m&&a.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:a.jsx(xT,{size:Ye,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-output",children:_.join(`
286
- `)}),b&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${v.length-lp} more lines`]})]})]})}function $E(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 cp=5;function HE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=$E(s),m=o===void 0,g=(o==null?void 0:o.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 DE(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 ME(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 RE(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 IE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function OE(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=EE(r);if(c.length>0)return c}}const o=RE(t);if(o)return AE(o.oldStr,o.newStr)}const rp=5;function BE({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=ME(s),m=IE(p),g=o===void 0,v=OE(s,c),b=v?DE(v):null,_=((v==null?void 0:v.length)??0)>rp,x=d?v:v==null?void 0:v.slice(0,rp);return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${g?L.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(HT,{size:Ht})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&a.jsx("span",{className:L.fileName,title:p,children:m}),b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-diff-stats",children:[a.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",a.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&x&&x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-diff",children:x.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),a.jsx("span",{className:`${L.diffLine} ${T}`,children:S.content},j)})}),_&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${d?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),d?"collapse":`${((v==null?void 0:v.length)??0)-rp} more lines`]})]}),!r&&!v&&!g&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-content",children:o})]})}const LE=/^\[exit (\d+)\]\s*/;function zE(t){const s=LE.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function $E(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function HE(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 lp=3;function PE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=$E(s),p=HE(u),m=o===void 0,g=o?zE(o):null,v=(g==null?void 0:g.output.split(`
285
+ `))??[],b=v.length>lp,_=c?v:v.slice(0,lp),x=g==null?void 0:g.exitCode,S=r||x!==void 0&&x!==0;return a.jsxs("div",{className:`${L.card} ${S?L.cardRed:L.cardNeutral}`,"data-testid":"tool-card-shell",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),a.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}),x!==void 0&&a.jsxs("span",{className:x===0?L.exitOk:L.exitError,"data-testid":"tool-card-exit-code",children:[x===0?a.jsx(Ai,{size:Ye,"aria-hidden":"true"}):a.jsx(Ls,{size:Ye,"aria-hidden":"true"})," ","exit ",x]}),m&&a.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:a.jsx(jT,{size:Ye,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-output",children:_.join(`
286
+ `)}),b&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${v.length-lp} more lines`]})]})]})}function UE(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 cp=5;function VE({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=UE(s),m=o===void 0,g=(o==null?void 0:o.split(`
287
287
  `).filter(_=>_.length>0))??[],v=g.length>cp,b=c?g:g.slice(0,cp);return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-search",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(Up,{size:Ht})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&a.jsxs("span",{className:L.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-results",children:b.join(`
288
- `)}),v&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${g.length-cp} more matches`]})]})]})}const PE="_progressBar_14f5c_1",UE="_progressFill_14f5c_9",VE="_activeTask_14f5c_16",qE="_activeIcon_14f5c_27",GE="_todoPulse_14f5c_1",FE="_activeText_14f5c_34",KE="_checklist_14f5c_48",ZE="_item_14f5c_55",YE="_itemIcon_14f5c_65",JE="_itemText_14f5c_73",WE="_pending_14f5c_78",XE="_in_progress_14f5c_85",QE="_completed_14f5c_97",eA="_emptyMessage_14f5c_108",ms={progressBar:PE,progressFill:UE,activeTask:VE,activeIcon:qE,todoPulse:GE,activeText:FE,checklist:KE,item:ZE,itemIcon:YE,itemText:JE,pending:WE,in_progress:XE,completed:QE,emptyMessage:eA},tA=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function nA(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:Iy(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:Iy(o.status)})):typeof s.content=="string"?sA(s.content):[]}function Iy(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 sA(t){const s=t.split(`
289
- `),o=[];for(const r of s){const c=tA.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 aA(t){switch(t){case"completed":return a.jsx(Ai,{size:Ye});case"in_progress":return a.jsx(wi,{size:Ye,fill:"currentColor"});default:return a.jsx(wi,{size:Ye})}}function iA({args:t}){const s=nA(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return a.jsxs("div",{className:`${L.card} ${L.cardBlue}`,"data-testid":"tool-card-todo",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(vT,{size:Ht})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&a.jsx("div",{className:ms.progressBar,"data-testid":"tool-card-todo-bar",children:a.jsx("div",{className:ms.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&a.jsxs("div",{className:ms.activeTask,"data-testid":"tool-card-todo-active",children:[a.jsx("span",{className:ms.activeIcon,children:a.jsx(wi,{size:Ye,fill:"currentColor"})}),a.jsx("span",{className:ms.activeText,children:r.activeForm||r.content})]}),!c&&a.jsx("div",{className:ms.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>a.jsxs("div",{className:`${ms.item} ${ms[d.status]}`,"data-testid":"tool-card-todo-item",children:[a.jsx("span",{className:ms.itemIcon,children:aA(d.status)}),a.jsx("span",{className:ms.itemText,children:d.content})]},u))}),c&&a.jsx("div",{className:ms.emptyMessage,children:"All items completed and cleared."})]})}function oA(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 rA({tool:t,args:s}){const o=oA(t,s);return a.jsxs("div",{className:L.metadata,"data-testid":"tool-card-metadata",children:[a.jsx("span",{className:L.metadataPrefix,children:a.jsx(Jj,{size:Ye})}),o]})}function lA(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 cA(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 Oy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function dA(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 dp=5;function uA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=lA(s),m=o===void 0,{single:g,list:v,sessionId:b}=cA(o),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-task",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📋"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,style:{color:dA(k)},"data-testid":"tool-card-task-status",children:[Oy(k)," ",k]})]}),v&&!k&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&a.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&&a.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(`
288
+ `)}),v&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${g.length-cp} more matches`]})]})]})}const qE="_progressBar_14f5c_1",GE="_progressFill_14f5c_9",FE="_activeTask_14f5c_16",KE="_activeIcon_14f5c_27",ZE="_todoPulse_14f5c_1",YE="_activeText_14f5c_34",JE="_checklist_14f5c_48",WE="_item_14f5c_55",XE="_itemIcon_14f5c_65",QE="_itemText_14f5c_73",eA="_pending_14f5c_78",tA="_in_progress_14f5c_85",nA="_completed_14f5c_97",sA="_emptyMessage_14f5c_108",ms={progressBar:qE,progressFill:GE,activeTask:FE,activeIcon:KE,todoPulse:ZE,activeText:YE,checklist:JE,item:WE,itemIcon:XE,itemText:QE,pending:eA,in_progress:tA,completed:nA,emptyMessage:sA},aA=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function iA(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:Iy(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:Iy(o.status)})):typeof s.content=="string"?oA(s.content):[]}function Iy(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 oA(t){const s=t.split(`
289
+ `),o=[];for(const r of s){const c=aA.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 rA(t){switch(t){case"completed":return a.jsx(Ai,{size:Ye});case"in_progress":return a.jsx(Ni,{size:Ye,fill:"currentColor"});default:return a.jsx(Ni,{size:Ye})}}function lA({args:t}){const s=iA(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return a.jsxs("div",{className:`${L.card} ${L.cardBlue}`,"data-testid":"tool-card-todo",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(_T,{size:Ht})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&a.jsx("div",{className:ms.progressBar,"data-testid":"tool-card-todo-bar",children:a.jsx("div",{className:ms.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&a.jsxs("div",{className:ms.activeTask,"data-testid":"tool-card-todo-active",children:[a.jsx("span",{className:ms.activeIcon,children:a.jsx(Ni,{size:Ye,fill:"currentColor"})}),a.jsx("span",{className:ms.activeText,children:r.activeForm||r.content})]}),!c&&a.jsx("div",{className:ms.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>a.jsxs("div",{className:`${ms.item} ${ms[d.status]}`,"data-testid":"tool-card-todo-item",children:[a.jsx("span",{className:ms.itemIcon,children:rA(d.status)}),a.jsx("span",{className:ms.itemText,children:d.content})]},u))}),c&&a.jsx("div",{className:ms.emptyMessage,children:"All items completed and cleared."})]})}function cA(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 dA({tool:t,args:s}){const o=cA(t,s);return a.jsxs("div",{className:L.metadata,"data-testid":"tool-card-metadata",children:[a.jsx("span",{className:L.metadataPrefix,children:a.jsx(Qj,{size:Ye})}),o]})}function uA(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 fA(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 Oy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function pA(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 dp=5;function mA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=uA(s),m=o===void 0,{single:g,list:v,sessionId:b}=fA(o),_=(g==null?void 0:g.title)??p.title,x=(g==null?void 0:g.status)??p.status;return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-task",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📋"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,style:{color:pA(x)},"data-testid":"tool-card-task-status",children:[Oy(x)," ",x]})]}),v&&!x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&a.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&&a.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
290
  `)}),!r&&v&&v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,dp)).map(S=>{const j=Oy(S.status),T=S.title??S.id??"untitled";return`${j} ${T}`}).join(`
291
- `)}),v.length>dp&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-dp} more tasks`]})]})]})}function fA(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 pA(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 mA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=fA(s),m=o===void 0,g=pA(o),v=g.status??p.status,b=g.summary??p.summary;return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardGreen} ${m?L.inProgress:""}`,"data-testid":"tool-card-workpad",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📓"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsx("span",{className:L.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&a.jsx("pre",{className:L.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function hA(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 gA(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 up=5;function vA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=hA(s),m=o===void 0,g=gA(o);return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🧠"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,up)).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(`
291
+ `)}),v.length>dp&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-dp} more tasks`]})]})]})}function hA(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 gA(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 vA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=hA(s),m=o===void 0,g=gA(o),v=g.status??p.status,b=g.summary??p.summary;return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardGreen} ${m?L.inProgress:""}`,"data-testid":"tool-card-workpad",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"📓"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsx("span",{className:L.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&a.jsx("pre",{className:L.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!g.extra&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:o}),!r&&g.extra&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function yA(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 bA(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 up=5;function _A({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=yA(s),m=o===void 0,g=bA(o);return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardPurple} ${m?L.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🧠"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.results&&g.results.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,up)).map(v=>{var x,S,j;const b=((x=v.node)==null?void 0:x.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>up&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-up} more results`]})]}),!r&&g.node&&!g.results&&a.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 yA(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 bA(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 _A({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=yA(s),m=o===void 0,g=bA(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 a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${m?L.inProgress:""}`,"data-testid":"tool-card-ipc",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔀"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&a.jsx("span",{className:L.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
294
- `)}),g.fds.length>5&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function xA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const fp=8;function kA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=xA(t),u=s===void 0,p=(s==null?void 0:s.split(`
293
+ `)})]})}function xA(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 kA(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 SA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=hl(t),p=xA(s),m=o===void 0,g=kA(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 a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardOrange} ${m?L.inProgress:""}`,"data-testid":"tool-card-ipc",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔀"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&a.jsx("span",{className:L.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&g.sessionId&&a.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&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const x=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&x.push(_.streamName),_.owned&&x.push("(owned)"),x.filter(Boolean).join(" ")}).join(`
294
+ `)}),g.fds.length>5&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function jA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const fp=8;function TA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=jA(t),u=s===void 0,p=(s==null?void 0:s.split(`
295
295
  `))??[],m=p.length>fp,g=r?s:p.slice(0,fp).join(`
296
- `);return a.jsxs("div",{className:`${L.card} ${o?L.cardRed:L.cardNeutral} ${u?L.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔧"}),a.jsx("span",{className:L.toolName,children:"ToolSearch"}),d&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${r?L.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-fp} more lines`]})]})]})}function SA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function jA(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 pp=5;function TA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=SA(t),p=jA(s),m=o===void 0,g=(o==null?void 0:o.split(`
296
+ `);return a.jsxs("div",{className:`${L.card} ${o?L.cardRed:L.cardNeutral} ${u?L.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,"aria-hidden":"true",children:"🔧"}),a.jsx("span",{className:L.toolName,children:"ToolSearch"}),d&&a.jsxs("span",{className:L.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:L.spacer}),a.jsxs("span",{className:L.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${r?L.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-fp} more lines`]})]})]})}function NA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function wA(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 pp=5;function CA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=NA(t),p=wA(s),m=o===void 0,g=(o==null?void 0:o.split(`
297
297
  `))??[],v=g.length>pp,b=c?o:g.slice(0,pp).join(`
298
- `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-generic",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(Fj,{size:Ht,"aria-hidden":"true"})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&a.jsx("span",{className:L.fileName,children:p})]}),m&&_&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:_}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:b}),v&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${g.length-pp} more lines`]})]})]})}const wA="_badgePill_o7eqc_1",NA="_modelBadge_o7eqc_14",CA="_backgroundBadge_o7eqc_26",EA="_backgroundDot_o7eqc_36",AA="_backgroundDotPulsing_o7eqc_41",MA="_description_o7eqc_55",DA="_statusLine_o7eqc_62",RA="_statusCompleted_o7eqc_72",IA="_statusRunning_o7eqc_77",OA="_statusError_o7eqc_83",BA="_promptToggle_o7eqc_88",hs={badgePill:wA,modelBadge:NA,backgroundBadge:CA,backgroundDot:EA,backgroundDotPulsing:AA,description:MA,statusLine:DA,statusCompleted:RA,statusRunning:IA,statusError:OA,promptToggle:BA};function LA(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 zA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function $A(t){const s=zA.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 mp=5;function HA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=LA(t,s),g=o===void 0,v=m.isPoll&&o?$A(o):void 0,b=(v==null?void 0:v.content)??o,_=(b==null?void 0:b.split(`
299
- `))??[],k=_.length>mp,S=c?b:_.slice(0,mp).join(`
300
- `),j=m.isPoll?"Subagent":"Agent";return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardTeal} ${g?L.inProgress:""}`,"data-testid":"tool-card-agent",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&a.jsx("span",{className:hs.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&a.jsx("span",{className:hs.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&a.jsxs("span",{className:hs.backgroundBadge,"data-testid":"tool-card-agent-background",children:[a.jsx("span",{className:g?hs.backgroundDotPulsing:hs.backgroundDot,children:"●"}),"BG"]}),m.agentName&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),a.jsx("span",{className:L.spacer}),g&&!m.isBackground&&a.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&a.jsx("div",{className:hs.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&a.jsxs("div",{className:hs.statusLine,"data-testid":"tool-card-agent-status",children:[a.jsx("span",{className:v.status==="completed"?hs.statusCompleted:v.status==="running"?hs.statusRunning:hs.statusError,children:v.status}),v.metadata&&a.jsx("span",{children:v.metadata})]}),m.prompt&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:hs.promptToggle,onClick:()=>{p(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[a.jsx("span",{className:`${L.chevron} ${u?L.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:S}),k&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-mp} more lines`]})]})]})}function hp(t){switch(ZC(t.tool)){case"file-read":return a.jsx(Ry,{...t});case"file-edit":return a.jsx(RE,{...t});case"file-write":return a.jsx(Ry,{...t,writeVariant:!0});case"shell":return a.jsx(zE,{...t});case"search":return a.jsx(HE,{...t});case"todo":return a.jsx(iA,{...t});case"metadata":return a.jsx(rA,{...t});case"task":return a.jsx(uA,{...t});case"workpad":return a.jsx(mA,{...t});case"knowledge":return a.jsx(vA,{...t});case"ipc":return a.jsx(_A,{...t});case"tool-search":return a.jsx(kA,{...t});case"agent":return a.jsx(HA,{...t});default:return a.jsx(TA,{...t})}}const PA="_systemContextEvent_1kdcc_1",UA="_systemContextHeader_1kdcc_7",VA="_systemContextBadge_1kdcc_28",qA="_systemContextToggle_1kdcc_37",GA="_systemContextPre_1kdcc_43",FA="_systemContextEllipsis_1kdcc_54",KA="_systemEvent_1kdcc_58",ZA="_systemTimestamp_1kdcc_65",YA="_textEvent_1kdcc_69",JA="_codeBlockWrapper_1kdcc_156",WA="_codeBlockCopyButton_1kdcc_159",XA="_errorEvent_1kdcc_163",QA="_statusEvent_1kdcc_171",eM="_userInputEvent_1kdcc_180",tM="_userInputContent_1kdcc_186",nM="_signalEvent_1kdcc_293",sM="_signalBadge_1kdcc_304",aM="_signalContent_1kdcc_313",iM="_usageEvent_1kdcc_318",oM="_usageBadge_1kdcc_325",rM="_defaultEvent_1kdcc_334",$t={systemContextEvent:PA,systemContextHeader:UA,systemContextBadge:VA,systemContextToggle:qA,systemContextPre:GA,systemContextEllipsis:FA,systemEvent:KA,systemTimestamp:ZA,textEvent:YA,codeBlockWrapper:JA,codeBlockCopyButton:WA,errorEvent:XA,statusEvent:QA,userInputEvent:eM,userInputContent:tM,signalEvent:nM,signalBadge:sM,signalContent:aM,usageEvent:iM,usageBadge:oM,defaultEvent:rM},By=y.lazy(()=>$_(()=>import("./McpAppWidget-BRXtLl5r.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.McpAppWidget}))),Ly=3;function lM({content:t}){const[s,o]=y.useState(!1),r=t.split(`
298
+ `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardBlue} ${m?L.inProgress:""}`,"data-testid":"tool-card-generic",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,children:a.jsx(Yj,{size:Ht,"aria-hidden":"true"})}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&a.jsx("span",{className:L.fileName,children:p})]}),m&&_&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-args",children:_}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:b}),v&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),c?"collapse":`${g.length-pp} more lines`]})]})]})}const EA="_badgePill_o7eqc_1",AA="_modelBadge_o7eqc_14",DA="_backgroundBadge_o7eqc_26",MA="_backgroundDot_o7eqc_36",RA="_backgroundDotPulsing_o7eqc_41",IA="_description_o7eqc_55",OA="_statusLine_o7eqc_62",BA="_statusCompleted_o7eqc_72",LA="_statusRunning_o7eqc_77",zA="_statusError_o7eqc_83",$A="_promptToggle_o7eqc_88",hs={badgePill:EA,modelBadge:AA,backgroundBadge:DA,backgroundDot:MA,backgroundDotPulsing:RA,description:IA,statusLine:OA,statusCompleted:BA,statusRunning:LA,statusError:zA,promptToggle:$A};function HA(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 PA=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function UA(t){const s=PA.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 mp=5;function VA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=HA(t,s),g=o===void 0,v=m.isPoll&&o?UA(o):void 0,b=(v==null?void 0:v.content)??o,_=(b==null?void 0:b.split(`
299
+ `))??[],x=_.length>mp,S=c?b:_.slice(0,mp).join(`
300
+ `),j=m.isPoll?"Subagent":"Agent";return a.jsxs("div",{className:`${L.card} ${r?L.cardRed:L.cardTeal} ${g?L.inProgress:""}`,"data-testid":"tool-card-agent",children:[a.jsxs("div",{className:L.header,children:[a.jsx("span",{className:L.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),a.jsx("span",{className:L.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&a.jsx("span",{className:hs.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&a.jsx("span",{className:hs.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&a.jsxs("span",{className:hs.backgroundBadge,"data-testid":"tool-card-agent-background",children:[a.jsx("span",{className:g?hs.backgroundDotPulsing:hs.backgroundDot,children:"●"}),"BG"]}),m.agentName&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&a.jsx("span",{className:L.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),a.jsx("span",{className:L.spacer}),g&&!m.isBackground&&a.jsx("span",{className:L.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&a.jsx("div",{className:hs.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&a.jsxs("div",{className:hs.statusLine,"data-testid":"tool-card-agent-status",children:[a.jsx("span",{className:v.status==="completed"?hs.statusCompleted:v.status==="running"?hs.statusRunning:hs.statusError,children:v.status}),v.metadata&&a.jsx("span",{children:v.metadata})]}),m.prompt&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:hs.promptToggle,onClick:()=>{p(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[a.jsx("span",{className:`${L.chevron} ${u?L.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&o&&a.jsx("pre",{className:L.pre,"data-testid":"tool-card-error",children:o}),!r&&!g&&b&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:L.pre,"data-testid":"tool-card-result",children:S}),x&&a.jsxs("button",{type:"button",className:L.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${L.chevron} ${c?L.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-mp} more lines`]})]})]})}function hp(t){switch(WC(t.tool)){case"file-read":return a.jsx(Ry,{...t});case"file-edit":return a.jsx(BE,{...t});case"file-write":return a.jsx(Ry,{...t,writeVariant:!0});case"shell":return a.jsx(PE,{...t});case"search":return a.jsx(VE,{...t});case"todo":return a.jsx(lA,{...t});case"metadata":return a.jsx(dA,{...t});case"task":return a.jsx(mA,{...t});case"workpad":return a.jsx(vA,{...t});case"knowledge":return a.jsx(_A,{...t});case"ipc":return a.jsx(SA,{...t});case"tool-search":return a.jsx(TA,{...t});case"agent":return a.jsx(VA,{...t});default:return a.jsx(CA,{...t})}}const qA="_systemContextEvent_1kdcc_1",GA="_systemContextHeader_1kdcc_7",FA="_systemContextBadge_1kdcc_28",KA="_systemContextToggle_1kdcc_37",ZA="_systemContextPre_1kdcc_43",YA="_systemContextEllipsis_1kdcc_54",JA="_systemEvent_1kdcc_58",WA="_systemTimestamp_1kdcc_65",XA="_textEvent_1kdcc_69",QA="_codeBlockWrapper_1kdcc_156",eD="_codeBlockCopyButton_1kdcc_159",tD="_errorEvent_1kdcc_163",nD="_statusEvent_1kdcc_171",sD="_userInputEvent_1kdcc_180",aD="_userInputContent_1kdcc_186",iD="_signalEvent_1kdcc_293",oD="_signalBadge_1kdcc_304",rD="_signalContent_1kdcc_313",lD="_usageEvent_1kdcc_318",cD="_usageBadge_1kdcc_325",dD="_defaultEvent_1kdcc_334",$t={systemContextEvent:qA,systemContextHeader:GA,systemContextBadge:FA,systemContextToggle:KA,systemContextPre:ZA,systemContextEllipsis:YA,systemEvent:JA,systemTimestamp:WA,textEvent:XA,codeBlockWrapper:QA,codeBlockCopyButton:eD,errorEvent:tD,statusEvent:nD,userInputEvent:sD,userInputContent:aD,signalEvent:iD,signalBadge:oD,signalContent:rD,usageEvent:lD,usageBadge:cD,defaultEvent:dD},By=y.lazy(()=>H_(()=>import("./McpAppWidget-BTQyEJAZ.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.McpAppWidget}))),Ly=3;function uD({content:t}){const[s,o]=y.useState(!1),r=t.split(`
301
301
  `),c=r.length>Ly,d=s?t:r.slice(0,Ly).join(`
302
- `);return a.jsxs("div",{className:$t.systemContextEvent,"data-testid":"system-context-event",children:[a.jsxs("button",{type:"button",className:$t.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[a.jsx("span",{className:$t.systemContextBadge,children:"SYSTEM PROMPT"}),c&&a.jsx("span",{className:$t.systemContextToggle,"aria-hidden":"true",children:s?a.jsx(P_,{size:Ye}):a.jsx(pa,{size:Ye})})]}),a.jsxs("pre",{className:$t.systemContextPre,children:[d,!s&&c&&a.jsx("span",{className:$t.systemContextEllipsis,children:"…"})]})]})}function cM({time:t,content:s}){return a.jsxs("div",{className:$t.systemEvent,children:[a.jsxs("span",{className:$t.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Zp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Zp).join(""):t!=null&&typeof t=="object"&&"props"in t?Zp(t.props.children):""}function dM({children:t,node:s,...o}){const r=Zp(t);return a.jsxs("div",{className:$t.codeBlockWrapper,children:[a.jsx("pre",{...o,children:t}),a.jsx(wC,{text:r,"data-testid":"copy-code-block",className:$t.codeBlockCopyButton})]})}const uM={pre:dM};function hx({content:t}){return a.jsx(_m,{remarkPlugins:[xm],rehypePlugins:[FC],components:uM,children:t})}function fM({content:t}){return a.jsx("div",{className:$t.textEvent,children:a.jsx(hx,{content:t})})}function pM({content:t}){return a.jsxs("div",{className:$t.errorEvent,children:["Error: ",t]})}function mM({content:t}){return a.jsxs("div",{className:$t.statusEvent,children:["--- ",t," ---"]})}function hM({content:t}){return a.jsx("div",{className:$t.userInputEvent,children:a.jsx("div",{className:$t.userInputContent,"data-testid":"user-input-content",children:a.jsx(hx,{content:t})})})}function gM({content:t}){return a.jsxs("div",{className:$t.signalEvent,"data-testid":"signal-event",children:[a.jsx("span",{className:$t.signalBadge,children:"SIGNAL"}),a.jsx("span",{className:$t.signalContent,children:t})]})}function vM({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Ho(r+c),u=Rs(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return a.jsx("div",{className:$t.usageEvent,"data-testid":"usage-event",children:a.jsx("span",{className:$t.usageBadge,children:s})})}function Hr({content:t}){return a.jsx("div",{className:$t.defaultEvent,children:t})}function yM({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return a.jsx(Hr,{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 a.jsx(y.Suspense,{fallback:a.jsx(Hr,{content:"Loading widget..."}),children:a.jsx(By,{widgetHtml:m,sandboxProxyUrl:r,csp:d.csp,toolInput:{source:d.html,props:d.toolInput??{}}})})}return u!=="mcp-app-html"||!d.html?a.jsx(Hr,{content:t.content}):a.jsx(y.Suspense,{fallback:a.jsx(Hr,{content:"Loading widget..."}),children:a.jsx(By,{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 a.jsx(lM,{content:t.content})}catch{}return a.jsx(cM,{time:c,content:t.content})}case"text":case"output":return a.jsx(fM,{content:t.content});case"tool_use":{let d="",u={};try{const p=JSON.parse(t.content);d=p.tool||"",u=p.args}catch{}return a.jsx(hp,{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?a.jsx(hp,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult}):a.jsx(hp,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return a.jsx(pM,{content:t.content});case"status":return a.jsx(mM,{content:t.content});case"user_input":return a.jsx(hM,{content:t.content});case"signal":return a.jsx(gM,{content:t.content});case"usage":return a.jsx(vM,{content:t.content});default:return a.jsx(Hr,{content:t.content})}}const Rm=y.createContext({});function Im(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const Ed=y.createContext(null),Om=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class bM 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 _M({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(Om);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 a.jsxs("div",{className:$t.systemContextEvent,"data-testid":"system-context-event",children:[a.jsxs("button",{type:"button",className:$t.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[a.jsx("span",{className:$t.systemContextBadge,children:"SYSTEM PROMPT"}),c&&a.jsx("span",{className:$t.systemContextToggle,"aria-hidden":"true",children:s?a.jsx(U_,{size:Ye}):a.jsx(pa,{size:Ye})})]}),a.jsxs("pre",{className:$t.systemContextPre,children:[d,!s&&c&&a.jsx("span",{className:$t.systemContextEllipsis,children:"…"})]})]})}function fD({time:t,content:s}){return a.jsxs("div",{className:$t.systemEvent,children:[a.jsxs("span",{className:$t.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Zp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Zp).join(""):t!=null&&typeof t=="object"&&"props"in t?Zp(t.props.children):""}function pD({children:t,node:s,...o}){const r=Zp(t);return a.jsxs("div",{className:$t.codeBlockWrapper,children:[a.jsx("pre",{...o,children:t}),a.jsx(EC,{text:r,"data-testid":"copy-code-block",className:$t.codeBlockCopyButton})]})}const mD={pre:pD};function gx({content:t}){return a.jsx(_m,{remarkPlugins:[xm],rehypePlugins:[YC],components:mD,children:t})}function hD({content:t}){return a.jsx("div",{className:$t.textEvent,children:a.jsx(gx,{content:t})})}function gD({content:t}){return a.jsxs("div",{className:$t.errorEvent,children:["Error: ",t]})}function vD({content:t}){return a.jsxs("div",{className:$t.statusEvent,children:["--- ",t," ---"]})}function yD({content:t}){return a.jsx("div",{className:$t.userInputEvent,children:a.jsx("div",{className:$t.userInputContent,"data-testid":"user-input-content",children:a.jsx(gx,{content:t})})})}function bD({content:t}){return a.jsxs("div",{className:$t.signalEvent,"data-testid":"signal-event",children:[a.jsx("span",{className:$t.signalBadge,children:"SIGNAL"}),a.jsx("span",{className:$t.signalContent,children:t})]})}function _D({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Ho(r+c),u=Rs(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return a.jsx("div",{className:$t.usageEvent,"data-testid":"usage-event",children:a.jsx("span",{className:$t.usageBadge,children:s})})}function Hr({content:t}){return a.jsx("div",{className:$t.defaultEvent,children:t})}function xD({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return a.jsx(Hr,{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 a.jsx(y.Suspense,{fallback:a.jsx(Hr,{content:"Loading widget..."}),children:a.jsx(By,{widgetHtml:m,sandboxProxyUrl:r,csp:d.csp,toolInput:{source:d.html,props:d.toolInput??{}}})})}return u!=="mcp-app-html"||!d.html?a.jsx(Hr,{content:t.content}):a.jsx(y.Suspense,{fallback:a.jsx(Hr,{content:"Loading widget..."}),children:a.jsx(By,{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 a.jsx(uD,{content:t.content})}catch{}return a.jsx(fD,{time:c,content:t.content})}case"text":case"output":return a.jsx(hD,{content:t.content});case"tool_use":{let d="",u={};try{const p=JSON.parse(t.content);d=p.tool||"",u=p.args}catch{}return a.jsx(hp,{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?a.jsx(hp,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult}):a.jsx(hp,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return a.jsx(gD,{content:t.content});case"status":return a.jsx(vD,{content:t.content});case"user_input":return a.jsx(yD,{content:t.content});case"signal":return a.jsx(bD,{content:t.content});case"usage":return a.jsx(_D,{content:t.content});default:return a.jsx(Hr,{content:t.content})}}const Rm=y.createContext({});function Im(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const Ed=y.createContext(null),Om=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class kD 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 SD({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(Om);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]),a.jsx(bM,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const xM=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Im(kM),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=a.jsx(_M,{isPresent:o,children:t})),a.jsx(Ed.Provider,{value:v,children:t})};function kM(){return new Map}function gx(t=!0){const s=y.useContext(Ed);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 Hc=t=>t.key||"";function zy(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Bm=typeof window<"u",vx=Bm?y.useLayoutEffect:y.useEffect,os=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=gx(u),g=y.useMemo(()=>zy(t),[t]),v=u&&!p?[]:g.map(Hc),b=y.useRef(!0),_=y.useRef(g),k=Im(()=>new Map),[S,j]=y.useState(g),[T,w]=y.useState(g);vx(()=>{b.current=!1,_.current=g;for(let A=0;A<T.length;A++){const E=Hc(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=Hc(R);v.includes(O)||(A.splice(E,0,R),C.push(R))}d==="wait"&&C.length&&(A=C),w(zy(A)),j(g);return}const{forceRender:M}=y.useContext(Rm);return a.jsx(a.Fragment,{children:T.map(A=>{const E=Hc(A),R=u&&!p?!1:g===T||v.includes(E),O=()=>{if(k.has(E))k.set(E,!0);else return;let D=!0;k.forEach($=>{$||(D=!1)}),D&&(M==null||M(),w(_.current),u&&(m==null||m()),r&&r())};return a.jsx(xM,{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)})})},Hn=t=>t;let yx=Hn;const SM={useManualTiming:!1};function jM(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 Pc=["read","resolveKeyframes","update","preRender","render","postRender"],TM=40;function bx(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Pc.reduce((w,C)=>(w[C]=jM(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,TM),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:Pc.reduce((w,C)=>{const M=u[C];return w[C]=(A,E=!1,R=!1)=>(o||S(),M.schedule(A,E,R)),w},{}),cancel:w=>{for(let C=0;C<Pc.length;C++)u[Pc[C]].cancel(w)},state:c,steps:u}}const{schedule:wt,cancel:Ja,state:fn,steps:gp}=bx(typeof requestAnimationFrame<"u"?requestAnimationFrame:Hn,!0),_x=y.createContext({strict:!1}),$y={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"]},Po={};for(const t in $y)Po[t]={isEnabled:s=>$y[t].some(o=>!!s[o])};function wM(t){for(const s in t)Po[s]={...Po[s],...t[s]}}const NM=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 ud(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||NM.has(t)}let xx=t=>!ud(t);function CM(t){t&&(xx=s=>s.startsWith("on")?!ud(s):t(s))}try{CM(require("@emotion/is-prop-valid").default)}catch{}function EM(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(xx(c)||o===!0&&ud(c)||!s&&!ud(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function AM(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 Ad=y.createContext({});function ol(t){return typeof t=="string"||Array.isArray(t)}function Md(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Lm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zm=["initial",...Lm];function Dd(t){return Md(t.animate)||zm.some(s=>ol(t[s]))}function kx(t){return!!(Dd(t)||t.variants)}function MM(t,s){if(Dd(t)){const{initial:o,animate:r}=t;return{initial:o===!1||ol(o)?o:void 0,animate:ol(r)?r:void 0}}return t.inherit!==!1?s:{}}function DM(t){const{initial:s,animate:o}=MM(t,y.useContext(Ad));return y.useMemo(()=>({initial:s,animate:o}),[Hy(s),Hy(o)])}function Hy(t){return Array.isArray(t)?t.join(" "):t}const RM=Symbol.for("motionComponentSymbol");function Mo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function IM(t,s,o){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):Mo(o)&&(o.current=r))},[s])}const $m=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),OM="framerAppearId",Sx="data-"+$m(OM),{schedule:Hm}=bx(queueMicrotask,!1),jx=y.createContext({});function BM(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Ad),m=y.useContext(_x),g=y.useContext(Ed),v=y.useContext(Om).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(jx);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&LM(b.current,o,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,g)});const j=o[Sx],T=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return vx(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Hm.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 LM(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:Tx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Mo(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function Tx(t){if(t)return t.options.allowProjection!==!1?t.projection:Tx(t.parent)}function zM({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&wM(t);function p(g,v){let b;const _={...y.useContext(Om),...g,layoutId:$M(g)},{isStatic:k}=_,S=DM(g),j=r(g,k);if(!k&&Bm){HM();const T=PM(_);b=T.MeasureLayout,S.visualElement=BM(c,j,_,s,T.ProjectionNode)}return a.jsxs(Ad.Provider,{value:S,children:[b&&S.visualElement?a.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,g,IM(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[RM]=c,m}function $M({layoutId:t}){const s=y.useContext(Rm).id;return s&&t!==void 0?s+"-"+t:t}function HM(t,s){y.useContext(_x).strict}function PM(t){const{drag:s,layout:o}=Po;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 UM=["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 Pm(t){return typeof t!="string"||t.includes("-")?!1:!!(UM.indexOf(t)>-1||/[A-Z]/u.test(t))}function Py(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Um(t,s,o,r){if(typeof s=="function"){const[c,d]=Py(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]=Py(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Yp=t=>Array.isArray(t),VM=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),qM=t=>Yp(t)?t[t.length-1]||0:t,gn=t=>!!(t&&t.getVelocity);function nd(t){const s=gn(t)?t.get():t;return VM(s)?s.toValue():s}function GM({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:FM(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const wx=t=>(s,o)=>{const r=y.useContext(Ad),c=y.useContext(Ed),d=()=>GM(t,s,r,c);return o?d():Im(d)};function FM(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=nd(d[_]);let{initial:u,animate:p}=t;const m=Dd(t),g=kx(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"&&!Md(b)){const _=Array.isArray(b)?b:[b];for(let k=0;k<_.length;k++){const S=Um(t,_[k]);if(S){const{transitionEnd:j,transition:T,...w}=S;for(const C in w){let M=w[C];if(Array.isArray(M)){const A=v?M.length-1:0;M=M[A]}M!==null&&(c[C]=M)}for(const C in j)c[C]=j[C]}}}return c}const Ko=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ii=new Set(Ko),Nx=t=>s=>typeof s=="string"&&s.startsWith(t),Cx=Nx("--"),KM=Nx("var(--"),Vm=t=>KM(t)?ZM.test(t.split("/*")[0].trim()):!1,ZM=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ex=(t,s)=>s&&typeof t=="number"?s.transform(t):t,fa=(t,s,o)=>o>s?s:o<t?t:o,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},rl={...Zo,transform:t=>fa(0,1,t)},Uc={...Zo,default:1},gl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ka=gl("deg"),Os=gl("%"),Ae=gl("px"),YM=gl("vh"),JM=gl("vw"),Uy={...Os,parse:t=>Os.parse(t)/100,transform:t=>Os.transform(t*100)},WM={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},XM={rotate:Ka,rotateX:Ka,rotateY:Ka,rotateZ:Ka,scale:Uc,scaleX:Uc,scaleY:Uc,scaleZ:Uc,skew:Ka,skewX:Ka,skewY:Ka,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:rl,originX:Uy,originY:Uy,originZ:Ae},Vy={...Zo,transform:Math.round},qm={...WM,...XM,zIndex:Vy,size:Ae,fillOpacity:rl,strokeOpacity:rl,numOctaves:Vy},QM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},eD=Ko.length;function tD(t,s,o){let r="",c=!0;for(let d=0;d<eD;d++){const u=Ko[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=Ex(p,qm[u]);if(!m){c=!1;const v=QM[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Gm(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(Ii.has(m)){u=!0;continue}else if(Cx(m)){c[m]=g;continue}else{const v=Ex(g,qm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=tD(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 nD={offset:"stroke-dashoffset",array:"stroke-dasharray"},sD={offset:"strokeDashoffset",array:"strokeDasharray"};function aD(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?nD:sD;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function qy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function iD(t,s,o){const r=qy(s,t.x,t.width),c=qy(o,t.y,t.height);return`${r} ${c}`}function Fm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Gm(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=iD(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&&aD(_,u,p,m,!1)}const Km=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Ax=()=>({...Km(),attrs:{}}),Zm=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 Dx=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 Rx(t,s,o,r){Mx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Dx.has(c)?c:$m(c),s.attrs[c])}const fd={};function oD(t){Object.assign(fd,t)}function Ix(t,{layout:s,layoutId:o}){return Ii.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!fd[t]||t==="opacity")}function Ym(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(gn(c[u])||s.style&&gn(s.style[u])||Ix(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 Ox(t,s,o){const r=Ym(t,s,o);for(const c in t)if(gn(t[c])||gn(s[c])){const d=Ko.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function rD(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 Gy=["x","y","width","height","cx","cy","r"],lD={useVisualState:wx({scrapeMotionValuesFromProps:Ox,createRenderState:Ax,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(Ii.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Gy.length;p++){const m=Gy[p];t[m]!==s[m]&&(u=!0)}u&&wt.read(()=>{rD(o,r),wt.render(()=>{Fm(r,c,Zm(o.tagName),t.transformTemplate),Rx(o,r)})})}})},cD={useVisualState:wx({scrapeMotionValuesFromProps:Ym,createRenderState:Km})};function Bx(t,s,o){for(const r in s)!gn(s[r])&&!Ix(r,o)&&(t[r]=s[r])}function dD({transformTemplate:t},s){return y.useMemo(()=>{const o=Km();return Gm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function uD(t,s){const o=t.style||{},r={};return Bx(r,o,t),Object.assign(r,dD(t,s)),r}function fD(t,s){const o={},r=uD(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 pD(t,s,o,r){const c=y.useMemo(()=>{const d=Ax();return Fm(d,s,Zm(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 mD(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Pm(o)?pD:fD)(r,d,u,o),g=EM(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 hD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Pm(r)?lD:cD,preloadedFeatures:t,useRender:mD(c),createVisualElement:s,Component:r};return zM(u)}}function Lx(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 Rd(t,s,o){const r=t.getProps();return Um(r,s,o!==void 0?o:r.custom,t)}function Jm(t,s){return t?t[s]||t.default||t:void 0}const zx=new Set(["width","height","top","left","right","bottom",...Ko]);let sd;function gD(){sd=void 0}const Bs={now:()=>(sd===void 0&&Bs.set(fn.isProcessing||SM.useManualTiming?fn.timestamp:performance.now()),sd),set:t=>{sd=t,queueMicrotask(gD)}};function Wm(t,s){t.indexOf(s)===-1&&t.push(s)}function Xm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Qm{constructor(){this.subscriptions=[]}add(s){return Wm(this.subscriptions,s),()=>Xm(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 $x(t,s){return s?t*(1e3/s):0}const Fy=30,vD=t=>!isNaN(parseFloat(t));class yD{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Bs.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Bs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=vD(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(),wt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Bs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Fy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Fy);return $x(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 ll(t,s){return new yD(t,s)}function bD(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,ll(o))}function _D(t,s){const o=Rd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=qM(d[u]);bD(t,u,p)}}function xD(t){return!!(gn(t)&&t.add)}function Jp(t,s){const o=t.getValue("willChange");if(xD(o))return o.add(s)}function Hx(t){return t.props[Sx]}function eh(t){let s;return()=>(s===void 0&&(s=t()),s)}const kD=eh(()=>window.ScrollTimeline!==void 0);class SD{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(kD()&&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 jD extends SD{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const la=t=>t*1e3,ca=t=>t/1e3;function th(t){return typeof t=="function"}function Ky(t,s){t.timeline=s,t.onfinish=null}const nh=t=>Array.isArray(t)&&typeof t[0]=="number",TD={linearEasing:void 0};function wD(t,s){const o=eh(t);return()=>{var r;return(r=TD[s])!==null&&r!==void 0?r:o()}}const pd=wD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Uo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},Px=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Uo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function Ux(t){return!!(typeof t=="function"&&pd()||!t||typeof t=="string"&&(t in Wp||pd())||nh(t)||Array.isArray(t)&&t.every(Ux))}const Kr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Wp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kr([0,.65,.55,1]),circOut:Kr([.55,0,1,.45]),backIn:Kr([.31,.01,.66,-.59]),backOut:Kr([.33,1.53,.69,.99])};function Vx(t,s){if(t)return typeof t=="function"&&pd()?Px(t,s):nh(t)?Kr(t):Array.isArray(t)?t.map(o=>Vx(o,s)||Wp.easeOut):Wp[t]}const qx=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,ND=1e-7,CD=12;function ED(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=qx(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>ND&&++p<CD);return u}function vl(t,s,o,r){if(t===s&&o===r)return Hn;const c=d=>ED(d,0,1,t,o);return d=>d===0||d===1?d:qx(c(d),s,r)}const Gx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,Fx=t=>s=>1-t(1-s),Kx=vl(.33,1.53,.69,.99),sh=Fx(Kx),Zx=Gx(sh),Yx=t=>(t*=2)<1?.5*sh(t):.5*(2-Math.pow(2,-10*(t-1))),ah=t=>1-Math.sin(Math.acos(t)),Jx=Fx(ah),Wx=Gx(ah),Xx=t=>/^0[^.\s]+$/u.test(t);function AD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Xx(t):!0}const Xr=t=>Math.round(t*1e5)/1e5,ih=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function MD(t){return t==null}const DD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,oh=(t,s)=>o=>!!(typeof o=="string"&&DD.test(o)&&o.startsWith(t)||s&&!MD(o)&&Object.prototype.hasOwnProperty.call(o,s)),Qx=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(ih);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},RD=t=>fa(0,255,t),vp={...Zo,transform:t=>Math.round(RD(t))},Si={test:oh("rgb","red"),parse:Qx("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+vp.transform(t)+", "+vp.transform(s)+", "+vp.transform(o)+", "+Xr(rl.transform(r))+")"};function ID(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 Xp={test:oh("#"),parse:ID,transform:Si.transform},Do={test:oh("hsl","hue"),parse:Qx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Os.transform(Xr(s))+", "+Os.transform(Xr(o))+", "+Xr(rl.transform(r))+")"},hn={test:t=>Si.test(t)||Xp.test(t)||Do.test(t),parse:t=>Si.test(t)?Si.parse(t):Do.test(t)?Do.parse(t):Xp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Si.transform(t):Do.transform(t)},OD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function BD(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(ih))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(OD))===null||o===void 0?void 0:o.length)||0)>0}const e1="number",t1="color",LD="var",zD="var(",Zy="${}",$D=/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 cl(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace($D,m=>(hn.test(m)?(r.color.push(d),c.push(t1),o.push(hn.parse(m))):m.startsWith(zD)?(r.var.push(d),c.push(LD),o.push(m)):(r.number.push(d),c.push(e1),o.push(parseFloat(m))),++d,Zy)).split(Zy);return{values:o,split:p,indexes:r,types:c}}function n1(t){return cl(t).values}function s1(t){const{split:s,types:o}=cl(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===e1?d+=Xr(c[u]):p===t1?d+=hn.transform(c[u]):d+=c[u]}return d}}const HD=t=>typeof t=="number"?0:t;function PD(t){const s=n1(t);return s1(t)(s.map(HD))}const Wa={test:BD,parse:n1,createTransformer:s1,getAnimatableNone:PD},UD=new Set(["brightness","contrast","saturate","opacity"]);function VD(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(ih)||[];if(!r)return t;const c=o.replace(r,"");let d=UD.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const qD=/\b([a-z-]*)\(.*?\)/gu,Qp={...Wa,getAnimatableNone:t=>{const s=t.match(qD);return s?s.map(VD).join(" "):t}},GD={...qm,color:hn,backgroundColor:hn,outlineColor:hn,fill:hn,stroke:hn,borderColor:hn,borderTopColor:hn,borderRightColor:hn,borderBottomColor:hn,borderLeftColor:hn,filter:Qp,WebkitFilter:Qp},rh=t=>GD[t];function a1(t,s){let o=rh(t);return o!==Qp&&(o=Wa),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const FD=new Set(["auto","none","0"]);function KD(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!FD.has(d)&&cl(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=a1(o,c)}const Yy=t=>t===Zo||t===Ae,Jy=(t,s)=>parseFloat(t.split(", ")[s]),Wy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Jy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Jy(d[1],t):0}},ZD=new Set(["x","y","z"]),YD=Ko.filter(t=>!ZD.has(t));function JD(t){const s=[];return YD.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Vo={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:Wy(4,13),y:Wy(5,14)};Vo.translateX=Vo.x;Vo.translateY=Vo.y;const Ti=new Set;let em=!1,tm=!1;function i1(){if(tm){const t=Array.from(Ti).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=JD(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)})}tm=!1,em=!1,Ti.forEach(t=>t.complete()),Ti.clear()}function o1(){Ti.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(tm=!0)})}function WD(){o1(),i1()}class lh{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?(Ti.add(this),em||(em=!0,wt.read(o1),wt.resolveKeyframes(i1))):(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),Ti.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ti.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const r1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),XD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function QD(t){const s=XD.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function l1(t,s,o=1){const[r,c]=QD(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return r1(u)?parseFloat(u):u}return Vm(c)?l1(c,s,o+1):c}const c1=t=>s=>s.test(t),eR={test:t=>t==="auto",parse:t=>t},d1=[Zo,Ae,Os,Ka,JM,YM,eR],Xy=t=>d1.find(c1(t));class u1 extends lh{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(),Vm(g))){const v=l1(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!zx.has(r)||s.length!==2)return;const[c,d]=s,u=Xy(c),p=Xy(d);if(u!==p)if(Yy(u)&&Yy(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++)AD(s[c])&&r.push(c);r.length&&KD(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=Vo[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]=Vo[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"&&(Wa.test(t)||t==="0")&&!t.startsWith("url("));function tR(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 nR(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:tR(t)||(o==="spring"||th(o))&&r}const sR=t=>t!==null;function Id(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(sR),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const aR=40;class f1{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=Bs.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>aR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&WD(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Bs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!nR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Id(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 nm=2e4;function p1(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<nm;)s+=o,r=t.next(s);return s>=nm?1/0:s}const At=(t,s,o)=>t+(s-t)*o;function yp(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 iR({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=yp(m,p,t+1/3),d=yp(m,p,t),u=yp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function md(t,s){return o=>o>0?s:t}const bp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},oR=[Xp,Si,Do],rR=t=>oR.find(s=>s.test(t));function eb(t){const s=rR(t);if(!s)return!1;let o=s.parse(t);return s===Do&&(o=iR(o)),o}const tb=(t,s)=>{const o=eb(t),r=eb(s);if(!o||!r)return md(t,s);const c={...o};return d=>(c.red=bp(o.red,r.red,d),c.green=bp(o.green,r.green,d),c.blue=bp(o.blue,r.blue,d),c.alpha=At(o.alpha,r.alpha,d),Si.transform(c))},lR=(t,s)=>o=>s(t(o)),yl=(...t)=>t.reduce(lR),sm=new Set(["none","hidden"]);function cR(t,s){return sm.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function dR(t,s){return o=>At(t,s,o)}function ch(t){return typeof t=="number"?dR:typeof t=="string"?Vm(t)?md:hn.test(t)?tb:pR:Array.isArray(t)?m1:typeof t=="object"?hn.test(t)?tb:uR:md}function m1(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>ch(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function uR(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=ch(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function fR(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 pR=(t,s)=>{const o=Wa.createTransformer(s),r=cl(t),c=cl(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?sm.has(t)&&!c.values.length||sm.has(s)&&!r.values.length?cR(t,s):yl(m1(fR(r,c),c.values),o):md(t,s)};function h1(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?At(t,s,o):ch(t)(t,s)}const mR=5;function g1(t,s,o){const r=Math.max(s-mR,0);return $x(o-t(r),s-r)}const It={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},_p=.001;function hR({duration:t=It.duration,bounce:s=It.bounce,velocity:o=It.velocity,mass:r=It.mass}){let c,d,u=1-s;u=fa(It.minDamping,It.maxDamping,u),t=fa(It.minDuration,It.maxDuration,ca(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-o,k=am(g,u),S=Math.exp(-b);return _p-_/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=am(Math.pow(g,2),u);return(-c(g)+_p>0?-1:1)*((_-k)*S)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-_p+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=vR(c,d,p);if(t=la(t),isNaN(m))return{stiffness:It.stiffness,damping:It.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const gR=12;function vR(t,s,o){let r=o;for(let c=1;c<gR;c++)r=r-t(r)/s(r);return r}function am(t,s){return t*Math.sqrt(1-s*s)}const yR=["duration","bounce"],bR=["stiffness","damping","mass"];function nb(t,s){return s.some(o=>t[o]!==void 0)}function _R(t){let s={velocity:It.velocity,stiffness:It.stiffness,damping:It.damping,mass:It.mass,isResolvedFromDuration:!1,...t};if(!nb(t,bR)&&nb(t,yR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*fa(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:It.mass,stiffness:c,damping:d}}else{const o=hR(t);s={...s,...o,mass:It.mass},s.isResolvedFromDuration=!0}return s}function v1(t=It.visualDuration,s=It.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}=_R({...o,velocity:-ca(o.velocity||0)}),S=_||0,j=g/(2*Math.sqrt(m*v)),T=u-d,w=ca(Math.sqrt(m/v)),C=Math.abs(T)<5;r||(r=C?It.restSpeed.granular:It.restSpeed.default),c||(c=C?It.restDelta.granular:It.restDelta.default);let M;if(j<1){const E=am(w,j);M=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)M=E=>u-Math.exp(-w*E)*(T+(S+w*T)*E);else{const E=w*Math.sqrt(j*j-1);M=R=>{const O=Math.exp(-j*w*R),D=Math.min(E*R,300);return u-O*((S+j*w*T)*Math.sinh(D)+E*T*Math.cosh(D))/E}}const A={calculatedDuration:k&&b||null,next:E=>{const R=M(E);if(k)p.done=E>=b;else{let O=0;j<1&&(O=E===0?la(S):g1(M,E,R));const D=Math.abs(O)<=r,$=Math.abs(u-R)<=c;p.done=D&&$}return p.value=p.done?u:R,p},toString:()=>{const E=Math.min(p1(A),nm),R=Px(O=>A.next(E*O).value,E,30);return E+"ms "+R}};return A}function sb({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=D=>p!==void 0&&D<p||m!==void 0&&D>m,S=D=>p===void 0?m:m===void 0||Math.abs(p-D)<Math.abs(m-D)?p:m;let j=o*s;const T=b+j,w=u===void 0?T:u(T);w!==T&&(j=w-b);const C=D=>-j*Math.exp(-D/r),M=D=>w+C(D),A=D=>{const $=C(D),Y=M(D);_.done=Math.abs($)<=g,_.value=_.done?w:Y};let E,R;const O=D=>{k(_.value)&&(E=D,R=v1({keyframes:[_.value,S(_.value)],velocity:g1(M,D,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return O(0),{calculatedDuration:null,next:D=>{let $=!1;return!R&&E===void 0&&($=!0,A(D),O(D)),E!==void 0&&D>=E?R.next(D-E):(!$&&A(D),_)}}}const xR=vl(.42,0,1,1),kR=vl(0,0,.58,1),y1=vl(.42,0,.58,1),SR=t=>Array.isArray(t)&&typeof t[0]!="number",jR={linear:Hn,easeIn:xR,easeInOut:y1,easeOut:kR,circIn:ah,circInOut:Wx,circOut:Jx,backIn:sh,backInOut:Zx,backOut:Kx,anticipate:Yx},ab=t=>{if(nh(t)){yx(t.length===4);const[s,o,r,c]=t;return vl(s,o,r,c)}else if(typeof t=="string")return jR[t];return t};function TR(t,s,o){const r=[],c=o||h1,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]||Hn:s;p=yl(m,p)}r.push(p)}return r}function wR(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(yx(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=TR(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 _=Uo(t[b],t[b+1],v);return p[b](_)};return o?v=>g(fa(t[0],t[d-1],v)):g}function NR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Uo(0,s,r);t.push(At(o,1,c))}}function CR(t){const s=[0];return NR(s,t.length-1),s}function ER(t,s){return t.map(o=>o*s)}function AR(t,s){return t.map(()=>s||y1).splice(0,t.length-1)}function hd({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=SR(r)?r.map(ab):ab(r),d={done:!1,value:s[0]},u=ER(o&&o.length===s.length?o:CR(s),t),p=wR(u,s,{ease:Array.isArray(c)?c:AR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const MR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>wt.update(s,!0),stop:()=>Ja(s),now:()=>fn.isProcessing?fn.timestamp:Bs.now()}},DR={decay:sb,inertia:sb,tween:hd,keyframes:hd,spring:v1},RR=t=>t/100;class dh extends f1{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)||lh,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=th(o)?o:DR[o]||hd;let m,g;p!==hd&&typeof s[0]!="number"&&(m=yl(RR,h1(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=p1(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:D}=this.options;return{done:!0,value:D[D.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 M=this.currentTime,A=d;if(k){const D=Math.min(this.currentTime,v)/b;let $=Math.floor(D),Y=D%1;!Y&&D>=1&&(Y=1),Y===1&&$--,$=Math.min($,k+1),!!($%2)&&(S==="reverse"?(Y=1-Y,j&&(Y-=j/b)):S==="mirror"&&(A=u)),M=fa(0,1,Y)*b}const E=C?{done:!1,value:m[0]}:A.next(M);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=Id(m,this.options,c)),T&&T(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?ca(s.calculatedDuration):0}get time(){return ca(this.currentTime)}set time(s){s=la(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=ca(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=MR,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 IR=new Set(["opacity","clipPath","filter","transform"]);function OR(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=Vx(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 BR=eh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gd=10,LR=2e4;function zR(t){return th(t.type)||t.type==="spring"||!Ux(t.ease)}function $R(t,s){const o=new dh({...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<LR;)r=o.sample(d),c.push(r.value),d+=gd;return{times:void 0,keyframes:c,duration:d-gd,ease:"linear"}}const b1={anticipate:Yx,backInOut:Zx,circInOut:Wx};function HR(t){return t in b1}class ib extends f1{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new u1(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"&&pd()&&HR(d)&&(d=b1[d]),zR(this.options)){const{onComplete:b,onUpdate:_,motionValue:k,element:S,...j}=this.options,T=$R(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=OR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Ky(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Id(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 ca(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return ca(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=la(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return Hn;const{animation:r}=o;Ky(r,s)}return Hn}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times: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 dh({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=la(this.time);g.setWithVelocity(S.sample(j-gd).value,S.sample(j).value,gd)}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 BR()&&r&&IR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const PR={type:"spring",stiffness:500,damping:25,restSpeed:10},UR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),VR={type:"keyframes",duration:.8},qR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},GR=(t,{keyframes:s})=>s.length>2?VR:Ii.has(t)?t.startsWith("scale")?UR(s[1]):PR:qR;function FR({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 uh=(t,s,o,r={},c,d)=>u=>{const p=Jm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-la(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};FR(p)||(v={...v,...GR(t,v)}),v.duration&&(v.duration=la(v.duration)),v.repeatDelay&&(v.repeatDelay=la(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 _=Id(v.keyframes,p);if(_!==void 0)return wt.update(()=>{v.onUpdate(_),v.onComplete()}),new jD([])}return!d&&ib.supports(v)?new ib(v):new dh(v)};function KR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function _1(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&&KR(v,b))continue;const S={delay:o,...Jm(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const w=Hx(t);if(w){const C=window.MotionHandoffAnimation(w,b,wt);C!==null&&(S.startTime=C,j=!0)}}Jp(t,b),_.start(uh(b,_,k,t.shouldReduceMotion&&zx.has(b)?{type:!1}:S,t,j));const T=_.animation;T&&g.push(T)}return p&&Promise.all(g).then(()=>{wt.update(()=>{p&&_D(t,p)})}),g}function im(t,s,o={}){var r;const c=Rd(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(_1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return ZR(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 ZR(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(YR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(im(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function YR(t,s){return t.sortNodePosition(s)}function JR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>im(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=im(t,s,o);else{const c=typeof s=="function"?Rd(t,s,o.custom):s;r=Promise.all(_1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const WR=zm.length;function x1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?x1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<WR;o++){const r=zm[o],c=t.props[r];(ol(c)||c===!1)&&(s[r]=c)}return s}const XR=[...Lm].reverse(),QR=Lm.length;function e4(t){return s=>Promise.all(s.map(({animation:o,options:r})=>JR(t,o,r)))}function t4(t){let s=e4(t),o=ob(),r=!0;const c=m=>(g,v)=>{var b;const _=Rd(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=x1(t.parent)||{},b=[],_=new Set;let k={},S=1/0;for(let T=0;T<QR;T++){const w=XR[T],C=o[w],M=g[w]!==void 0?g[w]:v[w],A=ol(M),E=w===m?C.isActive:null;E===!1&&(S=T);let R=M===v[w]&&M!==g[w]&&A;if(R&&r&&t.manuallyAnimateOnMount&&(R=!1),C.protectedKeys={...k},!C.isActive&&E===null||!M&&!C.prevProp||Md(M)||typeof M=="boolean")continue;const O=n4(C.prevProp,M);let D=O||w===m&&C.isActive&&!R&&A||T>S&&A,$=!1;const Y=Array.isArray(M)?M:[M];let V=Y.reduce(c(w),{});E===!1&&(V={});const{prevResolvedValues:ne={}}=C,le={...ne,...V},Z=B=>{D=!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;Yp(F)&&Yp(ge)?ee=!Lx(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=M,C.prevResolvedValues=V,C.isActive&&(k={...k,...V}),r&&t.blockInitialAnimation&&(D=!1),D&&(!(R&&O)||$)&&b.push(...Y.map(B=>({animation:B,options:{type:w}})))}if(_.size){const T={};_.forEach(w=>{const C=t.getBaseTarget(w),M=t.getValue(w);M&&(M.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=ob(),r=!0}}}function n4(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!Lx(s,t):!1}function yi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ob(){return{animate:yi(!0),whileInView:yi(),whileHover:yi(),whileTap:yi(),whileDrag:yi(),whileFocus:yi(),exit:yi()}}class Xa{constructor(s){this.isMounted=!1,this.node=s}update(){}}class s4 extends Xa{constructor(s){super(s),s.animationState||(s.animationState=t4(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Md(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 a4=0;class i4 extends Xa{constructor(){super(...arguments),this.id=a4++}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 o4={animation:{Feature:s4},exit:{Feature:i4}},ys={x:!1,y:!1};function k1(){return ys.x||ys.y}function r4(t){return t==="x"||t==="y"?ys[t]?null:(ys[t]=!0,()=>{ys[t]=!1}):ys.x||ys.y?null:(ys.x=ys.y=!0,()=>{ys.x=ys.y=!1})}const fh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function dl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function bl(t){return{point:{x:t.pageX,y:t.pageY}}}const l4=t=>s=>fh(s)&&t(s,bl(s));function Qr(t,s,o,r){return dl(t,s,l4(o),r)}const rb=(t,s)=>Math.abs(t-s);function c4(t,s){const o=rb(t.x,s.x),r=rb(t.y,s.y);return Math.sqrt(o**2+r**2)}class S1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=kp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=c4(b.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=b,{timestamp:j}=fn;this.history.push({...S,timestamp:j});const{onStart:T,onMove:w}=this.handlers;_||(T&&T(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=xp(_,this.transformPagePoint),wt.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=kp(b.type==="pointercancel"?this.lastMoveEventInfo:xp(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,T),S&&S(b,T)},!fh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=bl(s),p=xp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=fn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,kp(p,this.history)),this.removeListeners=yl(Qr(this.contextWindow,"pointermove",this.handlePointerMove),Qr(this.contextWindow,"pointerup",this.handlePointerUp),Qr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ja(this.updatePoint)}}function xp(t,s){return s?{point:s(t.point)}:t}function lb(t,s){return{x:t.x-s.x,y:t.y-s.y}}function kp({point:t},s){return{point:t,delta:lb(t,j1(s)),offset:lb(t,d4(s)),velocity:u4(s,.1)}}function d4(t){return t[0]}function j1(t){return t[t.length-1]}function u4(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=j1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>la(s)));)o--;if(!r)return{x:0,y:0};const d=ca(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 T1=1e-4,f4=1-T1,p4=1+T1,w1=.01,m4=0-w1,h4=0+w1;function Pn(t){return t.max-t.min}function g4(t,s,o){return Math.abs(t-s)<=o}function cb(t,s,o,r=.5){t.origin=r,t.originPoint=At(s.min,s.max,t.origin),t.scale=Pn(o)/Pn(s),t.translate=At(o.min,o.max,t.origin)-t.originPoint,(t.scale>=f4&&t.scale<=p4||isNaN(t.scale))&&(t.scale=1),(t.translate>=m4&&t.translate<=h4||isNaN(t.translate))&&(t.translate=0)}function el(t,s,o,r){cb(t.x,s.x,o.x,r?r.originX:void 0),cb(t.y,s.y,o.y,r?r.originY:void 0)}function db(t,s,o){t.min=o.min+s.min,t.max=t.min+Pn(s)}function v4(t,s,o){db(t.x,s.x,o.x),db(t.y,s.y,o.y)}function ub(t,s,o){t.min=s.min-o.min,t.max=t.min+Pn(s)}function tl(t,s,o){ub(t.x,s.x,o.x),ub(t.y,s.y,o.y)}function y4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?At(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?At(o,t,r.max):Math.min(t,o)),t}function fb(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 b4(t,{top:s,left:o,bottom:r,right:c}){return{x:fb(t.x,o,c),y:fb(t.y,s,r)}}function pb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function _4(t,s){return{x:pb(t.x,s.x),y:pb(t.y,s.y)}}function x4(t,s){let o=.5;const r=Pn(t),c=Pn(s);return c>r?o=Uo(s.min,s.max-r,t.min):r>c&&(o=Uo(t.min,t.max-c,s.min)),fa(0,1,o)}function k4(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 om=.35;function S4(t=om){return t===!1?t=0:t===!0&&(t=om),{x:mb(t,"left","right"),y:mb(t,"top","bottom")}}function mb(t,s,o){return{min:hb(t,s),max:hb(t,o)}}function hb(t,s){return typeof t=="number"?t:t[s]||0}const gb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ro=()=>({x:gb(),y:gb()}),vb=()=>({min:0,max:0}),Lt=()=>({x:vb(),y:vb()});function is(t){return[t("x"),t("y")]}function N1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function j4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function T4(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 Sp(t){return t===void 0||t===1}function rm({scale:t,scaleX:s,scaleY:o}){return!Sp(t)||!Sp(s)||!Sp(o)}function xi(t){return rm(t)||C1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function C1(t){return yb(t.x)||yb(t.y)}function yb(t){return t&&t!=="0%"}function vd(t,s,o){const r=t-o,c=s*r;return o+c}function bb(t,s,o,r,c){return c!==void 0&&(t=vd(t,c,r)),vd(t,o,r)+s}function lm(t,s=0,o=1,r,c){t.min=bb(t.min,s,o,r,c),t.max=bb(t.max,s,o,r,c)}function E1(t,{x:s,y:o}){lm(t.x,s.translate,s.scale,s.originPoint),lm(t.y,o.translate,o.scale,o.originPoint)}const _b=.999999999999,xb=1.0000000000001;function w4(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&&Oo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,E1(t,u)),r&&xi(d.latestValues)&&Oo(t,d.latestValues))}s.x<xb&&s.x>_b&&(s.x=1),s.y<xb&&s.y>_b&&(s.y=1)}function Io(t,s){t.min=t.min+s,t.max=t.max+s}function kb(t,s,o,r,c=.5){const d=At(t.min,t.max,c);lm(t,s,o,d,r)}function Oo(t,s){kb(t.x,s.x,s.scaleX,s.scale,s.originX),kb(t.y,s.y,s.scaleY,s.scale,s.originY)}function A1(t,s){return N1(T4(t.getBoundingClientRect(),s))}function N4(t,s,o){const r=A1(t,o),{scroll:c}=s;return c&&(Io(r.x,c.offset.x),Io(r.y,c.offset.y)),r}const M1=({current:t})=>t?t.ownerDocument.defaultView:null,C4=new WeakMap;class E4{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Lt(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(bl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=r4(_),!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),is(T=>{let w=this.getAxisMotionValue(T).get()||0;if(Os.test(w)){const{projection:C}=this.visualElement;if(C&&C.layout){const M=C.layout.layoutBox[T];M&&(w=Pn(M)*(parseFloat(w)/100))}}this.originPoint[T]=w}),S&&wt.postRender(()=>S(v,b)),Jp(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=A4(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=()=>is(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new S1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow: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&&wt.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!Vc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=y4(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&Mo(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=b4(c.layoutBox,o):this.constraints=!1,this.elastic=S4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&is(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=k4(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Mo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=N4(r,c.root,this.visualElement.getTransformPagePoint());let u=_4(c.layout.layoutBox,d);if(o){const p=o(j4(u));this.hasMutatedConstraints=!!p,p&&(u=N1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=is(v=>{if(!Vc(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 Jp(this.visualElement,s),r.start(uh(s,r,0,o,this.visualElement,!1))}stopAnimation(){is(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){is(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){is(o=>{const{drag:r}=this.getProps();if(!Vc(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]-At(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Mo(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};is(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=x4({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(),is(u=>{if(!Vc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(At(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;C4.set(this.visualElement,this);const s=this.visualElement.current,o=Qr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Mo(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()),wt.read(r);const u=dl(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(is(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=om,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Vc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function A4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class M4 extends Xa{constructor(s){super(s),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new E4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Sb=t=>(s,o)=>{t&&wt.postRender(()=>t(s,o))};class D4 extends Xa{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(s){this.session=new S1(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:Sb(s),onStart:Sb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&wt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Qr(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 ad={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function jb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Pr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=jb(t,s.target.x),r=jb(t,s.target.y);return`${o}% ${r}%`}},R4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Wa.parse(t);if(c.length>5)return r;const d=Wa.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=At(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 I4 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;oD(O4),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()})),ad.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||wt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Hm.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 D1(t){const[s,o]=gx(),r=y.useContext(Rm);return a.jsx(I4,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(jx),isPresent:s,safeToRemove:o})}const O4={borderRadius:{...Pr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Pr,borderTopRightRadius:Pr,borderBottomLeftRadius:Pr,borderBottomRightRadius:Pr,boxShadow:R4};function B4(t,s,o){const r=gn(t)?t:ll(t);return r.start(uh("",r,s,o)),r.animation}function L4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const z4=(t,s)=>t.depth-s.depth;class $4{constructor(){this.children=[],this.isDirty=!1}add(s){Wm(this.children,s),this.isDirty=!0}remove(s){Xm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(z4),this.isDirty=!1,this.children.forEach(s)}}function H4(t,s){const o=Bs.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Ja(r),t(d-s))};return wt.read(r,!0),()=>Ja(r)}const R1=["TopLeft","TopRight","BottomLeft","BottomRight"],P4=R1.length,Tb=t=>typeof t=="string"?parseFloat(t):t,wb=t=>typeof t=="number"||Ae.test(t);function U4(t,s,o,r,c,d){c?(t.opacity=At(0,o.opacity!==void 0?o.opacity:1,V4(r)),t.opacityExit=At(s.opacity!==void 0?s.opacity:1,0,q4(r))):d&&(t.opacity=At(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<P4;u++){const p=`border${R1[u]}Radius`;let m=Nb(s,p),g=Nb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||wb(m)===wb(g)?(t[p]=Math.max(At(Tb(m),Tb(g),r),0),(Os.test(g)||Os.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=At(s.rotate||0,o.rotate||0,r))}function Nb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const V4=I1(0,.5,Jx),q4=I1(.5,.95,Hn);function I1(t,s,o){return r=>r<t?0:r>s?1:o(Uo(t,s,r))}function Cb(t,s){t.min=s.min,t.max=s.max}function Qn(t,s){Cb(t.x,s.x),Cb(t.y,s.y)}function Eb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Ab(t,s,o,r,c){return t-=s,t=vd(t,1/o,r),c!==void 0&&(t=vd(t,1/c,r)),t}function G4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Os.test(s)&&(s=parseFloat(s),s=At(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=At(d.min,d.max,r);t===d&&(p-=s),t.min=Ab(t.min,s,o,p,c),t.max=Ab(t.max,s,o,p,c)}function Mb(t,s,[o,r,c],d,u){G4(t,s[o],s[r],s[c],s.scale,d,u)}const F4=["x","scaleX","originX"],K4=["y","scaleY","originY"];function Db(t,s,o,r){Mb(t.x,s,F4,o?o.x:void 0,r?r.x:void 0),Mb(t.y,s,K4,o?o.y:void 0,r?r.y:void 0)}function Rb(t){return t.translate===0&&t.scale===1}function O1(t){return Rb(t.x)&&Rb(t.y)}function Ib(t,s){return t.min===s.min&&t.max===s.max}function Z4(t,s){return Ib(t.x,s.x)&&Ib(t.y,s.y)}function Ob(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function B1(t,s){return Ob(t.x,s.x)&&Ob(t.y,s.y)}function Bb(t){return Pn(t.x)/Pn(t.y)}function Lb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class Y4{constructor(){this.members=[]}add(s){Wm(this.members,s),s.scheduleRender()}remove(s){if(Xm(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 J4(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 ki={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zr=typeof window<"u"&&window.MotionDebug!==void 0,jp=["","X","Y","Z"],W4={visibility:"hidden"},zb=1e3;let X4=0;function Tp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function L1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Hx(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",wt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&L1(r)}function z1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=X4++,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,Zr&&(ki.totalNodes=ki.resolvedTargetDeltas=ki.recalculatedProjection=0),this.nodes.forEach(t3),this.nodes.forEach(o3),this.nodes.forEach(r3),this.nodes.forEach(n3),Zr&&window.MotionDebug.record(ki)},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 $4)}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=L4(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=H4(_,250),ad.hasAnimatedSinceResize&&(ad.hasAnimatedSinceResize=!1,this.nodes.forEach(Hb))})}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()||f3,{onLayoutAnimationStart:T,onLayoutAnimationComplete:w}=v.getProps(),C=!this.targetLayout||!B1(this.targetLayout,S)||k,M=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||M||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,M);const A={...Jm(j,"layout"),onPlay:T,onComplete:w};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else _||Hb(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,Ja(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(l3),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&&L1(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($b);return}this.isUpdating||this.nodes.forEach(a3),this.isUpdating=!1,this.nodes.forEach(i3),this.nodes.forEach(Q4),this.nodes.forEach(e3),this.clearAllSnapshots();const p=Bs.now();fn.delta=fa(0,1e3/60,p-fn.timestamp),fn.timestamp=p,fn.isProcessing=!0,gp.update.process(fn),gp.preRender.process(fn),gp.render.process(fn),fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Hm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(s3),this.sharedNodes.forEach(c3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Lt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!O1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||xi(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)),p3(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Lt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(m3))){const{scroll:v}=this.root;v&&(Io(m.x,v.offset.x),Io(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Lt();if(Qn(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&&Qn(m,u),Io(m.x,b.offset.x),Io(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Lt();Qn(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&&Oo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),xi(v.latestValues)&&Oo(m,v.latestValues)}return xi(this.latestValues)&&Oo(m,this.latestValues),m}removeTransform(u){const p=Lt();Qn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!xi(g.latestValues))continue;rm(g.latestValues)&&g.updateSnapshot();const v=Lt(),b=g.measurePageBox();Qn(v,b),Db(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return xi(this.latestValues)&&Db(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=Lt(),this.relativeTargetOrigin=Lt(),tl(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Lt(),this.targetWithTransforms=Lt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),v4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Qn(this.target,this.layout.layoutBox),E1(this.target,this.targetDelta)):Qn(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=Lt(),this.relativeTargetOrigin=Lt(),tl(this.relativeTargetOrigin,this.target,k.target),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zr&&ki.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||rm(this.parent.latestValues)||C1(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;Qn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;w4(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Lt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Eb(this.prevProjectionDelta.x,this.projectionDelta.x),Eb(this.prevProjectionDelta.y,this.projectionDelta.y)),el(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!Lb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Lb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Zr&&ki.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=Ro(),this.projectionDelta=Ro(),this.projectionDeltaWithTransform=Ro()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Lt(),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(u3));this.animationProgress=0;let M;this.mixTargetDelta=A=>{const E=A/1e3;Pb(b.x,u.x,E),Pb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tl(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),d3(this.relativeTarget,this.relativeTargetOrigin,_,E),M&&Z4(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=Lt()),Qn(M,this.relativeTarget)),j&&(this.animationValues=v,U4(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&&(Ja(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wt.update(()=>{ad.hasAnimatedSinceResize=!0,this.currentAnimation=B4(0,zb,{...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(zb),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&&$1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Lt();const b=Pn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Pn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Qn(p,m),Oo(p,v),el(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Y4),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&&Tp("z",u,g,this.animationValues);for(let v=0;v<jp.length;v++)Tp(`rotate${jp[v]}`,u,g,this.animationValues),Tp(`skew${jp[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 W4;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=nd(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=nd(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!xi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=J4(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 fd){if(_[j]===void 0)continue;const{correct:T,applyTo:w}=fd[j],C=g.transform==="none"?_[j]:T(_[j],b);if(w){const M=w.length;for(let A=0;A<M;A++)g[w[A]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?nd(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($b),this.root.sharedNodes.clear()}}}function Q4(t){t.updateLayout()}function e3(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"?is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Pn(_);_.min=r[b].min,_.max=_.min+k}):$1(d,o.layoutBox,r)&&is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],k=Pn(r[b]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=Ro();el(p,r,o.layoutBox);const m=Ro();u?el(m,t.applyTransform(c,!0),o.measuredBox):el(m,r,o.layoutBox);const g=!O1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:k}=b;if(_&&k){const S=Lt();tl(S,o.layoutBox,_.layoutBox);const j=Lt();tl(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 t3(t){Zr&&ki.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 n3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function s3(t){t.clearSnapshot()}function $b(t){t.clearMeasurements()}function a3(t){t.isLayoutDirty=!1}function i3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Hb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function o3(t){t.resolveTargetDelta()}function r3(t){t.calcProjection()}function l3(t){t.resetSkewAndRotation()}function c3(t){t.removeLeadSnapshot()}function Pb(t,s,o){t.translate=At(s.translate,0,o),t.scale=At(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Ub(t,s,o,r){t.min=At(s.min,o.min,r),t.max=At(s.max,o.max,r)}function d3(t,s,o,r){Ub(t.x,s.x,o.x,r),Ub(t.y,s.y,o.y,r)}function u3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const f3={duration:.45,ease:[.4,0,.1,1]},Vb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),qb=Vb("applewebkit/")&&!Vb("chrome/")?Math.round:Hn;function Gb(t){t.min=qb(t.min),t.max=qb(t.max)}function p3(t){Gb(t.x),Gb(t.y)}function $1(t,s,o){return t==="position"||t==="preserve-aspect"&&!g4(Bb(s),Bb(o),.2)}function m3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const h3=z1({attachResizeListener:(t,s)=>dl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),wp={current:void 0},H1=z1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wp.current){const t=new h3({});t.mount(window),t.setOptions({layoutScroll:!0}),wp.current=t}return wp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),g3={pan:{Feature:D4},drag:{Feature:M4,ProjectionNode:H1,MeasureLayout:D1}};function v3(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 P1(t,s){const o=v3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Fb(t){return s=>{s.pointerType==="touch"||k1()||t(s)}}function y3(t,s,o={}){const[r,c,d]=P1(t,o),u=Fb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Fb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Kb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&wt.postRender(()=>d(s,bl(s)))}class b3 extends Xa{mount(){const{current:s}=this.node;s&&(this.unmount=y3(s,o=>(Kb(this.node,o,"Start"),r=>Kb(this.node,r,"End"))))}unmount(){}}class _3 extends Xa{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=yl(dl(this.node.current,"focus",()=>this.onFocus()),dl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const U1=(t,s)=>s?t===s?!0:U1(t,s.parentElement):!1,x3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function k3(t){return x3.has(t.tagName)||t.tabIndex!==-1}const Yr=new WeakSet;function Zb(t){return s=>{s.key==="Enter"&&t(s)}}function Np(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const S3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Zb(()=>{if(Yr.has(o))return;Np(o,"down");const c=Zb(()=>{Np(o,"up")}),d=()=>Np(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 Yb(t){return fh(t)&&!k1()}function j3(t,s,o={}){const[r,c,d]=P1(t,o),u=p=>{const m=p.currentTarget;if(!Yb(p)||Yr.has(m))return;Yr.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Yb(k)||!Yr.has(m))&&(Yr.delete(m),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,o.useGlobalTarget||U1(m,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!k3(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>S3(g,c),c)}),d}function Jb(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&wt.postRender(()=>d(s,bl(s)))}class T3 extends Xa{mount(){const{current:s}=this.node;s&&(this.unmount=j3(s,o=>(Jb(this.node,o,"Start"),(r,{success:c})=>Jb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const cm=new WeakMap,Cp=new WeakMap,w3=t=>{const s=cm.get(t.target);s&&s(t)},N3=t=>{t.forEach(w3)};function C3({root:t,...s}){const o=t||document;Cp.has(o)||Cp.set(o,{});const r=Cp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(N3,{root:t,...s})),r[c]}function E3(t,s,o){const r=C3(s);return cm.set(t,o),r.observe(t),()=>{cm.delete(t),r.unobserve(t)}}const A3={some:0,all:1};class M3 extends Xa{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:A3[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 E3(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(D3(s,o))&&this.startObserver()}unmount(){}}function D3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const R3={inView:{Feature:M3},tap:{Feature:T3},focus:{Feature:_3},hover:{Feature:b3}},I3={layout:{ProjectionNode:H1,MeasureLayout:D1}},yd={current:null},ph={current:!1};function V1(){if(ph.current=!0,!!Bm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>yd.current=t.matches;t.addListener(s),s()}else yd.current=!1}const O3=[...d1,hn,Wa],B3=t=>O3.find(c1(t)),Wb=new WeakMap;function L3(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,ll(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,ll(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Xb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class z3{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=lh,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=Bs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,wt.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=Dd(o),this.isVariantNode=kx(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,Wb.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)),ph.current||V1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Wb.delete(this.current),this.projection&&this.projection.unmount(),Ja(this.notifyUpdate),Ja(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=Ii.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&wt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Po){const o=Po[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Lt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Xb.length;r++){const c=Xb[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=L3(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=ll(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"&&(r1(c)||Xx(c))?c=parseFloat(c):!B3(c)&&Wa.test(o)&&(c=a1(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=Um(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 q1 extends z3{constructor(){super(...arguments),this.KeyframeResolver=u1}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 $3(t){return window.getComputedStyle(t)}class H3 extends q1{constructor(){super(...arguments),this.type="html",this.renderInstance=Mx}readValueFromInstance(s,o){if(Ii.has(o)){const r=rh(o);return r&&r.default||0}else{const r=$3(s),c=(Cx(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return A1(s,o)}build(s,o,r){Gm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Ym(s,o,r)}}class P3 extends q1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Ii.has(o)){const r=rh(o);return r&&r.default||0}return o=Dx.has(o)?o:$m(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return Ox(s,o,r)}build(s,o,r){Fm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){Rx(s,o,r,c)}mount(s){this.isSVGTag=Zm(s.tagName),super.mount(s)}}const U3=(t,s)=>Pm(t)?new P3(s):new H3(s,{allowProjection:t!==y.Fragment}),V3=hD({...o4,...R3,...g3,...I3},U3),Pt=AM(V3);function q3(){!ph.current&&V1();const[t]=y.useState(yd.current);return t}const G3="_overlay_cmicx_1",F3="_dialog_cmicx_11",K3="_title_cmicx_30",Z3="_description_cmicx_38",Y3="_actions_cmicx_45",J3="_cancelButton_cmicx_52",W3="_confirmButton_cmicx_79",bi={overlay:G3,dialog:F3,title:K3,description:Z3,actions:Y3,cancelButton:J3,confirmButton:W3};function _s({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return a.jsx(os,{children:t&&a.jsx(Pt.div,{className:bi.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:a.jsxs(Pt.div,{className:bi.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:[a.jsx("h3",{id:u,className:bi.title,children:s}),o&&a.jsx("p",{id:p,className:bi.description,children:o}),a.jsxs("div",{className:bi.actions,children:[a.jsx("button",{type:"button",className:bi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),a.jsx("button",{type:"button",className:bi.confirmButton,onClick:c,children:r})]})]})})})}const X3="_skeleton_1gqp4_9",Q3="_circular_1gqp4_17",e6="_textContainer_1gqp4_26",t6="_card_1gqp4_31",bd={skeleton:X3,circular:Q3,textContainer:e6,card:t6};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[bd.skeleton,r==="circular"?bd.circular:"",c??""].filter(Boolean).join(" ");return a.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function dm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return a.jsx("div",{className:`${bd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>a.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function um({lines:t=2,className:s}){return a.jsxs("div",{className:`${bd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[a.jsx(Te,{width:"40%",height:"1.25rem"}),a.jsx(dm,{lines:t})]})}const n6="_spinner_1uyt1_1",s6="_spin_1uyt1_1",a6="_sm_1uyt1_14",i6="_md_1uyt1_20",o6="_lg_1uyt1_26",r6="_xl_1uyt1_32",Qb={spinner:n6,spin:s6,sm:a6,md:i6,lg:o6,xl:r6};function G1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return a.jsx("span",{className:`${Qb.spinner} ${Qb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function Od(t){return`/${t.replace(/^\//,"")}`}const l6="_splash_1bn1g_1",c6="_logo_1bn1g_11",e_={splash:l6,logo:c6};function F1(){return a.jsxs("div",{className:e_.splash,"data-testid":"splash-screen",children:[a.jsx("img",{src:Od("grackle-logo.png"),alt:"Grackle",className:e_.logo}),a.jsx(G1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const d6="_wrapper_4e5yt_1",u6="_wrapperBlock_4e5yt_6",f6="_tooltip_4e5yt_11",p6="_visible_4e5yt_31",m6="_top_4e5yt_41",h6="_bottom_4e5yt_48",g6="_left_4e5yt_55",v6="_right_4e5yt_62",Ur={wrapper:d6,wrapperBlock:u6,tooltip:f6,visible:p6,top:m6,bottom:h6,left:g6,right:v6},y6=300,qc=6;function Ci({text:t,placement:s="top",delayMs:o=y6,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-qc,ne=$.left+$.width/2-Y.width/2;break;case"bottom":V=$.bottom+qc,ne=$.left+$.width/2-Y.width/2;break;case"left":V=$.top+$.height/2-Y.height/2,ne=$.left-Y.width-qc;break;case"right":V=$.top+$.height/2-Y.height/2,ne=$.right+qc;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]),M=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?Ur.wrapper:Ur.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 D=a.jsx("div",{ref:_,id:S,role:"tooltip",className:`${Ur.tooltip} ${Ur[s]} ${p?Ur.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return a.jsxs(E,{ref:b,className:R,onMouseEnter:C,onMouseLeave:A,onFocus:M,onBlur:A,children:[O,j?H2.createPortal(D,document.body):null]})}const b6="_attemptSelector_ggigl_1",_6="_attemptLabel_ggigl_17",x6="_attemptButton_ggigl_21",k6="_attemptActive_ggigl_38",S6="_attemptStatus_ggigl_44",Vr={attemptSelector:b6,attemptLabel:_6,attemptButton:x6,attemptActive:k6,attemptStatus:S6};function j6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return a.jsxs("div",{className:Vr.attemptSelector,"data-testid":"attempt-selector",children:[a.jsx("span",{className:Vr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return a.jsxs("button",{className:`${Vr.attemptButton} ${d?Vr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&a.jsx("span",{className:Vr.attemptStatus,children:u})]},r.id)})]})}const T6="_row_ldkru_1",w6="_hoverActions_ldkru_5",N6="_hoverButton_ldkru_31",C6="_selectingRow_ldkru_72",E6="_selected_ldkru_83",A6="_checkboxArea_ldkru_90",M6="_checkbox_ldkru_90",D6="_contentArea_ldkru_106",gs={row:T6,hoverActions:w6,hoverButton:N6,selectingRow:C6,selected:E6,checkboxArea:A6,checkbox:M6,contentArea:D6};function R6({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?a.jsxs("div",{className:`${gs.row} ${gs.selectingRow} ${r?gs.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[a.jsx("div",{className:gs.checkboxArea,children:a.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:gs.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),a.jsx("div",{className:gs.contentArea,children:m})]}):a.jsxs("div",{className:gs.row,"data-testid":"event-hover-row",children:[a.jsxs("div",{className:gs.hoverActions,"data-testid":"event-hover-actions",children:[a.jsx("button",{type:"button",className:gs.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?a.jsx(Ai,{size:Ye,"aria-hidden":"true"}):a.jsx(U_,{size:Ye,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:gs.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:a.jsx(FT,{size:Ye,"aria-hidden":"true"})})]}),m]}):a.jsx("div",{className:gs.row,children:m})}const I6="_bar_lagql_1",O6="_left_lagql_21",B6="_right_lagql_27",L6="_count_lagql_33",z6="_toggleButton_lagql_40",$6="_copyButton_lagql_68",H6="_forwardButton_lagql_108",P6="_cancelButton_lagql_148",Pa={bar:I6,left:O6,right:B6,count:L6,toggleButton:z6,copyButton:$6,forwardButton:H6,cancelButton:P6};function U6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:p}){const m=t>0&&t>=s;return a.jsxs(Pt.div,{className:Pa.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[a.jsxs("div",{className:Pa.left,children:[a.jsxs("span",{className:Pa.count,"data-testid":"floating-bar-count",children:[t," selected"]}),a.jsx("button",{type:"button",className:Pa.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),a.jsxs("div",{className:Pa.right,children:[a.jsxs("button",{type:"button",className:Pa.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[a.jsx(Zj,{size:Ye,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&a.jsx(Ci,{text:u?"No active sessions to forward to":"Forward to another session",children:a.jsxs("button",{type:"button",className:Pa.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[a.jsx(nT,{size:Ye,"aria-hidden":"true"}),"Forward"]})}),a.jsx("button",{type:"button",className:Pa.cancelButton,onClick:p,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:a.jsx(Ls,{size:Ye,"aria-hidden":"true"})})]})]})}const V6="_overlay_1hra6_1",q6="_dialog_1hra6_11",G6="_header_1hra6_27",F6="_title_1hra6_35",K6="_closeButton_1hra6_42",Z6="_filterRow_1hra6_78",Y6="_searchIcon_1hra6_86",J6="_filterInput_1hra6_91",W6="_list_1hra6_108",X6="_emptyItem_1hra6_116",Q6="_sessionRow_1hra6_123",e5="_sessionMain_1hra6_158",t5="_envName_1hra6_165",n5="_personaName_1hra6_175",s5="_statusBadge_1hra6_189",a5="_status_running_1hra6_198",i5="_status_idle_1hra6_202",o5="_status_other_1hra6_206",r5="_sessionPrompt_1hra6_211",l5="_noSessions_1hra6_220",Zt={overlay:V6,dialog:q6,header:G6,title:F6,closeButton:K6,filterRow:Z6,searchIcon:Y6,filterInput:J6,list:W6,emptyItem:X6,sessionRow:Q6,sessionMain:e5,envName:t5,personaName:n5,statusBadge:s5,status_running:a5,status_idle:i5,status_other:o5,sessionPrompt:r5,noSessions:l5};function c5(t){return t==="running"?"running":t==="idle"?"idle":t}function d5({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 a.jsx(os,{children:t&&a.jsx(Pt.div,{className:Zt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:a.jsxs(Pt.div,{ref:m,className:Zt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[a.jsxs("div",{className:Zt.header,children:[a.jsx("h3",{className:Zt.title,children:"Forward to session"}),a.jsx("button",{ref:g,type:"button",className:Zt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:a.jsx(Ls,{size:Ye,"aria-hidden":"true"})})]}),k&&a.jsxs("div",{className:Zt.filterRow,children:[a.jsx(Up,{size:Ye,className:Zt.searchIcon,"aria-hidden":"true"}),a.jsx("input",{type:"text",className:Zt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{p(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?a.jsxs("div",{className:Zt.noSessions,"data-testid":"session-picker-no-sessions",children:[a.jsx(Up,{size:Ht,"aria-hidden":"true"}),a.jsx("p",{children:"No active sessions to forward to."})]}):a.jsx("ul",{className:Zt.list,"data-testid":"session-picker-list",children:S.length===0?a.jsx("li",{className:Zt.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 a.jsx("li",{children:a.jsxs("button",{type:"button",className:Zt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[a.jsxs("div",{className:Zt.sessionMain,children:[a.jsx("span",{className:Zt.envName,children:T}),w!==void 0&&a.jsx("span",{className:Zt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:w}),a.jsx("span",{className:`${Zt.statusBadge} ${Zt[`status_${j.status}`]??Zt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:c5(j.status)})]}),a.jsx("div",{className:Zt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const K1=50;function u5(t,s,o,r,c=K1){return r?t<c:s-t-o<c}function f5(t,s){const o=s-t;return o>0?o:0}function p5({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=u5(v.scrollTop,v.scrollHeight,v.clientHeight,o,K1);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=f5(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 m5=new Set(["text","output","user_input","tool_use","tool_result","error"]);function ul(t){return m5.has(t.eventType)}function h5(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 t_(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;return typeof s.command=="string"?`\`${s.command}\``:typeof s.file_path=="string"||typeof s.filePath=="string"?`\`${s.file_path??s.filePath}\``:typeof s.path=="string"?`\`${s.path}\``:typeof s.query=="string"?`\`${s.query}\``:typeof s.pattern=="string"?`\`${s.pattern}\``:""}function Z1(t){var o;const s=[];for(const r of t){if(!ul(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]),a.jsx(kD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const jD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=Im(TD),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=a.jsx(SD,{isPresent:o,children:t})),a.jsx(Ed.Provider,{value:v,children:t})};function TD(){return new Map}function vx(t=!0){const s=y.useContext(Ed);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 Hc=t=>t.key||"";function zy(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Bm=typeof window<"u",yx=Bm?y.useLayoutEffect:y.useEffect,os=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=vx(u),g=y.useMemo(()=>zy(t),[t]),v=u&&!p?[]:g.map(Hc),b=y.useRef(!0),_=y.useRef(g),x=Im(()=>new Map),[S,j]=y.useState(g),[T,N]=y.useState(g);yx(()=>{b.current=!1,_.current=g;for(let A=0;A<T.length;A++){const E=Hc(T[A]);v.includes(E)?x.delete(E):x.get(E)!==!0&&x.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=Hc(R);v.includes(O)||(A.splice(E,0,R),C.push(R))}d==="wait"&&C.length&&(A=C),N(zy(A)),j(g);return}const{forceRender:D}=y.useContext(Rm);return a.jsx(a.Fragment,{children:T.map(A=>{const E=Hc(A),R=u&&!p?!1:g===T||v.includes(E),O=()=>{if(x.has(E))x.set(E,!0);else return;let M=!0;x.forEach($=>{$||(M=!1)}),M&&(D==null||D(),N(_.current),u&&(m==null||m()),r&&r())};return a.jsx(jD,{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)})})},Hn=t=>t;let bx=Hn;const ND={useManualTiming:!1};function wD(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 x=b&&r?s:o;return v&&d.add(g),x.has(g)||x.add(g),g},cancel:g=>{o.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Pc=["read","resolveKeyframes","update","preRender","render","postRender"],CD=40;function _x(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Pc.reduce((N,C)=>(N[C]=wD(d),N),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,x=()=>{const N=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(N-c.timestamp,CD),1),c.timestamp=N,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(x))},S=()=>{o=!0,r=!0,c.isProcessing||t(x)};return{schedule:Pc.reduce((N,C)=>{const D=u[C];return N[C]=(A,E=!1,R=!1)=>(o||S(),D.schedule(A,E,R)),N},{}),cancel:N=>{for(let C=0;C<Pc.length;C++)u[Pc[C]].cancel(N)},state:c,steps:u}}const{schedule:Nt,cancel:Ja,state:fn,steps:gp}=_x(typeof requestAnimationFrame<"u"?requestAnimationFrame:Hn,!0),xx=y.createContext({strict:!1}),$y={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"]},Po={};for(const t in $y)Po[t]={isEnabled:s=>$y[t].some(o=>!!s[o])};function ED(t){for(const s in t)Po[s]={...Po[s],...t[s]}}const AD=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 ud(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||AD.has(t)}let kx=t=>!ud(t);function DD(t){t&&(kx=s=>s.startsWith("on")?!ud(s):t(s))}try{DD(require("@emotion/is-prop-valid").default)}catch{}function MD(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(kx(c)||o===!0&&ud(c)||!s&&!ud(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function RD(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 Ad=y.createContext({});function ol(t){return typeof t=="string"||Array.isArray(t)}function Dd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Lm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zm=["initial",...Lm];function Md(t){return Dd(t.animate)||zm.some(s=>ol(t[s]))}function Sx(t){return!!(Md(t)||t.variants)}function ID(t,s){if(Md(t)){const{initial:o,animate:r}=t;return{initial:o===!1||ol(o)?o:void 0,animate:ol(r)?r:void 0}}return t.inherit!==!1?s:{}}function OD(t){const{initial:s,animate:o}=ID(t,y.useContext(Ad));return y.useMemo(()=>({initial:s,animate:o}),[Hy(s),Hy(o)])}function Hy(t){return Array.isArray(t)?t.join(" "):t}const BD=Symbol.for("motionComponentSymbol");function Do(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function LD(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):Do(o)&&(o.current=r))},[s])}const $m=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),zD="framerAppearId",jx="data-"+$m(zD),{schedule:Hm}=_x(queueMicrotask,!1),Tx=y.createContext({});function $D(t,s,o,r,c){var d,u;const{visualElement:p}=y.useContext(Ad),m=y.useContext(xx),g=y.useContext(Ed),v=y.useContext(Om).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,x=y.useContext(Tx);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&HD(b.current,o,c,x);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,g)});const j=o[jx],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 yx(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Hm.render(_.render),T.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var N;(N=window.MotionHandoffMarkAsComplete)===null||N===void 0||N.call(window,j)}),T.current=!1))}),_}function HD(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:Nx(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&Do(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function Nx(t){if(t)return t.options.allowProjection!==!1?t.projection:Nx(t.parent)}function PD({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&ED(t);function p(g,v){let b;const _={...y.useContext(Om),...g,layoutId:UD(g)},{isStatic:x}=_,S=OD(g),j=r(g,x);if(!x&&Bm){VD();const T=qD(_);b=T.MeasureLayout,S.visualElement=$D(c,j,_,s,T.ProjectionNode)}return a.jsxs(Ad.Provider,{value:S,children:[b&&S.visualElement?a.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,g,LD(j,S.visualElement,v),j,x,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[BD]=c,m}function UD({layoutId:t}){const s=y.useContext(Rm).id;return s&&t!==void 0?s+"-"+t:t}function VD(t,s){y.useContext(xx).strict}function qD(t){const{drag:s,layout:o}=Po;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 GD=["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 Pm(t){return typeof t!="string"||t.includes("-")?!1:!!(GD.indexOf(t)>-1||/[A-Z]/u.test(t))}function Py(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Um(t,s,o,r){if(typeof s=="function"){const[c,d]=Py(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]=Py(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Yp=t=>Array.isArray(t),FD=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),KD=t=>Yp(t)?t[t.length-1]||0:t,gn=t=>!!(t&&t.getVelocity);function nd(t){const s=gn(t)?t.get():t;return FD(s)?s.toValue():s}function ZD({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:YD(r,c,d,t),renderState:s()};return o&&(u.onMount=p=>o({props:r,current:p,...u}),u.onUpdate=p=>o(p)),u}const wx=t=>(s,o)=>{const r=y.useContext(Ad),c=y.useContext(Ed),d=()=>ZD(t,s,r,c);return o?d():Im(d)};function YD(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=nd(d[_]);let{initial:u,animate:p}=t;const m=Md(t),g=Sx(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"&&!Dd(b)){const _=Array.isArray(b)?b:[b];for(let x=0;x<_.length;x++){const S=Um(t,_[x]);if(S){const{transitionEnd:j,transition:T,...N}=S;for(const C in N){let D=N[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 Ko=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ii=new Set(Ko),Cx=t=>s=>typeof s=="string"&&s.startsWith(t),Ex=Cx("--"),JD=Cx("var(--"),Vm=t=>JD(t)?WD.test(t.split("/*")[0].trim()):!1,WD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ax=(t,s)=>s&&typeof t=="number"?s.transform(t):t,fa=(t,s,o)=>o>s?s:o<t?t:o,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},rl={...Zo,transform:t=>fa(0,1,t)},Uc={...Zo,default:1},gl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Ka=gl("deg"),Os=gl("%"),Ae=gl("px"),XD=gl("vh"),QD=gl("vw"),Uy={...Os,parse:t=>Os.parse(t)/100,transform:t=>Os.transform(t*100)},eM={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},tM={rotate:Ka,rotateX:Ka,rotateY:Ka,rotateZ:Ka,scale:Uc,scaleX:Uc,scaleY:Uc,scaleZ:Uc,skew:Ka,skewX:Ka,skewY:Ka,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:rl,originX:Uy,originY:Uy,originZ:Ae},Vy={...Zo,transform:Math.round},qm={...eM,...tM,zIndex:Vy,size:Ae,fillOpacity:rl,strokeOpacity:rl,numOctaves:Vy},nM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},sM=Ko.length;function aM(t,s,o){let r="",c=!0;for(let d=0;d<sM;d++){const u=Ko[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=Ax(p,qm[u]);if(!m){c=!1;const v=nM[u]||u;r+=`${v}(${g}) `}o&&(s[u]=g)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Gm(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(Ii.has(m)){u=!0;continue}else if(Ex(m)){c[m]=g;continue}else{const v=Ax(g,qm[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=aM(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 iM={offset:"stroke-dashoffset",array:"stroke-dasharray"},oM={offset:"strokeDashoffset",array:"strokeDasharray"};function rM(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?iM:oM;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),p=Ae.transform(o);t[d.array]=`${u} ${p}`}function qy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function lM(t,s,o){const r=qy(s,t.x,t.width),c=qy(o,t.y,t.height);return`${r} ${c}`}function Fm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Gm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:x,dimensions:S}=t;_.transform&&(S&&(x.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||x.transform)&&(x.transformOrigin=lM(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&&rM(_,u,p,m,!1)}const Km=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Dx=()=>({...Km(),attrs:{}}),Zm=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 Rx=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 Ix(t,s,o,r){Mx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Rx.has(c)?c:$m(c),s.attrs[c])}const fd={};function cM(t){Object.assign(fd,t)}function Ox(t,{layout:s,layoutId:o}){return Ii.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!fd[t]||t==="opacity")}function Ym(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(gn(c[u])||s.style&&gn(s.style[u])||Ox(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 Bx(t,s,o){const r=Ym(t,s,o);for(const c in t)if(gn(t[c])||gn(s[c])){const d=Ko.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function dM(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 Gy=["x","y","width","height","cx","cy","r"],uM={useVisualState:wx({scrapeMotionValuesFromProps:Bx,createRenderState:Dx,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const p in c)if(Ii.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Gy.length;p++){const m=Gy[p];t[m]!==s[m]&&(u=!0)}u&&Nt.read(()=>{dM(o,r),Nt.render(()=>{Fm(r,c,Zm(o.tagName),t.transformTemplate),Ix(o,r)})})}})},fM={useVisualState:wx({scrapeMotionValuesFromProps:Ym,createRenderState:Km})};function Lx(t,s,o){for(const r in s)!gn(s[r])&&!Ox(r,o)&&(t[r]=s[r])}function pM({transformTemplate:t},s){return y.useMemo(()=>{const o=Km();return Gm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function mM(t,s){const o=t.style||{},r={};return Lx(r,o,t),Object.assign(r,pM(t,s)),r}function hM(t,s){const o={},r=mM(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 gM(t,s,o,r){const c=y.useMemo(()=>{const d=Dx();return Fm(d,s,Zm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};Lx(d,t.style,t),c.style={...d,...c.style}}return c}function vM(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Pm(o)?gM:hM)(r,d,u,o),g=MD(r,typeof o=="string",t),v=o!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>gn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:_})}}function yM(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Pm(r)?uM:fM,preloadedFeatures:t,useRender:vM(c),createVisualElement:s,Component:r};return PD(u)}}function zx(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 Rd(t,s,o){const r=t.getProps();return Um(r,s,o!==void 0?o:r.custom,t)}function Jm(t,s){return t?t[s]||t.default||t:void 0}const $x=new Set(["width","height","top","left","right","bottom",...Ko]);let sd;function bM(){sd=void 0}const Bs={now:()=>(sd===void 0&&Bs.set(fn.isProcessing||ND.useManualTiming?fn.timestamp:performance.now()),sd),set:t=>{sd=t,queueMicrotask(bM)}};function Wm(t,s){t.indexOf(s)===-1&&t.push(s)}function Xm(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class Qm{constructor(){this.subscriptions=[]}add(s){return Wm(this.subscriptions,s),()=>Xm(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 Hx(t,s){return s?t*(1e3/s):0}const Fy=30,_M=t=>!isNaN(parseFloat(t));class xM{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Bs.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Bs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=_M(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(),Nt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Bs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Fy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Fy);return Hx(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 ll(t,s){return new xM(t,s)}function kM(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,ll(o))}function SM(t,s){const o=Rd(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const p=KD(d[u]);kM(t,u,p)}}function jM(t){return!!(gn(t)&&t.add)}function Jp(t,s){const o=t.getValue("willChange");if(jM(o))return o.add(s)}function Px(t){return t.props[jx]}function eh(t){let s;return()=>(s===void 0&&(s=t()),s)}const TM=eh(()=>window.ScrollTimeline!==void 0);class NM{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(TM()&&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 wM extends NM{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const la=t=>t*1e3,ca=t=>t/1e3;function th(t){return typeof t=="function"}function Ky(t,s){t.timeline=s,t.onfinish=null}const nh=t=>Array.isArray(t)&&typeof t[0]=="number",CM={linearEasing:void 0};function EM(t,s){const o=eh(t);return()=>{var r;return(r=CM[s])!==null&&r!==void 0?r:o()}}const pd=EM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Uo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},Ux=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(Uo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function Vx(t){return!!(typeof t=="function"&&pd()||!t||typeof t=="string"&&(t in Wp||pd())||nh(t)||Array.isArray(t)&&t.every(Vx))}const Kr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,Wp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Kr([0,.65,.55,1]),circOut:Kr([.55,0,1,.45]),backIn:Kr([.31,.01,.66,-.59]),backOut:Kr([.33,1.53,.69,.99])};function qx(t,s){if(t)return typeof t=="function"&&pd()?Ux(t,s):nh(t)?Kr(t):Array.isArray(t)?t.map(o=>qx(o,s)||Wp.easeOut):Wp[t]}const Gx=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,AM=1e-7,DM=12;function MM(t,s,o,r,c){let d,u,p=0;do u=s+(o-s)/2,d=Gx(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>AM&&++p<DM);return u}function vl(t,s,o,r){if(t===s&&o===r)return Hn;const c=d=>MM(d,0,1,t,o);return d=>d===0||d===1?d:Gx(c(d),s,r)}const Fx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,Kx=t=>s=>1-t(1-s),Zx=vl(.33,1.53,.69,.99),sh=Kx(Zx),Yx=Fx(sh),Jx=t=>(t*=2)<1?.5*sh(t):.5*(2-Math.pow(2,-10*(t-1))),ah=t=>1-Math.sin(Math.acos(t)),Wx=Kx(ah),Xx=Fx(ah),Qx=t=>/^0[^.\s]+$/u.test(t);function RM(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Qx(t):!0}const Xr=t=>Math.round(t*1e5)/1e5,ih=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function IM(t){return t==null}const OM=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,oh=(t,s)=>o=>!!(typeof o=="string"&&OM.test(o)&&o.startsWith(t)||s&&!IM(o)&&Object.prototype.hasOwnProperty.call(o,s)),e1=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(ih);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},BM=t=>fa(0,255,t),vp={...Zo,transform:t=>Math.round(BM(t))},Si={test:oh("rgb","red"),parse:e1("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+vp.transform(t)+", "+vp.transform(s)+", "+vp.transform(o)+", "+Xr(rl.transform(r))+")"};function LM(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 Xp={test:oh("#"),parse:LM,transform:Si.transform},Mo={test:oh("hsl","hue"),parse:e1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Os.transform(Xr(s))+", "+Os.transform(Xr(o))+", "+Xr(rl.transform(r))+")"},hn={test:t=>Si.test(t)||Xp.test(t)||Mo.test(t),parse:t=>Si.test(t)?Si.parse(t):Mo.test(t)?Mo.parse(t):Xp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Si.transform(t):Mo.transform(t)},zM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $M(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(ih))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(zM))===null||o===void 0?void 0:o.length)||0)>0}const t1="number",n1="color",HM="var",PM="var(",Zy="${}",UM=/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 cl(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(UM,m=>(hn.test(m)?(r.color.push(d),c.push(n1),o.push(hn.parse(m))):m.startsWith(PM)?(r.var.push(d),c.push(HM),o.push(m)):(r.number.push(d),c.push(t1),o.push(parseFloat(m))),++d,Zy)).split(Zy);return{values:o,split:p,indexes:r,types:c}}function s1(t){return cl(t).values}function a1(t){const{split:s,types:o}=cl(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===t1?d+=Xr(c[u]):p===n1?d+=hn.transform(c[u]):d+=c[u]}return d}}const VM=t=>typeof t=="number"?0:t;function qM(t){const s=s1(t);return a1(t)(s.map(VM))}const Wa={test:$M,parse:s1,createTransformer:a1,getAnimatableNone:qM},GM=new Set(["brightness","contrast","saturate","opacity"]);function FM(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(ih)||[];if(!r)return t;const c=o.replace(r,"");let d=GM.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const KM=/\b([a-z-]*)\(.*?\)/gu,Qp={...Wa,getAnimatableNone:t=>{const s=t.match(KM);return s?s.map(FM).join(" "):t}},ZM={...qm,color:hn,backgroundColor:hn,outlineColor:hn,fill:hn,stroke:hn,borderColor:hn,borderTopColor:hn,borderRightColor:hn,borderBottomColor:hn,borderLeftColor:hn,filter:Qp,WebkitFilter:Qp},rh=t=>ZM[t];function i1(t,s){let o=rh(t);return o!==Qp&&(o=Wa),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const YM=new Set(["auto","none","0"]);function JM(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!YM.has(d)&&cl(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=i1(o,c)}const Yy=t=>t===Zo||t===Ae,Jy=(t,s)=>parseFloat(t.split(", ")[s]),Wy=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Jy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Jy(d[1],t):0}},WM=new Set(["x","y","z"]),XM=Ko.filter(t=>!WM.has(t));function QM(t){const s=[];return XM.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Vo={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:Wy(4,13),y:Wy(5,14)};Vo.translateX=Vo.x;Vo.translateY=Vo.y;const Ti=new Set;let em=!1,tm=!1;function o1(){if(tm){const t=Array.from(Ti).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=QM(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)})}tm=!1,em=!1,Ti.forEach(t=>t.complete()),Ti.clear()}function r1(){Ti.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(tm=!0)})}function eR(){r1(),o1()}class lh{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?(Ti.add(this),em||(em=!0,Nt.read(r1),Nt.resolveKeyframes(o1))):(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),Ti.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ti.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const l1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),tR=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function nR(t){const s=tR.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function c1(t,s,o=1){const[r,c]=nR(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return l1(u)?parseFloat(u):u}return Vm(c)?c1(c,s,o+1):c}const d1=t=>s=>s.test(t),sR={test:t=>t==="auto",parse:t=>t},u1=[Zo,Ae,Os,Ka,QD,XD,sR],Xy=t=>u1.find(d1(t));class f1 extends lh{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(),Vm(g))){const v=c1(g,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!$x.has(r)||s.length!==2)return;const[c,d]=s,u=Xy(c),p=Xy(d);if(u!==p)if(Yy(u)&&Yy(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++)RM(s[c])&&r.push(c);r.length&&JM(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=Vo[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]=Vo[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"&&(Wa.test(t)||t==="0")&&!t.startsWith("url("));function aR(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 iR(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:aR(t)||(o==="spring"||th(o))&&r}const oR=t=>t!==null;function Id(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(oR),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const rR=40;class p1{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=Bs.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>rR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&eR(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Bs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!iR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Id(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 nm=2e4;function m1(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<nm;)s+=o,r=t.next(s);return s>=nm?1/0:s}const At=(t,s,o)=>t+(s-t)*o;function yp(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 lR({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=yp(m,p,t+1/3),d=yp(m,p,t),u=yp(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function md(t,s){return o=>o>0?s:t}const bp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},cR=[Xp,Si,Mo],dR=t=>cR.find(s=>s.test(t));function eb(t){const s=dR(t);if(!s)return!1;let o=s.parse(t);return s===Mo&&(o=lR(o)),o}const tb=(t,s)=>{const o=eb(t),r=eb(s);if(!o||!r)return md(t,s);const c={...o};return d=>(c.red=bp(o.red,r.red,d),c.green=bp(o.green,r.green,d),c.blue=bp(o.blue,r.blue,d),c.alpha=At(o.alpha,r.alpha,d),Si.transform(c))},uR=(t,s)=>o=>s(t(o)),yl=(...t)=>t.reduce(uR),sm=new Set(["none","hidden"]);function fR(t,s){return sm.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function pR(t,s){return o=>At(t,s,o)}function ch(t){return typeof t=="number"?pR:typeof t=="string"?Vm(t)?md:hn.test(t)?tb:gR:Array.isArray(t)?h1:typeof t=="object"?hn.test(t)?tb:mR:md}function h1(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>ch(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function mR(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=ch(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function hR(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 gR=(t,s)=>{const o=Wa.createTransformer(s),r=cl(t),c=cl(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?sm.has(t)&&!c.values.length||sm.has(s)&&!r.values.length?fR(t,s):yl(h1(hR(r,c),c.values),o):md(t,s)};function g1(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?At(t,s,o):ch(t)(t,s)}const vR=5;function v1(t,s,o){const r=Math.max(s-vR,0);return Hx(o-t(r),s-r)}const It={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},_p=.001;function yR({duration:t=It.duration,bounce:s=It.bounce,velocity:o=It.velocity,mass:r=It.mass}){let c,d,u=1-s;u=fa(It.minDamping,It.maxDamping,u),t=fa(It.minDuration,It.maxDuration,ca(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-o,x=am(g,u),S=Math.exp(-b);return _p-_/x*S},d=g=>{const b=g*u*t,_=b*o+o,x=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-b),j=am(Math.pow(g,2),u);return(-c(g)+_p>0?-1:1)*((_-x)*S)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-o)*t+1;return-_p+v*b},d=g=>{const v=Math.exp(-g*t),b=(o-g)*(t*t);return v*b});const p=5/t,m=_R(c,d,p);if(t=la(t),isNaN(m))return{stiffness:It.stiffness,damping:It.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const bR=12;function _R(t,s,o){let r=o;for(let c=1;c<bR;c++)r=r-t(r)/s(r);return r}function am(t,s){return t*Math.sqrt(1-s*s)}const xR=["duration","bounce"],kR=["stiffness","damping","mass"];function nb(t,s){return s.some(o=>t[o]!==void 0)}function SR(t){let s={velocity:It.velocity,stiffness:It.stiffness,damping:It.damping,mass:It.mass,isResolvedFromDuration:!1,...t};if(!nb(t,kR)&&nb(t,xR))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*fa(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:It.mass,stiffness:c,damping:d}}else{const o=yR(t);s={...s,...o,mass:It.mass},s.isResolvedFromDuration=!0}return s}function y1(t=It.visualDuration,s=It.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:x}=SR({...o,velocity:-ca(o.velocity||0)}),S=_||0,j=g/(2*Math.sqrt(m*v)),T=u-d,N=ca(Math.sqrt(m/v)),C=Math.abs(T)<5;r||(r=C?It.restSpeed.granular:It.restSpeed.default),c||(c=C?It.restDelta.granular:It.restDelta.default);let D;if(j<1){const E=am(N,j);D=R=>{const O=Math.exp(-j*N*R);return u-O*((S+j*N*T)/E*Math.sin(E*R)+T*Math.cos(E*R))}}else if(j===1)D=E=>u-Math.exp(-N*E)*(T+(S+N*T)*E);else{const E=N*Math.sqrt(j*j-1);D=R=>{const O=Math.exp(-j*N*R),M=Math.min(E*R,300);return u-O*((S+j*N*T)*Math.sinh(M)+E*T*Math.cosh(M))/E}}const A={calculatedDuration:x&&b||null,next:E=>{const R=D(E);if(x)p.done=E>=b;else{let O=0;j<1&&(O=E===0?la(S):v1(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(m1(A),nm),R=Ux(O=>A.next(E*O).value,E,30);return E+"ms "+R}};return A}function sb({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},x=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,N=u===void 0?T:u(T);N!==T&&(j=N-b);const C=M=>-j*Math.exp(-M/r),D=M=>N+C(M),A=M=>{const $=C(M),Y=D(M);_.done=Math.abs($)<=g,_.value=_.done?N:Y};let E,R;const O=M=>{x(_.value)&&(E=M,R=y1({keyframes:[_.value,S(_.value)],velocity:v1(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 jR=vl(.42,0,1,1),TR=vl(0,0,.58,1),b1=vl(.42,0,.58,1),NR=t=>Array.isArray(t)&&typeof t[0]!="number",wR={linear:Hn,easeIn:jR,easeInOut:b1,easeOut:TR,circIn:ah,circInOut:Xx,circOut:Wx,backIn:sh,backInOut:Yx,backOut:Zx,anticipate:Jx},ab=t=>{if(nh(t)){bx(t.length===4);const[s,o,r,c]=t;return vl(s,o,r,c)}else if(typeof t=="string")return wR[t];return t};function CR(t,s,o){const r=[],c=o||g1,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]||Hn:s;p=yl(m,p)}r.push(p)}return r}function ER(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(bx(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=CR(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 _=Uo(t[b],t[b+1],v);return p[b](_)};return o?v=>g(fa(t[0],t[d-1],v)):g}function AR(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=Uo(0,s,r);t.push(At(o,1,c))}}function DR(t){const s=[0];return AR(s,t.length-1),s}function MR(t,s){return t.map(o=>o*s)}function RR(t,s){return t.map(()=>s||b1).splice(0,t.length-1)}function hd({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=NR(r)?r.map(ab):ab(r),d={done:!1,value:s[0]},u=MR(o&&o.length===s.length?o:DR(s),t),p=ER(u,s,{ease:Array.isArray(c)?c:RR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const IR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>Nt.update(s,!0),stop:()=>Ja(s),now:()=>fn.isProcessing?fn.timestamp:Bs.now()}},OR={decay:sb,inertia:sb,tween:hd,keyframes:hd,spring:y1},BR=t=>t/100;class dh extends p1{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)||lh,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=th(o)?o:OR[o]||hd;let m,g;p!==hd&&typeof s[0]!="number"&&(m=yl(BR,g1(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=m1(v));const{calculatedDuration:b}=v,_=b+c,x=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:x}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes: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:x,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 N=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?N<0:N>v;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,A=d;if(x){const M=Math.min(this.currentTime,v)/b;let $=Math.floor(M),Y=M%1;!Y&&M>=1&&(Y=1),Y===1&&$--,$=Math.min($,x+1),!!($%2)&&(S==="reverse"?(Y=1-Y,j&&(Y-=j/b)):S==="mirror"&&(A=u)),D=fa(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=Id(m,this.options,c)),T&&T(E.value),O&&this.finish(),E}get duration(){const{resolved:s}=this;return s?ca(s.calculatedDuration):0}get time(){return ca(this.currentTime)}set time(s){s=la(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=ca(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=IR,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 LR=new Set(["opacity","clipPath","filter","transform"]);function zR(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=qx(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 $R=eh(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),gd=10,HR=2e4;function PR(t){return th(t.type)||t.type==="spring"||!Vx(t.ease)}function UR(t,s){const o=new dh({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const c=[];let d=0;for(;!r.done&&d<HR;)r=o.sample(d),c.push(r.value),d+=gd;return{times:void 0,keyframes:c,duration:d-gd,ease:"linear"}}const _1={anticipate:Jx,backInOut:Yx,circInOut:Xx};function VR(t){return t in _1}class ib extends p1{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new f1(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"&&pd()&&VR(d)&&(d=_1[d]),PR(this.options)){const{onComplete:b,onUpdate:_,motionValue:x,element:S,...j}=this.options,T=UR(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=zR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(Ky(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(Id(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 ca(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return ca(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=la(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return Hn;const{animation:r}=o;Ky(r,s)}return Hn}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...x}=this.options,S=new dh({...x,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=la(this.time);g.setWithVelocity(S.sample(j-gd).value,S.sample(j).value,gd)}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 $R()&&r&&LR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const qR={type:"spring",stiffness:500,damping:25,restSpeed:10},GR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),FR={type:"keyframes",duration:.8},KR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ZR=(t,{keyframes:s})=>s.length>2?FR:Ii.has(t)?t.startsWith("scale")?GR(s[1]):qR:KR;function YR({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 uh=(t,s,o,r={},c,d)=>u=>{const p=Jm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-la(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};YR(p)||(v={...v,...ZR(t,v)}),v.duration&&(v.duration=la(v.duration)),v.repeatDelay&&(v.repeatDelay=la(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 _=Id(v.keyframes,p);if(_!==void 0)return Nt.update(()=>{v.onUpdate(_),v.onComplete()}),new wM([])}return!d&&ib.supports(v)?new ib(v):new dh(v)};function JR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function x1(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),x=m[b];if(x===void 0||v&&JR(v,b))continue;const S={delay:o,...Jm(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const N=Px(t);if(N){const C=window.MotionHandoffAnimation(N,b,Nt);C!==null&&(S.startTime=C,j=!0)}}Jp(t,b),_.start(uh(b,_,x,t.shouldReduceMotion&&$x.has(b)?{type:!1}:S,t,j));const T=_.animation;T&&g.push(T)}return p&&Promise.all(g).then(()=>{Nt.update(()=>{p&&SM(t,p)})}),g}function im(t,s,o={}){var r;const c=Rd(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(x1(t,c,o)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return WR(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 WR(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(XR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(im(g,s,{...d,delay:o+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function XR(t,s){return t.sortNodePosition(s)}function QR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>im(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=im(t,s,o);else{const c=typeof s=="function"?Rd(t,s,o.custom):s;r=Promise.all(x1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const e4=zm.length;function k1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?k1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<e4;o++){const r=zm[o],c=t.props[r];(ol(c)||c===!1)&&(s[r]=c)}return s}const t4=[...Lm].reverse(),n4=Lm.length;function s4(t){return s=>Promise.all(s.map(({animation:o,options:r})=>QR(t,o,r)))}function a4(t){let s=s4(t),o=ob(),r=!0;const c=m=>(g,v)=>{var b;const _=Rd(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:x,transitionEnd:S,...j}=_;g={...g,...j,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=k1(t.parent)||{},b=[],_=new Set;let x={},S=1/0;for(let T=0;T<n4;T++){const N=t4[T],C=o[N],D=g[N]!==void 0?g[N]:v[N],A=ol(D),E=N===m?C.isActive:null;E===!1&&(S=T);let R=D===v[N]&&D!==g[N]&&A;if(R&&r&&t.manuallyAnimateOnMount&&(R=!1),C.protectedKeys={...x},!C.isActive&&E===null||!D&&!C.prevProp||Dd(D)||typeof D=="boolean")continue;const O=i4(C.prevProp,D);let M=O||N===m&&C.isActive&&!R&&A||T>S&&A,$=!1;const Y=Array.isArray(D)?D:[D];let V=Y.reduce(c(N),{});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(x.hasOwnProperty(B))continue;let ee=!1;Yp(F)&&Yp(ge)?ee=!zx(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&&(x={...x,...V}),r&&t.blockInitialAnimation&&(M=!1),M&&(!(R&&O)||$)&&b.push(...Y.map(B=>({animation:B,options:{type:N}})))}if(_.size){const T={};_.forEach(N=>{const C=t.getBaseTarget(N),D=t.getValue(N);D&&(D.liveStyle=!0),T[N]=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 x;return(x=_.animationState)===null||x===void 0?void 0:x.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=ob(),r=!0}}}function i4(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!zx(s,t):!1}function yi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ob(){return{animate:yi(!0),whileInView:yi(),whileHover:yi(),whileTap:yi(),whileDrag:yi(),whileFocus:yi(),exit:yi()}}class Xa{constructor(s){this.isMounted=!1,this.node=s}update(){}}class o4 extends Xa{constructor(s){super(s),s.animationState||(s.animationState=a4(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Dd(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 r4=0;class l4 extends Xa{constructor(){super(...arguments),this.id=r4++}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 c4={animation:{Feature:o4},exit:{Feature:l4}},ys={x:!1,y:!1};function S1(){return ys.x||ys.y}function d4(t){return t==="x"||t==="y"?ys[t]?null:(ys[t]=!0,()=>{ys[t]=!1}):ys.x||ys.y?null:(ys.x=ys.y=!0,()=>{ys.x=ys.y=!1})}const fh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function dl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function bl(t){return{point:{x:t.pageX,y:t.pageY}}}const u4=t=>s=>fh(s)&&t(s,bl(s));function Qr(t,s,o,r){return dl(t,s,u4(o),r)}const rb=(t,s)=>Math.abs(t-s);function f4(t,s){const o=rb(t.x,s.x),r=rb(t.y,s.y);return Math.sqrt(o**2+r**2)}class j1{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=kp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,x=f4(b.offset,{x:0,y:0})>=3;if(!_&&!x)return;const{point:S}=b,{timestamp:j}=fn;this.history.push({...S,timestamp:j});const{onStart:T,onMove:N}=this.handlers;_||(T&&T(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),N&&N(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=xp(_,this.transformPagePoint),Nt.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=kp(b.type==="pointercancel"?this.lastMoveEventInfo:xp(_,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,T),S&&S(b,T)},!fh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=bl(s),p=xp(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=fn;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=o;v&&v(s,kp(p,this.history)),this.removeListeners=yl(Qr(this.contextWindow,"pointermove",this.handlePointerMove),Qr(this.contextWindow,"pointerup",this.handlePointerUp),Qr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ja(this.updatePoint)}}function xp(t,s){return s?{point:s(t.point)}:t}function lb(t,s){return{x:t.x-s.x,y:t.y-s.y}}function kp({point:t},s){return{point:t,delta:lb(t,T1(s)),offset:lb(t,p4(s)),velocity:m4(s,.1)}}function p4(t){return t[0]}function T1(t){return t[t.length-1]}function m4(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=T1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>la(s)));)o--;if(!r)return{x:0,y:0};const d=ca(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 N1=1e-4,h4=1-N1,g4=1+N1,w1=.01,v4=0-w1,y4=0+w1;function Pn(t){return t.max-t.min}function b4(t,s,o){return Math.abs(t-s)<=o}function cb(t,s,o,r=.5){t.origin=r,t.originPoint=At(s.min,s.max,t.origin),t.scale=Pn(o)/Pn(s),t.translate=At(o.min,o.max,t.origin)-t.originPoint,(t.scale>=h4&&t.scale<=g4||isNaN(t.scale))&&(t.scale=1),(t.translate>=v4&&t.translate<=y4||isNaN(t.translate))&&(t.translate=0)}function el(t,s,o,r){cb(t.x,s.x,o.x,r?r.originX:void 0),cb(t.y,s.y,o.y,r?r.originY:void 0)}function db(t,s,o){t.min=o.min+s.min,t.max=t.min+Pn(s)}function _4(t,s,o){db(t.x,s.x,o.x),db(t.y,s.y,o.y)}function ub(t,s,o){t.min=s.min-o.min,t.max=t.min+Pn(s)}function tl(t,s,o){ub(t.x,s.x,o.x),ub(t.y,s.y,o.y)}function x4(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?At(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?At(o,t,r.max):Math.min(t,o)),t}function fb(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 k4(t,{top:s,left:o,bottom:r,right:c}){return{x:fb(t.x,o,c),y:fb(t.y,s,r)}}function pb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function S4(t,s){return{x:pb(t.x,s.x),y:pb(t.y,s.y)}}function j4(t,s){let o=.5;const r=Pn(t),c=Pn(s);return c>r?o=Uo(s.min,s.max-r,t.min):r>c&&(o=Uo(t.min,t.max-c,s.min)),fa(0,1,o)}function T4(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 om=.35;function N4(t=om){return t===!1?t=0:t===!0&&(t=om),{x:mb(t,"left","right"),y:mb(t,"top","bottom")}}function mb(t,s,o){return{min:hb(t,s),max:hb(t,o)}}function hb(t,s){return typeof t=="number"?t:t[s]||0}const gb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ro=()=>({x:gb(),y:gb()}),vb=()=>({min:0,max:0}),Lt=()=>({x:vb(),y:vb()});function is(t){return[t("x"),t("y")]}function C1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function w4({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function C4(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 Sp(t){return t===void 0||t===1}function rm({scale:t,scaleX:s,scaleY:o}){return!Sp(t)||!Sp(s)||!Sp(o)}function xi(t){return rm(t)||E1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function E1(t){return yb(t.x)||yb(t.y)}function yb(t){return t&&t!=="0%"}function vd(t,s,o){const r=t-o,c=s*r;return o+c}function bb(t,s,o,r,c){return c!==void 0&&(t=vd(t,c,r)),vd(t,o,r)+s}function lm(t,s=0,o=1,r,c){t.min=bb(t.min,s,o,r,c),t.max=bb(t.max,s,o,r,c)}function A1(t,{x:s,y:o}){lm(t.x,s.translate,s.scale,s.originPoint),lm(t.y,o.translate,o.scale,o.originPoint)}const _b=.999999999999,xb=1.0000000000001;function E4(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&&Oo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,A1(t,u)),r&&xi(d.latestValues)&&Oo(t,d.latestValues))}s.x<xb&&s.x>_b&&(s.x=1),s.y<xb&&s.y>_b&&(s.y=1)}function Io(t,s){t.min=t.min+s,t.max=t.max+s}function kb(t,s,o,r,c=.5){const d=At(t.min,t.max,c);lm(t,s,o,d,r)}function Oo(t,s){kb(t.x,s.x,s.scaleX,s.scale,s.originX),kb(t.y,s.y,s.scaleY,s.scale,s.originY)}function D1(t,s){return C1(C4(t.getBoundingClientRect(),s))}function A4(t,s,o){const r=D1(t,o),{scroll:c}=s;return c&&(Io(r.x,c.offset.x),Io(r.y,c.offset.y)),r}const M1=({current:t})=>t?t.ownerDocument.defaultView:null,D4=new WeakMap;class M4{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Lt(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(bl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:x,onDragStart:S}=this.getProps();if(_&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=d4(_),!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),is(T=>{let N=this.getAxisMotionValue(T).get()||0;if(Os.test(N)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[T];D&&(N=Pn(D)*(parseFloat(N)/100))}}this.originPoint[T]=N}),S&&Nt.postRender(()=>S(v,b)),Jp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:x,onDirectionLock:S,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=b;if(x&&this.currentDirection===null){this.currentDirection=R4(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=()=>is(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 j1(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&&Nt.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||!Vc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=x4(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&&Do(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=k4(c.layoutBox,o):this.constraints=!1,this.elastic=N4(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&is(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=T4(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Do(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=A4(r,c.root,this.visualElement.getTransformPagePoint());let u=S4(c.layout.layoutBox,d);if(o){const p=o(w4(u));this.hasMutatedConstraints=!!p,p&&(u=C1(p))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=is(v=>{if(!Vc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,x=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:x,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 Jp(this.visualElement,s),r.start(uh(s,r,0,o,this.visualElement,!1))}stopAnimation(){is(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){is(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){is(o=>{const{drag:r}=this.getProps();if(!Vc(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]-At(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Do(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};is(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=j4({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(),is(u=>{if(!Vc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(At(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;D4.set(this.visualElement,this);const s=this.visualElement.current,o=Qr(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Do(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()),Nt.read(r);const u=dl(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(is(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=om,dragMomentum:p=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Vc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function R4(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class I4 extends Xa{constructor(s){super(s),this.removeGroupControls=Hn,this.removeListeners=Hn,this.controls=new M4(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Hn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Sb=t=>(s,o)=>{t&&Nt.postRender(()=>t(s,o))};class O4 extends Xa{constructor(){super(...arguments),this.removePointerDownListener=Hn}onPointerDown(s){this.session=new j1(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:Sb(s),onStart:Sb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&Nt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Qr(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 ad={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function jb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Pr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=jb(t,s.target.x),r=jb(t,s.target.y);return`${o}% ${r}%`}},B4={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=Wa.parse(t);if(c.length>5)return r;const d=Wa.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=At(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 L4 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;cM(z4),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()})),ad.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()||Nt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Hm.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 R1(t){const[s,o]=vx(),r=y.useContext(Rm);return a.jsx(L4,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(Tx),isPresent:s,safeToRemove:o})}const z4={borderRadius:{...Pr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Pr,borderTopRightRadius:Pr,borderBottomLeftRadius:Pr,borderBottomRightRadius:Pr,boxShadow:B4};function $4(t,s,o){const r=gn(t)?t:ll(t);return r.start(uh("",r,s,o)),r.animation}function H4(t){return t instanceof SVGElement&&t.tagName!=="svg"}const P4=(t,s)=>t.depth-s.depth;class U4{constructor(){this.children=[],this.isDirty=!1}add(s){Wm(this.children,s),this.isDirty=!0}remove(s){Xm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(P4),this.isDirty=!1,this.children.forEach(s)}}function V4(t,s){const o=Bs.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(Ja(r),t(d-s))};return Nt.read(r,!0),()=>Ja(r)}const I1=["TopLeft","TopRight","BottomLeft","BottomRight"],q4=I1.length,Tb=t=>typeof t=="string"?parseFloat(t):t,Nb=t=>typeof t=="number"||Ae.test(t);function G4(t,s,o,r,c,d){c?(t.opacity=At(0,o.opacity!==void 0?o.opacity:1,F4(r)),t.opacityExit=At(s.opacity!==void 0?s.opacity:1,0,K4(r))):d&&(t.opacity=At(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<q4;u++){const p=`border${I1[u]}Radius`;let m=wb(s,p),g=wb(o,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||Nb(m)===Nb(g)?(t[p]=Math.max(At(Tb(m),Tb(g),r),0),(Os.test(g)||Os.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||o.rotate)&&(t.rotate=At(s.rotate||0,o.rotate||0,r))}function wb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const F4=O1(0,.5,Wx),K4=O1(.5,.95,Hn);function O1(t,s,o){return r=>r<t?0:r>s?1:o(Uo(t,s,r))}function Cb(t,s){t.min=s.min,t.max=s.max}function Qn(t,s){Cb(t.x,s.x),Cb(t.y,s.y)}function Eb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Ab(t,s,o,r,c){return t-=s,t=vd(t,1/o,r),c!==void 0&&(t=vd(t,1/c,r)),t}function Z4(t,s=0,o=1,r=.5,c,d=t,u=t){if(Os.test(s)&&(s=parseFloat(s),s=At(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=At(d.min,d.max,r);t===d&&(p-=s),t.min=Ab(t.min,s,o,p,c),t.max=Ab(t.max,s,o,p,c)}function Db(t,s,[o,r,c],d,u){Z4(t,s[o],s[r],s[c],s.scale,d,u)}const Y4=["x","scaleX","originX"],J4=["y","scaleY","originY"];function Mb(t,s,o,r){Db(t.x,s,Y4,o?o.x:void 0,r?r.x:void 0),Db(t.y,s,J4,o?o.y:void 0,r?r.y:void 0)}function Rb(t){return t.translate===0&&t.scale===1}function B1(t){return Rb(t.x)&&Rb(t.y)}function Ib(t,s){return t.min===s.min&&t.max===s.max}function W4(t,s){return Ib(t.x,s.x)&&Ib(t.y,s.y)}function Ob(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function L1(t,s){return Ob(t.x,s.x)&&Ob(t.y,s.y)}function Bb(t){return Pn(t.x)/Pn(t.y)}function Lb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class X4{constructor(){this.members=[]}add(s){Wm(this.members,s),s.scheduleRender()}remove(s){if(Xm(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 Q4(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:x,skewY:S}=o;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),x&&(r+=`skewX(${x}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 ki={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zr=typeof window<"u"&&window.MotionDebug!==void 0,jp=["","X","Y","Z"],e3={visibility:"hidden"},zb=1e3;let t3=0;function Tp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function z1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Px(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",Nt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&z1(r)}function $1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=t3++,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,Zr&&(ki.totalNodes=ki.resolvedTargetDeltas=ki.recalculatedProjection=0),this.nodes.forEach(a3),this.nodes.forEach(c3),this.nodes.forEach(d3),this.nodes.forEach(i3),Zr&&window.MotionDebug.record(ki)},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 U4)}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=H4(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=V4(_,250),ad.hasAnimatedSinceResize&&(ad.hasAnimatedSinceResize=!1,this.nodes.forEach(Hb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:x,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||h3,{onLayoutAnimationStart:T,onLayoutAnimationComplete:N}=v.getProps(),C=!this.targetLayout||!L1(this.targetLayout,S)||x,D=!_&&x;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={...Jm(j,"layout"),onPlay:T,onComplete:N};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else _||Hb(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,Ja(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(u3),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&&z1(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($b);return}this.isUpdating||this.nodes.forEach(r3),this.isUpdating=!1,this.nodes.forEach(l3),this.nodes.forEach(n3),this.nodes.forEach(s3),this.clearAllSnapshots();const p=Bs.now();fn.delta=fa(0,1e3/60,p-fn.timestamp),fn.timestamp=p,fn.isProcessing=!0,gp.update.process(fn),gp.preRender.process(fn),gp.render.process(fn),fn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Hm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(o3),this.sharedNodes.forEach(f3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Nt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Nt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Lt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!B1(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||xi(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)),g3(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Lt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(v3))){const{scroll:v}=this.root;v&&(Io(m.x,v.offset.x),Io(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Lt();if(Qn(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&&Qn(m,u),Io(m.x,b.offset.x),Io(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Lt();Qn(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&&Oo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),xi(v.latestValues)&&Oo(m,v.latestValues)}return xi(this.latestValues)&&Oo(m,this.latestValues),m}removeTransform(u){const p=Lt();Qn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!xi(g.latestValues))continue;rm(g.latestValues)&&g.updateSnapshot();const v=Lt(),b=g.measurePageBox();Qn(v,b),Mb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return xi(this.latestValues)&&Mb(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 x=this.getClosestProjectingParent();x&&x.layout&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lt(),this.relativeTargetOrigin=Lt(),tl(this.relativeTargetOrigin,this.layout.layoutBox,x.layout.layoutBox),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Lt(),this.targetWithTransforms=Lt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_4(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Qn(this.target,this.layout.layoutBox),A1(this.target,this.targetDelta)):Qn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const x=this.getClosestProjectingParent();x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Lt(),this.relativeTargetOrigin=Lt(),tl(this.relativeTargetOrigin,this.target,x.target),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Zr&&ki.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||rm(this.parent.latestValues)||E1(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;Qn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,x=this.treeScale.y;E4(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Lt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Eb(this.prevProjectionDelta.x,this.projectionDelta.x),Eb(this.prevProjectionDelta.y,this.projectionDelta.y)),el(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==x||!Lb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Lb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Zr&&ki.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=Ro(),this.projectionDelta=Ro(),this.projectionDeltaWithTransform=Ro()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=Ro();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Lt(),x=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=x!==S,T=this.getStack(),N=!T||T.members.length<=1,C=!!(j&&!N&&this.options.crossfade===!0&&!this.path.some(m3));this.animationProgress=0;let D;this.mixTargetDelta=A=>{const E=A/1e3;Pb(b.x,u.x,E),Pb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(tl(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p3(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&W4(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Lt()),Qn(D,this.relativeTarget)),j&&(this.animationValues=v,G4(v,g,this.latestValues,E,C,N)),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&&(Ja(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nt.update(()=>{ad.hasAnimatedSinceResize=!0,this.currentAnimation=$4(0,zb,{...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(zb),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&&H1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Lt();const b=Pn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Pn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Qn(p,m),Oo(p,v),el(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new X4),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&&Tp("z",u,g,this.animationValues);for(let v=0;v<jp.length;v++)Tp(`rotate${jp[v]}`,u,g,this.animationValues),Tp(`skew${jp[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 e3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=nd(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=nd(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!xi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=Q4(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x,y:S}=this.projectionDelta;g.transformOrigin=`${x.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 fd){if(_[j]===void 0)continue;const{correct:T,applyTo:N}=fd[j],C=g.transform==="none"?_[j]:T(_[j],b);if(N){const D=N.length;for(let A=0;A<D;A++)g[N[A]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?nd(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($b),this.root.sharedNodes.clear()}}}function n3(t){t.updateLayout()}function s3(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"?is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],x=Pn(_);_.min=r[b].min,_.max=_.min+x}):H1(d,o.layoutBox,r)&&is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],x=Pn(r[b]);_.max=_.min+x,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+x)});const p=Ro();el(p,r,o.layoutBox);const m=Ro();u?el(m,t.applyTransform(c,!0),o.measuredBox):el(m,r,o.layoutBox);const g=!B1(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:x}=b;if(_&&x){const S=Lt();tl(S,o.layoutBox,_.layoutBox);const j=Lt();tl(j,r,x.layoutBox),L1(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 a3(t){Zr&&ki.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 i3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function o3(t){t.clearSnapshot()}function $b(t){t.clearMeasurements()}function r3(t){t.isLayoutDirty=!1}function l3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Hb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function c3(t){t.resolveTargetDelta()}function d3(t){t.calcProjection()}function u3(t){t.resetSkewAndRotation()}function f3(t){t.removeLeadSnapshot()}function Pb(t,s,o){t.translate=At(s.translate,0,o),t.scale=At(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Ub(t,s,o,r){t.min=At(s.min,o.min,r),t.max=At(s.max,o.max,r)}function p3(t,s,o,r){Ub(t.x,s.x,o.x,r),Ub(t.y,s.y,o.y,r)}function m3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const h3={duration:.45,ease:[.4,0,.1,1]},Vb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),qb=Vb("applewebkit/")&&!Vb("chrome/")?Math.round:Hn;function Gb(t){t.min=qb(t.min),t.max=qb(t.max)}function g3(t){Gb(t.x),Gb(t.y)}function H1(t,s,o){return t==="position"||t==="preserve-aspect"&&!b4(Bb(s),Bb(o),.2)}function v3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const y3=$1({attachResizeListener:(t,s)=>dl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Np={current:void 0},P1=$1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Np.current){const t=new y3({});t.mount(window),t.setOptions({layoutScroll:!0}),Np.current=t}return Np.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),b3={pan:{Feature:O4},drag:{Feature:I4,ProjectionNode:P1,MeasureLayout:R1}};function _3(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 U1(t,s){const o=_3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Fb(t){return s=>{s.pointerType==="touch"||S1()||t(s)}}function x3(t,s,o={}){const[r,c,d]=U1(t,o),u=Fb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Fb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function Kb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&Nt.postRender(()=>d(s,bl(s)))}class k3 extends Xa{mount(){const{current:s}=this.node;s&&(this.unmount=x3(s,o=>(Kb(this.node,o,"Start"),r=>Kb(this.node,r,"End"))))}unmount(){}}class S3 extends Xa{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=yl(dl(this.node.current,"focus",()=>this.onFocus()),dl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const V1=(t,s)=>s?t===s?!0:V1(t,s.parentElement):!1,j3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function T3(t){return j3.has(t.tagName)||t.tabIndex!==-1}const Yr=new WeakSet;function Zb(t){return s=>{s.key==="Enter"&&t(s)}}function wp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const N3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=Zb(()=>{if(Yr.has(o))return;wp(o,"down");const c=Zb(()=>{wp(o,"up")}),d=()=>wp(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 Yb(t){return fh(t)&&!S1()}function w3(t,s,o={}){const[r,c,d]=U1(t,o),u=p=>{const m=p.currentTarget;if(!Yb(p)||Yr.has(m))return;Yr.add(m);const g=s(p),v=(x,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Yb(x)||!Yr.has(m))&&(Yr.delete(m),typeof g=="function"&&g(x,{success:S}))},b=x=>{v(x,o.useGlobalTarget||V1(m,x.target))},_=x=>{v(x,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!T3(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(o.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>N3(g,c),c)}),d}function Jb(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&&Nt.postRender(()=>d(s,bl(s)))}class C3 extends Xa{mount(){const{current:s}=this.node;s&&(this.unmount=w3(s,o=>(Jb(this.node,o,"Start"),(r,{success:c})=>Jb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const cm=new WeakMap,Cp=new WeakMap,E3=t=>{const s=cm.get(t.target);s&&s(t)},A3=t=>{t.forEach(E3)};function D3({root:t,...s}){const o=t||document;Cp.has(o)||Cp.set(o,{});const r=Cp.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(A3,{root:t,...s})),r[c]}function M3(t,s,o){const r=D3(s);return cm.set(t,o),r.observe(t),()=>{cm.delete(t),r.unobserve(t)}}const R3={some:0,all:1};class I3 extends Xa{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:R3[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return M3(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(O3(s,o))&&this.startObserver()}unmount(){}}function O3({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const B3={inView:{Feature:I3},tap:{Feature:C3},focus:{Feature:S3},hover:{Feature:k3}},L3={layout:{ProjectionNode:P1,MeasureLayout:R1}},yd={current:null},ph={current:!1};function q1(){if(ph.current=!0,!!Bm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>yd.current=t.matches;t.addListener(s),s()}else yd.current=!1}const z3=[...u1,hn,Wa],$3=t=>z3.find(d1(t)),Wb=new WeakMap;function H3(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,ll(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,ll(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const Xb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class P3{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=lh,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=Bs.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,Nt.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=Md(o),this.isVariantNode=Sx(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(o,{},this);for(const x in _){const S=_[x];m[x]!==void 0&&gn(S)&&S.set(m[x],!1)}}mount(s){this.current=s,Wb.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)),ph.current||q1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Wb.delete(this.current),this.projection&&this.projection.unmount(),Ja(this.notifyUpdate),Ja(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=Ii.has(s),c=o.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&Nt.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 Po){const o=Po[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Lt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<Xb.length;r++){const c=Xb[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=H3(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=ll(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"&&(l1(c)||Qx(c))?c=parseFloat(c):!$3(c)&&Wa.test(o)&&(c=i1(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=Um(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 G1 extends P3{constructor(){super(...arguments),this.KeyframeResolver=f1}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 U3(t){return window.getComputedStyle(t)}class V3 extends G1{constructor(){super(...arguments),this.type="html",this.renderInstance=Mx}readValueFromInstance(s,o){if(Ii.has(o)){const r=rh(o);return r&&r.default||0}else{const r=U3(s),c=(Ex(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return D1(s,o)}build(s,o,r){Gm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return Ym(s,o,r)}}class q3 extends G1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Lt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Ii.has(o)){const r=rh(o);return r&&r.default||0}return o=Rx.has(o)?o:$m(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return Bx(s,o,r)}build(s,o,r){Fm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){Ix(s,o,r,c)}mount(s){this.isSVGTag=Zm(s.tagName),super.mount(s)}}const G3=(t,s)=>Pm(t)?new q3(s):new V3(s,{allowProjection:t!==y.Fragment}),F3=yM({...c4,...B3,...b3,...L3},G3),Pt=RD(F3);function K3(){!ph.current&&q1();const[t]=y.useState(yd.current);return t}const Z3="_overlay_cmicx_1",Y3="_dialog_cmicx_11",J3="_title_cmicx_30",W3="_description_cmicx_38",X3="_actions_cmicx_45",Q3="_cancelButton_cmicx_52",e6="_confirmButton_cmicx_79",bi={overlay:Z3,dialog:Y3,title:J3,description:W3,actions:X3,cancelButton:Q3,confirmButton:e6};function _s({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return a.jsx(os,{children:t&&a.jsx(Pt.div,{className:bi.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:a.jsxs(Pt.div,{className:bi.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:[a.jsx("h3",{id:u,className:bi.title,children:s}),o&&a.jsx("p",{id:p,className:bi.description,children:o}),a.jsxs("div",{className:bi.actions,children:[a.jsx("button",{type:"button",className:bi.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),a.jsx("button",{type:"button",className:bi.confirmButton,onClick:c,children:r})]})]})})})}const t6="_skeleton_1gqp4_9",n6="_circular_1gqp4_17",s6="_textContainer_1gqp4_26",a6="_card_1gqp4_31",bd={skeleton:t6,circular:n6,textContainer:s6,card:a6};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[bd.skeleton,r==="circular"?bd.circular:"",c??""].filter(Boolean).join(" ");return a.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function dm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return a.jsx("div",{className:`${bd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>a.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function um({lines:t=2,className:s}){return a.jsxs("div",{className:`${bd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[a.jsx(Te,{width:"40%",height:"1.25rem"}),a.jsx(dm,{lines:t})]})}const i6="_spinner_1uyt1_1",o6="_spin_1uyt1_1",r6="_sm_1uyt1_14",l6="_md_1uyt1_20",c6="_lg_1uyt1_26",d6="_xl_1uyt1_32",Qb={spinner:i6,spin:o6,sm:r6,md:l6,lg:c6,xl:d6};function F1({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return a.jsx("span",{className:`${Qb.spinner} ${Qb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function Od(t){return`/${t.replace(/^\//,"")}`}const u6="_splash_1bn1g_1",f6="_logo_1bn1g_11",e_={splash:u6,logo:f6};function K1(){return a.jsxs("div",{className:e_.splash,"data-testid":"splash-screen",children:[a.jsx("img",{src:Od("grackle-logo.png"),alt:"Grackle",className:e_.logo}),a.jsx(F1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const p6="_wrapper_4e5yt_1",m6="_wrapperBlock_4e5yt_6",h6="_tooltip_4e5yt_11",g6="_visible_4e5yt_31",v6="_top_4e5yt_41",y6="_bottom_4e5yt_48",b6="_left_4e5yt_55",_6="_right_4e5yt_62",Ur={wrapper:p6,wrapperBlock:m6,tooltip:h6,visible:g6,top:v6,bottom:y6,left:b6,right:_6},x6=300,qc=6;function Ci({text:t,placement:s="top",delayMs:o=x6,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),x=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-qc,ne=$.left+$.width/2-Y.width/2;break;case"bottom":V=$.bottom+qc,ne=$.left+$.width/2-Y.width/2;break;case"left":V=$.top+$.height/2-Y.height/2,ne=$.left-Y.width-qc;break;case"right":V=$.top+$.height/2-Y.height/2,ne=$.right+qc;break}v({top:V,left:ne})},[s]),N=y.useCallback($=>{x.current!==void 0&&clearTimeout(x.current),x.current=setTimeout(()=>{T(),m(!0),x.current=void 0},$)},[T]),C=y.useCallback(()=>{N(o)},[o,N]),D=y.useCallback(()=>{N(0)},[N]),A=y.useCallback(()=>{x.current!==void 0&&(clearTimeout(x.current),x.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(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const E=r?"span":"div",R=[r?Ur.wrapper:Ur.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=a.jsx("div",{ref:_,id:S,role:"tooltip",className:`${Ur.tooltip} ${Ur[s]} ${p?Ur.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return a.jsxs(E,{ref:b,className:R,onMouseEnter:C,onMouseLeave:A,onFocus:D,onBlur:A,children:[O,j?P2.createPortal(M,document.body):null]})}const k6="_attemptSelector_ggigl_1",S6="_attemptLabel_ggigl_17",j6="_attemptButton_ggigl_21",T6="_attemptActive_ggigl_38",N6="_attemptStatus_ggigl_44",Vr={attemptSelector:k6,attemptLabel:S6,attemptButton:j6,attemptActive:T6,attemptStatus:N6};function w6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return a.jsxs("div",{className:Vr.attemptSelector,"data-testid":"attempt-selector",children:[a.jsx("span",{className:Vr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return a.jsxs("button",{className:`${Vr.attemptButton} ${d?Vr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&a.jsx("span",{className:Vr.attemptStatus,children:u})]},r.id)})]})}const C6="_row_ldkru_1",E6="_hoverActions_ldkru_5",A6="_hoverButton_ldkru_31",D6="_selectingRow_ldkru_72",M6="_selected_ldkru_83",R6="_checkboxArea_ldkru_90",I6="_checkbox_ldkru_90",O6="_contentArea_ldkru_106",gs={row:C6,hoverActions:E6,hoverButton:A6,selectingRow:D6,selected:M6,checkboxArea:R6,checkbox:I6,contentArea:O6};function B6({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]),x=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?a.jsxs("div",{className:`${gs.row} ${gs.selectingRow} ${r?gs.selected:""}`,onClick:x,"data-testid":"event-selectable-row",children:[a.jsx("div",{className:gs.checkboxArea,children:a.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:gs.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),a.jsx("div",{className:gs.contentArea,children:m})]}):a.jsxs("div",{className:gs.row,"data-testid":"event-hover-row",children:[a.jsxs("div",{className:gs.hoverActions,"data-testid":"event-hover-actions",children:[a.jsx("button",{type:"button",className:gs.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?a.jsx(Ai,{size:Ye,"aria-hidden":"true"}):a.jsx(V_,{size:Ye,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:gs.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:a.jsx(YT,{size:Ye,"aria-hidden":"true"})})]}),m]}):a.jsx("div",{className:gs.row,children:m})}const L6="_bar_lagql_1",z6="_left_lagql_21",$6="_right_lagql_27",H6="_count_lagql_33",P6="_toggleButton_lagql_40",U6="_copyButton_lagql_68",V6="_forwardButton_lagql_108",q6="_cancelButton_lagql_148",Pa={bar:L6,left:z6,right:$6,count:H6,toggleButton:P6,copyButton:U6,forwardButton:V6,cancelButton:q6};function G6({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:p}){const m=t>0&&t>=s;return a.jsxs(Pt.div,{className:Pa.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[a.jsxs("div",{className:Pa.left,children:[a.jsxs("span",{className:Pa.count,"data-testid":"floating-bar-count",children:[t," selected"]}),a.jsx("button",{type:"button",className:Pa.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),a.jsxs("div",{className:Pa.right,children:[a.jsxs("button",{type:"button",className:Pa.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[a.jsx(Wj,{size:Ye,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&a.jsx(Ci,{text:u?"No active sessions to forward to":"Forward to another session",children:a.jsxs("button",{type:"button",className:Pa.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[a.jsx(iT,{size:Ye,"aria-hidden":"true"}),"Forward"]})}),a.jsx("button",{type:"button",className:Pa.cancelButton,onClick:p,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:a.jsx(Ls,{size:Ye,"aria-hidden":"true"})})]})]})}const F6="_overlay_1hra6_1",K6="_dialog_1hra6_11",Z6="_header_1hra6_27",Y6="_title_1hra6_35",J6="_closeButton_1hra6_42",W6="_filterRow_1hra6_78",X6="_searchIcon_1hra6_86",Q6="_filterInput_1hra6_91",e5="_list_1hra6_108",t5="_emptyItem_1hra6_116",n5="_sessionRow_1hra6_123",s5="_sessionMain_1hra6_158",a5="_envName_1hra6_165",i5="_personaName_1hra6_175",o5="_statusBadge_1hra6_189",r5="_status_running_1hra6_198",l5="_status_idle_1hra6_202",c5="_status_other_1hra6_206",d5="_sessionPrompt_1hra6_211",u5="_noSessions_1hra6_220",Zt={overlay:F6,dialog:K6,header:Z6,title:Y6,closeButton:J6,filterRow:W6,searchIcon:X6,filterInput:Q6,list:e5,emptyItem:t5,sessionRow:n5,sessionMain:s5,envName:a5,personaName:i5,statusBadge:o5,status_running:r5,status_idle:l5,status_other:c5,sessionPrompt:d5,noSessions:u5};function f5(t){return t==="running"?"running":t==="idle"?"idle":t}function p5({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})),x=s.length>4,S=u.trim()?_.filter(({session:j,environmentName:T})=>T.toLowerCase().includes(u.toLowerCase())||j.prompt.toLowerCase().includes(u.toLowerCase())):_;return a.jsx(os,{children:t&&a.jsx(Pt.div,{className:Zt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:a.jsxs(Pt.div,{ref:m,className:Zt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[a.jsxs("div",{className:Zt.header,children:[a.jsx("h3",{className:Zt.title,children:"Forward to session"}),a.jsx("button",{ref:g,type:"button",className:Zt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:a.jsx(Ls,{size:Ye,"aria-hidden":"true"})})]}),x&&a.jsxs("div",{className:Zt.filterRow,children:[a.jsx(Up,{size:Ye,className:Zt.searchIcon,"aria-hidden":"true"}),a.jsx("input",{type:"text",className:Zt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{p(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?a.jsxs("div",{className:Zt.noSessions,"data-testid":"session-picker-no-sessions",children:[a.jsx(Up,{size:Ht,"aria-hidden":"true"}),a.jsx("p",{children:"No active sessions to forward to."})]}):a.jsx("ul",{className:Zt.list,"data-testid":"session-picker-list",children:S.length===0?a.jsx("li",{className:Zt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):S.map(({session:j,environmentName:T})=>{const N=j.personaId?b.get(j.personaId)??void 0:void 0;return a.jsx("li",{children:a.jsxs("button",{type:"button",className:Zt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[a.jsxs("div",{className:Zt.sessionMain,children:[a.jsx("span",{className:Zt.envName,children:T}),N!==void 0&&a.jsx("span",{className:Zt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:N}),a.jsx("span",{className:`${Zt.statusBadge} ${Zt[`status_${j.status}`]??Zt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:f5(j.status)})]}),a.jsx("div",{className:Zt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const Z1=50;function m5(t,s,o,r,c=Z1){return r?t<c:s-t-o<c}function h5(t,s){const o=s-t;return o>0?o:0}function g5({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 x=m5(v.scrollTop,v.scrollHeight,v.clientHeight,o,Z1);x!==b&&(b=x,d(x))}))};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=h5(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 v5=new Set(["text","output","user_input","tool_use","tool_result","error"]);function ul(t){return v5.has(t.eventType)}function y5(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 t_(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 Y1(t){var o;const s=[];for(const r of t){if(!ul(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=t_(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}):
@@ -318,11 +318,11 @@ ${JSON.stringify(u,void 0,2)}
318
318
  \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
319
319
  ${r.content}`);break}}}return s.join(`
320
320
 
321
- `)}function g5(t,s){const o=v5(t),r=Z1(s);return`--- Forwarded from ${o} ---
321
+ `)}function b5(t,s){const o=_5(t),r=Y1(s);return`--- Forwarded from ${o} ---
322
322
 
323
323
  ${r}
324
324
 
325
- --- End forwarded ---`}function v5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function y5({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 M=new Set(C);for(let A=T;A<=w;A++)A<t.length&&ul(t[A])&&M.add(A);return M})}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++)ul(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 b5="_wrapper_1cdza_1",_5="_scrollContainer_1cdza_9",x5="_selectingPadding_1cdza_16",k5="_toolbar_1cdza_20",S5="_directionToggle_1cdza_27",j5="_scrollToAnchor_1cdza_65",T5="_scrollToAnchorBottom_1cdza_89",w5="_scrollToAnchorTop_1cdza_93",N5="_eventOverflowWarning_1cdza_97",oa={wrapper:b5,scrollContainer:_5,selectingPadding:x5,toolbar:k5,directionToggle:S5,scrollToAnchor:j5,scrollToAnchorBottom:T5,scrollToAnchorTop:w5,eventOverflowWarning:N5},C5=10*1024,E5=new Set(["running","idle"]);function A5(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 Y1="grackle-stream-direction";function M5(){try{return localStorage.getItem(Y1)==="reversed"}catch{return!1}}function D5({eventsDropped:t}){return t<=0?a.jsx(a.Fragment,{}):a.jsxs("div",{className:oa.eventOverflowWarning,role:"alert",children:[a.jsx(Sm,{size:Ht,"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 mh({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(M5),k=q3(),[S,j]=y.useState(!1),[T,w]=y.useState(!1),[C,M]=y.useState(void 0),A=y5({events:t,formatForClipboard:Z1}),E=y.useMemo(()=>t.filter(ul).length,[t]),R=y.useMemo(()=>c?c.filter(ce=>E5.has(ce.status)&&ce.id!==d):[],[c,d]),O=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:D,scrollToAnchor:$}=p5({scrollRef:v,contentLength:t.length,isReversed:b,paused:A.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(Y1,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(Me=>Me.id===ce);if(!me)return ce.slice(0,8);const xe=u==null?void 0:u.find(Me=>Me.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 Me=A.selectedCount;r==null||r(`Forwarded ${Me} message${Me===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),Me=g5(xe,me);if(new TextEncoder().encode(Me).length>C5){M({sessionId:ce,text:Me}),w(!0);return}Z(ce,Me).catch(()=>{})},[ne,le,d,Z]),H=y.useCallback(()=>{w(!1),C&&(Z(C.sessionId,C.text).catch(()=>{}),M(void 0))},[C,Z]),B=y.useCallback(()=>{w(!1),M(void 0)},[]),F=k?0:.2,ge=b?-8:8,ee=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return a.jsxs("div",{className:oa.wrapper,children:[a.jsx("div",{className:oa.toolbar,children:a.jsx(Ci,{text:b?"Showing newest first":"Showing oldest first",children:a.jsx("button",{className:oa.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?a.jsx(xy,{size:Ht,"aria-hidden":"true"}):a.jsx(ky,{size:Ht,"aria-hidden":"true"})})})}),a.jsxs("div",{ref:v,className:`${oa.scrollContainer} ${A.isSelecting?oa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,a.jsx(D5,{eventsDropped:s}),a.jsx(os,{initial:!1,children:O.map((ce,me)=>{const xe=b?t.length-1-me:me;return a.jsx(Pt.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:F,ease:"easeOut"},children:a.jsx(R6,{copyText:h5(ce),isContentBearing:ul(ce),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(xe),checkboxLabel:A5(ce),onSelect:()=>{A.enterSelectionMode(xe)},onToggle:Me=>{A.toggleEvent(xe,Me)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:a.jsx(yM,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:g})})},`${ce.sessionId}-${ce.timestamp}-${xe}`)})})]}),a.jsx(os,{children:A.isSelecting&&a.jsx(U6,{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})}),a.jsx(d5,{isOpen:S,sessions:R,environments:u??[],personas:p,onSelect:se,onCancel:()=>{j(!1)}}),a.jsx(_s,{isOpen:T,title:"Send large message?",description:`This will forward a large message (${ee} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:B}),a.jsx(os,{children:!D&&a.jsxs(Pt.button,{className:`${oa.scrollToAnchor} ${b?oa.scrollToAnchorTop:oa.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?a.jsx(ky,{size:Ht,"aria-hidden":"true"}):a.jsx(xy,{size:Ht,"aria-hidden":"true"})," New events"]})})]})}function hh(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 D=m?s.trim():s;if(O===D){w();return}o(O),w()},[g,s,m,r,o,w]),M=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:M,cancelEdit:w,save:C,setDraft:j,clearError:T,handleBlur:A,handleKeyDown:E,ignoreInitialBlurRef:k}}const R5="_editFieldWrapper_yuzty_1",I5="_editInput_yuzty_10",O5="_editTextarea_yuzty_42",B5="_editSelect_yuzty_78",L5="_editError_yuzty_111",z5="_editInputInvalid_yuzty_118",$5="_editHint_yuzty_123",H5="_unsavedDot_yuzty_132",P5="_metaValueClickable_yuzty_140",U5="_editButton_yuzty_159",V5="_metaPlaceholder_yuzty_175",q5="_worktreeToggle_yuzty_180",it={editFieldWrapper:R5,editInput:I5,editTextarea:O5,editSelect:B5,editError:L5,editInputInvalid:z5,editHint:$5,unsavedDot:H5,metaValueClickable:P5,editButton:U5,metaPlaceholder:V5,worktreeToggle:q5};function zt(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=hh({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=M=>{m==null||m(M.target.value)},C=r==null?void 0:r(s);return a.jsxs("div",{className:it.editFieldWrapper,children:[a.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&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.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&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),j.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:j.error}),a.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const T=g==null?void 0:g(s);return a.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?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function fm(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=hh({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 a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("textarea",{className:`${it.editTextarea} ${w?it.editInputInvalid:""}`,value:s,onChange:T,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),w&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:w})]})}if(S.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.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&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),a.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return a.jsxs("span",{role:"button",tabIndex:0,className: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?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function _d(t){var M;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=hh({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 a.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=>a.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return a.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=>a.jsx("option",{value:A.value,children:A.label},A.value))});const w=g==null?void 0:g(s),C=(M=c.find(A=>A.value===s))==null?void 0:M.label;return a.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?a.jsx("span",{children:C}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function G5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return a.jsxs("label",{className:it.worktreeToggle,"data-testid":d,children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),a.jsx("span",{children:r})]})}const F5="_nav_1snmp_1",K5="_searchForm_1snmp_8",Z5="_searchInput_1snmp_15",Y5="_searchButton_1snmp_33",J5="_clearButton_1snmp_68",W5="_workspaceSelect_1snmp_85",X5="_listHeader_1snmp_99",Q5="_nodeList_1snmp_108",eI="_nodeItem_1snmp_116",tI="_indicator_1snmp_129",nI="_label_1snmp_136",sI="_badge_1snmp_145",es={nav:F5,searchForm:K5,searchInput:Z5,searchButton:Y5,clearButton:J5,workspaceSelect:W5,listHeader:X5,nodeList:Q5,nodeItem:eI,indicator:tI,label:nI,badge:sI};function aI({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 a.jsxs("div",{className:es.nav,"data-testid":"knowledge-nav",children:[a.jsxs("form",{className:es.searchForm,onSubmit:v,children:[a.jsx("input",{className:es.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),a.jsx("button",{type:"submit",className:es.searchButton,disabled:o,children:"Go"})]}),r&&a.jsx("button",{type:"button",className:es.clearButton,onClick:b,children:"Clear search"}),a.jsxs("select",{className:es.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[a.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>a.jsx("option",{value:S.id,children:S.name},S.id))]}),a.jsxs("div",{className:es.listHeader,children:["Nodes (",t.length,")"]}),a.jsx("ul",{className:es.nodeList,children:t.map(S=>a.jsxs("li",{className:es.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[a.jsx("span",{className:es.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),a.jsx("span",{className:es.label,children:S.label}),a.jsx("span",{className:es.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const iI="_container_bwu10_1",oI="_hamburger_bwu10_33",rI="_brand_bwu10_49",lI="_brandLogo_bwu10_68",cI="_info_bwu10_75",dI="_connectionLabel_bwu10_90",uI="_connectionDot_bwu10_103",fI="_connected_bwu10_106",pI="_disconnected_bwu10_110",mI="_connecting_bwu10_113",Ds={container:iI,hamburger:oI,brand:rI,brandLogo:lI,info:cI,connectionLabel:dI,connectionDot:uI,connected:fI,disconnected:pI,connecting:mI},hI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},gI={connected:Ds.connected,connecting:Ds.connecting,disconnected:Ds.disconnected};function vI({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=xt(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=hI[t];return a.jsxs("div",{className:Ds.container,children:[r&&a.jsx("button",{type:"button",className:Ds.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:a.jsx(ST,{size:Et,"aria-hidden":"true"})}),a.jsx(Ci,{text:"Home",placement:"bottom",children:a.jsxs("button",{type:"button",className:Ds.brand,onClick:()=>d(Fo),"data-testid":"statusbar-brand",children:[a.jsx("img",{src:Od("icon-192x192.png"),alt:"",className:Ds.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),a.jsxs("div",{className:Ds.info,children:[a.jsxs("span",{"aria-label":g,children:[a.jsx("span",{className:`${Ds.connectionDot} ${gI[t]}`,"aria-hidden":"true",children:a.jsx(wi,{size:V_,fill:"currentColor"})})," ",a.jsx("span",{className:Ds.connectionLabel,"aria-hidden":"true",children:g})]}),a.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),a.jsxs("span",{children:[m," active"]})]})]})}const yI="_nav_gx5h3_1",bI="_tab_gx5h3_35",_I="_tabIcon_gx5h3_68",xI="_tabLabel_gx5h3_79",kI="_tabActive_gx5h3_84",SI="_tabEnd_gx5h3_90",No={nav:yI,tab:bI,tabIcon:_I,tabLabel:xI,tabActive:kI,tabEnd:SI},id=[{view:"dashboard",label:"Dashboard",icon:a.jsx(dT,{size:Et}),route:Fo,testId:"sidebar-tab-dashboard",order:0},{view:"tasks",label:"Tasks",icon:a.jsx(Vj,{size:Et}),route:iC,testId:"sidebar-tab-tasks",order:1},{view:"environments",label:"Environments",icon:a.jsx(ET,{size:Et}),route:zo,testId:"sidebar-tab-environments",order:2},{view:"chat",label:"Root",icon:a.jsx(TT,{size:Et}),route:aC,testId:"sidebar-tab-chat",order:3},{view:"knowledge",label:"Knowledge",icon:a.jsx(Oj,{size:Et}),route:px,testId:"sidebar-tab-knowledge",order:5},{view:"coordination",label:"Coordination",icon:a.jsx(MT,{size:Et}),route:ux,testId:"sidebar-tab-coordination",order:6},{view:"settings",label:"Settings",icon:a.jsx(qT,{size:Et}),route:QN,testId:"sidebar-tab-settings",align:"end"}];function jI(t){return t===Fo||t==="/"?"dashboard":t.startsWith(ux)?"coordination":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(px)?"knowledge":t.startsWith(ji)?"settings":"tasks"}function TI({tabs:t=id}){var g;const s=Wt(),o=xt(),r=y.useRef(null),c=jI(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 a.jsx("nav",{className:No.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 a.jsx(Ci,{text:v.label,placement:"bottom",className:_?No.tabEnd:void 0,children:a.jsxs("button",{role:"tab",type:"button","aria-selected":b,tabIndex:b?0:-1,className:`${No.tab} ${b?No.tabActive:""}`,onClick:()=>p(v),"data-testid":v.testId,"aria-label":v.label,children:[a.jsx("span",{className:No.tabIcon,"aria-hidden":"true",children:v.icon}),a.jsx("span",{className:No.tabLabel,children:v.label})]})},v.view)})})}const wI="_container_pi6ii_1",NI="_content_pi6ii_66",n_={container:wI,content:NI},CI=320,J1=220,W1=600,X1="grackle-sidebar-width";function EI(){try{const t=localStorage.getItem(X1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=J1&&s<=W1)return s}}catch{}return CI}function AI(t){try{localStorage.setItem(X1,String(t))}catch{}}function MI({content:t}){const[s]=y.useState(EI),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>=J1&&m<=W1&&AI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return a.jsx("div",{className:n_.container,ref:o,"data-testid":"sidebar",style:{width:s},children:a.jsx("div",{className:n_.content,children:t})})}const DI="_bar_tnfsh_1",RI="_btnPrimary_tnfsh_32",II="_statusText_tnfsh_85",OI="_statusCompleted_tnfsh_90",BI="_statusFailed_tnfsh_94",LI="_statusBlocked_tnfsh_98",zI="_hintText_tnfsh_103",Ct={bar:DI,btnPrimary:RI,statusText:II,statusCompleted:OI,statusFailed:BI,statusBlocked:LI,hintText:zI};function $I({sessions:t,tasks:s,environments:o}){const r=xt(),c=Wt(),d=nn("/sessions/:sessionId"),u=nn("/tasks/:taskId"),p=nn("/tasks/:taskId/stream"),m=nn("/tasks/:taskId/edit"),g=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),v=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=nn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),_=nn("/sessions/new"),k=nn("/environments/:environmentId/workspaces/:workspaceId"),S=nn("/tasks/new"),j=nn("/chat"),T=nn("/"),w=nn("/settings/*"),C=d==null?void 0:d.params.sessionId,M=(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,D=!!_,$=!!k&&!g&&!v&&!b,Y=!!S;if(!!T&&!D&&!$&&!Y||!!w||(!!m||!!b)||Y||R||D)return a.jsx(a.Fragment,{});if(O)return o.find(se=>se.adapterType==="local"&&se.status==="connected")?a.jsx(a.Fragment,{}):a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Add a local environment to start chatting"})});if($)return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Select a task or click + to create one"})});if(M){const Z=s.find(B=>B.id===M);if(!Z)return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.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 a.jsx("div",{className:Ct.bar,children:H?a.jsxs("span",{className:Ct.statusBlocked,children:["Blocked by: ",B.join(", ")]}):a.jsx("span",{className:Ct.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"?a.jsx(a.Fragment,{}):a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Waiting for agent..."})})}if(Z.status==="complete")return a.jsxs("div",{className:Ct.bar,children:[a.jsx("span",{className:`${Ct.statusText} ${Ct.statusCompleted}`,children:"Task completed"}),a.jsx("button",{onClick:()=>r(Ri(Z.workspaceId,void 0,E)),className:Ct.btnPrimary,children:"+ New Task"})]});if(Z.status==="failed")return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:`${Ct.statusText} ${Ct.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 a.jsx(a.Fragment,{});if(se)return a.jsxs("div",{className:Ct.bar,children:[a.jsxs("span",{className:`${Ct.statusText} ${Ct.hintText}`,children:["Session ",Z.endReason||Z.status]}),a.jsx("button",{onClick:()=>r(lx(Z.environmentId)),className:Ct.btnPrimary,children:"+ New Chat"})]})}return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Loading..."})})}const HI="_nav_14i94_1",PI="_tab_14i94_24",UI="_tabActive_14i94_62",VI="_tabLabel_14i94_75",qI="_statusDot_14i94_81",GI="_pulse_14i94_87",FI="_addButton_14i94_99",KI="_empty_14i94_132",Ua={nav:HI,tab:PI,tabActive:UI,tabLabel:VI,statusDot:qI,pulse:GI,addButton:FI,empty:KI},ZI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function YI({environments:t}){const s=xt(),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($o(_))},[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($o(t[T].id)),k[T].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return a.jsxs("div",{className:Ua.nav,"data-testid":"environment-nav",children:[a.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=ZI[_.status]||"var(--text-tertiary)",T=_.status==="connected";return a.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Ua.tab} ${k?Ua.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[a.jsx("span",{className:`${Ua.statusDot} ${T?Ua.pulse:""}`,style:{color:j},"aria-hidden":"true",children:a.jsx(wi,{size:V_,fill:"currentColor"})}),a.jsx("span",{className:Ua.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),a.jsx("button",{type:"button",className:Ua.addButton,onClick:()=>s(WN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&a.jsx("div",{className:Ua.empty,children:"No environments yet."})]})}function JI(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 Q1({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return a.jsx(a.Fragment,{children:t});const r=JI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(a.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(a.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(a.jsx("span",{children:t.slice(d)},`p${d}`)),a.jsx(a.Fragment,{children:c})}function WI(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 XI(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 tw){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ya(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=Ya(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const QI="_container_z4i38_1",eO="_header_z4i38_5",tO="_headerActions_z4i38_17",nO="_searchInput_z4i38_23",sO="_searchHighlight_z4i38_56",aO="_groupToggle_z4i38_62",iO="_groupToggleActive_z4i38_89",oO="_addButton_z4i38_93",rO="_taskRow_z4i38_120",lO="_selected_z4i38_140",cO="_expandArrow_z4i38_150",dO="_expanded_z4i38_157",uO="_leafSpacer_z4i38_161",fO="_taskStatusIcon_z4i38_166",pO="_taskTitle_z4i38_170",mO="_workspaceBadge_z4i38_177",hO="_childCountBadge_z4i38_195",gO="_dependencyBadge_z4i38_208",vO="_blockedBadge_z4i38_220",yO="_addChildButton_z4i38_225",bO="_emptyState_z4i38_268",_O="_statusGroupHeader_z4i38_275",xO="_statusGroupIcon_z4i38_294",kO="_statusGroupLabel_z4i38_298",SO="_statusGroupCount_z4i38_303",We={container:QI,header:eO,headerActions:tO,searchInput:nO,searchHighlight:sO,groupToggle:aO,groupToggleActive:iO,addButton:oO,taskRow:rO,selected:lO,expandArrow:cO,expanded:dO,leafSpacer:uO,taskStatusIcon:fO,taskTitle:pO,workspaceBadge:mO,childCountBadge:hO,dependencyBadge:gO,blockedBadge:vO,addChildButton:yO,emptyState:bO,statusGroupHeader:_O,statusGroupIcon:xO,statusGroupLabel:kO,statusGroupCount:SO},jO=[{name:"title",weight:2},{name:"description",weight:1}],ek=16,TO=16,tk="grackle-task-group-by-status";function s_(){try{return localStorage.getItem(tk)==="true"}catch{return!1}}function wO(t){try{localStorage.setItem(tk,String(t))}catch{}}function NO({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return a.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[a.jsxs("div",{className:We.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[a.jsx("span",{className:`${We.expandArrow} ${s?We.expanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),a.jsx("span",{className:We.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),a.jsx("span",{className:We.statusGroupLabel,children:t.label}),a.jsx("span",{className:We.statusGroupCount,children:t.tasks.length})]}),a.jsx(os,{children:s&&a.jsx(Pt.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=Ya(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return a.jsxs("div",{onClick:()=>c(ls(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(ls(p.id)))},className:`${We.taskRow} ${g?We.selected:""}`,style:{"--task-indent":`${ek}px`},"data-task-id":p.id,children:[a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${fl(p.status)}`,children:m.icon}),a.jsx("span",{className:We.taskTitle,title:p.title,children:a.jsx(Q1,{text:p.title,indices:d.get(p.id),highlightClass:We.searchHighlight})}),v&&a.jsx("span",{className:We.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function nk({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Ya(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=ek+s*TO,T=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>d(ls(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:w=>{w.currentTarget===w.target&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),d(ls(t.id)))},className:`${We.taskRow} ${k?We.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&a.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:a.jsx(pa,{size:Ye,"aria-hidden":"true"})}),!_&&a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${fl(t.status)}`,children:g.icon}),a.jsx("span",{className:We.taskTitle,title:t.title,children:a.jsx(Q1,{text:t.title,indices:p.get(t.id),highlightClass:We.searchHighlight})}),T&&a.jsx("span",{className:We.workspaceBadge,title:T,children:T}),_&&a.jsxs("span",{className:We.childCountBadge,children:[t.children.filter(w=>w.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&a.jsx("span",{className:`${We.dependencyBadge} ${v?We.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<K2&&a.jsx(Ci,{text:"Add child task",children:a.jsx("button",{onClick:w=>{w.stopPropagation(),d(Ri(t.workspaceId,t.id))},"aria-label":"Add child task",className:We.addChildButton,children:"+"})})]}),a.jsx(os,{children:_&&b&&a.jsx(Pt.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=>a.jsx(nk,{node:w,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},w.id))})})]})}function CO({workspaces:t,tasks:s}){const o=xt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(s_),[g,v]=y.useState(s_),[b,_]=y.useState(new Map),k=nn("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(Z=>[Z.id,Z.status])),[s]),T=y.useMemo(()=>new Map(t.map(Z=>[Z.id,Z.name])),[t]),w=()=>{const Z=!p;wO(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})},M=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:D,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Z=F2(s,E,jO),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:D:null,ne=V?s.filter(Z=>V.has(Z.id)):s,le=p?[]:WI(ne);return a.jsxs("div",{className:We.container,children:[a.jsxs("div",{className:We.header,children:[a.jsx("span",{children:"Tasks"}),a.jsxs("div",{className:We.headerActions,children:[a.jsx(Ci,{text:p?"Switch to tree view":"Group tasks by status",children:a.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:a.jsx(bT,{size:Ht})})}),a.jsx(Ci,{text:"New task",children:a.jsx("button",{className:We.addButton,onClick:()=>o(Ri()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&a.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?XI(ne,j).map(Z=>a.jsx(NO,{group:Z,isExpanded:M(Z.status),onToggle:()=>C(Z.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:T},Z.status)):le.map(Z=>a.jsx(nk,{node:Z,depth:0,expandedTasks:r,toggleTask:A,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:$,workspaceNames:T},Z.id)),ne.length===0&&!Y&&a.jsx("div",{className:We.emptyState,children:"No tasks yet. Click + to create one."}),ne.length===0&&Y&&a.jsx("div",{className:We.emptyState,children:"No matching tasks"})]})}const EO="_toast_ed2dk_1",AO="_success_ed2dk_18",MO="_icon_ed2dk_22",DO="_error_ed2dk_25",RO="_warning_ed2dk_32",IO="_info_ed2dk_38",OO="_message_ed2dk_53",BO="_close_ed2dk_60",qr={toast:EO,success:AO,icon:MO,error:DO,warning:RO,info:IO,message:OO,close:BO},LO={success:a.jsx(Ai,{size:Et}),error:a.jsx(Ls,{size:Et}),warning:a.jsx(Sm,{size:Et}),info:a.jsx(km,{size:Et})};function zO({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),a.jsxs(Pt.div,{className:`${qr.toast} ${qr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[a.jsx("span",{className:qr.icon,"aria-hidden":"true",children:LO[t.variant]}),a.jsx("span",{className:qr.message,children:t.message}),a.jsx("button",{type:"button",className:qr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]})}const $O="_container_qqse2_1",HO={container:$O};function PO({toasts:t,onDismiss:s}){return a.jsx("div",{className:HO.container,"data-testid":"toast-container",children:a.jsx(os,{children:t.map(o=>a.jsx(zO,{toast:o,onDismiss:s},o.id))})})}const UO="_callout_e5awm_1",VO="_success_e5awm_11",qO="_icon_e5awm_15",GO="_error_e5awm_18",FO="_warning_e5awm_25",KO="_info_e5awm_32",ZO="_content_e5awm_48",YO="_close_e5awm_53",Gr={callout:UO,success:VO,icon:qO,error:GO,warning:FO,info:KO,content:ZO,close:YO},JO={success:a.jsx(Ai,{size:Et}),error:a.jsx(Ls,{size:Et}),warning:a.jsx(Sm,{size:Et}),info:a.jsx(km,{size:Et})};function WO({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return a.jsx(a.Fragment,{children:!c&&a.jsxs("div",{className:[Gr.callout,Gr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[a.jsx("span",{className:Gr.icon,"aria-hidden":"true",children:JO[t]}),a.jsx("span",{className:Gr.content,children:s}),o&&a.jsx("button",{type:"button",className:Gr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]})})}function XO({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return a.jsx(a.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return a.jsx("div",{"data-testid":"update-banner",children:a.jsxs(WO,{variant:"info",dismissible:!0,children:[a.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",a.jsx("code",{children:c})]})})}const QO="_container_m1fsr_1",eB="_heading_m1fsr_7",tB="_section_m1fsr_14",nB="_sectionTitle_m1fsr_26",sB="_sectionDescription_m1fsr_35",aB="_emptyState_m1fsr_41",iB="_tokenList_m1fsr_48",oB="_tokenRow_m1fsr_55",rB="_tokenBadge_m1fsr_68",lB="_tokenName_m1fsr_83",cB="_tokenTarget_m1fsr_90",dB="_deleteButton_m1fsr_99",uB="_addForm_m1fsr_113",fB="_formRow_m1fsr_119",pB="_input_m1fsr_125",mB="_select_m1fsr_155",hB="_addButton_m1fsr_187",gB="_emptyStateInfo_m1fsr_221",vB="_themeOptions_m1fsr_229",yB="_themeOption_m1fsr_229",bB="_themeOptionSelected_m1fsr_254",_B="_themeOptionHeader_m1fsr_259",xB="_themeOptionLabel_m1fsr_266",kB="_themeOptionDesc_m1fsr_273",SB="_variantToggle_m1fsr_279",jB="_variantButton_m1fsr_286",TB="_variantActive_m1fsr_305",wB="_themeSwatches_m1fsr_311",NB="_themeSwatch_m1fsr_311",CB="_systemToggle_m1fsr_325",EB="_systemToggleHint_m1fsr_341",AB="_themeActive_m1fsr_348",MB="_aboutGrid_m1fsr_354",DB="_aboutItem_m1fsr_360",RB="_aboutLabel_m1fsr_373",IB="_aboutValue_m1fsr_379",OB="_aboutDot_m1fsr_387",BB="_aboutDotConnected_m1fsr_394",LB="_aboutDotDisconnected_m1fsr_398",zB="_aboutDotConnecting_m1fsr_402",fe={container:QO,heading:eB,section:tB,sectionTitle:nB,sectionDescription:sB,emptyState:aB,tokenList:iB,tokenRow:oB,tokenBadge:rB,tokenName:lB,tokenTarget:cB,deleteButton:dB,addForm:uB,formRow:fB,input:pB,select:mB,addButton:hB,emptyStateInfo:gB,themeOptions:vB,themeOption:yB,themeOptionSelected:bB,themeOptionHeader:_B,themeOptionLabel:xB,themeOptionDesc:kB,variantToggle:SB,variantButton:jB,variantActive:TB,themeSwatches:wB,themeSwatch:NB,systemToggle:CB,systemToggleHint:EB,themeActive:AB,aboutGrid:MB,aboutItem:DB,aboutLabel:RB,aboutValue:IB,aboutDot:OB,aboutDotConnected:BB,aboutDotDisconnected:LB,aboutDotConnecting:zB},$B=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function HB({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 a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:T,onCancel:()=>k(null)}),a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),a.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):a.jsx("div",{className:fe.tokenList,children:t.map(w=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenBadge,children:w.tokenType}),a.jsx("span",{className:fe.tokenName,children:w.name}),a.jsx("span",{className:fe.tokenTarget,children:w.tokenType==="env_var"?w.envVar:w.filePath}),a.jsx("button",{className:fe.deleteButton,onClick:()=>j(w.name),title:`Delete ${w.name}`,"aria-label":`Delete ${w.name}`,children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]},w.name))}),a.jsxs("form",{className:fe.addForm,onSubmit:S,children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:w=>d(w.target.value)}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:w=>p(w.target.value)})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsx("select",{className:fe.select,value:m,onChange:w=>g(w.target.value),children:$B.map(w=>a.jsx("option",{value:w.value,children:w.label},w.value))}),a.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)}),a.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Bd=[{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"]}],sk=new Set(Bd.map(t=>t.id)),a_="grackle";function pm(t){return Bd.find(s=>s.id===t)}function PB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),a.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),a.jsx("div",{className:fe.themeOptions,children:Bd.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 a.jsxs("button",{type:"button",className:`${fe.themeOption} ${p?fe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[a.jsxs("span",{className:fe.themeOptionHeader,children:[a.jsxs("span",{children:[a.jsx("span",{className:fe.themeOptionLabel,children:d.label}),a.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&a.jsxs("span",{className:fe.variantToggle,children:[a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${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:"☼"}),a.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&&a.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((g,v)=>a.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),a.jsxs("label",{className:fe.systemToggle,children:[a.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),a.jsx("span",{children:"Match system light/dark preference"})]}),a.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),a.jsxs("p",{className:fe.themeActive,children:["Active theme: ",a.jsx("strong",{children:s})]})]})}const UB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},VB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function qB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return a.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"About"}),a.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),a.jsxs("div",{className:fe.aboutGrid,children:[a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Connection"}),a.jsxs("span",{className:fe.aboutValue,children:[a.jsx("span",{className:`${fe.aboutDot} ${VB[t]}`}),UB[t]]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Environments"}),a.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),a.jsx("span",{className:fe.aboutValue,children:d})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Version"}),a.jsx("span",{className:fe.aboutValue,children:"0.123.0"})]})]})]})}const GB="_container_cddyd_1",FB="_header_cddyd_8",KB="_headerTitle_cddyd_35",ZB="_badge_cddyd_44",YB="_headerActions_cddyd_54",JB="_body_cddyd_61",WB="_formContent_cddyd_73",XB="_section_cddyd_85",QB="_label_cddyd_91",eL="_titleInput_cddyd_98",tL="_descriptionTextarea_cddyd_131",nL="_parentContext_cddyd_167",sL="_parentLabel_cddyd_175",aL="_parentName_cddyd_182",iL="_personaSelect_cddyd_186",oL="_depList_cddyd_220",rL="_depItem_cddyd_226",lL="_depItemSelected_cddyd_248",cL="_noDeps_cddyd_252",dL="_btnPrimary_cddyd_258",uL="_btnGhost_cddyd_289",Qe={container:GB,header:FB,headerTitle:KB,badge:ZB,headerActions:YB,body:JB,formContent:WB,section:XB,label:QB,titleInput:eL,descriptionTextarea:tL,parentContext:nL,parentLabel:sL,parentName:aL,personaSelect:iL,depList:oL,depItem:rL,depItemSelected:lL,noDeps:cL,btnPrimary:dL,btnGhost:uL};function ak({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 _=xt(),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,M=u.find(ke=>ke.id===C),A=c??(M==null?void 0:M.linkedEnvironmentIds[0]),E=!k&&!o,R=k?(S==null?void 0:S.parentTaskId)??"":r??"",O=R?d.find(ke=>ke.id===R):void 0,[D,$]=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),Me=D.trim().length>0&&(!k||S!==void 0)&&C.length>0,ot=ke=>{le(ct=>ct.includes(ke)?ct.filter(ue=>ue!==ke):[...ct,ke])},bt=()=>{!Me||ee||k&&S===void 0||(k&&s?(g(s,D.trim(),Y,ne,Z),b==null||b("Task updated","success"),v?v():_(ls(s,void 0,C,A),{replace:!0})):(ce(!0),m(C,D.trim(),Y,ne.length>0?ne:void 0,R||void 0,Z,H,F,()=>{b==null||b("Task created","success"),_(o?Ni(o,A):"/tasks",{replace:!0})},ke=>{b==null||b(ke,"error"),ce(!1)})))},lt=()=>{if(v){v();return}_(k&&s?ls(s,void 0,C,A):o?Ni(o,A):"/tasks")},Pe=k?"edit task":R?"child task":"new task";return a.jsxs("div",{className:Qe.container,children:[a.jsxs("div",{className:Qe.header,children:[a.jsxs("div",{className:Qe.headerTitle,children:[a.jsx("span",{className:Qe.badge,children:Pe}),O&&a.jsxs("span",{className:Qe.parentContext,children:[a.jsx("span",{className:Qe.parentLabel,children:"Child of"}),a.jsx("span",{className:Qe.parentName,children:O.title})]})]}),a.jsxs("div",{className:Qe.headerActions,children:[a.jsx("button",{onClick:bt,disabled:!Me||ee,className:Qe.btnPrimary,"data-testid":"task-edit-save",children:ee?"Creating…":k?"Save Changes":"Create"}),a.jsx("button",{onClick:lt,className:Qe.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:Qe.body,children:a.jsxs("div",{className:Qe.formContent,children:[E&&a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),a.jsxs("select",{id:"task-edit-workspace",value:T,onChange:ke=>w(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-workspace",children:[a.jsx("option",{value:"",children:"Select a workspace..."}),u.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-title",children:"Title"}),a.jsx("input",{id:"task-edit-title",type:"text",value:D,onChange:ke=>$(ke.target.value),placeholder:"Task title...",autoFocus:!0,className:Qe.titleInput,"data-testid":"task-edit-title",onKeyDown:ke=>{ke.key==="Enter"&&Me&&bt()}})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-description",children:"Description"}),a.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})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),a.jsxs("select",{id:"task-edit-persona",value:Z,onChange:ke=>se(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),p.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),!k&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-can-decompose",children:[a.jsx("input",{type:"checkbox",checked:H,onChange:ke=>B(ke.target.checked)}),"Can spawn subtasks"]})}),!k&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-inject-knowledge",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:ke=>ge(ke.target.checked)}),"Inject related prior work from the knowledge graph"]})}),a.jsxs("div",{className:Qe.section,children:[a.jsx("div",{className:Qe.label,children:"Dependencies"}),xe.length===0?a.jsx("div",{className:Qe.noDeps,children:"No other tasks in this workspace"}):a.jsx("div",{className:Qe.depList,children:xe.map(ke=>{const ct=ne.includes(ke.id);return a.jsxs("label",{className:`${Qe.depItem} ${ct?Qe.depItemSelected:""}`,"data-testid":`dep-option-${ke.id}`,children:[a.jsx("input",{type:"checkbox",checked:ct,onChange:()=>ot(ke.id)}),ke.title,a.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",ke.status,")"]})]},ke.id)})})]})]})})]})}const fL="_actionButtons_1rjka_1",pL="_btnPrimary_1rjka_8",mL="_btnDanger_1rjka_39",hL="_btnGhost_1rjka_78",Yt={actionButtons:fL,btnPrimary:pL,btnDanger:mL,btnGhost:hL};function gL({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?a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:m,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Yt.btnPrimary,children:"Start"}),a.jsx("button",{onClick:m,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Yt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:u,disabled:!s,className:Yt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Yt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:c,className:Yt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return a.jsx("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:r,className:Yt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const vL="_workpadSection_y8nj9_1",yL="_workpadLabel_y8nj9_9",bL="_workpadStatus_y8nj9_17",_L="_workpadSummary_y8nj9_23",xL="_workpadExtra_y8nj9_29",Va={workpadSection:vL,workpadLabel:yL,workpadStatus:bL,workpadSummary:_L,workpadExtra:xL};function kL({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return a.jsxs("div",{className:Va.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Va.workpadLabel,children:"Workpad"}),a.jsx("div",{className:Va.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return a.jsxs("div",{className:Va.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Va.workpadLabel,children:"Workpad"}),s.status&&a.jsx("div",{className:Va.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&a.jsx("div",{className:Va.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&a.jsx("div",{className:Va.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const SL="_overviewDashboard_r05qm_1",jL="_overviewHero_r05qm_7",TL="_statusBadge_r05qm_14",wL="_statusPending_r05qm_26",NL="_statusAssigned_r05qm_31",CL="_statusInProgress_r05qm_36",EL="_statusReview_r05qm_41",AL="_statusDone_r05qm_46",ML="_statusFailed_r05qm_51",DL="_statusWaitingInput_r05qm_56",RL="_overviewBranchPill_r05qm_61",IL="_branchLink_r05qm_76",OL="_overviewSection_r05qm_87",BL="_overviewLabel_r05qm_93",LL="_overviewValue_r05qm_100",zL="_overviewMuted_r05qm_105",$L="_overviewMarkdown_r05qm_111",HL="_envRow_r05qm_180",PL="_envDot_r05qm_186",UL="_envDotGreen_r05qm_193",VL="_envDotYellow_r05qm_197",qL="_envDotRed_r05qm_201",GL="_envDotGray_r05qm_205",FL="_depList_r05qm_209",KL="_depItem_r05qm_215",ZL="_depBlocked_r05qm_222",YL="_depDone_r05qm_226",JL="_timeline_r05qm_230",WL="_timelineRow_r05qm_236",XL="_timelineKey_r05qm_243",QL="_timelineValue_r05qm_249",e8="_timelineDelta_r05qm_253",t8="_reviewNotes_r05qm_264",be={overviewDashboard:SL,overviewHero:jL,statusBadge:TL,statusPending:wL,statusAssigned:NL,statusInProgress:CL,statusReview:EL,statusDone:AL,statusFailed:ML,statusWaitingInput:DL,overviewBranchPill:RL,branchLink:IL,overviewSection:OL,overviewLabel:BL,overviewValue:LL,overviewMuted:zL,overviewMarkdown:$L,envRow:HL,envDot:PL,envDotGreen:UL,envDotYellow:VL,envDotRed:qL,envDotGray:GL,depList:FL,depItem:KL,depBlocked:ZL,depDone:YL,timeline:JL,timelineRow:WL,timelineKey:XL,timelineValue:QL,timelineDelta:e8,reviewNotes:t8};function Gc(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 Ep(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 i_(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 n8({status:t}){const s=Ya(t),o=ew(t);return a.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function s8({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 a.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[a.jsxs("div",{className:be.overviewHero,children:[a.jsx(n8,{status:t.status}),t.branch&&a.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:k?a.jsxs("a",{href:k,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):a.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[a.jsx("div",{className:be.overviewLabel,children:"Description"}),a.jsx("div",{className:be.overviewMarkdown,children:a.jsx(_m,{remarkPlugins:[xm],children:t.description})})]}),t.workpad&&a.jsx(kL,{workpad:t.workpad}),a.jsxs("div",{className:be.overviewSection,children:[a.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${i_(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${i_(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:_.displayName}),a.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):a.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[a.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?a.jsx("div",{className:be.overviewMuted,children:"None"}):a.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const j=s.get(S),T=(j==null?void 0:j.status)==="complete";return a.jsxs("div",{className:`${be.depItem} ${T?be.depDone:be.depBlocked}`,children:[a.jsx("span",{children:T?"✓":"○"}),a.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[a.jsx("div",{className:be.overviewLabel,children:"Timeline"}),a.jsxs("div",{className:be.timeline,children:[t.createdAt&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Created"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=Ep(t.createdAt,t.assignedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Assigned"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.assignedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=Ep(t.assignedAt??t.createdAt,t.startedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Started"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.startedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=Ep(t.startedAt,t.completedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Completed"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.completedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&a.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[a.jsx("div",{className:be.overviewLabel,children:"Usage"}),a.jsxs("div",{className:be.timeline,children:[a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsx("span",{className:be.timelineValue,children:Rs(u.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),a.jsx("span",{className:be.timelineValue,children:Rs(p.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[a.jsx("div",{className:be.overviewLabel,children:"Budget"}),a.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Tokens"}),a.jsxs("span",{className:be.timelineValue,children:[Ho(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Ho(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsxs("span",{className:be.timelineValue,children:[Rs((u==null?void 0:u.costMillicents)??0)," / ",Rs(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[a.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),a.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function a8({plugins:t,loading:s,onSetPluginEnabled:o}){return a.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[a.jsx("h2",{className:fe.heading,children:"Plugins"}),a.jsxs("div",{className:fe.section,children:[a.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&a.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&a.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return a.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&a.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),a.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&a.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),a.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:a.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function i8({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),M=t.find(D=>D.id===w),A=async D=>{if(D.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 D=>{try{await r(D,{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(D){const $=D instanceof Error?D.message:"Failed to remove account";u==null||u($,"error")}finally{C(null)}},O=async()=>{T(!0);try{const D=await d();D.imported>0?u==null||u(`Imported ${D.imported} account(s): ${D.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(D){const $=D instanceof Error?D.message:"Import failed";u==null||u($,"error")}finally{T(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:w!==null,title:"Remove GitHub Account?",description:M?`"${M.label}"${M.username?` (@${M.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{R().catch(()=>{})},onCancel:()=>C(null)}),a.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),a.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?a.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):a.jsx("div",{className:fe.tokenList,children:t.map(D=>a.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${D.id}`,children:[D.isDefault&&a.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),a.jsx("span",{className:fe.tokenName,children:D.label}),D.username&&a.jsxs("span",{className:fe.tokenTarget,children:["@",D.username]}),!D.isDefault&&a.jsx("button",{className:fe.deleteButton,onClick:()=>{E(D.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${D.label} as default`,"data-testid":`github-account-set-default-${D.id}`,children:a.jsx(ZT,{size:Ht,"aria-hidden":"true"})}),a.jsx("button",{className:fe.deleteButton,onClick:()=>C(D.id),title:`Remove ${D.label}`,"aria-label":`Remove ${D.label}`,"data-testid":`github-account-remove-${D.id}`,children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]},D.id))}),a.jsxs("form",{className:fe.addForm,onSubmit:D=>{A(D).catch(()=>{})},children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:p,onChange:D=>m(D.target.value),"data-testid":"github-account-label-input"}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:g,onChange:D=>v(D.target.value),"data-testid":"github-account-token-input"})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:b,onChange:D=>_(D.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),a.jsx("button",{className:fe.addButton,type:"submit",disabled:!p.trim()||!g.trim()||k,"data-testid":"github-account-add-button",children:k?"Adding...":"Add Account"}),a.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 o8="_container_legrg_1",r8="_header_legrg_8",l8="_headerTitle_legrg_35",c8="_badge_legrg_44",d8="_headerActions_legrg_54",u8="_body_legrg_61",f8="_formContent_legrg_73",p8="_section_legrg_85",m8="_label_legrg_91",h8="_nameInput_legrg_98",g8="_fieldInput_legrg_131",v8="_adapterSelect_legrg_164",y8="_readOnlyValue_legrg_198",b8="_codespaceSection_legrg_204",_8="_codespaceActions_legrg_210",x8="_creatingHint_legrg_216",k8="_errorHint_legrg_222",S8="_btnPrimary_legrg_235",j8="_btnGhost_legrg_266",oe={container:o8,header:r8,headerTitle:l8,badge:c8,headerActions:d8,body:u8,formContent:f8,section:p8,label:m8,nameInput:h8,fieldInput:g8,adapterSelect:v8,readOnlyValue:y8,codespaceSection:b8,codespaceActions:_8,creatingHint:x8,errorHint:k8,btnPrimary:S8,btnGhost:j8},od=1,rd=65535;function Ap(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=od&&s<=rd}function Mp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function T8({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"?a.jsxs("div",{className:oe.codespaceSection,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Repository"}),a.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Machine Type"}),a.jsx("input",{type:"text",value:k,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),a.jsxs("div",{className:oe.codespaceActions,children:[a.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),a.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):a.jsx("div",{className:oe.codespaceSection,children:a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Codespace"}),!u&&a.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[a.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>a.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),a.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&a.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:oe.errorHint,children:u}),a.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&&a.jsx("span",{className:oe.errorHint,children:d})]})})}function ik({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=xt(),w=t==="edit",C=w&&s?o.find(re=>re.id===s):void 0,[M,A]=y.useState(""),[E,R]=y.useState("local"),[O,D]=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,Me]=y.useState("create"),[ot,bt]=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=()=>!(!M.trim()||E==="ssh"&&!O.trim()||E==="codespace"&&!ge.trim()||E==="docker"&&xe==="attach"&&!ot.trim()||(E==="local"||E==="ssh")&&!Ap($)),ue=()=>{ct()&&(c(M.trim(),E,ke(),ce||void 0),j==null||j("Environment added successfully","success"),T(zo,{replace:!0}))},Re=()=>{T(s?$o(s):zo)},Q=y.useCallback((re,ve)=>{if(!C||!s)return;const et=Mp(C.adapterConfig),an=ve.trim();an?et[re]=an:delete et[re],d(s,{adapterConfig:et})},[C,s,d]),nt=y.useCallback((re,ve)=>{if(!C||!s)return;const et=Mp(C.adapterConfig);if(ve.trim()){const an=Number(ve);Number.isInteger(an)&&an>=od&&an<=rd&&(et[re]=an)}else delete et[re];d(s,{adapterConfig:et})},[C,s,d]);if(w){if(!C)return a.jsxs("div",{className:oe.container,children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"edit environment"})}),a.jsx("div",{className:oe.headerActions,children:a.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Back"})})]}),a.jsx("div",{className:oe.body,children:a.jsx("div",{className:oe.formContent,children:a.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const re=Mp(C.adapterConfig);return a.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"edit environment"})}),a.jsx("div",{className:oe.headerActions,children:a.jsx("button",{onClick:Re,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),a.jsx("div",{className:oe.body,children:a.jsxs("div",{className:oe.formContent,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Name"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Adapter Type"}),a.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)&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"GitHub Account"}),a.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:oe.adapterSelect,"data-testid":"env-edit-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>a.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Host"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Port"}),a.jsx(zt,{value:String(re.port??""),onSave:ve=>nt("port",ve),validate:ve=>Ap(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"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Host"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"User"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"SSH Port"}),a.jsx(zt,{value:String(re.sshPort??""),onSave:ve=>nt("sshPort",ve),validate:ve=>Ap(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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Identity File"}),a.jsx(zt,{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&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Attach (container)"}),a.jsx(zt,{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&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Image"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Repo"}),a.jsx(zt,{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"&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Codespace Name"}),a.jsx(zt,{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 a.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"new environment"})}),a.jsxs("div",{className:oe.headerActions,children:[a.jsx("button",{onClick:ue,disabled:!ct(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),a.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:oe.body,children:a.jsxs("div",{className:oe.formContent,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),a.jsx("input",{id:"env-create-name",type:"text",value:M,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()}})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),a.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:[a.jsx("option",{value:"local",children:"local"}),a.jsx("option",{value:"ssh",children:"ssh"}),a.jsx("option",{value:"docker",children:"docker"}),a.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),a.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:[a.jsx("option",{value:"",children:"(Default)"}),r.map(re=>a.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>D(re.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:$,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:O,onChange:re=>D(re.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:$,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),a.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"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-docker-mode",children:"Source"}),a.jsxs("select",{id:"env-docker-mode",value:xe,onChange:re=>{const ve=re.target.value;Me(ve),ve==="attach"&&_()},className:oe.adapterSelect,"data-testid":"env-docker-mode",children:[a.jsx("option",{value:"create",children:"Create new container"}),a.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),xe==="create"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),a.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"})]})]}):a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Container"}),!S&&k.length>0&&a.jsxs("select",{value:ot,onChange:re=>{bt(re.target.value),re.target.value&&!M.trim()&&A(re.target.value)},className:oe.adapterSelect,"data-testid":"env-docker-container-select",children:[a.jsx("option",{value:"",children:"Select a container..."}),k.map(re=>a.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(S||k.length===0)&&a.jsxs(a.Fragment,{children:[S?a.jsx("span",{className:oe.errorHint,children:S}):a.jsx("span",{className:oe.creatingHint,children:"No running containers found."}),a.jsx("input",{type:"text",value:ot,onChange:re=>{bt(re.target.value),re.target.value&&!M.trim()&&A(re.target.value)},placeholder:"Enter container name/ID...",className:oe.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&a.jsx(T8,{codespaceName:ge,onCodespaceNameChange:ee,envName:M,onEnvNameChange:A,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b})]})})]})}const w8="_group_1iprv_1",N8="_groupTitle_1iprv_8",C8="_shortcutList_1iprv_17",E8="_shortcutRow_1iprv_23",A8="_keys_1iprv_36",M8="_kbd_1iprv_43",D8="_description_1iprv_60",_i={group:w8,groupTitle:N8,shortcutList:C8,shortcutRow:E8,keys:A8,kbd:M8,description:D8},R8=[{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 I8(){return a.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),a.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),R8.map(t=>a.jsxs("div",{className:_i.group,children:[a.jsx("h4",{className:_i.groupTitle,children:t.title}),a.jsx("div",{className:_i.shortcutList,children:t.shortcuts.map(s=>a.jsxs("div",{className:_i.shortcutRow,children:[a.jsx("span",{className:_i.keys,children:s.keys.map(o=>a.jsx("kbd",{className:_i.kbd,children:o},o))}),a.jsx("span",{className:_i.description,children:s.description})]},s.description))})]},t.title))]})}const O8=[{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 B8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),a.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),a.jsx("div",{className:fe.tokenList,children:O8.map(r=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenName,children:r.label}),a.jsx("span",{className:fe.tokenTarget,children:r.description}),a.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>a.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const L8="_container_10efq_1",z8="_header_10efq_7",$8="_list_10efq_105",H8="_card_10efq_111",P8="_cardHeader_10efq_125",U8="_cardTitle_10efq_135",V8="_defaultBadge_10efq_141",q8="_cardActions_10efq_155",G8="_description_10efq_160",F8="_meta_10efq_166",K8="_empty_10efq_212",Z8="_typeBadge_10efq_362",ts={container:L8,header:z8,list:$8,card:H8,cardHeader:P8,cardTitle:U8,defaultBadge:V8,cardActions:q8,description:G8,meta:F8,empty:K8,typeBadge:Z8};function Y8({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 a.jsxs("div",{className:ts.container,children:[a.jsxs("div",{className:ts.header,children:[a.jsx("h2",{children:"Personas"}),a.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?a.jsx("p",{className:ts.empty,children:"No personas yet. Create one to get started."}):a.jsx("div",{className:ts.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return a.jsxs("div",{className:ts.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:[a.jsxs("div",{className:ts.cardHeader,children:[a.jsxs("span",{className:ts.cardTitle,children:[a.jsx("strong",{children:v.name}),a.jsx("span",{className:ts.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&a.jsx("span",{className:ts.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),a.jsxs("div",{className:ts.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&a.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"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&a.jsx("p",{className:ts.description,children:v.description}),a.jsxs("div",{className:ts.meta,children:[v.runtime&&a.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&a.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&a.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),a.jsx(_s,{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 J8="_container_uy08i_1",W8="_header_uy08i_7",X8="_count_uy08i_13",Q8="_presets_uy08i_18",e7="_presetButton_uy08i_24",t7="_filterInput_uy08i_41",n7="_groups_uy08i_53",s7="_group_uy08i_53",a7="_groupHeader_uy08i_68",i7="_groupName_uy08i_77",o7="_groupCount_uy08i_81",r7="_toolList_uy08i_87",l7="_toolItem_uy08i_95",c7="_toolName_uy08i_103",yn={container:J8,header:W8,count:X8,presets:Q8,presetButton:e7,filterInput:t7,groups:n7,group:s7,groupHeader:a7,groupName:i7,groupCount:o7,toolList:r7,toolItem:l7,toolName:c7},d7=(()=>{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()}))})(),u7=[{name:"default",label:"Default",tools:O_},{name:"worker",label:"Worker",tools:Z2},{name:"orchestrator",label:"Orchestrator",tools:Y2},{name:"admin",label:"Admin",tools:J2}];function o_({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 a.jsxs("div",{className:yn.container,"data-testid":"mcp-tool-selector",children:[a.jsx("div",{className:yn.header,children:a.jsx("span",{className:yn.count,children:t.length===0?`Using default (${O_.length} tools)`:`${t.length} of ${B_.size} tools selected`})}),a.jsxs("div",{className:yn.presets,"data-testid":"mcp-tool-presets",children:[u7.map(v=>a.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),a.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),a.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"}),a.jsx("div",{className:yn.groups,children:d7.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 a.jsxs("div",{className:yn.group,"data-testid":`tool-group-${v}`,children:[a.jsxs("label",{className:yn.groupHeader,children:[a.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:o,"data-testid":`group-toggle-${v}`}),a.jsx("span",{className:yn.groupName,children:v}),a.jsxs("span",{className:yn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),a.jsx("div",{className:yn.toolList,children:_.map(S=>a.jsxs("label",{className:yn.toolItem,children:[a.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),a.jsx("span",{className:yn.toolName,children:S})]},S))})]},v)})})]})}function mm(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 ok(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 f7="_container_1gfuq_1",p7="_header_1gfuq_7",m7="_list_1gfuq_19",h7="_card_1gfuq_25",g7="_cardHeader_1gfuq_40",v7="_cardTitle_1gfuq_46",y7="_statusBadge_1gfuq_56",b7="_enabled_1gfuq_68",_7="_disabled_1gfuq_71",x7="_cardActions_1gfuq_75",k7="_cardMeta_1gfuq_80",S7="_empty_1gfuq_98",ns={container:f7,header:p7,list:m7,card:h7,cardHeader:g7,cardTitle:v7,statusBadge:y7,enabled:b7,disabled:_7,cardActions:x7,cardMeta:k7,empty:S7};function j7({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 a.jsxs("div",{className:ns.container,children:[a.jsxs("div",{className:ns.header,children:[a.jsx("h2",{children:"Schedules"}),a.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?a.jsx("p",{className:ns.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):a.jsx("div",{className:ns.list,children:t.map(_=>a.jsxs("div",{className:ns.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:[a.jsxs("div",{className:ns.cardHeader,children:[a.jsxs("span",{className:ns.cardTitle,children:[a.jsx("strong",{children:_.title}),a.jsx("span",{className:`${ns.statusBadge} ${_.enabled?ns.enabled:ns.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),a.jsxs("div",{className:ns.cardActions,onClick:k=>k.stopPropagation(),children:[a.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"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),a.jsxs("div",{className:ns.cardMeta,children:[a.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&a.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),a.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?mm(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?a.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",ok(_.nextRunAt)]}):null,_.runCount>0&&a.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),a.jsx(_s,{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 T7="_nav_1bhou_1",w7="_tab_1bhou_24",N7="_tabIcon_1bhou_62",C7="_tabActive_1bhou_68",Fc={nav:T7,tab:w7,tabIcon:N7,tabActive:C7},ia=[{path:"credentials",label:"Credentials",icon:a.jsx(pT,{size:Et})},{path:"github-accounts",label:"GitHub Accounts",icon:a.jsx(oT,{size:Et})},{path:"personas",label:"Personas",icon:a.jsx(WT,{size:Et})},{path:"schedules",label:"Schedules",icon:a.jsx(Lj,{size:Et})},{path:"appearance",label:"Appearance",icon:a.jsx(RT,{size:Et})},{path:"shortcuts",label:"Shortcuts",icon:a.jsx(hT,{size:Et})},{path:"plugins",label:"Plugins",icon:a.jsx($T,{size:Et})},{path:"about",label:"About",icon:a.jsx(km,{size:Et})}];function E7(){var u;const t=Wt(),s=xt(),o=y.useRef(null),r=((u=ia.find(p=>{const m=`${ji}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??ia[0].path,c=y.useCallback(p=>{s(`${ji}/${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:ia.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%ia.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+ia.length)%ia.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=ia.length-1;else return;const _=ia[b].path;s(`${ji}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return a.jsx("nav",{className:Fc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:ia.map(p=>{const m=p.path===r;return a.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Fc.tab} ${m?Fc.tabActive:""}`,onClick:()=>c(p.path),children:[a.jsx("span",{className:Fc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const A7=["lifecycle:","pipe:","stdin:"];function gh(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function rk(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 M7(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const p=rk(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 D7="_container_16qkd_1",R7="_header_16qkd_7",I7="_title_16qkd_15",O7="_headerActions_16qkd_21",B7="_internalsToggle_16qkd_27",L7="_refreshButton_16qkd_37",z7="_state_16qkd_52",$7="_group_16qkd_59",H7="_groupHeader_16qkd_63",P7="_row_16qkd_72",U7="_selected_16qkd_92",V7="_kindBadge_16qkd_96",q7="_kindChatroom_16qkd_108",G7="_kindPipe_16qkd_114",F7="_kindChannel_16qkd_120",K7="_streamName_16qkd_126",Z7="_meta_16qkd_135",Jt={container:D7,header:R7,title:I7,headerActions:O7,internalsToggle:B7,refreshButton:L7,state:z7,group:$7,groupHeader:H7,row:P7,selected:U7,kindBadge:V7,kindChatroom:q7,kindPipe:G7,kindChannel:F7,streamName:K7,meta:Z7},Y7={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function J7({kind:t}){return t==="chatroom"?a.jsx(NT,{size:Ye,"aria-hidden":"true"}):t==="pipe"?a.jsx(aT,{size:Ye,"aria-hidden":"true"}):a.jsx(lT,{size:Ye,"aria-hidden":"true"})}function W7({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:p,selectedStreamId:m,onSelectStream:g,onRefresh:v,hideHeaderControls:b=!1}){const _=M7(t,s),k={chatroom:Jt.kindChatroom,pipe:Jt.kindPipe,channel:Jt.kindChannel},S=j=>{var T;return((T=o.find(w=>w.id===j))==null?void 0:T.title)??j};return a.jsxs("div",{className:Jt.container,"data-testid":"coordination-list",children:[a.jsxs("div",{className:Jt.header,children:[a.jsx("span",{className:Jt.title,children:"Coordination"}),!b&&a.jsxs("div",{className:Jt.headerActions,children:[a.jsxs("label",{className:Jt.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:u,onChange:j=>p(j.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&a.jsx("button",{type:"button",className:Jt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:a.jsx(PT,{size:Ye,"aria-hidden":"true"})})]})]}),r&&t.length===0&&a.jsxs("div",{className:Jt.state,children:["Loading","…"]}),!r&&c&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-empty",children:"No active streams"}),_.map(j=>a.jsxs("div",{className:Jt.group,children:[a.jsx("div",{className:Jt.groupHeader,children:j.taskId?S(j.taskId):"Unattached / external (CLI · MCP)"}),j.streams.map(T=>{const w=gh(T),C=T.id===m;return a.jsxs("button",{type:"button",className:`${Jt.row}${C?` ${Jt.selected}`:""}`,onClick:()=>g(T.id),"data-testid":`coordination-row-${T.id}`,"aria-current":C?"page":void 0,children:[a.jsxs("span",{className:`${Jt.kindBadge} ${k[w]}`,children:[a.jsx(J7,{kind:w})," ",Y7[w]]}),a.jsx("span",{className:Jt.streamName,children:T.name}),a.jsxs("span",{className:Jt.meta,children:[T.subscriberCount," ",T.subscriberCount===1?"sub":"subs"," ","·"," ",T.messageBufferDepth," buffered"]})]},T.id)})]},j.taskId??"__orphans__"))]})}const X7="_transcript_1p4cm_1",Q7="_message_1p4cm_10",ez="_meta_1p4cm_16",tz="_sender_1p4cm_24",nz="_time_1p4cm_29",sz="_content_1p4cm_34",az="_state_1p4cm_42",qa={transcript:X7,message:Q7,meta:ez,sender:tz,time:nz,content:sz,state:az};function iz(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleTimeString()}function oz({messages:t,loading:s=!1}){return s?a.jsx("div",{className:qa.state,"data-testid":"stream-transcript-loading",children:"Loading transcript…"}):t.length===0?a.jsx("div",{className:qa.state,"data-testid":"stream-transcript-empty",children:"No messages yet."}):a.jsx("div",{className:qa.transcript,"data-testid":"stream-transcript",children:t.map(o=>a.jsxs("div",{className:qa.message,"data-testid":"stream-transcript-message",children:[a.jsxs("div",{className:qa.meta,children:[a.jsx("span",{className:qa.sender,title:o.senderId,children:o.senderId.slice(0,12)}),a.jsx("span",{className:qa.time,children:iz(o.timestamp)})]}),a.jsx("div",{className:qa.content,children:o.content})]},o.seq))})}const rz="_panel_iibrt_1",lz="_header_iibrt_24",cz="_title_iibrt_33",dz="_closeButton_iibrt_43",uz="_body_iibrt_57",fz="_section_iibrt_63",pz="_sectionLabel_iibrt_67",mz="_metaRow_iibrt_76",hz="_metaKey_iibrt_84",gz="_metaValue_iibrt_90",vz="_subscriberCard_iibrt_99",yz="_subscriberHeader_iibrt_107",bz="_sessionLink_iibrt_114",_z="_badges_iibrt_132",xz="_badgeRw_iibrt_150 _badge_iibrt_132",kz="_badgeR_iibrt_150 _badge_iibrt_132",Sz="_badgeW_iibrt_162 _badge_iibrt_132",jz="_badgeAsync_iibrt_168 _badge_iibrt_132",Tz="_badgeSync_iibrt_174 _badge_iibrt_132",wz="_badgeDetach_iibrt_178 _badge_iibrt_132",Nz="_spawnTag_iibrt_184 _badge_iibrt_132",Cz="_fdNumber_iibrt_189",Ez="_emptySubscribers_iibrt_195",Az="_metaValueMono_iibrt_201 _metaValue_iibrt_90",Mz="_advanced_iibrt_216",Dz="_advancedSummary_iibrt_220",He={panel:rz,header:lz,title:cz,closeButton:dz,body:uz,section:fz,sectionLabel:pz,metaRow:mz,metaKey:hz,metaValue:gz,subscriberCard:vz,subscriberHeader:yz,sessionLink:bz,badges:_z,badgeRw:xz,badgeR:kz,badgeW:Sz,badgeAsync:jz,badgeSync:Tz,badgeDetach:wz,spawnTag:Nz,fdNumber:Cz,emptySubscribers:Ez,metaValueMono:Az,advanced:Mz,advancedSummary:Dz},Rz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function Iz({permission:t}){const s=t==="rw"?He.badgeRw:t==="r"?He.badgeR:He.badgeW;return a.jsx("span",{className:s,children:t})}function Oz({mode:t}){const s=t==="async"?He.badgeAsync:t==="detach"?He.badgeDetach:He.badgeSync;return a.jsx("span",{className:s,children:t})}function Bz({stream:t,messages:s,transcriptLoading:o,onClose:r}){const c=xt();return y.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r]),a.jsxs("div",{className:He.panel,"data-testid":"stream-detail-panel",children:[a.jsxs("div",{className:He.header,children:[a.jsx("h3",{className:He.title,children:t.name}),a.jsx("button",{type:"button",className:He.closeButton,onClick:r,"aria-label":"Close stream details",children:"×"})]}),a.jsxs("div",{className:He.body,children:[a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Overview"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Kind"}),a.jsx("span",{className:He.metaValue,children:Rz[gh(t)]})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Participants"}),a.jsx("span",{className:He.metaValue,children:t.subscriberCount})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Buffered"}),a.jsxs("span",{className:He.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Participants"}),t.subscribers.length===0?a.jsx("div",{className:He.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,"data-testid":`subscriber-card-${d.subscriptionId}`,children:[a.jsxs("button",{type:"button",className:He.sessionLink,onClick:()=>{c(Dm(d.sessionId))},title:d.sessionId,children:[d.sessionId.slice(0,12),"…"]}),d.createdBySpawn&&a.jsx("span",{className:He.spawnTag,children:"spawn"})]},d.subscriptionId))]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Conversation"}),a.jsx(oz,{messages:s??[],loading:o??!1})]}),a.jsxs("details",{className:He.advanced,"data-testid":"stream-advanced",children:[a.jsx("summary",{className:He.advancedSummary,children:"Advanced"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Stream ID"}),a.jsx("span",{className:He.metaValueMono,children:t.id})]}),t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,children:[a.jsxs("div",{className:He.subscriberHeader,children:[a.jsxs("span",{className:He.fdNumber,children:["fd ",d.fd]}),a.jsxs("span",{className:He.metaValueMono,title:d.subscriptionId,children:[d.subscriptionId.slice(0,12),"…"]})]}),a.jsxs("div",{className:He.badges,children:[a.jsx(Iz,{permission:d.permission}),a.jsx(Oz,{mode:d.deliveryMode})]})]},d.subscriptionId))]})]})]})}function Dp(t){return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):t}const Lz=["--accent-green","--accent-yellow","--accent-red","--text-tertiary"];function lk(t,s){if(s)return{varName:"--text-tertiary",label:"External"};switch(t){case"running":return{varName:"--accent-green",label:"Running"};case"idle":case"suspended":case"hibernating":return{varName:"--accent-yellow",label:Dp(t)};case"failed":case"interrupted":return{varName:"--accent-red",label:Dp(t)};default:return{varName:"--text-tertiary",label:t.length>0?Dp(t):"Unknown"}}}const ck="session",vh="stream",r_="smoothstep";function Kc(t){return`session:${t}`}function l_(t){return`stream:${t}`}function zz(t){return{id:t,environmentId:"",runtime:"external",status:"external",prompt:"",startedAt:""}}function $z(t,s){return t==="detach"?{stroke:s,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6}:{stroke:s,strokeWidth:1.5}}function Hz(t,s){const o=t.permission.includes("w"),r=s.permission.includes("w"),c=t.permission.includes("r"),d=s.permission.includes("r");if(o&&!r&&d)return{source:t,target:s,bidirectional:!1};if(r&&!o&&c)return{source:s,target:t,bidirectional:!1};const u=[t,s].sort((p,m)=>p.sessionId.localeCompare(m.sessionId));return{source:u[0],target:u[1],bidirectional:!0}}function Pz(t,s){if(t.length===0)return{nodes:[],edges:[]};const o=new Map(s.map(m=>[m.id,m])),r=new Map,c=new Map,d=[],u=m=>{let g=r.get(m);if(!g){const v=o.get(m);g={kind:"session",session:v??zz(m),streamCount:0,external:v===void 0},r.set(m,g)}return g};for(const m of t){const g=gh(m);if(g==="pipe"&&m.subscribers.length===2&&m.subscribers[0].sessionId!==m.subscribers[1].sessionId){const[v,b]=m.subscribers;u(v.sessionId).streamCount+=1,u(b.sessionId).streamCount+=1;const{source:_,target:k,bidirectional:S}=Hz(v,b);d.push({id:`edge-pipe-${m.id}`,source:Kc(_.sessionId),target:Kc(k.sessionId),type:r_,data:{edgeKind:"pipe",streamId:m.id,permission:S?"rw":_.permission,deliveryMode:_.deliveryMode},style:{stroke:"var(--accent-yellow)",strokeWidth:1.5,strokeDasharray:"6 3"},markerEnd:{type:Dc.ArrowClosed},markerStart:S?{type:Dc.ArrowClosed}:void 0,animated:!1});continue}c.set(m.id,{kind:"stream",stream:m,streamKind:g,ownership:rk(m,o)});for(const v of m.subscribers){u(v.sessionId).streamCount+=1;const b=l_(m.id),_=Kc(v.sessionId),k=v.permission.includes("w"),S=v.permission.includes("r");let j,T,w=!1;k&&S?(j=_,T=b,w=!0):S?(j=b,T=_):(j=_,T=b),d.push({id:`edge-part-${m.id}-${v.subscriptionId}`,source:j,target:T,type:r_,data:{edgeKind:"participation",streamId:m.id,permission:v.permission,deliveryMode:v.deliveryMode},style:$z(v.deliveryMode,"var(--text-tertiary)"),markerEnd:{type:Dc.ArrowClosed},markerStart:w?{type:Dc.ArrowClosed}:void 0,animated:!1})}}const p=[];for(const[m,g]of r)p.push({id:Kc(m),type:ck,position:{x:0,y:0},data:g});for(const[m,g]of c)p.push({id:l_(m),type:vh,position:{x:0,y:0},data:g});return{nodes:p,edges:d}}const Uz=200,Vz=64,qz=180,Gz=56,Fz=40,Kz=70;function c_(t){return t===vh?{width:qz,height:Gz}:{width:Uz,height:Vz}}function Zz(t){if(t.nodes.length===0)return t;const s=new cd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"LR",nodesep:Fz,ranksep:Kz});for(const r of t.nodes){const{width:c,height:d}=c_(r.type);s.setNode(r.id,{width:c,height:d})}for(const r of t.edges)s.setEdge(r.source,r.target,{},r.id);return cd.layout(s),{nodes:t.nodes.map(r=>{const c=s.node(r.id),{width:d,height:u}=c_(r.type);return{...r,position:{x:c.x-d/2,y:c.y-u/2}}}),edges:t.edges}}function Yz(t,s){return y.useMemo(()=>Zz(Pz(t,s)),[t,s])}const Jz="_graphContainer_1oeu6_1",Wz="_empty_1oeu6_18",Xz="_nodeContent_1oeu6_28",Qz="_nodeHeader_1oeu6_38",e$="_nodeTitle_1oeu6_50",t$="_nodeMeta_1oeu6_58",n$="_nodeSubtle_1oeu6_64",s$="_countBadge_1oeu6_69",a$="_sessionNode_1oeu6_81",i$="_sessionAccent_1oeu6_103",o$="_external_1oeu6_109",r$="_streamNode_1oeu6_114",l$="_chatroom_1oeu6_134",c$="_channel_1oeu6_139",d$="_pipe_1oeu6_143",u$="_haloless_1oeu6_147",f$="_selected_1oeu6_153",p$="_kindBadge_1oeu6_158",m$="_handle_1oeu6_172",yt={graphContainer:Jz,empty:Wz,nodeContent:Xz,nodeHeader:Qz,nodeTitle:e$,nodeMeta:t$,nodeSubtle:n$,countBadge:s$,sessionNode:a$,sessionAccent:i$,external:o$,streamNode:r$,chatroom:l$,channel:c$,pipe:d$,haloless:u$,selected:f$,kindBadge:p$,handle:m$};function h$({data:t}){const{session:s,streamCount:o,external:r}=t,c=lk(s.status,r),d=`var(${c.varName})`,u=r?`${yt.sessionNode} ${yt.external}`:yt.sessionNode;return a.jsxs("div",{className:u,"data-testid":`coordination-node-session-${s.id}`,children:[a.jsx(Bo,{type:"target",position:Lo.Left,className:yt.handle}),a.jsx("div",{className:yt.sessionAccent,style:{backgroundColor:d}}),a.jsxs("div",{className:yt.nodeContent,children:[a.jsx("div",{className:yt.nodeHeader,children:a.jsx("span",{className:yt.nodeTitle,children:r?s.id:s.runtime})}),a.jsxs("div",{className:yt.nodeMeta,children:[a.jsx("span",{className:yt.nodeSubtle,style:{color:d},children:c.label}),o>0&&a.jsx("span",{className:yt.countBadge,children:o})]})]}),a.jsx(Bo,{type:"source",position:Lo.Right,className:yt.handle})]})}function g$({data:t,selected:s}){const{stream:o,streamKind:r,ownership:c}=t,d=r==="chatroom"?yt.chatroom:r==="pipe"?yt.pipe:yt.channel,u=[yt.streamNode,d];return c.kind!=="task"&&u.push(yt.haloless),s&&u.push(yt.selected),a.jsxs("div",{className:u.join(" "),"data-testid":`coordination-node-stream-${o.id}`,children:[a.jsx(Bo,{type:"target",position:Lo.Left,className:yt.handle}),a.jsxs("div",{className:yt.nodeContent,children:[a.jsx("div",{className:yt.nodeHeader,children:a.jsx("span",{className:yt.kindBadge,children:r})}),a.jsx("span",{className:yt.nodeTitle,children:o.name}),a.jsxs("span",{className:yt.nodeSubtle,children:[o.subscriberCount," ",o.subscriberCount===1?"subscriber":"subscribers"]})]}),a.jsx(Bo,{type:"source",position:Lo.Right,className:yt.handle})]})}const Rp="#6b7a8d",v$={[ck]:h$,[vh]:g$};function y$({streams:t,sessions:s,selectedStreamId:o,onSelectStream:r,resolvedThemeId:c}){const d=Yz(t,s),u=y.useMemo(()=>d.nodes.map(v=>{const b=v.data;return b.kind==="stream"&&b.stream.id===o?{...v,selected:!0}:v}),[d.nodes,o]),p=y.useMemo(()=>{const v=getComputedStyle(document.documentElement),b={};for(const _ of Lz)b[_]=v.getPropertyValue(_).trim()||Rp;return b},[c]),m=y.useCallback((v,b)=>{const _=b.data;_.kind==="stream"&&r(_.stream.id)},[r]),g=y.useCallback(v=>{const b=v.data;return b.kind==="session"?p[lk(b.session.status,b.external).varName]??Rp:Rp},[p]);return d.nodes.length===0?a.jsx("div",{className:yt.empty,"data-testid":"coordination-graph-empty",children:"No active streams to visualize"}):a.jsx("div",{className:yt.graphContainer,"data-testid":"coordination-graph",children:a.jsxs(A_,{nodes:u,edges:d.edges,nodeTypes:v$,onNodeClick:m,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(M_,{variant:D_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(R_,{showInteractive:!1}),a.jsx(I_,{nodeColor:g,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function b$({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(Sy.map(d=>[d,[]]));for(const d of t){const u=fl(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 Sy.map(d=>{const u=Ya(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const _$="_boardContainer_1c4y1_1",x$="_column_1c4y1_17",k$="_columnHeader_1c4y1_34",S$="_columnIcon_1c4y1_47",j$="_columnLabel_1c4y1_52",T$="_columnCount_1c4y1_57",w$="_cardList_1c4y1_67",N$="_emptyPlaceholder_1c4y1_76",C$="_card_1c4y1_67",E$="_cardHeader_1c4y1_107",A$="_cardStatusIcon_1c4y1_113",M$="_cardTitle_1c4y1_119",D$="_cardBadges_1c4y1_127",R$="_badge_1c4y1_134",I$="_blockedBadge_1c4y1_146",O$="_childBadge_1c4y1_151",B$="_depBadge_1c4y1_155",L$="_parentBadge_1c4y1_159",z$="_pausedSubBadge_1c4y1_166",$$="_personaBadge_1c4y1_170",H$="_envBadge_1c4y1_174",P$="_emptyCta_1c4y1_178",U$="_ctaButton_1c4y1_188",V$="_ctaDescription_1c4y1_204",dt={boardContainer:_$,column:x$,columnHeader:k$,columnIcon:S$,columnLabel:j$,columnCount:T$,cardList:w$,emptyPlaceholder:N$,card:C$,cardHeader:E$,cardStatusIcon:A$,cardTitle:M$,cardBadges:D$,badge:R$,blockedBadge:I$,childBadge:O$,depBadge:B$,parentBadge:L$,pausedSubBadge:z$,personaBadge:$$,envBadge:H$,emptyCta:P$,ctaButton:U$,ctaDescription:V$};function q$({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=xt(),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 M=_.get(C.latestSessionId);if(M){if(j.set(C.id,M.endReason||M.status),M.personaId){const A=k.get(M.personaId);A&&T.set(C.id,A.name)}if(M.environmentId){const A=S.get(M.environmentId);A&&w.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:T,environmentNameByTaskId:w}},[p,r,c,d]),b=y.useMemo(()=>b$({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?a.jsxs("div",{className:dt.emptyCta,"data-testid":"board-empty-cta",children:[a.jsx("button",{className:dt.ctaButton,onClick:()=>u(Ri(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:dt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):a.jsx("div",{className:dt.boardContainer,"data-testid":"board-container",children:b.map(_=>a.jsxs("section",{className:dt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[a.jsxs("div",{className:dt.columnHeader,children:[a.jsx("span",{className:dt.columnIcon,style:{color:_.style.color},children:_.style.icon}),a.jsx("span",{className:dt.columnLabel,children:_.label}),a.jsx("span",{className:dt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),a.jsx("div",{className:dt.cardList,children:_.tasks.length===0?a.jsx("div",{className:dt.emptyPlaceholder,children:"No tasks"}):a.jsx(os,{mode:"popLayout",children:_.tasks.map(k=>a.jsx(Pt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:a.jsx(G$,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(ls(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function G$({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Ya(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return a.jsxs("div",{className:dt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[a.jsxs("div",{className:dt.cardHeader,children:[a.jsx("span",{className:dt.cardStatusIcon,style:{color:v.color},children:v.icon}),a.jsx("span",{className:dt.cardTitle,children:d.title})]}),a.jsxs("div",{className:dt.cardBadges,children:[b&&a.jsx("span",{className:`${dt.badge} ${dt.parentBadge}`,title:b.title,children:b.title}),p>0&&a.jsxs("span",{className:`${dt.badge} ${dt.childBadge}`,children:[m,"/",p]}),u&&a.jsx("span",{className:`${dt.badge} ${dt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&a.jsx("span",{className:`${dt.badge} ${dt.depBadge}`,children:"dep"}),g&&a.jsx("span",{className:`${dt.badge} ${dt.pausedSubBadge}`,children:g}),o&&a.jsx("span",{className:`${dt.badge} ${dt.personaBadge}`,children:o}),r&&a.jsx("span",{className:`${dt.badge} ${dt.envBadge}`,children:r})]})]})}const F$="_formContent_ymnez_1",K$="_section_ymnez_13",Z$="_label_ymnez_19",Y$="_titleInput_ymnez_26",J$="_descriptionTextarea_ymnez_58",W$="_selectField_ymnez_94",X$="_checkboxRow_ymnez_128",Q$="_checkboxLabel_ymnez_141",eH="_fieldError_ymnez_146",jt={formContent:F$,section:K$,label:Z$,titleInput:Y$,descriptionTextarea:J$,selectField:W$,checkboxRow:X$,checkboxLabel:Q$,fieldError:eH};function tH(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 nH=100;function sH({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return a.jsxs("div",{className:jt.formContent,children:[a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-name",children:"Name"}),a.jsx("input",{id:"ws-name",className:jt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:nH,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-description",children:"Description"}),a.jsx("textarea",{id:"ws-description",className:jt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-repo",children:"Repository URL"}),a.jsx("input",{id:"ws-repo",className:jt.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)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-environment",children:"Environment"}),a.jsxs("select",{id:"ws-environment",className:jt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[a.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>a.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-persona",children:"Default Persona"}),a.jsxs("select",{id:"ws-persona",className:jt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>a.jsx("option",{value:m.id,children:m.name},m.id))]})]}),a.jsx("div",{className:jt.section,children:a.jsxs("label",{className:jt.checkboxRow,children:[a.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),a.jsx("span",{className:jt.checkboxLabel,children:"Enable worktree isolation"})]})}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-workdir",children:"Working Directory"}),a.jsx("input",{id:"ws-workdir",className:jt.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 dk=y.createContext(void 0),aH=4e3;function iH({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=aH)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return a.jsx(dk.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(dk);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const hm="grackle-theme",uk="grackle-prefer-system",fk="(prefers-color-scheme: dark)";let Jr=[],ld;function Ip(){ld=void 0;for(const t of Jr)t()}function gm(){return typeof window>"u"?!1:window.matchMedia(fk).matches}function nl(){if(typeof localStorage>"u")return a_;try{const t=localStorage.getItem(hm);if(t!==null&&sk.has(t))return t}catch{}return a_}function xd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(uk)==="true"}catch{return!1}}function vm(t){return Bd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function pk(t,s){const o=pm(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?gm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=vm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return gm()?r.variantDarkId:r.variantLightId}return t}function Ao(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=pk(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Ao(nl(),xd());function oH(){return ld===void 0&&(ld={themeId:nl(),systemDark:gm(),preferSystem:xd()}),ld}function rH(t){return Jr=[...Jr,t],()=>{Jr=Jr.filter(s=>s!==t)}}function lH(){const t=y.useSyncExternalStore(rH,oH),{themeId:s,preferSystem:o}=t,r=pk(s,o),c=y.useCallback(u=>{if(sk.has(u)){try{localStorage.setItem(hm,u)}catch{}Ao(u,xd(),!0),Ip()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(uk,u?"true":"false")}catch{}if(u){const p=nl(),m=pm(p);if(m!=null&&m.hidden){const g=vm(p);if(g)try{localStorage.setItem(hm,g.id)}catch{}}}Ao(nl(),u,!0),Ip()},[]);return y.useEffect(()=>{Ao(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(fk),p=()=>{const m=nl(),g=xd();if(g){const v=pm(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&Ao(m,g),v!=null&&v.hidden){const b=vm(m);b!=null&&b.variantDarkId&&b.variantLightId&&Ao(m,g)}}Ip()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const mk=y.createContext(void 0);function cH({children:t}){const s=lH();return a.jsx(mk.Provider,{value:s,children:t})}function yh(){const t=y.useContext(mk);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const hk=y.createContext(void 0),gk=y.createContext(void 0);function dH({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return a.jsx(gk.Provider,{value:r,children:a.jsx(hk.Provider,{value:s,children:t})})}function uH(){return y.useContext(hk)}function fH(){const t=y.useContext(gk);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const bh=y.createContext(void 0);function pt(){const t=y.useContext(bh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function vk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function yk(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function pH(t){return vk(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 mH=new Set(["off","subscription","api_key"]),Zc=new Set(["off","on"]);function hH(t){return vk(t)&&mH.has(t.claude)&&Zc.has(t.github)&&Zc.has(t.copilot)&&Zc.has(t.codex)&&Zc.has(t.goose)}function bk(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 _k(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 Co=5e3;function gH(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 Ei={label:"Home",url:Fo};function vH(t){return t?[Ei,{label:"Settings",url:ji},{label:t,url:void 0}]:[Ei,{label:"Settings",url:void 0}]}const xk={label:"Environments",url:zo};function yH(){return[Ei,{label:"Environments",url:void 0}]}function bH(){return[Ei,{label:"New Chat",url:void 0}]}function _H(t){return[Ei,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function xH(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Ei,xk,{label:(d==null?void 0:d.displayName)??"Environment",url:$o(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function kH(t,s,o,r,c){const d=gH(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=[Ei];v&&g&&(b.push(xk),b.push({label:v.displayName,url:$o(g)})),m&&g&&b.push({label:m.name,url:Ni(m.id,g)});for(let k=0;k<d.length-1;k++)b.push({label:d[k].title,url:ls(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 _h(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 Yc(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 SH(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 xh(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?Yc(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=_?SH(_):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?Yc(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 M=JSON.parse(T);typeof M.detailedContent=="string"&&(j=M.detailedContent)}catch{}d[b]={...k,toolUseCtx:{...S,detailedResult:j}},c.add(b);const w=s.get(_),C=w?Yc(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 _=Yc(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 jH(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=kk(s),d=s.filter(m=>ym(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||ym(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function kk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function ym(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function TH(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=kk(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}):ym(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 wH(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 NH(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 Ms=[{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 _5(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function x5({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),N=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let A=T;A<=N;A++)A<t.length&&ul(t[A])&&D.add(A);return D})}else d(T=>{const N=new Set(T);return N.has(S)?N.delete(S):N.add(S),N.size===0?(r(!1),u.current=void 0):u.current=S,N})},[t]),b=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)ul(t[j])&&S.add(j);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),x=y.useCallback(async()=>{const j=[...c].sort((N,C)=>N-C).filter(N=>N<t.length).map(N=>t[N]);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:x}}const k5="_wrapper_1cdza_1",S5="_scrollContainer_1cdza_9",j5="_selectingPadding_1cdza_16",T5="_toolbar_1cdza_20",N5="_directionToggle_1cdza_27",w5="_scrollToAnchor_1cdza_65",C5="_scrollToAnchorBottom_1cdza_89",E5="_scrollToAnchorTop_1cdza_93",A5="_eventOverflowWarning_1cdza_97",oa={wrapper:k5,scrollContainer:S5,selectingPadding:j5,toolbar:T5,directionToggle:N5,scrollToAnchor:w5,scrollToAnchorBottom:C5,scrollToAnchorTop:E5,eventOverflowWarning:A5},D5=10*1024,M5=new Set(["running","idle"]);function R5(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 J1="grackle-stream-direction";function I5(){try{return localStorage.getItem(J1)==="reversed"}catch{return!1}}function O5({eventsDropped:t}){return t<=0?a.jsx(a.Fragment,{}):a.jsxs("div",{className:oa.eventOverflowWarning,role:"alert",children:[a.jsx(Sm,{size:Ht,"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 mh({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(I5),x=K3(),[S,j]=y.useState(!1),[T,N]=y.useState(!1),[C,D]=y.useState(void 0),A=x5({events:t,formatForClipboard:Y1}),E=y.useMemo(()=>t.filter(ul).length,[t]),R=y.useMemo(()=>c?c.filter(ce=>M5.has(ce.status)&&ce.id!==d):[],[c,d]),O=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:M,scrollToAnchor:$}=g5({scrollRef:v,contentLength:t.length,isReversed:b,paused:A.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(J1,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=b5(xe,me);if(new TextEncoder().encode(De).length>D5){D({sessionId:ce,text:De}),N(!0);return}Z(ce,De).catch(()=>{})},[ne,le,d,Z]),H=y.useCallback(()=>{N(!1),C&&(Z(C.sessionId,C.text).catch(()=>{}),D(void 0))},[C,Z]),B=y.useCallback(()=>{N(!1),D(void 0)},[]),F=x?0:.2,ge=b?-8:8,ee=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return a.jsxs("div",{className:oa.wrapper,children:[a.jsx("div",{className:oa.toolbar,children:a.jsx(Ci,{text:b?"Showing newest first":"Showing oldest first",children:a.jsx("button",{className:oa.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?a.jsx(xy,{size:Ht,"aria-hidden":"true"}):a.jsx(ky,{size:Ht,"aria-hidden":"true"})})})}),a.jsxs("div",{ref:v,className:`${oa.scrollContainer} ${A.isSelecting?oa.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,a.jsx(O5,{eventsDropped:s}),a.jsx(os,{initial:!1,children:O.map((ce,me)=>{const xe=b?t.length-1-me:me;return a.jsx(Pt.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:F,ease:"easeOut"},children:a.jsx(B6,{copyText:y5(ce),isContentBearing:ul(ce),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(xe),checkboxLabel:R5(ce),onSelect:()=>{A.enterSelectionMode(xe)},onToggle:De=>{A.toggleEvent(xe,De)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:a.jsx(xD,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:g})})},`${ce.sessionId}-${ce.timestamp}-${xe}`)})})]}),a.jsx(os,{children:A.isSelecting&&a.jsx(G6,{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})}),a.jsx(p5,{isOpen:S,sessions:R,environments:u??[],personas:p,onSelect:se,onCancel:()=>{j(!1)}}),a.jsx(_s,{isOpen:T,title:"Send large message?",description:`This will forward a large message (${ee} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:B}),a.jsx(os,{children:!M&&a.jsxs(Pt.button,{className:`${oa.scrollToAnchor} ${b?oa.scrollToAnchorTop:oa.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?a.jsx(ky,{size:Ht,"aria-hidden":"true"}):a.jsx(xy,{size:Ht,"aria-hidden":"true"})," New events"]})})]})}function hh(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(""),x=y.useRef(!1),S=d===c,j=y.useCallback(O=>{v(O),_("")},[]),T=y.useCallback(()=>{_("")},[]),N=y.useCallback(()=>{x.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){N();return}o(O),N()},[g,s,m,r,o,N]),D=y.useCallback(()=>{x.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),A=y.useCallback(O=>{if(x.current){x.current=!1;return}O.relatedTarget instanceof HTMLElement&&O.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(O=>{O.key==="Escape"?N():O.key==="Enter"&&p&&C()},[N,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:N,save:C,setDraft:j,clearError:T,handleBlur:A,handleKeyDown:E,ignoreInitialBlurRef:x}}const B5="_editFieldWrapper_yuzty_1",L5="_editInput_yuzty_10",z5="_editTextarea_yuzty_42",$5="_editSelect_yuzty_78",H5="_editError_yuzty_111",P5="_editInputInvalid_yuzty_118",U5="_editHint_yuzty_123",V5="_unsavedDot_yuzty_132",q5="_metaValueClickable_yuzty_140",G5="_editButton_yuzty_159",F5="_metaPlaceholder_yuzty_175",K5="_worktreeToggle_yuzty_180",it={editFieldWrapper:B5,editInput:L5,editTextarea:z5,editSelect:$5,editError:H5,editInputInvalid:P5,editHint:U5,unsavedDot:V5,metaValueClickable:q5,editButton:G5,metaPlaceholder:F5,worktreeToggle:K5};function zt(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":x}=t,S=y.useRef(null),j=hh({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const N=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(N)}},[j.isEditing]),c==="create"){const N=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("input",{className:`${it.editInput} ${C?it.editInputInvalid:""}`,value:s,onChange:N,maxLength:b,placeholder:v,"aria-label":_,"data-testid":x?`${x}-input`:void 0}),C&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("input",{ref:S,className:`${it.editInput} ${j.error?it.editInputInvalid:""}`,value:j.draft,onChange:N=>j.setDraft(N.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":x?`${x}-input`:void 0}),j.isDirty&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),j.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:j.error}),a.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const T=g==null?void 0:g(s);return a.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":_,"data-testid":x?`${x}-button`:void 0,children:[T!==void 0?T:s?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function fm(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,x=y.useRef(null),S=hh({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 N;(N=x.current)==null||N.focus()},0);return()=>window.clearTimeout(T)}},[S.isEditing]),c==="create"){const T=C=>{m==null||m(C.target.value)},N=r==null?void 0:r(s);return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("textarea",{className:`${it.editTextarea} ${N?it.editInputInvalid:""}`,value:s,onChange:T,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),N&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:N})]})}if(S.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("textarea",{ref:x,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&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),a.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return a.jsxs("span",{role:"button",tabIndex:0,className: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?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function _d(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,x=y.useRef(null),S=hh({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=x.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 a.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=>a.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return a.jsx("select",{ref:x,className:it.editSelect,value:S.draft,onChange:j,onBlur:T,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>a.jsx("option",{value:A.value,children:A.label},A.value))});const N=g==null?void 0:g(s),C=(D=c.find(A=>A.value===s))==null?void 0:D.label;return a.jsxs("button",{type:"button",className:it.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[N!==void 0?N:C?a.jsx("span",{children:C}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function Z5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return a.jsxs("label",{className:it.worktreeToggle,"data-testid":d,children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),a.jsx("span",{children:r})]})}const Y5="_nav_1snmp_1",J5="_searchForm_1snmp_8",W5="_searchInput_1snmp_15",X5="_searchButton_1snmp_33",Q5="_clearButton_1snmp_68",eI="_workspaceSelect_1snmp_85",tI="_listHeader_1snmp_99",nI="_nodeList_1snmp_108",sI="_nodeItem_1snmp_116",aI="_indicator_1snmp_129",iI="_label_1snmp_136",oI="_badge_1snmp_145",es={nav:Y5,searchForm:J5,searchInput:W5,searchButton:X5,clearButton:Q5,workspaceSelect:eI,listHeader:tI,nodeList:nI,nodeItem:sI,indicator:aI,label:iI,badge:oI};function rI({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]),x=y.useCallback(S=>{g(""),p(S)},[p]);return a.jsxs("div",{className:es.nav,"data-testid":"knowledge-nav",children:[a.jsxs("form",{className:es.searchForm,onSubmit:v,children:[a.jsx("input",{className:es.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),a.jsx("button",{type:"submit",className:es.searchButton,disabled:o,children:"Go"})]}),r&&a.jsx("button",{type:"button",className:es.clearButton,onClick:b,children:"Clear search"}),a.jsxs("select",{className:es.workspaceSelect,onChange:S=>{x(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[a.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>a.jsx("option",{value:S.id,children:S.name},S.id))]}),a.jsxs("div",{className:es.listHeader,children:["Nodes (",t.length,")"]}),a.jsx("ul",{className:es.nodeList,children:t.map(S=>a.jsxs("li",{className:es.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[a.jsx("span",{className:es.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),a.jsx("span",{className:es.label,children:S.label}),a.jsx("span",{className:es.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const lI="_container_bwu10_1",cI="_hamburger_bwu10_33",dI="_brand_bwu10_49",uI="_brandLogo_bwu10_68",fI="_info_bwu10_75",pI="_connectionLabel_bwu10_90",mI="_connectionDot_bwu10_103",hI="_connected_bwu10_106",gI="_disconnected_bwu10_110",vI="_connecting_bwu10_113",Ms={container:lI,hamburger:cI,brand:dI,brandLogo:uI,info:fI,connectionLabel:pI,connectionDot:mI,connected:hI,disconnected:gI,connecting:vI},yI={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},bI={connected:Ms.connected,connecting:Ms.connecting,disconnected:Ms.disconnected};function _I({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c}){const d=xt(),u=s.length,p=s.filter(v=>v.status==="connected").length,m=o.filter(v=>["running","idle"].includes(v.status)).length,g=yI[t];return a.jsxs("div",{className:Ms.container,children:[r&&a.jsx("button",{type:"button",className:Ms.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:a.jsx(NT,{size:Et,"aria-hidden":"true"})}),a.jsx(Ci,{text:"Home",placement:"bottom",children:a.jsxs("button",{type:"button",className:Ms.brand,onClick:()=>d(Fo),"data-testid":"statusbar-brand",children:[a.jsx("img",{src:Od("icon-192x192.png"),alt:"",className:Ms.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),a.jsxs("div",{className:Ms.info,children:[a.jsxs("span",{"aria-label":g,children:[a.jsx("span",{className:`${Ms.connectionDot} ${bI[t]}`,"aria-hidden":"true",children:a.jsx(Ni,{size:q_,fill:"currentColor"})})," ",a.jsx("span",{className:Ms.connectionLabel,"aria-hidden":"true",children:g})]}),a.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),a.jsxs("span",{children:[m," active"]})]})]})}const xI="_nav_gx5h3_1",kI="_tab_gx5h3_35",SI="_tabIcon_gx5h3_68",jI="_tabLabel_gx5h3_79",TI="_tabActive_gx5h3_84",NI="_tabEnd_gx5h3_90",wo={nav:xI,tab:kI,tabIcon:SI,tabLabel:jI,tabActive:TI,tabEnd:NI},id=[{view:"dashboard",label:"Dashboard",icon:a.jsx(pT,{size:Et}),route:Fo,testId:"sidebar-tab-dashboard",order:0},{view:"tasks",label:"Tasks",icon:a.jsx(Fj,{size:Et}),route:lC,testId:"sidebar-tab-tasks",order:1},{view:"environments",label:"Environments",icon:a.jsx(MT,{size:Et}),route:zo,testId:"sidebar-tab-environments",order:2},{view:"chat",label:"Root",icon:a.jsx(CT,{size:Et}),route:rC,testId:"sidebar-tab-chat",order:3},{view:"knowledge",label:"Knowledge",icon:a.jsx(zj,{size:Et}),route:mx,testId:"sidebar-tab-knowledge",order:5},{view:"coordination",label:"Coordination",icon:a.jsx(IT,{size:Et}),route:fx,testId:"sidebar-tab-coordination",order:6},{view:"settings",label:"Settings",icon:a.jsx(KT,{size:Et}),route:nC,testId:"sidebar-tab-settings",align:"end"}];function wI(t){return t===Fo||t==="/"?"dashboard":t.startsWith(fx)?"coordination":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(mx)?"knowledge":t.startsWith(ji)?"settings":"tasks"}function CI({tabs:t=id}){var g;const s=Wt(),o=xt(),r=y.useRef(null),c=wI(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(N=>N===document.activeElement),x=_>=0?_:d.findIndex(N=>N.view===c);let S=x;if(v.key==="ArrowRight"||v.key==="j"||v.key==="J")v.preventDefault(),S=(x+1)%d.length;else if(v.key==="ArrowLeft"||v.key==="k"||v.key==="K")v.preventDefault(),S=(x-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 a.jsx("nav",{className:wo.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 a.jsx(Ci,{text:v.label,placement:"bottom",className:_?wo.tabEnd:void 0,children:a.jsxs("button",{role:"tab",type:"button","aria-selected":b,tabIndex:b?0:-1,className:`${wo.tab} ${b?wo.tabActive:""}`,onClick:()=>p(v),"data-testid":v.testId,"aria-label":v.label,children:[a.jsx("span",{className:wo.tabIcon,"aria-hidden":"true",children:v.icon}),a.jsx("span",{className:wo.tabLabel,children:v.label})]})},v.view)})})}const EI="_container_pi6ii_1",AI="_content_pi6ii_66",n_={container:EI,content:AI},DI=320,W1=220,X1=600,Q1="grackle-sidebar-width";function MI(){try{const t=localStorage.getItem(Q1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=W1&&s<=X1)return s}}catch{}return DI}function RI(t){try{localStorage.setItem(Q1,String(t))}catch{}}function II({content:t}){const[s]=y.useState(MI),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=W1&&m<=X1&&RI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return a.jsx("div",{className:n_.container,ref:o,"data-testid":"sidebar",style:{width:s},children:a.jsx("div",{className:n_.content,children:t})})}const OI="_bar_tnfsh_1",BI="_btnPrimary_tnfsh_32",LI="_statusText_tnfsh_85",zI="_statusCompleted_tnfsh_90",$I="_statusFailed_tnfsh_94",HI="_statusBlocked_tnfsh_98",PI="_hintText_tnfsh_103",Ct={bar:OI,btnPrimary:BI,statusText:LI,statusCompleted:zI,statusFailed:$I,statusBlocked:HI,hintText:PI};function UI({sessions:t,tasks:s,environments:o}){const r=xt(),c=Wt(),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"),x=nn("/environments/:environmentId/workspaces/:workspaceId"),S=nn("/tasks/new"),j=nn("/chat"),T=nn("/"),N=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)??(x==null?void 0:x.params.environmentId),R=c.pathname.startsWith("/environments")&&!x&&!A,O=!!j,M=!!_,$=!!x&&!g&&!v&&!b,Y=!!S;if(!!T&&!M&&!$&&!Y||!!N||(!!m||!!b)||Y||R||M)return a.jsx(a.Fragment,{});if(O)return o.find(se=>se.adapterType==="local"&&se.status==="connected")?a.jsx(a.Fragment,{}):a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Add a local environment to start chatting"})});if($)return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Select a task or click + to create one"})});if(D){const Z=s.find(B=>B.id===D);if(!Z)return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.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 a.jsx("div",{className:Ct.bar,children:H?a.jsxs("span",{className:Ct.statusBlocked,children:["Blocked by: ",B.join(", ")]}):a.jsx("span",{className:Ct.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"?a.jsx(a.Fragment,{}):a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Waiting for agent..."})})}if(Z.status==="complete")return a.jsxs("div",{className:Ct.bar,children:[a.jsx("span",{className:`${Ct.statusText} ${Ct.statusCompleted}`,children:"Task completed"}),a.jsx("button",{onClick:()=>r(Ri(Z.workspaceId,void 0,E)),className:Ct.btnPrimary,children:"+ New Task"})]});if(Z.status==="failed")return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:`${Ct.statusText} ${Ct.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 a.jsx(a.Fragment,{});if(se)return a.jsxs("div",{className:Ct.bar,children:[a.jsxs("span",{className:`${Ct.statusText} ${Ct.hintText}`,children:["Session ",Z.endReason||Z.status]}),a.jsx("button",{onClick:()=>r(cx(Z.environmentId)),className:Ct.btnPrimary,children:"+ New Chat"})]})}return a.jsx("div",{className:Ct.bar,children:a.jsx("span",{className:Ct.hintText,children:"Loading..."})})}const VI="_nav_14i94_1",qI="_tab_14i94_24",GI="_tabActive_14i94_62",FI="_tabLabel_14i94_75",KI="_statusDot_14i94_81",ZI="_pulse_14i94_87",YI="_addButton_14i94_99",JI="_empty_14i94_132",Ua={nav:VI,tab:qI,tabActive:GI,tabLabel:FI,statusDot:KI,pulse:ZI,addButton:YI,empty:JI},WI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function XI({environments:t}){const s=xt(),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($o(_))},[s]),v=y.useCallback(_=>{var N;const x=(N=o.current)==null?void 0:N.querySelectorAll('[role="tab"]');if(!x||x.length===0)return;const S=Array.from(x).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)%x.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),T=(j-1+x.length)%x.length;else if(_.key==="Home")_.preventDefault(),T=0;else if(_.key==="End")_.preventDefault(),T=x.length-1;else return;T<t.length&&s($o(t[T].id)),x[T].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return a.jsxs("div",{className:Ua.nav,"data-testid":"environment-nav",children:[a.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const x=_.id===m,S=_.id===b,j=WI[_.status]||"var(--text-tertiary)",T=_.status==="connected";return a.jsxs("button",{role:"tab",type:"button","aria-selected":x,tabIndex:S?0:-1,className:`${Ua.tab} ${x?Ua.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[a.jsx("span",{className:`${Ua.statusDot} ${T?Ua.pulse:""}`,style:{color:j},"aria-hidden":"true",children:a.jsx(Ni,{size:q_,fill:"currentColor"})}),a.jsx("span",{className:Ua.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),a.jsx("button",{type:"button",className:Ua.addButton,onClick:()=>s(eC),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&a.jsx("div",{className:Ua.empty,children:"No environments yet."})]})}function QI(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 ek({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return a.jsx(a.Fragment,{children:t});const r=QI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(a.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(a.jsx("mark",{className:o,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(a.jsx("span",{children:t.slice(d)},`p${d}`)),a.jsx(a.Fragment,{children:c})}function eO(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 tO(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 aN){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ya(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=Ya(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const nO="_container_z4i38_1",sO="_header_z4i38_5",aO="_headerActions_z4i38_17",iO="_searchInput_z4i38_23",oO="_searchHighlight_z4i38_56",rO="_groupToggle_z4i38_62",lO="_groupToggleActive_z4i38_89",cO="_addButton_z4i38_93",dO="_taskRow_z4i38_120",uO="_selected_z4i38_140",fO="_expandArrow_z4i38_150",pO="_expanded_z4i38_157",mO="_leafSpacer_z4i38_161",hO="_taskStatusIcon_z4i38_166",gO="_taskTitle_z4i38_170",vO="_workspaceBadge_z4i38_177",yO="_childCountBadge_z4i38_195",bO="_dependencyBadge_z4i38_208",_O="_blockedBadge_z4i38_220",xO="_addChildButton_z4i38_225",kO="_emptyState_z4i38_268",SO="_statusGroupHeader_z4i38_275",jO="_statusGroupIcon_z4i38_294",TO="_statusGroupLabel_z4i38_298",NO="_statusGroupCount_z4i38_303",We={container:nO,header:sO,headerActions:aO,searchInput:iO,searchHighlight:oO,groupToggle:rO,groupToggleActive:lO,addButton:cO,taskRow:dO,selected:uO,expandArrow:fO,expanded:pO,leafSpacer:mO,taskStatusIcon:hO,taskTitle:gO,workspaceBadge:vO,childCountBadge:yO,dependencyBadge:bO,blockedBadge:_O,addChildButton:xO,emptyState:kO,statusGroupHeader:SO,statusGroupIcon:jO,statusGroupLabel:TO,statusGroupCount:NO},wO=[{name:"title",weight:2},{name:"description",weight:1}],tk=16,CO=16,nk="grackle-task-group-by-status";function s_(){try{return localStorage.getItem(nk)==="true"}catch{return!1}}function EO(t){try{localStorage.setItem(nk,String(t))}catch{}}function AO({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return a.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[a.jsxs("div",{className:We.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),o())},children:[a.jsx("span",{className:`${We.expandArrow} ${s?We.expanded:""}`,"aria-hidden":"true",children:a.jsx(pa,{size:Ye})}),a.jsx("span",{className:We.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),a.jsx("span",{className:We.statusGroupLabel,children:t.label}),a.jsx("span",{className:We.statusGroupCount,children:t.tasks.length})]}),a.jsx(os,{children:s&&a.jsx(Pt.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=Ya(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return a.jsxs("div",{onClick:()=>c(ls(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(ls(p.id)))},className:`${We.taskRow} ${g?We.selected:""}`,style:{"--task-indent":`${tk}px`},"data-task-id":p.id,children:[a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${fl(p.status)}`,children:m.icon}),a.jsx("span",{className:We.taskTitle,title:p.title,children:a.jsx(ek,{text:p.title,indices:d.get(p.id),highlightClass:We.searchHighlight})}),v&&a.jsx("span",{className:We.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function sk({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Ya(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(N=>u.get(N)!=="complete"),b=o.has(t.id),_=t.children.length>0,x=c===t.id,S=tk+s*CO,T=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>d(ls(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:N=>{N.currentTarget===N.target&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),d(ls(t.id)))},className:`${We.taskRow} ${x?We.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&a.jsx("span",{className:`${We.expandArrow} ${b?We.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:N=>{N.stopPropagation(),r(t.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),N.stopPropagation(),r(t.id))},children:a.jsx(pa,{size:Ye,"aria-hidden":"true"})}),!_&&a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${fl(t.status)}`,children:g.icon}),a.jsx("span",{className:We.taskTitle,title:t.title,children:a.jsx(ek,{text:t.title,indices:p.get(t.id),highlightClass:We.searchHighlight})}),T&&a.jsx("span",{className:We.workspaceBadge,title:T,children:T}),_&&a.jsxs("span",{className:We.childCountBadge,children:[t.children.filter(N=>N.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&a.jsx("span",{className:`${We.dependencyBadge} ${v?We.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<J2&&a.jsx(Ci,{text:"Add child task",children:a.jsx("button",{onClick:N=>{N.stopPropagation(),d(Ri(t.workspaceId,t.id))},"aria-label":"Add child task",className:We.addChildButton,children:"+"})})]}),a.jsx(os,{children:_&&b&&a.jsx(Pt.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(N=>a.jsx(sk,{node:N,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},N.id))})})]})}function DO({workspaces:t,tasks:s}){const o=xt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(s_),[g,v]=y.useState(s_),[b,_]=y.useState(new Map),x=nn("/tasks/:taskId/*"),S=(x==null?void 0:x.params.taskId)!=="new"?x==null?void 0:x.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]),N=()=>{const Z=!p;EO(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=Y2(s,E,wO),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?[]:eO(ne);return a.jsxs("div",{className:We.container,children:[a.jsxs("div",{className:We.header,children:[a.jsx("span",{children:"Tasks"}),a.jsxs("div",{className:We.headerActions,children:[a.jsx(Ci,{text:p?"Switch to tree view":"Group tasks by status",children:a.jsx("button",{className:`${We.groupToggle} ${p?We.groupToggleActive:""}`,onClick:N,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:a.jsx(kT,{size:Ht})})}),a.jsx(Ci,{text:"New task",children:a.jsx("button",{className:We.addButton,onClick:()=>o(Ri()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&a.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?tO(ne,j).map(Z=>a.jsx(AO,{group:Z,isExpanded:D(Z.status),onToggle:()=>C(Z.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:T},Z.status)):le.map(Z=>a.jsx(sk,{node:Z,depth:0,expandedTasks:r,toggleTask:A,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:$,workspaceNames:T},Z.id)),ne.length===0&&!Y&&a.jsx("div",{className:We.emptyState,children:"No tasks yet. Click + to create one."}),ne.length===0&&Y&&a.jsx("div",{className:We.emptyState,children:"No matching tasks"})]})}const MO="_toast_ed2dk_1",RO="_success_ed2dk_18",IO="_icon_ed2dk_22",OO="_error_ed2dk_25",BO="_warning_ed2dk_32",LO="_info_ed2dk_38",zO="_message_ed2dk_53",$O="_close_ed2dk_60",qr={toast:MO,success:RO,icon:IO,error:OO,warning:BO,info:LO,message:zO,close:$O},HO={success:a.jsx(Ai,{size:Et}),error:a.jsx(Ls,{size:Et}),warning:a.jsx(Sm,{size:Et}),info:a.jsx(km,{size:Et})};function PO({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),a.jsxs(Pt.div,{className:`${qr.toast} ${qr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[a.jsx("span",{className:qr.icon,"aria-hidden":"true",children:HO[t.variant]}),a.jsx("span",{className:qr.message,children:t.message}),a.jsx("button",{type:"button",className:qr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]})}const UO="_container_qqse2_1",VO={container:UO};function qO({toasts:t,onDismiss:s}){return a.jsx("div",{className:VO.container,"data-testid":"toast-container",children:a.jsx(os,{children:t.map(o=>a.jsx(PO,{toast:o,onDismiss:s},o.id))})})}const GO="_callout_e5awm_1",FO="_success_e5awm_11",KO="_icon_e5awm_15",ZO="_error_e5awm_18",YO="_warning_e5awm_25",JO="_info_e5awm_32",WO="_content_e5awm_48",XO="_close_e5awm_53",Gr={callout:GO,success:FO,icon:KO,error:ZO,warning:YO,info:JO,content:WO,close:XO},QO={success:a.jsx(Ai,{size:Et}),error:a.jsx(Ls,{size:Et}),warning:a.jsx(Sm,{size:Et}),info:a.jsx(km,{size:Et})};function eB({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return a.jsx(a.Fragment,{children:!c&&a.jsxs("div",{className:[Gr.callout,Gr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[a.jsx("span",{className:Gr.icon,"aria-hidden":"true",children:QO[t]}),a.jsx("span",{className:Gr.content,children:s}),o&&a.jsx("button",{type:"button",className:Gr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]})})}function tB({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return a.jsx(a.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return a.jsx("div",{"data-testid":"update-banner",children:a.jsxs(eB,{variant:"info",dismissible:!0,children:[a.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",a.jsx("code",{children:c})]})})}const nB="_container_m1fsr_1",sB="_heading_m1fsr_7",aB="_section_m1fsr_14",iB="_sectionTitle_m1fsr_26",oB="_sectionDescription_m1fsr_35",rB="_emptyState_m1fsr_41",lB="_tokenList_m1fsr_48",cB="_tokenRow_m1fsr_55",dB="_tokenBadge_m1fsr_68",uB="_tokenName_m1fsr_83",fB="_tokenTarget_m1fsr_90",pB="_deleteButton_m1fsr_99",mB="_addForm_m1fsr_113",hB="_formRow_m1fsr_119",gB="_input_m1fsr_125",vB="_select_m1fsr_155",yB="_addButton_m1fsr_187",bB="_emptyStateInfo_m1fsr_221",_B="_themeOptions_m1fsr_229",xB="_themeOption_m1fsr_229",kB="_themeOptionSelected_m1fsr_254",SB="_themeOptionHeader_m1fsr_259",jB="_themeOptionLabel_m1fsr_266",TB="_themeOptionDesc_m1fsr_273",NB="_variantToggle_m1fsr_279",wB="_variantButton_m1fsr_286",CB="_variantActive_m1fsr_305",EB="_themeSwatches_m1fsr_311",AB="_themeSwatch_m1fsr_311",DB="_systemToggle_m1fsr_325",MB="_systemToggleHint_m1fsr_341",RB="_themeActive_m1fsr_348",IB="_aboutGrid_m1fsr_354",OB="_aboutItem_m1fsr_360",BB="_aboutLabel_m1fsr_373",LB="_aboutValue_m1fsr_379",zB="_aboutDot_m1fsr_387",$B="_aboutDotConnected_m1fsr_394",HB="_aboutDotDisconnected_m1fsr_398",PB="_aboutDotConnecting_m1fsr_402",fe={container:nB,heading:sB,section:aB,sectionTitle:iB,sectionDescription:oB,emptyState:rB,tokenList:lB,tokenRow:cB,tokenBadge:dB,tokenName:uB,tokenTarget:fB,deleteButton:pB,addForm:mB,formRow:hB,input:gB,select:vB,addButton:yB,emptyStateInfo:bB,themeOptions:_B,themeOption:xB,themeOptionSelected:kB,themeOptionHeader:SB,themeOptionLabel:jB,themeOptionDesc:TB,variantToggle:NB,variantButton:wB,variantActive:CB,themeSwatches:EB,themeSwatch:AB,systemToggle:DB,systemToggleHint:MB,themeActive:RB,aboutGrid:IB,aboutItem:OB,aboutLabel:BB,aboutValue:LB,aboutDot:zB,aboutDotConnected:$B,aboutDotDisconnected:HB,aboutDotConnecting:PB},UB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function VB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,x]=y.useState(null),S=N=>{if(N.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=N=>{x(N)},T=()=>{_&&(o(_),r==null||r("Token deleted","info")),x(null)};return a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:T,onCancel:()=>x(null)}),a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),a.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):a.jsx("div",{className:fe.tokenList,children:t.map(N=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenBadge,children:N.tokenType}),a.jsx("span",{className:fe.tokenName,children:N.name}),a.jsx("span",{className:fe.tokenTarget,children:N.tokenType==="env_var"?N.envVar:N.filePath}),a.jsx("button",{className:fe.deleteButton,onClick:()=>j(N.name),title:`Delete ${N.name}`,"aria-label":`Delete ${N.name}`,children:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]},N.name))}),a.jsxs("form",{className:fe.addForm,onSubmit:S,children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:N=>d(N.target.value)}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:N=>p(N.target.value)})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsx("select",{className:fe.select,value:m,onChange:N=>g(N.target.value),children:UB.map(N=>a.jsx("option",{value:N.value,children:N.label},N.value))}),a.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:N=>b(N.target.value)}),a.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const Bd=[{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"]}],ak=new Set(Bd.map(t=>t.id)),a_="grackle";function pm(t){return Bd.find(s=>s.id===t)}function qB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),a.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),a.jsx("div",{className:fe.themeOptions,children:Bd.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 a.jsxs("button",{type:"button",className:`${fe.themeOption} ${p?fe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>o(d.id),children:[a.jsxs("span",{className:fe.themeOptionHeader,children:[a.jsxs("span",{children:[a.jsx("span",{className:fe.themeOptionLabel,children:d.label}),a.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&a.jsxs("span",{className:fe.variantToggle,children:[a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${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:"☼"}),a.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&&a.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((g,v)=>a.jsx("span",{className:fe.themeSwatch,style:{background:g}},v))})]},d.id)})}),a.jsxs("label",{className:fe.systemToggle,children:[a.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),a.jsx("span",{children:"Match system light/dark preference"})]}),a.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),a.jsxs("p",{className:fe.themeActive,children:["Active theme: ",a.jsx("strong",{children:s})]})]})}const GB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},FB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function KB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return a.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"About"}),a.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),a.jsxs("div",{className:fe.aboutGrid,children:[a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Connection"}),a.jsxs("span",{className:fe.aboutValue,children:[a.jsx("span",{className:`${fe.aboutDot} ${FB[t]}`}),GB[t]]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Environments"}),a.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),a.jsx("span",{className:fe.aboutValue,children:d})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Version"}),a.jsx("span",{className:fe.aboutValue,children:"0.123.1"})]})]})]})}const ZB="_container_cddyd_1",YB="_header_cddyd_8",JB="_headerTitle_cddyd_35",WB="_badge_cddyd_44",XB="_headerActions_cddyd_54",QB="_body_cddyd_61",eL="_formContent_cddyd_73",tL="_section_cddyd_85",nL="_label_cddyd_91",sL="_titleInput_cddyd_98",aL="_descriptionTextarea_cddyd_131",iL="_parentContext_cddyd_167",oL="_parentLabel_cddyd_175",rL="_parentName_cddyd_182",lL="_personaSelect_cddyd_186",cL="_depList_cddyd_220",dL="_depItem_cddyd_226",uL="_depItemSelected_cddyd_248",fL="_noDeps_cddyd_252",pL="_btnPrimary_cddyd_258",mL="_btnGhost_cddyd_289",Qe={container:ZB,header:YB,headerTitle:JB,badge:WB,headerActions:XB,body:QB,formContent:eL,section:tL,label:nL,titleInput:sL,descriptionTextarea:aL,parentContext:iL,parentLabel:oL,parentName:rL,personaSelect:lL,depList:cL,depItem:dL,depItemSelected:uL,noDeps:fL,btnPrimary:pL,btnGhost:mL};function ik({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 _=xt(),x=t==="edit",S=x&&s?d.find(ke=>ke.id===s):void 0,j=x?(S==null?void 0:S.workspaceId)??"":o??"",[T,N]=y.useState(j),C=j||T,D=u.find(ke=>ke.id===C),A=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!x&&!o,R=x?(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(()=>{x&&S&&!me.current&&(me.current=!0,$(S.title),V(S.description),le(S.dependsOn),se(S.defaultPersonaId),B(S.canDecompose),ge(S.injectKnowledge))},[x,S]);const xe=d.filter(ke=>ke.workspaceId===C&&(!x||ke.id!==s)&&ke.id!==R),De=M.trim().length>0&&(!x||S!==void 0)&&C.length>0,ot=ke=>{le(ct=>ct.includes(ke)?ct.filter(ue=>ue!==ke):[...ct,ke])},bt=()=>{!De||ee||x&&S===void 0||(x&&s?(g(s,M.trim(),Y,ne,Z),b==null||b("Task updated","success"),v?v():_(ls(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?wi(o,A):"/tasks",{replace:!0})},ke=>{b==null||b(ke,"error"),ce(!1)})))},lt=()=>{if(v){v();return}_(x&&s?ls(s,void 0,C,A):o?wi(o,A):"/tasks")},Pe=x?"edit task":R?"child task":"new task";return a.jsxs("div",{className:Qe.container,children:[a.jsxs("div",{className:Qe.header,children:[a.jsxs("div",{className:Qe.headerTitle,children:[a.jsx("span",{className:Qe.badge,children:Pe}),O&&a.jsxs("span",{className:Qe.parentContext,children:[a.jsx("span",{className:Qe.parentLabel,children:"Child of"}),a.jsx("span",{className:Qe.parentName,children:O.title})]})]}),a.jsxs("div",{className:Qe.headerActions,children:[a.jsx("button",{onClick:bt,disabled:!De||ee,className:Qe.btnPrimary,"data-testid":"task-edit-save",children:ee?"Creating…":x?"Save Changes":"Create"}),a.jsx("button",{onClick:lt,className:Qe.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:Qe.body,children:a.jsxs("div",{className:Qe.formContent,children:[E&&a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),a.jsxs("select",{id:"task-edit-workspace",value:T,onChange:ke=>N(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-workspace",children:[a.jsx("option",{value:"",children:"Select a workspace..."}),u.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-title",children:"Title"}),a.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&&bt()}})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-description",children:"Description"}),a.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})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),a.jsxs("select",{id:"task-edit-persona",value:Z,onChange:ke=>se(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),p.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),!x&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-can-decompose",children:[a.jsx("input",{type:"checkbox",checked:H,onChange:ke=>B(ke.target.checked)}),"Can spawn subtasks"]})}),!x&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-inject-knowledge",children:[a.jsx("input",{type:"checkbox",checked:F,onChange:ke=>ge(ke.target.checked)}),"Inject related prior work from the knowledge graph"]})}),a.jsxs("div",{className:Qe.section,children:[a.jsx("div",{className:Qe.label,children:"Dependencies"}),xe.length===0?a.jsx("div",{className:Qe.noDeps,children:"No other tasks in this workspace"}):a.jsx("div",{className:Qe.depList,children:xe.map(ke=>{const ct=ne.includes(ke.id);return a.jsxs("label",{className:`${Qe.depItem} ${ct?Qe.depItemSelected:""}`,"data-testid":`dep-option-${ke.id}`,children:[a.jsx("input",{type:"checkbox",checked:ct,onChange:()=>ot(ke.id)}),ke.title,a.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",ke.status,")"]})]},ke.id)})})]})]})})]})}const hL="_actionButtons_1rjka_1",gL="_btnPrimary_1rjka_8",vL="_btnDanger_1rjka_39",yL="_btnGhost_1rjka_78",Yt={actionButtons:hL,btnPrimary:gL,btnDanger:vL,btnGhost:yL};function bL({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?a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:m,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{"data-testid":"task-header-start",onClick:r,className:Yt.btnPrimary,children:"Start"}),a.jsx("button",{onClick:m,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Yt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:u,disabled:!s,className:Yt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:d,className:Yt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:c,className:Yt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="complete")return a.jsx("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:r,className:Yt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),a.jsx("button",{onClick:p,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const _L="_workpadSection_y8nj9_1",xL="_workpadLabel_y8nj9_9",kL="_workpadStatus_y8nj9_17",SL="_workpadSummary_y8nj9_23",jL="_workpadExtra_y8nj9_29",Va={workpadSection:_L,workpadLabel:xL,workpadStatus:kL,workpadSummary:SL,workpadExtra:jL};function TL({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return a.jsxs("div",{className:Va.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Va.workpadLabel,children:"Workpad"}),a.jsx("div",{className:Va.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return a.jsxs("div",{className:Va.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Va.workpadLabel,children:"Workpad"}),s.status&&a.jsx("div",{className:Va.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&a.jsx("div",{className:Va.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&a.jsx("div",{className:Va.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const NL="_overviewDashboard_r05qm_1",wL="_overviewHero_r05qm_7",CL="_statusBadge_r05qm_14",EL="_statusPending_r05qm_26",AL="_statusAssigned_r05qm_31",DL="_statusInProgress_r05qm_36",ML="_statusReview_r05qm_41",RL="_statusDone_r05qm_46",IL="_statusFailed_r05qm_51",OL="_statusWaitingInput_r05qm_56",BL="_overviewBranchPill_r05qm_61",LL="_branchLink_r05qm_76",zL="_overviewSection_r05qm_87",$L="_overviewLabel_r05qm_93",HL="_overviewValue_r05qm_100",PL="_overviewMuted_r05qm_105",UL="_overviewMarkdown_r05qm_111",VL="_envRow_r05qm_180",qL="_envDot_r05qm_186",GL="_envDotGreen_r05qm_193",FL="_envDotYellow_r05qm_197",KL="_envDotRed_r05qm_201",ZL="_envDotGray_r05qm_205",YL="_depList_r05qm_209",JL="_depItem_r05qm_215",WL="_depBlocked_r05qm_222",XL="_depDone_r05qm_226",QL="_timeline_r05qm_230",e8="_timelineRow_r05qm_236",t8="_timelineKey_r05qm_243",n8="_timelineValue_r05qm_249",s8="_timelineDelta_r05qm_253",a8="_reviewNotes_r05qm_264",be={overviewDashboard:NL,overviewHero:wL,statusBadge:CL,statusPending:EL,statusAssigned:AL,statusInProgress:DL,statusReview:ML,statusDone:RL,statusFailed:IL,statusWaitingInput:OL,overviewBranchPill:BL,branchLink:LL,overviewSection:zL,overviewLabel:$L,overviewValue:HL,overviewMuted:PL,overviewMarkdown:UL,envRow:VL,envDot:qL,envDotGreen:GL,envDotYellow:FL,envDotRed:KL,envDotGray:ZL,depList:YL,depItem:JL,depBlocked:WL,depDone:XL,timeline:QL,timelineRow:e8,timelineKey:t8,timelineValue:n8,timelineDelta:s8,reviewNotes:a8};function Gc(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 Ep(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 i_(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 i8({status:t}){const s=Ya(t),o=sN(t);return a.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function o8({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),x=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return a.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[a.jsxs("div",{className:be.overviewHero,children:[a.jsx(i8,{status:t.status}),t.branch&&a.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:x?a.jsxs("a",{href:x,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):a.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[a.jsx("div",{className:be.overviewLabel,children:"Description"}),a.jsx("div",{className:be.overviewMarkdown,children:a.jsx(_m,{remarkPlugins:[xm],children:t.description})})]}),t.workpad&&a.jsx(TL,{workpad:t.workpad}),a.jsxs("div",{className:be.overviewSection,children:[a.jsx("div",{className:be.overviewLabel,children:"Environment"}),g&&v?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${i_(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${i_(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:_.displayName}),a.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):a.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[a.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?a.jsx("div",{className:be.overviewMuted,children:"None"}):a.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const j=s.get(S),T=(j==null?void 0:j.status)==="complete";return a.jsxs("div",{className:`${be.depItem} ${T?be.depDone:be.depBlocked}`,children:[a.jsx("span",{children:T?"✓":"○"}),a.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[a.jsx("div",{className:be.overviewLabel,children:"Timeline"}),a.jsxs("div",{className:be.timeline,children:[t.createdAt&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Created"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=Ep(t.createdAt,t.assignedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Assigned"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.assignedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=Ep(t.assignedAt??t.createdAt,t.startedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Started"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.startedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=Ep(t.startedAt,t.completedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Completed"}),a.jsx("span",{className:be.timelineValue,children:Gc(t.completedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&a.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[a.jsx("div",{className:be.overviewLabel,children:"Usage"}),a.jsxs("div",{className:be.timeline,children:[a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsx("span",{className:be.timelineValue,children:Rs(u.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),p&&p.costMillicents>u.costMillicents&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),a.jsx("span",{className:be.timelineValue,children:Rs(p.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[p.sessionCount," session",p.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[a.jsx("div",{className:be.overviewLabel,children:"Budget"}),a.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Tokens"}),a.jsxs("span",{className:be.timelineValue,children:[Ho(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," / ",Ho(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsxs("span",{className:be.timelineValue,children:[Rs((u==null?void 0:u.costMillicents)??0)," / ",Rs(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[a.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),a.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function r8({plugins:t,loading:s,onSetPluginEnabled:o}){return a.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[a.jsx("h2",{className:fe.heading,children:"Plugins"}),a.jsxs("div",{className:fe.section,children:[a.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&a.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&a.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return a.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&a.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),a.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&a.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),a.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:a.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function l8({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),[x,S]=y.useState(!1),[j,T]=y.useState(!1),[N,C]=y.useState(null),D=t.find(M=>M.id===N),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(N)try{await c(N),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 a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:N!==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)}),a.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),a.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?a.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):a.jsx("div",{className:fe.tokenList,children:t.map(M=>a.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${M.id}`,children:[M.isDefault&&a.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),a.jsx("span",{className:fe.tokenName,children:M.label}),M.username&&a.jsxs("span",{className:fe.tokenTarget,children:["@",M.username]}),!M.isDefault&&a.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:a.jsx(WT,{size:Ht,"aria-hidden":"true"})}),a.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:a.jsx(Ls,{size:Ht,"aria-hidden":"true"})})]},M.id))}),a.jsxs("form",{className:fe.addForm,onSubmit:M=>{A(M).catch(()=>{})},children:[a.jsxs("div",{className:fe.formRow,children:[a.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"}),a.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"})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:b,onChange:M=>_(M.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),a.jsx("button",{className:fe.addButton,type:"submit",disabled:!p.trim()||!g.trim()||x,"data-testid":"github-account-add-button",children:x?"Adding...":"Add Account"}),a.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 c8="_container_legrg_1",d8="_header_legrg_8",u8="_headerTitle_legrg_35",f8="_badge_legrg_44",p8="_headerActions_legrg_54",m8="_body_legrg_61",h8="_formContent_legrg_73",g8="_section_legrg_85",v8="_label_legrg_91",y8="_nameInput_legrg_98",b8="_fieldInput_legrg_131",_8="_adapterSelect_legrg_164",x8="_readOnlyValue_legrg_198",k8="_codespaceSection_legrg_204",S8="_codespaceActions_legrg_210",j8="_creatingHint_legrg_216",T8="_errorHint_legrg_222",N8="_btnPrimary_legrg_235",w8="_btnGhost_legrg_266",oe={container:c8,header:d8,headerTitle:u8,badge:f8,headerActions:p8,body:m8,formContent:h8,section:g8,label:v8,nameInput:y8,fieldInput:b8,adapterSelect:_8,readOnlyValue:x8,codespaceSection:k8,codespaceActions:S8,creatingHint:j8,errorHint:T8,btnPrimary:N8,btnGhost:w8},od=1,rd=65535;function Ap(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=od&&s<=rd}function Dp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function C8({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(""),[x,S]=y.useState("");return g==="create"?a.jsxs("div",{className:oe.codespaceSection,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Repository"}),a.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Machine Type"}),a.jsx("input",{type:"text",value:x,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),a.jsxs("div",{className:oe.codespaceActions,children:[a.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),x.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),a.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):a.jsx("div",{className:oe.codespaceSection,children:a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Codespace"}),!u&&a.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[a.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>a.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),a.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&a.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:oe.errorHint,children:u}),a.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&&a.jsx("span",{className:oe.errorHint,children:d})]})})}function ok({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:x,dockerContainersError:S,onShowToast:j}){const T=xt(),N=t==="edit",C=N&&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,bt]=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")&&!Ap($)),ue=()=>{ct()&&(c(D.trim(),E,ke(),ce||void 0),j==null||j("Environment added successfully","success"),T(zo,{replace:!0}))},Re=()=>{T(s?$o(s):zo)},Q=y.useCallback((re,ve)=>{if(!C||!s)return;const et=Dp(C.adapterConfig),an=ve.trim();an?et[re]=an:delete et[re],d(s,{adapterConfig:et})},[C,s,d]),nt=y.useCallback((re,ve)=>{if(!C||!s)return;const et=Dp(C.adapterConfig);if(ve.trim()){const an=Number(ve);Number.isInteger(an)&&an>=od&&an<=rd&&(et[re]=an)}else delete et[re];d(s,{adapterConfig:et})},[C,s,d]);if(N){if(!C)return a.jsxs("div",{className:oe.container,children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"edit environment"})}),a.jsx("div",{className:oe.headerActions,children:a.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Back"})})]}),a.jsx("div",{className:oe.body,children:a.jsx("div",{className:oe.formContent,children:a.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const re=Dp(C.adapterConfig);return a.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"edit environment"})}),a.jsx("div",{className:oe.headerActions,children:a.jsx("button",{onClick:Re,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),a.jsx("div",{className:oe.body,children:a.jsxs("div",{className:oe.formContent,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Name"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Adapter Type"}),a.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)&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"GitHub Account"}),a.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:oe.adapterSelect,"data-testid":"env-edit-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>a.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Host"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Port"}),a.jsx(zt,{value:String(re.port??""),onSave:ve=>nt("port",ve),validate:ve=>Ap(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"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Host"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"User"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"SSH Port"}),a.jsx(zt,{value:String(re.sshPort??""),onSave:ve=>nt("sshPort",ve),validate:ve=>Ap(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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Identity File"}),a.jsx(zt,{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&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Attach (container)"}),a.jsx(zt,{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&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Image"}),a.jsx(zt,{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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Repo"}),a.jsx(zt,{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"&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Codespace Name"}),a.jsx(zt,{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 a.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[a.jsxs("div",{className:oe.header,children:[a.jsx("div",{className:oe.headerTitle,children:a.jsx("span",{className:oe.badge,children:"new environment"})}),a.jsxs("div",{className:oe.headerActions,children:[a.jsx("button",{onClick:ue,disabled:!ct(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),a.jsx("button",{onClick:Re,className:oe.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:oe.body,children:a.jsxs("div",{className:oe.formContent,children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),a.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()}})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),a.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:[a.jsx("option",{value:"local",children:"local"}),a.jsx("option",{value:"ssh",children:"ssh"}),a.jsx("option",{value:"docker",children:"docker"}),a.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),a.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:[a.jsx("option",{value:"",children:"(Default)"}),r.map(re=>a.jsxs("option",{value:re.id,children:[re.label," (@",re.username,")",re.isDefault?" — default":""]},re.id))]})]}),E==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:$,onChange:re=>Y(re.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:od,max:rd,value:$,onChange:re=>Y(re.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),a.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"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-docker-mode",children:"Source"}),a.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:[a.jsx("option",{value:"create",children:"Create new container"}),a.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),xe==="create"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),a.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"})]}),a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),a.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"})]})]}):a.jsxs("div",{className:oe.section,children:[a.jsx("label",{className:oe.label,children:"Container"}),!S&&x.length>0&&a.jsxs("select",{value:ot,onChange:re=>{bt(re.target.value),re.target.value&&!D.trim()&&A(re.target.value)},className:oe.adapterSelect,"data-testid":"env-docker-container-select",children:[a.jsx("option",{value:"",children:"Select a container..."}),x.map(re=>a.jsxs("option",{value:re.name,children:[re.name," (",re.image,") ",re.status]},re.id))]}),(S||x.length===0)&&a.jsxs(a.Fragment,{children:[S?a.jsx("span",{className:oe.errorHint,children:S}):a.jsx("span",{className:oe.creatingHint,children:"No running containers found."}),a.jsx("input",{type:"text",value:ot,onChange:re=>{bt(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"&&a.jsx(C8,{codespaceName:ge,onCodespaceNameChange:ee,envName:D,onEnvNameChange:A,codespaces:p,codespaceError:m,codespaceListError:g,codespaceCreating:v,onCreateCodespace:b})]})})]})}const E8="_group_1iprv_1",A8="_groupTitle_1iprv_8",D8="_shortcutList_1iprv_17",M8="_shortcutRow_1iprv_23",R8="_keys_1iprv_36",I8="_kbd_1iprv_43",O8="_description_1iprv_60",_i={group:E8,groupTitle:A8,shortcutList:D8,shortcutRow:M8,keys:R8,kbd:I8,description:O8},B8=[{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 L8(){return a.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),a.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),B8.map(t=>a.jsxs("div",{className:_i.group,children:[a.jsx("h4",{className:_i.groupTitle,children:t.title}),a.jsx("div",{className:_i.shortcutList,children:t.shortcuts.map(s=>a.jsxs("div",{className:_i.shortcutRow,children:[a.jsx("span",{className:_i.keys,children:s.keys.map(o=>a.jsx("kbd",{className:_i.kbd,children:o},o))}),a.jsx("span",{className:_i.description,children:s.description})]},s.description))})]},t.title))]})}const z8=[{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 $8({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),a.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),a.jsx("div",{className:fe.tokenList,children:z8.map(r=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenName,children:r.label}),a.jsx("span",{className:fe.tokenTarget,children:r.description}),a.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>a.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const H8="_container_10efq_1",P8="_header_10efq_7",U8="_list_10efq_105",V8="_card_10efq_111",q8="_cardHeader_10efq_125",G8="_cardTitle_10efq_135",F8="_defaultBadge_10efq_141",K8="_cardActions_10efq_155",Z8="_description_10efq_160",Y8="_meta_10efq_166",J8="_empty_10efq_212",W8="_typeBadge_10efq_362",ts={container:H8,header:P8,list:U8,card:V8,cardHeader:q8,cardTitle:G8,defaultBadge:F8,cardActions:K8,description:Z8,meta:Y8,empty:J8,typeBadge:W8};function X8({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 a.jsxs("div",{className:ts.container,children:[a.jsxs("div",{className:ts.header,children:[a.jsx("h2",{children:"Personas"}),a.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?a.jsx("p",{className:ts.empty,children:"No personas yet. Create one to get started."}):a.jsx("div",{className:ts.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return a.jsxs("div",{className:ts.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(v.id))},children:[a.jsxs("div",{className:ts.cardHeader,children:[a.jsxs("span",{className:ts.cardTitle,children:[a.jsx("strong",{children:v.name}),a.jsx("span",{className:ts.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&a.jsx("span",{className:ts.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),a.jsxs("div",{className:ts.cardActions,onClick:x=>x.stopPropagation(),children:[!b&&a.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"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&a.jsx("p",{className:ts.description,children:v.description}),a.jsxs("div",{className:ts.meta,children:[v.runtime&&a.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&a.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&a.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),a.jsx(_s,{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 Q8="_container_uy08i_1",e7="_header_uy08i_7",t7="_count_uy08i_13",n7="_presets_uy08i_18",s7="_presetButton_uy08i_24",a7="_filterInput_uy08i_41",i7="_groups_uy08i_53",o7="_group_uy08i_53",r7="_groupHeader_uy08i_68",l7="_groupName_uy08i_77",c7="_groupCount_uy08i_81",d7="_toolList_uy08i_87",u7="_toolItem_uy08i_95",f7="_toolName_uy08i_103",yn={container:Q8,header:e7,count:t7,presets:n7,presetButton:s7,filterInput:a7,groups:i7,group:o7,groupHeader:r7,groupName:l7,groupCount:c7,toolList:d7,toolItem:u7,toolName:f7},p7=(()=>{const t=new Map;for(const s of L_){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()}))})(),m7=[{name:"default",label:"Default",tools:B_},{name:"worker",label:"Worker",tools:W2},{name:"orchestrator",label:"Orchestrator",tools:X2},{name:"admin",label:"Admin",tools:Q2}];function o_({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 x of v)b?_.delete(x):_.add(x);s([..._].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),g=r.toLowerCase();return a.jsxs("div",{className:yn.container,"data-testid":"mcp-tool-selector",children:[a.jsx("div",{className:yn.header,children:a.jsx("span",{className:yn.count,children:t.length===0?`Using default (${B_.length} tools)`:`${t.length} of ${L_.size} tools selected`})}),a.jsxs("div",{className:yn.presets,"data-testid":"mcp-tool-presets",children:[m7.map(v=>a.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),a.jsx("button",{type:"button",className:yn.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),a.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"}),a.jsx("div",{className:yn.groups,children:p7.map(({group:v,tools:b})=>{const _=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(_.length===0)return null;const x=_.every(S=>d.has(S));return a.jsxs("div",{className:yn.group,"data-testid":`tool-group-${v}`,children:[a.jsxs("label",{className:yn.groupHeader,children:[a.jsx("input",{type:"checkbox",checked:x,onChange:()=>p(_,x),disabled:o,"data-testid":`group-toggle-${v}`}),a.jsx("span",{className:yn.groupName,children:v}),a.jsxs("span",{className:yn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),a.jsx("div",{className:yn.toolList,children:_.map(S=>a.jsxs("label",{className:yn.toolItem,children:[a.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),a.jsx("span",{className:yn.toolName,children:S})]},S))})]},v)})})]})}function mm(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 rk(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 h7="_container_1gfuq_1",g7="_header_1gfuq_7",v7="_list_1gfuq_19",y7="_card_1gfuq_25",b7="_cardHeader_1gfuq_40",_7="_cardTitle_1gfuq_46",x7="_statusBadge_1gfuq_56",k7="_enabled_1gfuq_68",S7="_disabled_1gfuq_71",j7="_cardActions_1gfuq_75",T7="_cardMeta_1gfuq_80",N7="_empty_1gfuq_98",ns={container:h7,header:g7,list:v7,card:y7,cardHeader:b7,cardTitle:_7,statusBadge:x7,enabled:k7,disabled:S7,cardActions:j7,cardMeta:T7,empty:N7};function w7({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 x of s)_.set(x.id,x.name);return _},[s]),b=_=>v.get(_)??_;return a.jsxs("div",{className:ns.container,children:[a.jsxs("div",{className:ns.header,children:[a.jsx("h2",{children:"Schedules"}),a.jsx(sn,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?a.jsx("p",{className:ns.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):a.jsx("div",{className:ns.list,children:t.map(_=>a.jsxs("div",{className:ns.card,"data-testid":`schedule-card-${_.id}`,onClick:()=>d(_.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(_.id))},children:[a.jsxs("div",{className:ns.cardHeader,children:[a.jsxs("span",{className:ns.cardTitle,children:[a.jsx("strong",{children:_.title}),a.jsx("span",{className:`${ns.statusBadge} ${_.enabled?ns.enabled:ns.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),a.jsxs("div",{className:ns.cardActions,onClick:x=>x.stopPropagation(),children:[a.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"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),a.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>p(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),a.jsxs("div",{className:ns.cardMeta,children:[a.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&a.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),a.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?mm(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?a.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",rk(_.nextRunAt)]}):null,_.runCount>0&&a.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),a.jsx(_s,{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 C7="_nav_1bhou_1",E7="_tab_1bhou_24",A7="_tabIcon_1bhou_62",D7="_tabActive_1bhou_68",Fc={nav:C7,tab:E7,tabIcon:A7,tabActive:D7},ia=[{path:"credentials",label:"Credentials",icon:a.jsx(gT,{size:Et})},{path:"github-accounts",label:"GitHub Accounts",icon:a.jsx(cT,{size:Et})},{path:"personas",label:"Personas",icon:a.jsx(eN,{size:Et})},{path:"schedules",label:"Schedules",icon:a.jsx(Hj,{size:Et})},{path:"appearance",label:"Appearance",icon:a.jsx(BT,{size:Et})},{path:"shortcuts",label:"Shortcuts",icon:a.jsx(yT,{size:Et})},{path:"plugins",label:"Plugins",icon:a.jsx(UT,{size:Et})},{path:"about",label:"About",icon:a.jsx(km,{size:Et})}];function M7(){var u;const t=Wt(),s=xt(),o=y.useRef(null),r=((u=ia.find(p=>{const m=`${ji}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??ia[0].path,c=y.useCallback(p=>{s(`${ji}/${p}`)},[s]),d=y.useCallback(p=>{var x,S;const m=(x=o.current)==null?void 0:x.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:ia.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%ia.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+ia.length)%ia.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=ia.length-1;else return;const _=ia[b].path;s(`${ji}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return a.jsx("nav",{className:Fc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:ia.map(p=>{const m=p.path===r;return a.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Fc.tab} ${m?Fc.tabActive:""}`,onClick:()=>c(p.path),children:[a.jsx("span",{className:Fc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}const R7=["lifecycle:","pipe:","stdin:"];function gh(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function lk(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 I7(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const p=lk(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 O7="_container_16qkd_1",B7="_header_16qkd_7",L7="_title_16qkd_15",z7="_headerActions_16qkd_21",$7="_internalsToggle_16qkd_27",H7="_refreshButton_16qkd_37",P7="_state_16qkd_52",U7="_group_16qkd_59",V7="_groupHeader_16qkd_63",q7="_row_16qkd_72",G7="_selected_16qkd_92",F7="_kindBadge_16qkd_96",K7="_kindChatroom_16qkd_108",Z7="_kindPipe_16qkd_114",Y7="_kindChannel_16qkd_120",J7="_streamName_16qkd_126",W7="_meta_16qkd_135",Jt={container:O7,header:B7,title:L7,headerActions:z7,internalsToggle:$7,refreshButton:H7,state:P7,group:U7,groupHeader:V7,row:q7,selected:G7,kindBadge:F7,kindChatroom:K7,kindPipe:Z7,kindChannel:Y7,streamName:J7,meta:W7},X7={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function Q7({kind:t}){return t==="chatroom"?a.jsx(AT,{size:Ye,"aria-hidden":"true"}):t==="pipe"?a.jsx(rT,{size:Ye,"aria-hidden":"true"}):a.jsx(uT,{size:Ye,"aria-hidden":"true"})}function ez({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:p,selectedStreamId:m,onSelectStream:g,onRefresh:v,hideHeaderControls:b=!1}){const _=I7(t,s),x={chatroom:Jt.kindChatroom,pipe:Jt.kindPipe,channel:Jt.kindChannel},S=j=>{var T;return((T=o.find(N=>N.id===j))==null?void 0:T.title)??j};return a.jsxs("div",{className:Jt.container,"data-testid":"coordination-list",children:[a.jsxs("div",{className:Jt.header,children:[a.jsx("span",{className:Jt.title,children:"Coordination"}),!b&&a.jsxs("div",{className:Jt.headerActions,children:[a.jsxs("label",{className:Jt.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:u,onChange:j=>p(j.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&a.jsx("button",{type:"button",className:Jt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:a.jsx(qT,{size:Ye,"aria-hidden":"true"})})]})]}),r&&t.length===0&&a.jsxs("div",{className:Jt.state,children:["Loading","…"]}),!r&&c&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-empty",children:"No active streams"}),_.map(j=>a.jsxs("div",{className:Jt.group,children:[a.jsx("div",{className:Jt.groupHeader,children:j.taskId?S(j.taskId):"Unattached / external (CLI · MCP)"}),j.streams.map(T=>{const N=gh(T),C=T.id===m;return a.jsxs("button",{type:"button",className:`${Jt.row}${C?` ${Jt.selected}`:""}`,onClick:()=>g(T.id),"data-testid":`coordination-row-${T.id}`,"aria-current":C?"page":void 0,children:[a.jsxs("span",{className:`${Jt.kindBadge} ${x[N]}`,children:[a.jsx(Q7,{kind:N})," ",X7[N]]}),a.jsx("span",{className:Jt.streamName,children:T.name}),a.jsxs("span",{className:Jt.meta,children:[T.subscriberCount," ",T.subscriberCount===1?"sub":"subs"," ","·"," ",T.messageBufferDepth," buffered"]})]},T.id)})]},j.taskId??"__orphans__"))]})}const tz="_transcript_1p4cm_1",nz="_message_1p4cm_10",sz="_meta_1p4cm_16",az="_sender_1p4cm_24",iz="_time_1p4cm_29",oz="_content_1p4cm_34",rz="_state_1p4cm_42",qa={transcript:tz,message:nz,meta:sz,sender:az,time:iz,content:oz,state:rz};function lz(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleTimeString()}function cz({messages:t,loading:s=!1}){return s?a.jsx("div",{className:qa.state,"data-testid":"stream-transcript-loading",children:"Loading transcript…"}):t.length===0?a.jsx("div",{className:qa.state,"data-testid":"stream-transcript-empty",children:"No messages yet."}):a.jsx("div",{className:qa.transcript,"data-testid":"stream-transcript",children:t.map(o=>a.jsxs("div",{className:qa.message,"data-testid":"stream-transcript-message",children:[a.jsxs("div",{className:qa.meta,children:[a.jsx("span",{className:qa.sender,title:o.senderId,children:o.senderId.slice(0,12)}),a.jsx("span",{className:qa.time,children:lz(o.timestamp)})]}),a.jsx("div",{className:qa.content,children:o.content})]},o.seq))})}const dz="_panel_iibrt_1",uz="_header_iibrt_24",fz="_title_iibrt_33",pz="_closeButton_iibrt_43",mz="_body_iibrt_57",hz="_section_iibrt_63",gz="_sectionLabel_iibrt_67",vz="_metaRow_iibrt_76",yz="_metaKey_iibrt_84",bz="_metaValue_iibrt_90",_z="_subscriberCard_iibrt_99",xz="_subscriberHeader_iibrt_107",kz="_sessionLink_iibrt_114",Sz="_badges_iibrt_132",jz="_badgeRw_iibrt_150 _badge_iibrt_132",Tz="_badgeR_iibrt_150 _badge_iibrt_132",Nz="_badgeW_iibrt_162 _badge_iibrt_132",wz="_badgeAsync_iibrt_168 _badge_iibrt_132",Cz="_badgeSync_iibrt_174 _badge_iibrt_132",Ez="_badgeDetach_iibrt_178 _badge_iibrt_132",Az="_spawnTag_iibrt_184 _badge_iibrt_132",Dz="_fdNumber_iibrt_189",Mz="_emptySubscribers_iibrt_195",Rz="_metaValueMono_iibrt_201 _metaValue_iibrt_90",Iz="_advanced_iibrt_216",Oz="_advancedSummary_iibrt_220",He={panel:dz,header:uz,title:fz,closeButton:pz,body:mz,section:hz,sectionLabel:gz,metaRow:vz,metaKey:yz,metaValue:bz,subscriberCard:_z,subscriberHeader:xz,sessionLink:kz,badges:Sz,badgeRw:jz,badgeR:Tz,badgeW:Nz,badgeAsync:wz,badgeSync:Cz,badgeDetach:Ez,spawnTag:Az,fdNumber:Dz,emptySubscribers:Mz,metaValueMono:Rz,advanced:Iz,advancedSummary:Oz},Bz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function Lz({permission:t}){const s=t==="rw"?He.badgeRw:t==="r"?He.badgeR:He.badgeW;return a.jsx("span",{className:s,children:t})}function zz({mode:t}){const s=t==="async"?He.badgeAsync:t==="detach"?He.badgeDetach:He.badgeSync;return a.jsx("span",{className:s,children:t})}function $z({stream:t,messages:s,transcriptLoading:o,onClose:r}){const c=xt();return y.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r]),a.jsxs("div",{className:He.panel,"data-testid":"stream-detail-panel",children:[a.jsxs("div",{className:He.header,children:[a.jsx("h3",{className:He.title,children:t.name}),a.jsx("button",{type:"button",className:He.closeButton,onClick:r,"aria-label":"Close stream details",children:"×"})]}),a.jsxs("div",{className:He.body,children:[a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Overview"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Kind"}),a.jsx("span",{className:He.metaValue,children:Bz[gh(t)]})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Participants"}),a.jsx("span",{className:He.metaValue,children:t.subscriberCount})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Buffered"}),a.jsxs("span",{className:He.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Participants"}),t.subscribers.length===0?a.jsx("div",{className:He.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,"data-testid":`subscriber-card-${d.subscriptionId}`,children:[a.jsxs("button",{type:"button",className:He.sessionLink,onClick:()=>{c(Mm(d.sessionId))},title:d.sessionId,children:[d.sessionId.slice(0,12),"…"]}),d.createdBySpawn&&a.jsx("span",{className:He.spawnTag,children:"spawn"})]},d.subscriptionId))]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Conversation"}),a.jsx(cz,{messages:s??[],loading:o??!1})]}),a.jsxs("details",{className:He.advanced,"data-testid":"stream-advanced",children:[a.jsx("summary",{className:He.advancedSummary,children:"Advanced"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Stream ID"}),a.jsx("span",{className:He.metaValueMono,children:t.id})]}),t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,children:[a.jsxs("div",{className:He.subscriberHeader,children:[a.jsxs("span",{className:He.fdNumber,children:["fd ",d.fd]}),a.jsxs("span",{className:He.metaValueMono,title:d.subscriptionId,children:[d.subscriptionId.slice(0,12),"…"]})]}),a.jsxs("div",{className:He.badges,children:[a.jsx(Lz,{permission:d.permission}),a.jsx(zz,{mode:d.deliveryMode})]})]},d.subscriptionId))]})]})]})}function Mp(t){return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):t}const Hz=["--accent-green","--accent-yellow","--accent-red","--text-tertiary"];function ck(t,s){if(s)return{varName:"--text-tertiary",label:"External"};switch(t){case"running":return{varName:"--accent-green",label:"Running"};case"idle":case"suspended":case"hibernating":return{varName:"--accent-yellow",label:Mp(t)};case"failed":case"interrupted":return{varName:"--accent-red",label:Mp(t)};default:return{varName:"--text-tertiary",label:t.length>0?Mp(t):"Unknown"}}}const dk="session",vh="stream",r_="messageDot";function Kc(t){return`session:${t}`}function l_(t){return`stream:${t}`}function Pz(t){return{id:t,environmentId:"",runtime:"external",status:"external",prompt:"",startedAt:""}}function Uz(t,s){return t==="detach"?{stroke:s,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6}:{stroke:s,strokeWidth:1.5}}function Vz(t,s){const o=t.permission.includes("w"),r=s.permission.includes("w"),c=t.permission.includes("r"),d=s.permission.includes("r");if(o&&!r&&d)return{source:t,target:s,bidirectional:!1};if(r&&!o&&c)return{source:s,target:t,bidirectional:!1};const u=[t,s].sort((p,m)=>p.sessionId.localeCompare(m.sessionId));return{source:u[0],target:u[1],bidirectional:!0}}function qz(t,s){if(t.length===0)return{nodes:[],edges:[]};const o=new Map(s.map(m=>[m.id,m])),r=new Map,c=new Map,d=[],u=m=>{let g=r.get(m);if(!g){const v=o.get(m);g={kind:"session",session:v??Pz(m),streamCount:0,external:v===void 0},r.set(m,g)}return g};for(const m of t){const g=gh(m);if(g==="pipe"&&m.subscribers.length===2&&m.subscribers[0].sessionId!==m.subscribers[1].sessionId){const[v,b]=m.subscribers;u(v.sessionId).streamCount+=1,u(b.sessionId).streamCount+=1;const{source:_,target:x,bidirectional:S}=Vz(v,b);d.push({id:`edge-pipe-${m.id}`,source:Kc(_.sessionId),target:Kc(x.sessionId),type:r_,data:{edgeKind:"pipe",streamId:m.id,permission:S?"rw":_.permission,deliveryMode:_.deliveryMode},style:{stroke:"var(--accent-yellow)",strokeWidth:1.5,strokeDasharray:"6 3"},markerEnd:{type:Mc.ArrowClosed},markerStart:S?{type:Mc.ArrowClosed}:void 0,animated:!1});continue}c.set(m.id,{kind:"stream",stream:m,streamKind:g,ownership:lk(m,o)});for(const v of m.subscribers){u(v.sessionId).streamCount+=1;const b=l_(m.id),_=Kc(v.sessionId),x=v.permission.includes("w"),S=v.permission.includes("r");let j,T,N=!1;x&&S?(j=_,T=b,N=!0):S?(j=b,T=_):(j=_,T=b),d.push({id:`edge-part-${m.id}-${v.subscriptionId}`,source:j,target:T,type:r_,data:{edgeKind:"participation",streamId:m.id,permission:v.permission,deliveryMode:v.deliveryMode},style:Uz(v.deliveryMode,"var(--text-tertiary)"),markerEnd:{type:Mc.ArrowClosed},markerStart:N?{type:Mc.ArrowClosed}:void 0,animated:!1})}}const p=[];for(const[m,g]of r)p.push({id:Kc(m),type:dk,position:{x:0,y:0},data:g});for(const[m,g]of c)p.push({id:l_(m),type:vh,position:{x:0,y:0},data:g});return{nodes:p,edges:d}}const Gz=200,Fz=64,Kz=180,Zz=56,Yz=40,Jz=70;function c_(t){return t===vh?{width:Kz,height:Zz}:{width:Gz,height:Fz}}function Wz(t){if(t.nodes.length===0)return t;const s=new cd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"LR",nodesep:Yz,ranksep:Jz});for(const r of t.nodes){const{width:c,height:d}=c_(r.type);s.setNode(r.id,{width:c,height:d})}for(const r of t.edges)s.setEdge(r.source,r.target,{},r.id);return cd.layout(s),{nodes:t.nodes.map(r=>{const c=s.node(r.id),{width:d,height:u}=c_(r.type);return{...r,position:{x:c.x-d/2,y:c.y-u/2}}}),edges:t.edges}}function Xz(t,s){return y.useMemo(()=>Wz(qz(t,s)),[t,s])}const Qz="_graphContainer_bez0d_1",e$="_empty_bez0d_18",t$="_nodeContent_bez0d_28",n$="_nodeHeader_bez0d_38",s$="_nodeTitle_bez0d_50",a$="_nodeMeta_bez0d_58",i$="_nodeSubtle_bez0d_64",o$="_countBadge_bez0d_69",r$="_sessionNode_bez0d_81",l$="_sessionAccent_bez0d_103",c$="_external_bez0d_109",d$="_streamNode_bez0d_114",u$="_chatroom_bez0d_134",f$="_channel_bez0d_139",p$="_pipe_bez0d_143",m$="_haloless_bez0d_147",h$="_selected_bez0d_153",g$="_kindBadge_bez0d_158",v$="_handle_bez0d_172",y$="_messageDot_bez0d_179",vt={graphContainer:Qz,empty:e$,nodeContent:t$,nodeHeader:n$,nodeTitle:s$,nodeMeta:a$,nodeSubtle:i$,countBadge:o$,sessionNode:r$,sessionAccent:l$,external:c$,streamNode:d$,chatroom:u$,channel:f$,pipe:p$,haloless:m$,selected:h$,kindBadge:g$,handle:v$,messageDot:y$};function b$({data:t}){const{session:s,streamCount:o,external:r}=t,c=ck(s.status,r),d=`var(${c.varName})`,u=r?`${vt.sessionNode} ${vt.external}`:vt.sessionNode;return a.jsxs("div",{className:u,"data-testid":`coordination-node-session-${s.id}`,children:[a.jsx(Bo,{type:"target",position:Lo.Left,className:vt.handle}),a.jsx("div",{className:vt.sessionAccent,style:{backgroundColor:d}}),a.jsxs("div",{className:vt.nodeContent,children:[a.jsx("div",{className:vt.nodeHeader,children:a.jsx("span",{className:vt.nodeTitle,children:r?s.id:s.runtime})}),a.jsxs("div",{className:vt.nodeMeta,children:[a.jsx("span",{className:vt.nodeSubtle,style:{color:d},children:c.label}),o>0&&a.jsx("span",{className:vt.countBadge,children:o})]})]}),a.jsx(Bo,{type:"source",position:Lo.Right,className:vt.handle})]})}function _$({data:t,selected:s}){const{stream:o,streamKind:r,ownership:c}=t,d=r==="chatroom"?vt.chatroom:r==="pipe"?vt.pipe:vt.channel,u=[vt.streamNode,d];return c.kind!=="task"&&u.push(vt.haloless),s&&u.push(vt.selected),a.jsxs("div",{className:u.join(" "),"data-testid":`coordination-node-stream-${o.id}`,children:[a.jsx(Bo,{type:"target",position:Lo.Left,className:vt.handle}),a.jsxs("div",{className:vt.nodeContent,children:[a.jsx("div",{className:vt.nodeHeader,children:a.jsx("span",{className:vt.kindBadge,children:r})}),a.jsx("span",{className:vt.nodeTitle,children:o.name}),a.jsxs("span",{className:vt.nodeSubtle,children:[o.subscriberCount," ",o.subscriberCount===1?"subscriber":"subscribers"]})]}),a.jsx(Bo,{type:"source",position:Lo.Right,className:vt.handle})]})}const d_="0.7s",x$=3;function k$(t){const{sourceX:s,sourceY:o,targetX:r,targetY:c,sourcePosition:d,targetPosition:u,markerStart:p,markerEnd:m,style:g,data:v}=t,[b]=U2({sourceX:s,sourceY:o,targetX:r,targetY:c,sourcePosition:d,targetPosition:u}),_=v==null?void 0:v.pulseSeq;return a.jsxs(a.Fragment,{children:[a.jsx(V2,{path:b,markerStart:p,markerEnd:m,style:g}),_!==void 0&&a.jsxs("circle",{r:x$,opacity:0,className:vt.messageDot,"data-testid":"coordination-message-dot",children:[a.jsx("animateMotion",{dur:d_,repeatCount:"1",path:b}),a.jsx("animate",{attributeName:"opacity",dur:d_,repeatCount:"1",values:"0;1;1;0",keyTimes:"0;0.1;0.85;1"})]},_)]})}const Rp="#6b7a8d",S$={[dk]:b$,[vh]:_$},j$={messageDot:k$};function T$({streams:t,sessions:s,selectedStreamId:o,onSelectStream:r,recentMessages:c,resolvedThemeId:d}){const u=Xz(t,s),p=y.useMemo(()=>u.edges.map(_=>{var S,j;if(!_.data)return _;const x=(j=(S=c==null?void 0:c[_.data.streamId])==null?void 0:S.at(-1))==null?void 0:j.seq;return x===void 0?_:{..._,data:{..._.data,pulseSeq:x}}}),[u.edges,c]),m=y.useMemo(()=>u.nodes.map(_=>{const x=_.data;return x.kind==="stream"&&x.stream.id===o?{..._,selected:!0}:_}),[u.nodes,o]),g=y.useMemo(()=>{const _=getComputedStyle(document.documentElement),x={};for(const S of Hz)x[S]=_.getPropertyValue(S).trim()||Rp;return x},[d]),v=y.useCallback((_,x)=>{const S=x.data;S.kind==="stream"&&r(S.stream.id)},[r]),b=y.useCallback(_=>{const x=_.data;return x.kind==="session"?g[ck(x.session.status,x.external).varName]??Rp:Rp},[g]);return u.nodes.length===0?a.jsx("div",{className:vt.empty,"data-testid":"coordination-graph-empty",children:"No active streams to visualize"}):a.jsx("div",{className:vt.graphContainer,"data-testid":"coordination-graph",children:a.jsxs(D_,{nodes:m,edges:p,nodeTypes:S$,edgeTypes:j$,onNodeClick:v,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(M_,{variant:R_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(I_,{showInteractive:!1}),a.jsx(O_,{nodeColor:b,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function N$({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(Sy.map(d=>[d,[]]));for(const d of t){const u=fl(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},x=c.get(u);x?x.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return Sy.map(d=>{const u=Ya(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const w$="_boardContainer_1c4y1_1",C$="_column_1c4y1_17",E$="_columnHeader_1c4y1_34",A$="_columnIcon_1c4y1_47",D$="_columnLabel_1c4y1_52",M$="_columnCount_1c4y1_57",R$="_cardList_1c4y1_67",I$="_emptyPlaceholder_1c4y1_76",O$="_card_1c4y1_67",B$="_cardHeader_1c4y1_107",L$="_cardStatusIcon_1c4y1_113",z$="_cardTitle_1c4y1_119",$$="_cardBadges_1c4y1_127",H$="_badge_1c4y1_134",P$="_blockedBadge_1c4y1_146",U$="_childBadge_1c4y1_151",V$="_depBadge_1c4y1_155",q$="_parentBadge_1c4y1_159",G$="_pausedSubBadge_1c4y1_166",F$="_personaBadge_1c4y1_170",K$="_envBadge_1c4y1_174",Z$="_emptyCta_1c4y1_178",Y$="_ctaButton_1c4y1_188",J$="_ctaDescription_1c4y1_204",dt={boardContainer:w$,column:C$,columnHeader:E$,columnIcon:A$,columnLabel:D$,columnCount:M$,cardList:R$,emptyPlaceholder:I$,card:O$,cardHeader:B$,cardStatusIcon:L$,cardTitle:z$,cardBadges:$$,badge:H$,blockedBadge:P$,childBadge:U$,depBadge:V$,parentBadge:q$,pausedSubBadge:G$,personaBadge:F$,envBadge:K$,emptyCta:Z$,ctaButton:Y$,ctaDescription:J$};function W$({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=xt(),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])),x=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,T=new Map,N=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=x.get(D.personaId);A&&T.set(C.id,A.name)}if(D.environmentId){const A=S.get(D.environmentId);A&&N.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:T,environmentNameByTaskId:N}},[p,r,c,d]),b=y.useMemo(()=>N$({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?a.jsxs("div",{className:dt.emptyCta,"data-testid":"board-empty-cta",children:[a.jsx("button",{className:dt.ctaButton,onClick:()=>u(Ri(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:dt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):a.jsx("div",{className:dt.boardContainer,"data-testid":"board-container",children:b.map(_=>a.jsxs("section",{className:dt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[a.jsxs("div",{className:dt.columnHeader,children:[a.jsx("span",{className:dt.columnIcon,style:{color:_.style.color},children:_.style.icon}),a.jsx("span",{className:dt.columnLabel,children:_.label}),a.jsx("span",{className:dt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),a.jsx("div",{className:dt.cardList,children:_.tasks.length===0?a.jsx("div",{className:dt.emptyPlaceholder,children:"No tasks"}):a.jsx(os,{mode:"popLayout",children:_.tasks.map(x=>a.jsx(Pt.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:a.jsx(X$,{boardTask:x,tasksById:g,personaName:v.personaNameByTaskId.get(x.task.id),envName:v.environmentNameByTaskId.get(x.task.id),onClick:()=>u(ls(x.task.id,void 0,t,s))})},x.task.id))})})]},_.status))})}function X$({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Ya(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return a.jsxs("div",{className:dt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[a.jsxs("div",{className:dt.cardHeader,children:[a.jsx("span",{className:dt.cardStatusIcon,style:{color:v.color},children:v.icon}),a.jsx("span",{className:dt.cardTitle,children:d.title})]}),a.jsxs("div",{className:dt.cardBadges,children:[b&&a.jsx("span",{className:`${dt.badge} ${dt.parentBadge}`,title:b.title,children:b.title}),p>0&&a.jsxs("span",{className:`${dt.badge} ${dt.childBadge}`,children:[m,"/",p]}),u&&a.jsx("span",{className:`${dt.badge} ${dt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&a.jsx("span",{className:`${dt.badge} ${dt.depBadge}`,children:"dep"}),g&&a.jsx("span",{className:`${dt.badge} ${dt.pausedSubBadge}`,children:g}),o&&a.jsx("span",{className:`${dt.badge} ${dt.personaBadge}`,children:o}),r&&a.jsx("span",{className:`${dt.badge} ${dt.envBadge}`,children:r})]})]})}const Q$="_formContent_ymnez_1",eH="_section_ymnez_13",tH="_label_ymnez_19",nH="_titleInput_ymnez_26",sH="_descriptionTextarea_ymnez_58",aH="_selectField_ymnez_94",iH="_checkboxRow_ymnez_128",oH="_checkboxLabel_ymnez_141",rH="_fieldError_ymnez_146",jt={formContent:Q$,section:eH,label:tH,titleInput:nH,descriptionTextarea:sH,selectField:aH,checkboxRow:iH,checkboxLabel:oH,fieldError:rH};function lH(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 cH=100;function dH({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return a.jsxs("div",{className:jt.formContent,children:[a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-name",children:"Name"}),a.jsx("input",{id:"ws-name",className:jt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:cH,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-description",children:"Description"}),a.jsx("textarea",{id:"ws-description",className:jt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-repo",children:"Repository URL"}),a.jsx("input",{id:"ws-repo",className:jt.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)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-environment",children:"Environment"}),a.jsxs("select",{id:"ws-environment",className:jt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[a.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>a.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&a.jsx("span",{className:jt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-persona",children:"Default Persona"}),a.jsxs("select",{id:"ws-persona",className:jt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>a.jsx("option",{value:m.id,children:m.name},m.id))]})]}),a.jsx("div",{className:jt.section,children:a.jsxs("label",{className:jt.checkboxRow,children:[a.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),a.jsx("span",{className:jt.checkboxLabel,children:"Enable worktree isolation"})]})}),a.jsxs("div",{className:jt.section,children:[a.jsx("label",{className:jt.label,htmlFor:"ws-workdir",children:"Working Directory"}),a.jsx("input",{id:"ws-workdir",className:jt.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 uk=y.createContext(void 0),uH=4e3;function fH({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=uH)=>{const g=`toast-${++r.current}`;o(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return a.jsx(uk.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function pn(){const t=y.useContext(uk);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const hm="grackle-theme",fk="grackle-prefer-system",pk="(prefers-color-scheme: dark)";let Jr=[],ld;function Ip(){ld=void 0;for(const t of Jr)t()}function gm(){return typeof window>"u"?!1:window.matchMedia(pk).matches}function nl(){if(typeof localStorage>"u")return a_;try{const t=localStorage.getItem(hm);if(t!==null&&ak.has(t))return t}catch{}return a_}function xd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(fk)==="true"}catch{return!1}}function vm(t){return Bd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function mk(t,s){const o=pm(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?gm()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=vm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return gm()?r.variantDarkId:r.variantLightId}return t}function Ao(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=mk(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Ao(nl(),xd());function pH(){return ld===void 0&&(ld={themeId:nl(),systemDark:gm(),preferSystem:xd()}),ld}function mH(t){return Jr=[...Jr,t],()=>{Jr=Jr.filter(s=>s!==t)}}function hH(){const t=y.useSyncExternalStore(mH,pH),{themeId:s,preferSystem:o}=t,r=mk(s,o),c=y.useCallback(u=>{if(ak.has(u)){try{localStorage.setItem(hm,u)}catch{}Ao(u,xd(),!0),Ip()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(fk,u?"true":"false")}catch{}if(u){const p=nl(),m=pm(p);if(m!=null&&m.hidden){const g=vm(p);if(g)try{localStorage.setItem(hm,g.id)}catch{}}}Ao(nl(),u,!0),Ip()},[]);return y.useEffect(()=>{Ao(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(pk),p=()=>{const m=nl(),g=xd();if(g){const v=pm(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&Ao(m,g),v!=null&&v.hidden){const b=vm(m);b!=null&&b.variantDarkId&&b.variantLightId&&Ao(m,g)}}Ip()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const hk=y.createContext(void 0);function gH({children:t}){const s=hH();return a.jsx(hk.Provider,{value:s,children:t})}function yh(){const t=y.useContext(hk);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const gk=y.createContext(void 0),vk=y.createContext(void 0);function vH({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return a.jsx(vk.Provider,{value:r,children:a.jsx(gk.Provider,{value:s,children:t})})}function yH(){return y.useContext(gk)}function bH(){const t=y.useContext(vk);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const bh=y.createContext(void 0);function pt(){const t=y.useContext(bh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function yk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bk(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function _H(t){return yk(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 xH=new Set(["off","subscription","api_key"]),Zc=new Set(["off","on"]);function kH(t){return yk(t)&&xH.has(t.claude)&&Zc.has(t.github)&&Zc.has(t.copilot)&&Zc.has(t.codex)&&Zc.has(t.goose)}function _k(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 xk(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 Co=5e3;function SH(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 Ei={label:"Home",url:Fo};function jH(t){return t?[Ei,{label:"Settings",url:ji},{label:t,url:void 0}]:[Ei,{label:"Settings",url:void 0}]}const kk={label:"Environments",url:zo};function TH(){return[Ei,{label:"Environments",url:void 0}]}function NH(){return[Ei,{label:"New Chat",url:void 0}]}function wH(t){return[Ei,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function CH(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Ei,kk,{label:(d==null?void 0:d.displayName)??"Environment",url:$o(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function EH(t,s,o,r,c){const d=SH(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?o.find(x=>x.id===p):void 0,g=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=g?r.find(x=>x.id===g):void 0,b=[Ei];v&&g&&(b.push(kk),b.push({label:v.displayName,url:$o(g)})),m&&g&&b.push({label:m.name,url:wi(m.id,g)});for(let x=0;x<d.length-1;x++)b.push({label:d[x].title,url:ls(d[x].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}function _h(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 Yc(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 AH(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 xh(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?Yc(b):void 0;if(_)try{const x=JSON.parse(v.content);o.set(_,{tool:x.tool,args:x.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),x=_?AH(_):void 0;if(!x)return v;const S=o.get(x);if(!S)return v;r.add(x),c.add(b);let j;const T=v.content.trim();if(T.startsWith("{"))try{const N=JSON.parse(T);typeof N.detailedContent=="string"&&(j=N.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?Yc(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],x=d[b];let S;try{const j=JSON.parse(_.content);S={tool:j.tool,args:j.args}}catch{}if(S){let j;const T=x.content.trim();if(T.startsWith("{"))try{const D=JSON.parse(T);typeof D.detailedContent=="string"&&(j=D.detailedContent)}catch{}d[b]={...x,toolUseCtx:{...S,detailedResult:j}},c.add(b);const N=s.get(_),C=N?Yc(N):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...N??{},__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 _=Yc(b);if(_&&r.has(_))return!1;const x=b.__seqId;return!(x&&r.has(x))});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 DH(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=Sk(s),d=s.filter(m=>ym(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||ym(m,c)).length,p=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function Sk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function ym(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function MH(t,s){var u;const o=new Map;for(const p of s)o.set(p.id,p);const r=Sk(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}):ym(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 RH(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 IH(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 Ds=[{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}],Ga=[{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"}],CH=new Map(Ms.map(t=>[t.id,t]));function Op(t){const s=CH.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const d_={"kn-auth-flow":{node:Op("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:Op("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:Op("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"}]}},u_=[{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}]}],EH={"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"}]},AH=[{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:""}],MH=[{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}],DH=[{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}],Ga=[{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"}],OH=new Map(Ds.map(t=>[t.id,t]));function Op(t){const s=OH.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const u_={"kn-auth-flow":{node:Op("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:Op("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:Op("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"}]}},f_=[{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}]}],BH={"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"}]},LH=[{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:""}],zH=[{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}],$H=[{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,7 +654,7 @@ 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"}],RH=[{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"}],IH=[{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}],OH=[{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:""}],BH=[{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:[]}],LH={"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 f_=[{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
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"}],HH=[{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"}],PH=[{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}],UH=[{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:""}],VH=[{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:[]}],qH={"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 p_=[{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
@@ -738,18 +738,18 @@ export function verifyToken(req: Request, res: Response, next: NextFunction): vo
738
738
 
739
739
  Tests: 3 passed, 3 total
740
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"}}]}],ss={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function p_(t){return t?u_:u_.filter(s=>!A7.some(o=>s.name.startsWith(o)))}const m_=400;function zH({children:t}){const[s,o]=y.useState(AH),[r,c]=y.useState(MH),[d,u]=y.useState(()=>p_(!1)),[p,m]=y.useState(DH),[g,v]=y.useState(void 0),[b,_]=y.useState(RH),[k,S]=y.useState(""),[j,T]=y.useState(IH),[w,C]=y.useState(OH),[M,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,R]=y.useState(BH),[O,D]=y.useState([]),[$]=y.useState(LH),[Y,V]=y.useState(""),[ne,le]=y.useState(Ms),[Z,se]=y.useState(Ga),[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),Me=y.useRef(0),ot=y.useRef(new Set),bt=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=f_[Me.current%f_.length];return Me.current+=1,U},[]),Re=y.useCallback((U,ae,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=bt.current.get(de))==null||ye.delete(pe)),U()},ae);ot.current.add(pe),de&&(bt.current.has(de)||bt.current.set(de,new Set),bt.current.get(de).add(pe))},[]),Q=y.useCallback(U=>{const ae=bt.current.get(U);ae&&(ae.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),bt.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=bk(pe.event.content),Le=_k(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),Mt=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"})},Mt+m_,ye),je.resumeSteps&&Pe.current.set(ye,je.resumeSteps)}else ve(ye,je.steps)},[ct,ue,ve,Re,nt,re]),an=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]),ks=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]),ds=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),zs=y.useCallback(async U=>{console.log("[MockGrackle] loadSessionEvents",U)},[]),ga=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Oi=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createWorkspace",{name:U,description:ae});const Mt={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,Mt]),Le&&Le(Mt)},[ct]),Xt=y.useCallback(async U=>{console.log("[MockGrackle] archiveWorkspace",U),_(ae=>ae.map(de=>de.id===U?{...de,status:"archived"}:de))},[]),Qa=y.useCallback(async U=>{console.log("[MockGrackle] loadTasks",U)},[]),ei=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue,Mt)=>{console.log("[MockGrackle] createTask",{workspaceId:U,title:ae,parentTaskId:ye}),T(qe=>{const En=qe.filter(Ts=>Ts.workspaceId===U).reduce((Ts,ws)=>Math.max(Ts,ws.sortOrder),0),_t=ye?qe.find(Ts=>Ts.id===ye):void 0;if(ye&&!_t)return console.warn("[MockGrackle] Parent task not found:",ye),qe;if(_t&&!_t.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),qe;const js=_t?_t.depth+1:0,Hi={id:ct("task"),workspaceId:U,title:ae,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:En+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:js,childTaskIds:[],canDecompose:je??!ye,injectKnowledge:Le??!0,defaultPersonaId:tt||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...qe,Hi]}),Ue&&Ue()},[ct]),va=y.useCallback(async(U,ae,de,pe)=>{var Mt;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(on=>on.id===U?{...on,status:"working",latestSessionId:je,branch:`mock/${U.slice(0,8)}`}:on));const Ue=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ue.label}`),Ue.pauseForInput){const qe=Ue.pauseAfterStep??Ue.steps.length-1,on=Ue.steps.slice(0,qe+1),En=on.length>0?on[on.length-1].delayMs:0;if(ve(je,on),Re(()=>{nt(je,"idle"),re({sessionId:je,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},En+m_,je),Ue.resumeSteps){const _t=[...Ue.resumeSteps];Pe.current.set(je,_t);const js=_t.reduce((Hi,Ts)=>Math.max(Hi,Ts.delayMs),0);ke.current.set(je,{taskId:U,delayAfterResume:js+200})}}else{const qe=Ue.steps.length>0?Ue.steps[Ue.steps.length-1].delayMs:0;ve(je,Ue.steps);const on=(Mt=Ue.steps[Ue.steps.length-1])==null?void 0:Mt.event.content;Re(()=>{on==="completed"?T(En=>En.map(_t=>_t.id===U&&_t.status==="working"?{..._t,status:"paused"}:_t)):on==="failed"&&T(En=>En.map(_t=>_t.id===U&&_t.status==="working"?{..._t,status:"failed"}:_t))},qe+100,je)}},[ct,ue,ve,Re,nt,re]),$s=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]),Ss=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))},[]),_n=y.useCallback(async U=>{console.log("[MockGrackle] deleteTask",U),T(ae=>ae.filter(de=>de.id!==U))},[]),mn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Ut=y.useCallback(async(U,ae,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:U,adapterType:ae,adapterConfig:de})},[]),Cn=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)}:{}}))},[]),Qt=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Bi=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:""}])},[]),Li=y.useCallback(async U=>{console.log("[MockGrackle] deleteToken",U),C(ae=>ae.filter(de=>de.name!==U))},[]),zi=y.useCallback(async U=>{console.log("[MockGrackle] updateCredentialProviders",U),A(U)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const $i=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:mn,addEnvironment:Ut,updateEnvironment:Cn,provisionEnvironment:async(U,ae)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ss},sessions:{sessions:r,sessionsLoading:!1,events:p,eventsDropped:0,lastSpawnedId:g,taskSessions:$,spawn:et,sendInput:$s,kill:an,stopGraceful:ks,loadSessionEvents:zs,clearEvents:ga,loadTaskSessions:async U=>{console.log("[MockGrackle] loadTaskSessions",U)},domainHook:ss},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Oi,archiveWorkspace:Xt,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:ss},tasks:{tasks:j,tasksLoading:!1,taskStartingId:void 0,loadTasks:Qa,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:ei,startTask:va,stopTask:async U=>{console.log("[MockGrackle] stopTask",{taskId:U}),await Ss(U)},completeTask:Ss,resumeTask:Ne,updateTask:Ve,deleteTask:_n,domainHook:ss},tokens:{tokens:w,tokensLoading:!1,loadTokens:Qt,setToken:Bi,deleteToken:Li,domainHook:ss},credentials:{credentialProviders:M,credentialsLoading:!1,updateCredentialProviders:zi,domainHook:ss},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ss},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ss},personas:{personas:E,personasLoading:!1,createPersona:async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createPersona",{name:U});const Mt={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,Mt]),Mt},updatePersona:async(U,ae,de,pe,ye,tt,je,Le,Ue,Mt)=>{console.log("[MockGrackle] updatePersona",{personaId:U,name:ae});const qe=E.find(_t=>_t.id===U);if(!qe)throw new Error(`Persona not found: ${U}`);const on=new Date().toISOString(),En={...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}:{},...Mt!==void 0?{allowedMcpTools:Mt}:{},updatedAt:on};return R(_t=>_t.map(js=>js.id===U?En:js)),En},deletePersona:async U=>{console.log("[MockGrackle] deletePersona",U),R(ae=>ae.filter(de=>de.id!==U))},domainHook:ss},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 D(je=>[...je,tt]),tt},updateSchedule:async(U,ae)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:U,fields:ae});let de;if(D(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),D(ae=>ae.filter(de=>de.id!==U))},domainHook:ss},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(U=!1)=>{u(p_(U))},liveMessages:EH,loadTranscript:async()=>{},handleStreamMessage:()=>{},domainHook:ss},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?Ms.filter(je=>!je.workspaceId||je.workspaceId===ae):Ms,pe=U.toLowerCase(),ye=de.filter(je=>{var Le,Ue,Mt;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)))||((Mt=je.category)==null?void 0:Mt.toLowerCase().includes(pe))});le(ye);const tt=new Set(ye.map(je=>je.id));se(Ga.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?Ms.filter(pe=>!pe.workspaceId||pe.workspaceId===U):Ms;le(ae);const de=new Set(ae.map(pe=>pe.id));se(Ga.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 d_?d_[U]:void 0;if(ae)B(ae);else{const de=Ms.find(pe=>pe.id===U);if(de){const pe=Ga.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=Ga.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=Ms.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}`)),Mt=Ga.filter(qe=>je.has(qe.source)&&je.has(qe.target)&&!Ue.has(`${qe.source}|${qe.target}|${qe.type}`));return Mt.length>0?[...Le,...Mt]:Le}),[...ae,...tt]})},loadRecent:async U=>{if(console.log("[MockGrackle] knowledge.loadRecent",U),me.current=U,U){const ae=Ms.filter(pe=>!pe.workspaceId||pe.workspaceId===U);le(ae);const de=new Set(ae.map(pe=>pe.id));se(Ga.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else le(Ms),se(Ga);ce("")},handleEvent:()=>!1,domainHook:ss},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:ds}),[s,r,d,p,g,$,b,k,j,w,M,E,O,Y,ne,Z,H,F,ee,et,$s,an,ks,zs,ga,Oi,Xt,Qa,ei,va,Ss,Ne,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi,ds]);return a.jsx(bh.Provider,{value:$i,children:t})}const Sk=3e3,$H=Sk;function HH(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,$H);try{const w=Be.streamEvents({});for await(const C of w){if(k(),m)break;const M=C.event;if(M.case==="sessionEvent"){const A=M.value;r.current({sessionId:A.sessionId,type:A.type,timestamp:A.timestamp,content:A.content,raw:A.raw})}else if(M.case==="domainEvent"){const A=M.value;c.current({id:A.id,type:A.type,timestamp:A.timestamp,payloadJson:A.payloadJson})}else if(M.case==="streamMessageEvent"){const A=M.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 da&&w.code===L_.Unauthenticated){window.location.href=sC;return}}clearTimeout(v),m||(o("connecting"),(T=p.current)==null||T.call(p),g=setTimeout(()=>{b().catch(()=>{})},Sk))}return b().catch(()=>{}),()=>{m=!0,clearTimeout(g),clearTimeout(v)}},[]),{connectionStatus:s}}const bm=["core","orchestration","scheduling"],jk=y.createContext({pluginNames:[...bm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function PH({children:t}){const[s,o]=y.useState([...bm]),[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([...bm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),a.jsx(jk.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:p,error:g},children:t})}function Ld(){return y.useContext(jk)}function kh(){const{sandboxPort:t,sandboxOrigin:s}=Ld();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 UH=new Set(["dashboard","chat","environments","coordination","settings"]),VH=new Set(["tasks"]),qH=new Set(["knowledge"]),Tk={core:{navItems:id.filter(t=>UH.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:id.filter(t=>VH.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:id.filter(t=>qH.has(t.view)),domainHookKeys:["knowledge"]}};function GH(t){return t.flatMap(s=>{var o;return((o=Tk[s])==null?void 0:o.navItems)??[]})}function FH(t){return new Set(t.flatMap(s=>{var o;return((o=Tk[s])==null?void 0:o.domainHookKeys)??[]}))}function KH(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function h_(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 ZH(t){return{sessionId:t.sessionId,eventType:z_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function g_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:W2(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function v_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:X2(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 YH(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function JH(t){return{claude:Q2(t.claude),github:Rc(t.github),copilot:Rc(t.copilot),codex:Rc(t.codex),goose:Rc(t.goose)}}function WH(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function XH(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function Bp(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 QH(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Lp(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 Jc(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 zp(t){return{source:t.fromId,target:t.toId,type:t.type}}function e9(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function t9(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(e9),selfEcho:t.selfEcho}}function xs(){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 y_=5e3;function Fr(t){return t instanceof da?t.message:"Operation failed"}function n9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[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(KH))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const M=C.payload.environmentId;return M&&(s(A=>A.filter(E=>E.id!==M)),d(A=>{const E={...A};return delete E[M],E})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const M=C.payload;if(typeof M.environmentId!="string"||typeof M.stage!="string"||typeof M.message!="string"||typeof M.progress!="number")return yk("environment.provision_progress","invalid payload"),!0;if(d(A=>({...A,[M.environmentId]:{stage:M.stage,message:M.message,progress:M.progress}})),M.stage==="ready"){const A=M.environmentId;setTimeout(()=>{d(E=>{const R={...E};return delete R[A],R})},y_)}return!0}default:return!1}},[g]),b=y.useCallback(C=>{var M;if(C.type==="environments"){const A=Array.isArray((M=C.payload)==null?void 0:M.environments)?C.payload.environments:[];return s(A),!0}return!1},[]),_=y.useCallback(async(C,M,A,E)=>{p("");try{await Be.addEnvironment({displayName:C,adapterType:M,adapterConfig:JSON.stringify(A??{}),githubAccountId:E??""})}catch(R){p(Fr(R))}},[]),k=y.useCallback(async(C,M)=>{p("");try{await Be.updateEnvironment({id:C,displayName:M.displayName,adapterConfig:M.adapterConfig?JSON.stringify(M.adapterConfig):void 0,githubAccountId:M.githubAccountId})}catch(A){p(Fr(A))}},[]),S=y.useCallback(async(C,M)=>{p("");try{const A=Be.provisionEnvironment({id:C,force:M??!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})},y_)}catch(A){d(E=>{const R={...E};return delete R[C],R}),p(Fr(A))}},[]),j=y.useCallback(async C=>{p("");try{await Be.stopEnvironment({id:C})}catch(M){p(Fr(M))}},[]),T=y.useCallback(async C=>{p("");try{await Be.removeEnvironment({id:C})}catch(M){p(Fr(M))}},[]);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 $p=new Set(["pending","running","idle"]),s9=new Set(["completed","failed","interrupted","hibernating","suspended"]),b_=["pending","running","idle"];function a9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[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(h_);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:s9.has(Z)&&$p.has(ne.status)?{...ne,status:Z,...le.endReason!==void 0?{endReason:le.endReason}:{}}:$p.has(Z)&&$p.has(ne.status)&&b_.indexOf(Z)>b_.indexOf(ne.status)?{...ne,status:Z}:ne})})}catch{}},[r]),k=y.useCallback(D=>{if(D.type!=="session_event")return!1;if(!pH(D.payload))return yk("session_event","payload is not a valid SessionEvent"),!0;const $=D.payload;let Y=0;if(d(V=>{const ne=[...V,$];return ne.length>Co?(Y=ne.length-Co,ne.slice(-Co)):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=bk($.content),ne=_k($.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(D=>{k({type:"session_event",payload:D})},[k]),j=y.useCallback(D=>{var $,Y,V,ne,le;switch(D.type){case"sessions":{const Z=Array.isArray(($=D.payload)==null?void 0:$.sessions)?D.payload.sessions:[];return s(Z),!0}case"spawned":{const Z=(Y=D.payload)==null?void 0:Y.sessionId;return typeof Z=="string"&&Z&&g(Z),_().catch(()=>{}),!0}case"session_events":{const Z=Array.isArray((V=D.payload)==null?void 0:V.events)?D.payload.events:[];return Z.length>0&&d(Z),!0}case"task_sessions":{const Z=(ne=D.payload)==null?void 0:ne.taskId;if(typeof Z=="string"&&Z){const se=Array.isArray((le=D.payload)==null?void 0:le.sessions)?D.payload.sessions:[];b(H=>({...H,[Z]:se}))}return!0}default:return!1}},[_]),T=y.useCallback(async(D,$,Y,V,ne)=>{try{const le=await Be.spawnAgent({environmentId:D,prompt:$,personaId:Y||"",workingDirectory:V||"",workspaceId:ne||""});g(le.id),await _()}catch{}},[_]),w=y.useCallback(async(D,$)=>{await Be.sendInput({sessionId:D,text:$})},[]),C=y.useCallback(async D=>{try{await Be.killAgent({id:D,graceful:!1})}catch{}},[]),M=y.useCallback(async D=>{try{await Be.killAgent({id:D,graceful:!0})}catch{}},[]),A=y.useCallback(async D=>{try{const Y=(await Be.getSessionEvents({id:D})).events.map(ZH);if(Y.length>0){let V=0;d(ne=>{const le=new Set;for(const H of ne)H.sessionId===D&&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>Co?(V=se.length-Co,se.slice(-Co)):se}),V>0&&p(ne=>ne+V)}}catch{}},[]),E=y.useCallback(()=>{d([]),p(0)},[]),R=y.useCallback(async D=>{try{const Y=(await Be.getTaskSessions({id:D})).sessions.map(h_);b(V=>({...V,[D]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:T,sendInput:w,kill:C,stopGraceful:M,loadSessionEvents:A,clearEvents:E,loadTaskSessions:R,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function __(t){return t instanceof da?t.message:"Operation failed"}function i9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Be.listWorkspaces({}));s(C.workspaces.map(g_))}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,M,A,E,R,O,D,$,Y)=>{d(!0);try{const V=await Be.createWorkspace({name:C,description:M||"",repoUrl:A||"",environmentId:E||"",defaultPersonaId:R||void 0,useWorktrees:O??!0,workingDirectory:D||void 0}),ne=g_(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 da?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,M)=>{try{await Be.updateWorkspace({id:C,...M})}catch{}},[]),S=y.useCallback(()=>{p("")},[]),j=y.useCallback(async(C,M)=>{try{p(""),await Be.linkEnvironment({workspaceId:C,environmentId:M}),await m().catch(()=>{})}catch(A){p(__(A))}},[m]),T=y.useCallback(async(C,M)=>{try{p(""),await Be.unlinkEnvironment({workspaceId:C,environmentId:M}),await m().catch(()=>{})}catch(A){p(__(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 o9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await zn.listTasks({workspaceId:E})).tasks.map(v_);s(D=>[...D.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(zn.listTasks({}))).tasks.map(v_);s(O=>{const D=new Set(R.map($=>$.id));return[...O.filter($=>!D.has($.id)),...R]})}catch{}},[r]),g=y.useCallback((E,R)=>{const O=D=>{clearTimeout(u.current[D]),u.current[D]=setTimeout(()=>{delete u.current[D],p(D).catch(()=>{})},200)};E?O(E):R&&s(D=>{const $=D.find(Y=>Y.id===R);return $!=null&&$.workspaceId?O($.workspaceId):m().catch(()=>{}),D})},[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:"",D=typeof R.sessionId=="string"?R.sessionId:"",$=typeof R.workspaceId=="string"?R.workspaceId:"";return d(Y=>O&&Y===O?void 0:Y),D&&O&&s(Y=>Y.map(V=>V.id===O?{...V,latestSessionId:D}:V)),g($,O),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const O=typeof R.workspaceId=="string"?R.workspaceId:"",D=typeof R.taskId=="string"?R.taskId:"";return d($=>D&&$===D?void 0:$),g(O,D),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var R,O;if(E.type==="tasks"){const D=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!==$),...D]:Y=>{const V=new Set(D.map(ne=>ne.id));return[...Y.filter(ne=>!V.has(ne.id)),...D]}),!0}return!1},[]),k=y.useCallback(async(E,R,O,D,$,Y,V,ne,le,Z)=>{try{await zn.createTask({workspaceId:E,title:R,description:O||"",dependsOn:D||[],parentTaskId:$||"",defaultPersonaId:Y||void 0,canDecompose:V??void 0,injectKnowledge:ne??void 0}),le==null||le()}catch(se){const H=se instanceof da?se.message:"Failed to create task";Z==null||Z(H)}},[]),S=y.useCallback(async(E,R,O,D)=>{d(E);try{await zn.startTask({taskId:E,personaId:R||"",environmentId:O||"",notes:D||""})}catch($){if($ instanceof da&&$.code===L_.ResourceExhausted)return;throw d(void 0),$}},[]),j=y.useCallback(async E=>{try{await zn.stopTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await zn.completeTask({id:E})}catch{}},[]),w=y.useCallback(async E=>{try{await zn.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,R,O,D,$)=>{try{await zn.updateTask({id:E,title:R,description:O,dependsOn:D,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),M=y.useCallback(async E=>{try{await zn.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:M,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function r9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const g=await r(Be.listTokens({}));s(g.tokens.map(YH))}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 l9(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const m=await r(Be.getCredentialProviders({}));s(JH(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(hH(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 c9(){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(WH)),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 da?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 d9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await Be.listDockerContainers({});s(u.containers.map(XH)),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 u9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const v=await r(zn.listPersonas({}));s(v.personas.map(Bp))}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 M=await zn.createPersona({name:v,description:b,systemPrompt:_,runtime:k||"",model:S||"",maxTurns:j||0,type:T||"agent",script:w||"",allowedMcpTools:C||[]}),A=Bp(M);return s(E=>[...E.filter(R=>R.id!==A.id),A]),A},[]),p=y.useCallback(async(v,b,_,k,S,j,T,w,C,M)=>{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),M!==void 0&&(A.allowedMcpTools={tools:M});const E=await zn.updatePersona(A),R=Bp(E);return s(O=>O.map(D=>D.id===R.id?R:D)),R},[]),m=y.useCallback(async v=>{await zn.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 f9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Bc.listSchedules({}));s(b.schedules.map(Lp))}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 Bc.createSchedule({title:b,description:_,scheduleExpression:k,personaId:S,workspaceId:j||"",parentTaskId:T||""}),C=Lp(w);return s(M=>[...M.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 Bc.updateSchedule(k),j=Lp(S);return s(T=>T.map(w=>w.id===j.id?j:w)),j},[]),g=y.useCallback(async b=>{await Bc.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 p9(t){if(t)try{return JSON.parse(t)}catch{return}}function m9(){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 Lc.listRecentKnowledgeNodes({limit:30,workspaceId:R}),D=new Map,$=[];for(const Y of O.nodes)D.set(Y.id,Jc(Y));for(const Y of O.edges)$.push(zp(Y));for(const Y of $){const V=D.get(Y.source);V&&(V.val+=1);const ne=D.get(Y.target);ne&&(ne.val+=1)}s(D),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 Lc.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,D=[];for(const $ of R.results){$.node&&O.set($.node.id,Jc($.node,$.edges.length));for(const Y of $.edges)D.push(zp(Y))}s(O),r(D)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{k(_.current).catch(()=>{})},[k]),T=y.useCallback(async E=>{p(E);try{const R=await Lc.getKnowledgeNode({id:E});if(!R.node){d(void 0);return}d({node:Jc(R.node,R.edges.length),edges:R.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:p9(O.metadataJson)}))})}catch{d(void 0)}},[]),w=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const R=await Lc.expandKnowledgeNode({id:E,depth:1});s(O=>{const D=new Map(O);for(const $ of R.nodes)D.has($.id)||D.set($.id,Jc($));return D}),r(O=>{const D=new Set(O.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of R.edges){const V=zp(Y),ne=`${V.source}:${V.target}:${V.type}`;D.has(ne)||$.push(V)}return[...O,...$]})}catch{}},[]),M=y.useCallback(E=>!1,[]),A={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:M};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:M,domainHook:A}}function h9(){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:Od("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 Wc=500;function g9(){const[t,s]=y.useState([]),[o,r]=y.useState({}),[c,d]=y.useState(!1),[u,p]=y.useState(!1),{loading:m,track:g}=xs(),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(t9)),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(M=>{const A=new Map;for(const O of M[T]??[])A.set(O.seq,O);for(const O of C)A.set(O.seq,O);const E=Array.from(A.values()).sort((O,D)=>O.seq.localeCompare(D.seq)),R=E.length>Wc?E.slice(E.length-Wc):E;return{...M,[T]:R}})},[]),k=y.useCallback(T=>{r(w=>{const C=w[T.streamId]??[];if(C.some(E=>E.seq===T.seq))return w;const M=[...C,T],A=M.length>Wc?M.slice(M.length-Wc):M;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 v9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),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 y9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),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 b9(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Ld(),p=FH(u),m=n9(),g=a9(),v=i9(),b=o9(),_=r9(),k=l9(),S=c9(),j=d9(),T=u9(),w=f9(),C=m9(),M=h9(),A=g9(),E=v9(),R=y9(),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")?[M.domainHook]:[],...p.has("streams")?[A.domainHook]:[],...p.has("plugins")?[E.domainHook]:[],R.domainHook],{connectionStatus:D}=HH({onSessionEvent:F=>{g.handleSessionEvent({sessionId:F.sessionId,eventType:z_(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]:QH(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:D,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 _9({children:t}){const s=b9();return a.jsx(bh.Provider,{value:s,children:t})}function x9(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 k9(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 S9={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 j9(t){return S9[t]}function T9(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=j9(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 w9(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=T9(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const N9="_dashboard_16pzm_1",C9="_kpiStrip_16pzm_11",E9="_kpiCard_16pzm_23",A9="_kpiValue_16pzm_68",M9="_kpiLabel_16pzm_76",D9="_bodyGrid_16pzm_84",R9="_section_16pzm_96",I9="_sectionHeader_16pzm_109",O9="_sectionIcon_16pzm_118",B9="_sectionTitle_16pzm_123",L9="_sectionCount_16pzm_131",z9="_sectionBody_16pzm_138",$9="_emptyHint_16pzm_143",H9="_sessionRow_16pzm_150",P9="_sessionPrompt_16pzm_177",U9="_sessionEnv_16pzm_186",V9="_sessionRuntime_16pzm_192",q9="_sessionStatus_16pzm_198",G9="_statusDot_16pzm_207",F9="_attentionRow_16pzm_233",K9="_attentionTitle_16pzm_259",Z9="_attentionMeta_16pzm_267",Y9="_reasonBadge_16pzm_274",J9="_bottomGrid_16pzm_301",W9="_envRow_16pzm_312",X9="_envName_16pzm_323",Q9="_envStatusBadge_16pzm_333",eP="_workspaceRow_16pzm_369",tP="_workspaceTop_16pzm_395",nP="_workspaceName_16pzm_401",sP="_workspaceCounts_16pzm_407",aP="_progressBar_16pzm_415",iP="_progressFill_16pzm_422",he={dashboard:N9,kpiStrip:C9,kpiCard:E9,kpiValue:A9,kpiLabel:M9,bodyGrid:D9,section:R9,sectionHeader:I9,sectionIcon:O9,sectionTitle:B9,sectionCount:L9,sectionBody:z9,emptyHint:$9,sessionRow:H9,sessionPrompt:P9,sessionEnv:U9,sessionRuntime:V9,sessionStatus:q9,statusDot:G9,attentionRow:F9,attentionTitle:K9,attentionMeta:Z9,reasonBadge:Y9,bottomGrid:J9,envRow:W9,envName:X9,envStatusBadge:Q9,workspaceRow:eP,workspaceTop:tP,workspaceName:nP,workspaceCounts:sP,progressBar:aP,progressFill:iP};function oP(){return a.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[a.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:he.kpiCard,children:[a.jsx(Te,{width:"3rem",height:"2rem"}),a.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>a.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"70%",height:"0.875rem"})]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"9rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.envRow,children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"6rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx(Te,{width:"50%",height:"0.875rem"}),a.jsx(Te,{width:"2rem",height:"0.75rem"})]}),a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const rP={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Xc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function lP(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 Qc({value:t,label:s,accent:o,index:r,testId:c}){return a.jsxs(Pt.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:rP,initial:"hidden",animate:"visible",custom:r,children:[a.jsx("span",{className:he.kpiValue,children:t}),a.jsx("span",{className:he.kpiLabel,children:s})]})}function cP(){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=xt(),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(()=>jH(d,o,p),[d,o,p]),_=y.useMemo(()=>wH(d,p),[d,p]),k=y.useMemo(()=>TH(o,t),[o,t]),S=y.useMemo(()=>NH(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?a.jsx(oP,{}):a.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[a.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[a.jsx(Qc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),a.jsx(Qc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),a.jsx(Qc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),a.jsx(Qc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),a.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),a.jsx("span",{className:he.sectionCount,children:_.length})]}),a.jsx("div",{className:he.sectionBody,children:_.length===0?a.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:T,environmentName:w})=>a.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(Dm(T.id)),"data-testid":"session-row",children:[a.jsx("span",{className:he.sessionPrompt,title:T.prompt,children:T.prompt||"—"}),a.jsx("span",{className:he.sessionEnv,children:w}),a.jsx("span",{className:he.sessionRuntime,children:T.runtime}),a.jsxs("span",{className:he.sessionStatus,children:[a.jsx("span",{className:he.statusDot,"data-status":T.status}),T.status]})]},T.id))})]}),a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),a.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),a.jsx("span",{className:he.sectionCount,children:k.length})]}),a.jsx("div",{className:he.sectionBody,children:k.length===0?a.jsx("div",{className:he.emptyHint,children:"All clear"}):k.map(({task:T,reason:w,workspaceName:C})=>a.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(ls(T.id)),"data-testid":"attention-row",children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx("span",{className:he.reasonBadge,"data-reason":w,children:w}),T.title]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx("span",{children:C})})]},T.id))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),a.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),a.jsx("span",{className:he.sectionCount,children:p.length})]}),a.jsx("div",{className:he.sectionBody,children:p.length===0?a.jsx("div",{className:he.emptyHint,children:"No environments configured"}):p.map(T=>a.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[a.jsx("span",{className:he.envName,children:T.displayName}),a.jsx("span",{className:he.envStatusBadge,"data-status":T.status,children:T.status})]},T.id))})]}),a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),a.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),a.jsx("span",{className:he.sectionCount,children:t.length})]}),a.jsx("div",{className:he.sectionBody,children:S.length===0?a.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:T,totalTasks:w,completedTasks:C,workingTasks:M,failedTasks:A})=>{const E=w>0?Math.round(C/w*100):0;return a.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(Ni(T.id,T.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx("span",{className:he.workspaceName,children:T.name}),a.jsxs("span",{className:he.workspaceCounts,"aria-label":lP(C,w,M,A),children:[C,"/",w,M>0&&a.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",M]}),A>0&&a.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",A]})]})]}),w>0&&a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},T.id)})})]})]})]})}const dP="_panelContainer_1udy7_1",uP="_emptyState_1udy7_8",fP="_workspaceSummary_1udy7_17",pP="_workspaceSummaryTitle_1udy7_28",mP="_workspaceSummarySubtitle_1udy7_32",hP="_header_1udy7_36",gP="_headerInfo_1udy7_71",vP="_headerTitle_1udy7_106",yP="_taskStatusBadge_1udy7_128",bP="_taskBranch_1udy7_137",_P="_taskBlockedBadge_1udy7_143",xP="_tabBar_1udy7_277",kP="_tab_1udy7_277",SP="_active_1udy7_303",jP="_eventScroll_1udy7_308",TP="_overviewContent_1udy7_325",wP="_overviewDashboard_1udy7_334",NP="_overviewHero_1udy7_340",CP="_overviewSection_1udy7_347",EP="_overviewLabel_1udy7_353",AP="_envRow_1udy7_360",MP="_timeline_1udy7_366",DP="_timelineRow_1udy7_372",RP="_waitingMessage_1udy7_379",IP="_errorMessage_1udy7_383",OP="_emptyCta_1udy7_387",BP="_ctaTitle_1udy7_399",LP="_ctaDescription_1udy7_405",zP="_ctaButton_1udy7_412",$P="_workspaceHeader_1udy7_533",HP="_workspaceName_1udy7_558",PP="_workspaceMeta_1udy7_571",UP="_metaRow_1udy7_579",VP="_metaLabel_1udy7_592",qP="_metaValue_1udy7_607",GP="_archiveButton_1udy7_617",FP="_repoLink_1udy7_647",KP="_metaToggle_1udy7_657",ZP="_metaToggleArrow_1udy7_678",YP="_metaToggleArrowOpen_1udy7_683",JP="_progressBarContainer_1udy7_687",WP="_progressBar_1udy7_687",XP="_progressFill_1udy7_703",QP="_progressLabel_1udy7_710",eU="_metaTimestamps_1udy7_717",tU="_metaTimestamp_1udy7_717",nU="_metaPlaceholder_1udy7_739",sU="_linkedEnvList_1udy7_744",aU="_linkedEnvChip_1udy7_750",iU="_chipDismiss_1udy7_762",oU="_linkError_1udy7_777",rU="_linkEnvSelect_1udy7_782",W={panelContainer:dP,emptyState:uP,workspaceSummary:fP,workspaceSummaryTitle:pP,workspaceSummarySubtitle:mP,header:hP,headerInfo:gP,headerTitle:vP,taskStatusBadge:yP,taskBranch:bP,taskBlockedBadge:_P,tabBar:xP,tab:kP,active:SP,eventScroll:jP,overviewContent:TP,overviewDashboard:wP,overviewHero:NP,overviewSection:CP,overviewLabel:EP,envRow:AP,timeline:MP,timelineRow:DP,waitingMessage:RP,errorMessage:IP,emptyCta:OP,ctaTitle:BP,ctaDescription:LP,ctaButton:zP,workspaceHeader:$P,workspaceName:HP,workspaceMeta:PP,metaRow:UP,metaLabel:VP,metaValue:qP,archiveButton:GP,repoLink:FP,metaToggle:KP,metaToggleArrow:ZP,metaToggleArrowOpen:YP,progressBarContainer:JP,progressBar:WP,progressFill:XP,progressLabel:QP,metaTimestamps:eU,metaTimestamp:tU,metaPlaceholder:nU,linkedEnvList:sU,linkedEnvChip:aU,chipDismiss:iU,linkError:oU,linkEnvSelect:rU};function lU(){return a.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function cU(){return a.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function dU(){const{workspaces:{workspaces:t},environments:{environments:s}}=pt(),o=xt(),r=s.length>0;return t.length>0?a.jsx(cP,{}):a.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[a.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),a.jsx("button",{className:W.ctaButton,onClick:()=>o(fx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&a.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const uU="_panelContainer_1rih4_1",fU="_chatHeader_1rih4_9",pU="_chatHeaderInfo_1rih4_38",mU="_chatHeaderActions_1rih4_44",hU="_emptyState_1rih4_64",gU="_emptyTitle_1rih4_76",vU="_emptyDescription_1rih4_82",yU="_emptyHint_1rih4_88",ra={panelContainer:uU,chatHeader:fU,chatHeaderInfo:pU,chatHeaderActions:mU,emptyState:hU,emptyTitle:gU,emptyDescription:vU,emptyHint:yU};function x_(){return a.jsx("div",{className:ra.panelContainer,"aria-hidden":"true",children:a.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function bU({hasLocalEnvironment:t}){return a.jsxs("div",{className:ra.emptyState,"data-testid":"chat-empty-state",children:[a.jsx("div",{className:ra.emptyTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:ra.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&a.jsx("div",{className:ra.emptyHint,children:"Go to Settings → Environments to add one."})]})}function _U(){const t=kh(),{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}=pn(),M=y.useRef(void 0),[A,E]=y.useState(),R=s.find(le=>le.id===Ic),O=R!=null&&R.latestSessionId?c.find(le=>le.id===R.latestSessionId)??(m[Ic]??[]).find(le=>le.id===R.latestSessionId):void 0;y.useEffect(()=>{g(Ic).catch(()=>{})},[R==null?void 0:R.latestSessionId,g]),y.useEffect(()=>{O&&O.id!==M.current&&(M.current=O.id,v(O.id).catch(()=>{}))},[O==null?void 0:O.id,v]);const D=y.useMemo(()=>{if(!O)return[];const le=u.filter(Z=>Z.sessionId===O.id);return xh(_h(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)?a.jsx(x_,{}):R!=null&&R.latestSessionId&&!O?a.jsx(x_,{}):a.jsxs("div",{className:ra.panelContainer,"data-testid":"chat-page",children:[Y&&a.jsxs("div",{className:ra.chatHeader,children:[a.jsxs("span",{className:ra.chatHeaderInfo,children:["Session: ",O.id.slice(0,8)," | ",O.runtime," | ",O.status]}),a.jsx("div",{className:ra.chatHeaderActions,children:a.jsx(mx,{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(()=>{})}}]})})]}),a.jsx(mh,{events:D,eventsDropped:p,sandboxProxyUrl:t,emptyState:a.jsx(bU,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&a.jsx(jd,{mode:Y?"send":"start",sessionId:Y?O.id:void 0,taskId:Ic,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 xU="_container_h5uod_1",kU="_toolbar_h5uod_9",SU="_viewToggle_h5uod_18",jU="_toolbarControls_h5uod_23",TU="_internalsToggle_h5uod_30",wU="_refreshButton_h5uod_39",NU="_toggleButton_h5uod_53",CU="_toggleActive_h5uod_67",as={container:xU,toolbar:kU,viewToggle:SU,toolbarControls:jU,internalsToggle:TU,refreshButton:wU,toggleButton:NU,toggleActive:CU};function EU(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c,liveMessages:d,loadTranscript:u},sessions:{sessions:p},tasks:{tasks:m}}=pt(),{resolvedThemeId:g}=yh(),[v,b]=y.useState("list"),[_,k]=y.useState(!1),[S,j]=y.useState(void 0),[T,w]=y.useState(!1);y.useEffect(()=>{if(S===void 0){w(!1);return}let E=!0;return w(!0),u(S).then(()=>{E&&w(!1)}).catch(()=>{E&&w(!1)}),()=>{E=!1}},[S,u]);const C=y.useRef(!1);y.useEffect(()=>{if(!C.current){C.current=!0;return}c(_).catch(()=>{})},[_,c]);const M=y.useCallback(()=>{c(_).catch(()=>{})},[c,_]),A=S!==void 0?t.find(E=>E.id===S):void 0;return a.jsxs("div",{className:as.container,"data-testid":"coordination-page",children:[a.jsxs("div",{className:as.toolbar,children:[a.jsxs("div",{className:as.viewToggle,role:"group","aria-label":"Coordination view","data-testid":"coordination-view-toggle",children:[a.jsx("button",{type:"button",className:v==="list"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="list","data-testid":"coordination-view-list",onClick:()=>b("list"),children:"List"}),a.jsx("button",{type:"button",className:v==="graph"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="graph","data-testid":"coordination-view-graph",onClick:()=>b("graph"),children:"Graph"})]}),a.jsxs("div",{className:as.toolbarControls,children:[a.jsxs("label",{className:as.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:_,onChange:E=>k(E.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),a.jsx("button",{type:"button",className:as.refreshButton,onClick:M,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:"Refresh"})]})]}),v==="list"?a.jsx(W7,{streams:t,sessions:p,tasks:m,loading:s,loadError:r,loadedOnce:o,showInternals:_,onToggleInternals:k,selectedStreamId:S,onSelectStream:j,onRefresh:M,hideHeaderControls:!0}):a.jsx(y$,{streams:t,sessions:p,selectedStreamId:S,onSelectStream:j,resolvedThemeId:g}),A&&a.jsx(Bz,{stream:A,messages:d[A.id]??[],transcriptLoading:T,onClose:()=>j(void 0)})]})}function AU(){const t=bH(),[s]=Mm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=pt(),{showToast:g}=pn();return a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:t}),a.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),a.jsx(jd,{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 MU(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsxs("div",{className:W.header,children:[a.jsx("span",{children:a.jsx(Te,{width:"10rem",height:"0.875rem"})}),a.jsx("span",{className:W.headerInfo,children:a.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),a.jsx("div",{className:W.eventScroll,children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function DU({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return a.jsxs("div",{className:W.header,children:[a.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Ho((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Rs(s.costMillicents??0)}`:""]}),a.jsxs("span",{className:W.headerInfo,children:[s&&a.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&a.jsx(mx,{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 RU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return a.jsx("div",{className:s?W.errorMessage:W.waitingMessage,children:o})}function IU(){const{sessionId:t}=ma(),s=kh(),{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}=pn(),T=y.useRef(void 0),w=_H(t),C=c.find(E=>E.id===t)??void 0,M=y.useMemo(()=>{const E=t?o.filter(R=>R.sessionId===t):[];return xh(_h(E))},[o,t]);if(y.useEffect(()=>{t&&t!==T.current&&(T.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return a.jsx(MU,{});if(!t)return a.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 a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:w}),a.jsx(DU,{sessionId:t,session:C,isActive:A,onStop:()=>{p(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),a.jsx(mh,{events:M,eventsDropped:r,emptyState:a.jsx(RU,{session:C}),onShowToast:j,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:k,personas:_,onForward:(E,R)=>g(E,R)}),A&&a.jsx(jd,{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 OU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Za(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&&OU(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 BU(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.workspaceHeader,children:a.jsx("span",{className:W.workspaceName,children:a.jsx(Te,{width:"12rem",height:"1.25rem"})})}),a.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:a.jsx(Te,{width:"4rem",height:"0.625rem"})}),a.jsxs("div",{className:W.progressBarContainer,children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),a.jsx(Te,{width:"2rem",height:"0.625rem"})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),a.jsx("span",{className:W.tab,children:"Board"}),a.jsx("span",{className:W.tab,children:"Tasks"})]}),a.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>a.jsx(um,{lines:2},s))})]})}function k_(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 Hp=100;function LU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function zU(){const{workspaceId:t,environmentId:s}=ma(),o=xt(),{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}=yh(),[C,M]=y.useState("tasks"),[A,E]=y.useState(!1),[R,O]=y.useState(null),[D,$]=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=xH(t,ne,d,c);Za({key:"1"},()=>M("graph")),Za({key:"2"},()=>M("board")),Za({key:"3"},()=>M("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?a.jsx(BU,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:le}),a.jsxs("div",{className:W.workspaceHeader,children:[a.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:a.jsx(zt,{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>Hp)return`Max ${Hp} characters`},maxLength:Hp,fieldId:"name",activeFieldId:R,onActivate:O,ariaLabel:"Workspace name",renderDisplay:ee=>ee||t||void 0,"data-testid":"edit-name"})}),a.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),a.jsxs("button",{className:W.metaToggle,onClick:()=>$(!D),"aria-expanded":!D,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[a.jsx("span",{className:`${W.metaToggleArrow} ${D?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!D&&a.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Description"}),a.jsx("div",{className:W.metaValue,children:a.jsx(fm,{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?a.jsx("span",{className:W.overviewMarkdown,children:a.jsx(_m,{remarkPlugins:[xm],children:ee})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Repository"}),a.jsx("div",{className:W.metaValue,children:a.jsx(zt,{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=LU(ee);return ce?a.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:ee}):ee?a.jsx("span",{children:ee}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Environments"}),a.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:V?a.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const ee=[...new Set(V.linkedEnvironmentIds)];return ee.length===0?a.jsx("span",{className:W.metaPlaceholder,children:"None"}):ee.map(ce=>{const me=c.find(xe=>xe.id===ce);return a.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,a.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:a.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:[a.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>a.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&a.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,a.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):a.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Persona"}),a.jsx("div",{className:W.metaValue,children:a.jsx(_d,{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 a.jsx("span",{children:ce.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Worktrees"}),a.jsx("div",{className:W.metaValue,children:a.jsx(G5,{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"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Working Dir"}),a.jsx("div",{className:W.metaValue,children:a.jsx(zt,{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&&a.jsxs("div",{className:W.metaTimestamps,children:[a.jsxs("span",{className:W.metaTimestamp,children:["Created ",k_(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&a.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",k_(V.updatedAt)]})]})]}),F>0&&a.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),a.jsxs("span",{className:W.progressLabel,children:[B,"/",F]})]}),se&&se.costMillicents>0&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Usage: ",Rs(se.costMillicents)," (",se.sessionCount," session",se.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&a.jsxs(a.Fragment,{children:["Tokens: ",Ho(((se==null?void 0:se.inputTokens)??0)+((se==null?void 0:se.outputTokens)??0))," / ",Ho(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&a.jsxs(a.Fragment,{children:["Cost: ",Rs((se==null?void 0:se.costMillicents)??0)," / ",Rs(V.costBudgetMillicents)]})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>M("graph"),children:"Graph"}),a.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>M("board"),"data-testid":"board-tab",children:"Board"}),a.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>M("tasks"),children:"Tasks"})]}),C==="tasks"&&F>0&&a.jsxs("div",{className:W.workspaceSummary,children:[a.jsx("span",{className:W.workspaceSummaryTitle,children:`${B}/${F} tasks complete`}),a.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&F===0&&a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{className:W.ctaButton,onClick:()=>o(Ri(t,void 0,ne)),children:"Create Task"}),a.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&a.jsx(q$,{workspaceId:t,environmentId:ne,tasks:r,sessions:S,personas:k,environments:c}),C==="graph"&&a.jsx(lC,{workspaceId:t,environmentId:ne,tasks:r,resolvedThemeId:w}),a.jsx(_s,{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 $U="_container_3pgew_1",HU="_header_3pgew_8",PU="_headerTitle_3pgew_35",UU="_headerActions_3pgew_44",VU="_body_3pgew_51",qU="_btnPrimary_3pgew_63",GU="_btnGhost_3pgew_94",FU="_error_3pgew_116",Fa={container:$U,header:HU,headerTitle:PU,headerActions:UU,body:VU,btnPrimary:qU,btnGhost:GU,error:FU};function KU(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 ZU=[{label:"Home",url:Fo},{label:"New Workspace",url:void 0}];function YU(){const[t]=Mm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=pt(),{showToast:u}=pn(),p=xt(),[m,g]=y.useState(()=>{var T;return tH(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=KU(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(Ni(w.id,w.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},w=>{k(w)}).catch(()=>{})},j=()=>{p(s?$o(s):Fo,{replace:!0})};return a.jsxs("div",{className:Fa.container,children:[a.jsxs("div",{className:Fa.header,children:[a.jsx("div",{className:Fa.headerTitle,children:a.jsx(ha,{segments:ZU})}),a.jsxs("div",{className:Fa.headerActions,children:[a.jsx("button",{className:Fa.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),a.jsx("button",{className:Fa.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?a.jsx(G1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),a.jsxs("div",{className:Fa.body,children:[a.jsx(sH,{values:m,onChange:T=>{g(T),b(void 0),k(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&a.jsx("div",{className:Fa.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function S_(){const{workspaceId:t,environmentId:s}=ma(),[o]=Mm(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=pt(),{showToast:v}=pn();return a.jsx(ak,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,k,S,j,T,w,C,M,A)=>{u(b,_,k,S,j,T,w,C,M,A).catch(()=>{})},onUpdateTask:(b,_,k,S,j)=>{p(b,_,k,S,j).catch(()=>{})},onShowToast:v})}function JU(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.header,children:a.jsxs("span",{className:W.headerTitle,children:[a.jsx(Te,{width:"12rem",height:"1rem"}),a.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),a.jsx("span",{className:W.tab,children:"Stream"})]}),a.jsx("div",{className:W.overviewContent,children:a.jsxs("div",{className:W.overviewDashboard,children:[a.jsx("div",{className:W.overviewHero,children:a.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Description"}),a.jsx(dm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Environment"}),a.jsxs("div",{className:W.envRow,children:[a.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),a.jsx(dm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Timeline"}),a.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:W.timelineRow,children:[a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Eo(){const{taskId:t,workspaceId:s,environmentId:o}=ma(),r=kh(),c=Wt(),d=xt(),{showToast:u}=pn(),{sessions:{events:p,eventsDropped:m,sessions:g,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:k,spawn:S,kill:j},tasks:{tasks:T,tasksLoading:w,startTask:C,stopTask:M,resumeTask:A,deleteTask:E,createTask:R,updateTask:O},environments:{environments:D,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,Me]=y.useState(!1),[ot,bt]=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(D.length>0){const Ne=D.find(Ve=>Ve.status==="connected");Pe((Ne==null?void 0:Ne.id)??D[0].id)}}},[lt,re==null?void 0:re.linkedEnvironmentIds[0],D]);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 an=()=>{Me(!0)},ks=()=>{if(!Q)return;E(Q.id).catch(()=>{}),Me(!1);const Ne=o??(re==null?void 0:re.linkedEnvironmentIds[0]);d(Q.workspaceId&&Ne?Ni(Q.workspaceId,Ne):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==se.current&&(se.current=Q==null?void 0:Q.id,bt(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 ds=y.useMemo(()=>new Map(T.map(Ne=>[Ne.id,Ne])),[T]),zs=y.useMemo(()=>{const Ne=et?p.filter(Ve=>Ve.sessionId===et):[];return xh(_h(Ne))},[p,et]),ga=Q?Q.dependsOn.some(Ne=>{const Ve=ds.get(Ne);return Ve!==void 0&&Ve.status!=="complete"}):!1,Oi=y.useMemo(()=>kH(t,o,Y,D,ds),[t,o,Y,D,ds]);y.useEffect(()=>{et&&et!==Z.current&&(Z.current=et,v(et).catch(()=>{}))},[et,v]);const Xt=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,Xt]);const Qa=Q?`task:${Q.id}`:"",ei=Qa in ne?ne[Qa]:void 0,va=Q?`task_tree:${Q.id}`:"",$s=Q&&Q.childTaskIds.length>0&&va in ne?ne[va]:void 0,Ss=Ne=>{me(Ne),d(ls(t,Ne==="overview"?void 0:Ne,s,o))};return Za({key:"1"},()=>Ss("overview")),Za({key:"2"},()=>Ss("stream")),!Q&&w?a.jsx(JU,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:Oi}),a.jsxs("div",{className:W.header,children:[a.jsxs("span",{className:W.headerTitle,children:[a.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&a.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&a.jsx("span",{className:W.taskBranch,children:Q.branch}),ga&&a.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),Q&&a.jsx(gL,{task:Q,sessionId:et,isBlocked:ga,onStart:()=>{C(Q.id,void 0,lt).catch(Ne=>{const Ve=Ne instanceof da?Ne.message:"Failed to start task";u(Ve,"error")})},onResume:()=>{A(Q.id).catch(()=>{})},onStop:()=>{M(Q.id).catch(()=>{})},onPause:()=>{et&&j(et).catch(()=>{})},onDelete:an,onEdit:()=>ct(!0)})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>Ss("overview"),children:"Overview"}),a.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>Ss("stream"),children:"Stream"})]}),a.jsxs(os,{mode:"wait",children:[ce==="overview"&&a.jsx(Pt.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?a.jsx(ak,{mode:"edit",taskId:Q.id,workspaceId:nt,environmentId:o,tasks:T,workspaces:Y,personas:V,onCreateTask:(Ne,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi)=>{R(Ne,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi).catch(()=>{})},onUpdateTask:(Ne,Ve,_n,mn,Ut)=>{O(Ne,Ve,_n,mn,Ut).catch(()=>{})},onEditDone:()=>{ee?d(ls(Q.id,void 0,s,o),{replace:!0}):ct(!1)},onShowToast:u}):Q?a.jsx(s8,{task:Q,tasksById:ds,environments:D,workspaces:Y,taskSessions:ve,selectedEnvId:lt,taskUsage:ei,treeUsage:$s}):a.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&a.jsxs(Pt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[a.jsx(j6,{taskSessions:ve,selectedSessionId:et,onSelect:Ne=>bt(Ne)}),a.jsx(mh,{events:zs,eventsDropped:m,sandboxProxyUrl:r,emptyState:!et&&Q?ga?a.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:a.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(Q.id,void 0,lt).catch(Ne=>{const Ve=Ne instanceof da?Ne.message:"Failed to start task";u(Ve,"error")})},children:"Start Task"}),a.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):et&&zs.length===0?a.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 a.jsx(jd,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:V,environments:D,onSendInput:(Ve,_n)=>{k(Ve,_n).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ve,_n,mn)=>{S(Ve,_n,mn,void 0,nt).catch(()=>{})},onStartTask:(Ve,_n,mn)=>{C(Ve,_n,mn).catch(()=>{})},onProvisionEnvironment:Ve=>{$(Ve).catch(()=>{})},onShowToast:u})})(),Q&&a.jsx(_s,{isOpen:xe,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:ks,onCancel:()=>Me(!1)})]})}function WU(){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}=pn();return a.jsx(ik,{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 XU(){const{environmentId:t}=ma(),{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}=pn();return a.jsx(ik,{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 QU="_layout_11u79_1",eV="_content_11u79_8",tV="_tabPanel_11u79_14",sl={layout:QU,content:eV,tabPanel:tV};function nV(){const t=yH();return a.jsxs("div",{className:sl.layout,children:[a.jsx(ha,{segments:t}),a.jsx("div",{className:sl.content,children:a.jsx(Di,{})})]})}const sV="_container_144a4_1",aV="_envHeader_144a4_6",iV="_envTitleRow_144a4_10",oV="_statusDot_144a4_16",rV="_envName_144a4_21",lV="_statusBadge_144a4_27",cV="_envMeta_144a4_33",dV="_metaTag_144a4_39",uV="_actions_144a4_51",fV="_provisionMessage_144a4_59",pV="_errorMessage_144a4_64",mV="_section_144a4_69",hV="_sectionHeader_144a4_73",gV="_cardList_144a4_121",vV="_card_144a4_121",yV="_cardHeader_144a4_138",bV="_cardName_144a4_144",_V="_cardActions_144a4_149",xV="_cardDescription_144a4_154",kV="_cardMeta_144a4_160",SV="_repoLink_144a4_166",jV="_empty_144a4_174",TV="_errorHint_144a4_180",wV="_btnPrimary_144a4_186",NV="_btnOutline_144a4_220",CV="_btnSmall_144a4_247",EV="_btnDanger_144a4_273",De={container:sV,envHeader:aV,envTitleRow:iV,statusDot:oV,envName:rV,statusBadge:lV,envMeta:cV,metaTag:dV,actions:uV,provisionMessage:fV,errorMessage:pV,section:mV,sectionHeader:hV,cardList:gV,card:vV,cardHeader:yV,cardName:bV,cardActions:_V,cardDescription:xV,cardMeta:kV,repoLink:SV,empty:jV,errorHint:TV,btnPrimary:wV,btnOutline:NV,btnSmall:CV,btnDanger:EV};function AV(){return a.jsxs("div",{className:De.container,"aria-hidden":"true",children:[a.jsxs("div",{className:De.envHeader,children:[a.jsxs("div",{className:De.envTitleRow,children:[a.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),a.jsx(Te,{width:"12rem",height:"1.5rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem"})]}),a.jsxs("div",{className:De.envMeta,children:[a.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),a.jsxs("div",{className:De.actions,children:[a.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),a.jsxs("div",{className:De.section,children:[a.jsx("div",{className:De.sectionHeader,children:a.jsx("h3",{style:{margin:0},children:"Workspaces"})}),a.jsxs("div",{className:De.cardList,children:[a.jsx(um,{lines:2}),a.jsx(um,{lines:2})]})]})]})}const MV={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function DV(){const{environmentId:t}=ma(),s=xt(),{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),[M,A]=y.useState(void 0),E=o.find(B=>B.id===t);if(!E&&r)return a.jsx(AV,{});if(!t||!E)return a.jsx($n,{to:zo,replace:!0});const R=m.filter(B=>B.linkedEnvironmentIds.includes(E.id)),O=S.filter(B=>B.environmentId===E.id),D=O.reduce((B,F)=>B+(F.costMillicents??0),0),$=MV[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(zo,{replace:!0})},se=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=B=>{g(B).catch(()=>{}),A(void 0)};return a.jsxs("div",{className:De.container,children:[a.jsx(_s,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>T(!1)}),a.jsx(_s,{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)}),a.jsxs("div",{className:De.envHeader,children:[a.jsxs("div",{className:De.envTitleRow,children:[a.jsx("span",{className:De.statusDot,style:{color:$},children:"●"}),a.jsx("h2",{className:De.envName,children:E.displayName||E.id}),a.jsx("span",{className:De.statusBadge,style:{color:$},children:E.status})]}),a.jsxs("div",{className:De.envMeta,children:[a.jsxs("span",{className:De.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&a.jsxs("span",{className:De.metaTag,children:[O.length," session",O.length!==1?"s":""]}),D>0&&a.jsxs("span",{className:De.metaTag,children:["Cost: ",Rs(D)]})]})]}),a.jsxs("div",{className:De.actions,children:[Y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:De.btnPrimary,onClick:()=>s(lx(E.id)),children:"New Chat"}),a.jsx("button",{className:De.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),a.jsx("button",{className:De.btnOutline,onClick:()=>C(!0),disabled:le!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ne&&a.jsx("button",{className:De.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&le!==void 0&&a.jsx("span",{className:De.provisionMessage,children:le.message}),E.status==="error"&&(le==null?void 0:le.stage)==="error"&&a.jsx("span",{className:De.errorMessage,children:le.message}),a.jsx("button",{className:De.btnOutline,onClick:()=>s(XN(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),a.jsx("button",{className:De.btnDanger,onClick:()=>T(!0),children:"Delete"})]}),a.jsxs("div",{className:De.section,children:[a.jsxs("div",{className:De.sectionHeader,children:[a.jsx("h3",{children:"Workspaces"}),a.jsx("button",{className:De.btnPrimary,onClick:()=>s(`${fx}?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:a.jsxs("select",{className:De.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:[a.jsx("option",{value:"",children:"+ Link Workspace"}),B.map(F=>a.jsx("option",{value:F.id,children:F.name},F.id))]})})()]}),_&&a.jsxs("p",{className:De.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,a.jsx("button",{className:De.btnSmall,onClick:k,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),R.length===0&&a.jsx("p",{className:De.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),a.jsx("div",{className:De.cardList,"data-testid":"linked-workspaces-list",children:R.map(B=>a.jsx(RV,{workspace:B,confirmArchiveId:M,onOpen:()=>s(Ni(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 RV({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 a.jsxs("div",{className:De.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[a.jsxs("div",{className:De.cardHeader,children:[a.jsx("strong",{className:De.cardName,children:t.name}),a.jsxs("div",{className:De.cardActions,children:[a.jsx("button",{className:De.btnSmall,onClick:o,children:"Open"}),a.jsx("button",{className:De.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:De.btnDanger,onClick:c,children:"Confirm"}),a.jsx("button",{className:De.btnSmall,onClick:d,children:"Cancel"})]}):a.jsx("button",{className:De.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&a.jsx("p",{className:De.cardDescription,children:t.description}),t.repoUrl&&a.jsx("div",{className:De.cardMeta,children:m?a.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:De.repoLink,children:t.repoUrl}):a.jsx("span",{children:t.repoUrl})})]})}const IV={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function OV(){const s=Wt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=IV[s],r=vH(o);return a.jsxs("div",{className:sl.layout,children:[a.jsx(ha,{segments:r}),a.jsx("div",{className:sl.content,children:a.jsx("div",{className:sl.tabPanel,children:a.jsx(Di,{})},s)})]})}function BV(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=pt(),{showToast:d}=pn();return a.jsxs(a.Fragment,{children:[a.jsx(B8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),a.jsx(HB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function LV(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=pt(),{showToast:u}=pn();return a.jsx(i8,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function zV(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=pt(),{showToast:c}=pn(),d=xt();return a.jsx(Y8,{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(eC),onNavigateToPersona:u=>d(cx(u))})}const $V="_container_1ooin_1",HV="_form_1ooin_7",PV="_formActions_1ooin_75",UV="_editableSection_1ooin_82",VV="_defaultBadge_1ooin_93",qV="_typeToggle_1ooin_107",GV="_scriptEditor_1ooin_121",FV="_optional_1ooin_128",vs={container:$V,form:HV,formActions:PV,editableSection:UV,defaultBadge:VV,typeToggle:qV,scriptEditor:GV,optional:FV},j_=[{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)"}],T_=[{value:"genaiscript",label:"genaiscript"}],KV="0";function w_(){const{personaId:t}=ma(),s=xt(),{showToast:o}=pn(),{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 a.jsx($n,{to:np,replace:!0});const b=[{label:"Settings",url:ji},{label:"Personas",url:np},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return a.jsxs("div",{className:vs.container,children:[a.jsx(ha,{segments:b}),a.jsx(ZV,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(np)},showToast:o})]})}function ZV({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=xt(),[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,M]=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"),[D,$]=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),M(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"?D.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,Me=(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,D).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,S,T,C,A,R,D,Y).then(Re=>{m("Persona created","success"),g(cx(Re.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},bt=()=>{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,an=ue==="script"?String(Re):D;lt(()=>c(t.id,ue==="name"?String(Re):v,ue==="description"?String(Re):_,et,nt,re,ve,Q,an),()=>{if(ue==="type"){const ks=String(Re)==="script"?"script":"agent";O(ks),w(nt)}ue==="runtime"&&w(String(Re)),ue==="name"&&b(String(Re)),ue==="description"&&k(String(Re)),ue==="systemPrompt"&&j(String(Re)),ue==="model"&&M(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 a.jsxs(a.Fragment,{children:[ge?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsx("p",{children:"Loading persona..."})]}):s?a.jsxs("form",{onSubmit:ke,className:vs.form,children:[a.jsx("h3",{children:"Create Persona"}),a.jsxs("div",{className:vs.typeToggle,"data-testid":"persona-type-toggle",children:[a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:R==="agent",onChange:()=>F("agent")}),"Agent"]}),a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"script",checked:R==="script",onChange:()=>F("script")}),"Script"]})]}),a.jsxs("label",{children:["Name",a.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"})]}),a.jsxs("label",{children:["Description",a.jsx("input",{type:"text",value:_,onChange:ue=>k(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Runtime",a.jsx("select",{value:T,onChange:ue=>w(ue.target.value),"data-testid":"persona-runtime-select",children:(R==="script"?T_:j_).map(ue=>a.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),R==="agent"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model",a.jsx("input",{type:"text",value:C,onChange:ue=>M(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx("input",{type:"number",value:A,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.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"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model ",a.jsx("span",{className:vs.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:C,onChange:ue=>M(ue.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),a.jsxs("label",{children:["Script",a.jsx("textarea",{value:D,onChange:ue=>$(ue.target.value),placeholder:`script({ model: "openai:gpt-4o" });
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"}}]}],ss={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function m_(t){return t?f_:f_.filter(s=>!R7.some(o=>s.name.startsWith(o)))}const h_=400;function GH({children:t}){const[s,o]=y.useState(LH),[r,c]=y.useState(zH),[d,u]=y.useState(()=>m_(!1)),[p,m]=y.useState($H),[g,v]=y.useState(void 0),[b,_]=y.useState(HH),[x,S]=y.useState(""),[j,T]=y.useState(PH),[N,C]=y.useState(UH),[D,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,R]=y.useState(VH),[O,M]=y.useState([]),[$]=y.useState(qH),[Y,V]=y.useState(""),[ne,le]=y.useState(Ds),[Z,se]=y.useState(Ga),[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),bt=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=p_[De.current%p_.length];return De.current+=1,U},[]),Re=y.useCallback((U,ae,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=bt.current.get(de))==null||ye.delete(pe)),U()},ae);ot.current.add(pe),de&&(bt.current.has(de)||bt.current.set(de,new Set),bt.current.get(de).add(pe))},[]),Q=y.useCallback(U=>{const ae=bt.current.get(U);ae&&(ae.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),bt.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=_k(pe.event.content),Le=xk(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),Dt=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"})},Dt+h_,ye),je.resumeSteps&&Pe.current.set(ye,je.resumeSteps)}else ve(ye,je.steps)},[ct,ue,ve,Re,nt,re]),an=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]),ks=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]),ds=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),zs=y.useCallback(async U=>{console.log("[MockGrackle] loadSessionEvents",U)},[]),ga=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Oi=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createWorkspace",{name:U,description:ae});const Dt={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,Dt]),Le&&Le(Dt)},[ct]),Xt=y.useCallback(async U=>{console.log("[MockGrackle] archiveWorkspace",U),_(ae=>ae.map(de=>de.id===U?{...de,status:"archived"}:de))},[]),Qa=y.useCallback(async U=>{console.log("[MockGrackle] loadTasks",U)},[]),ei=y.useCallback(async(U,ae,de,pe,ye,tt,je,Le,Ue,Dt)=>{console.log("[MockGrackle] createTask",{workspaceId:U,title:ae,parentTaskId:ye}),T(qe=>{const En=qe.filter(Ts=>Ts.workspaceId===U).reduce((Ts,Ns)=>Math.max(Ts,Ns.sortOrder),0),_t=ye?qe.find(Ts=>Ts.id===ye):void 0;if(ye&&!_t)return console.warn("[MockGrackle] Parent task not found:",ye),qe;if(_t&&!_t.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),qe;const js=_t?_t.depth+1:0,Hi={id:ct("task"),workspaceId:U,title:ae,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:En+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:js,childTaskIds:[],canDecompose:je??!ye,injectKnowledge:Le??!0,defaultPersonaId:tt||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...qe,Hi]}),Ue&&Ue()},[ct]),va=y.useCallback(async(U,ae,de,pe)=>{var Dt;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(on=>on.id===U?{...on,status:"working",latestSessionId:je,branch:`mock/${U.slice(0,8)}`}:on));const Ue=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ue.label}`),Ue.pauseForInput){const qe=Ue.pauseAfterStep??Ue.steps.length-1,on=Ue.steps.slice(0,qe+1),En=on.length>0?on[on.length-1].delayMs:0;if(ve(je,on),Re(()=>{nt(je,"idle"),re({sessionId:je,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},En+h_,je),Ue.resumeSteps){const _t=[...Ue.resumeSteps];Pe.current.set(je,_t);const js=_t.reduce((Hi,Ts)=>Math.max(Hi,Ts.delayMs),0);ke.current.set(je,{taskId:U,delayAfterResume:js+200})}}else{const qe=Ue.steps.length>0?Ue.steps[Ue.steps.length-1].delayMs:0;ve(je,Ue.steps);const on=(Dt=Ue.steps[Ue.steps.length-1])==null?void 0:Dt.event.content;Re(()=>{on==="completed"?T(En=>En.map(_t=>_t.id===U&&_t.status==="working"?{..._t,status:"paused"}:_t)):on==="failed"&&T(En=>En.map(_t=>_t.id===U&&_t.status==="working"?{..._t,status:"failed"}:_t))},qe+100,je)}},[ct,ue,ve,Re,nt,re]),$s=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]),Ss=y.useCallback(async U=>{console.log("[MockGrackle] completeTask",U),T(ae=>ae.map(de=>de.id===U?{...de,status:"complete"}:de))},[]),we=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))},[]),_n=y.useCallback(async U=>{console.log("[MockGrackle] deleteTask",U),T(ae=>ae.filter(de=>de.id!==U))},[]),mn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Ut=y.useCallback(async(U,ae,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:U,adapterType:ae,adapterConfig:de})},[]),Cn=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)}:{}}))},[]),Qt=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Bi=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:""}])},[]),Li=y.useCallback(async U=>{console.log("[MockGrackle] deleteToken",U),C(ae=>ae.filter(de=>de.name!==U))},[]),zi=y.useCallback(async U=>{console.log("[MockGrackle] updateCredentialProviders",U),A(U)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const $i=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:mn,addEnvironment:Ut,updateEnvironment:Cn,provisionEnvironment:async(U,ae)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ss},sessions:{sessions:r,sessionsLoading:!1,events:p,eventsDropped:0,lastSpawnedId:g,taskSessions:$,spawn:et,sendInput:$s,kill:an,stopGraceful:ks,loadSessionEvents:zs,clearEvents:ga,loadTaskSessions:async U=>{console.log("[MockGrackle] loadTaskSessions",U)},domainHook:ss},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Oi,archiveWorkspace:Xt,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:x,clearLinkOperationError:()=>{S("")},domainHook:ss},tasks:{tasks:j,tasksLoading:!1,taskStartingId:void 0,loadTasks:Qa,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:ei,startTask:va,stopTask:async U=>{console.log("[MockGrackle] stopTask",{taskId:U}),await Ss(U)},completeTask:Ss,resumeTask:we,updateTask:Ve,deleteTask:_n,domainHook:ss},tokens:{tokens:N,tokensLoading:!1,loadTokens:Qt,setToken:Bi,deleteToken:Li,domainHook:ss},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:zi,domainHook:ss},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ss},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ss},personas:{personas:E,personasLoading:!1,createPersona:async(U,ae,de,pe,ye,tt,je,Le,Ue)=>{console.log("[MockGrackle] createPersona",{name:U});const Dt={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,Dt]),Dt},updatePersona:async(U,ae,de,pe,ye,tt,je,Le,Ue,Dt)=>{console.log("[MockGrackle] updatePersona",{personaId:U,name:ae});const qe=E.find(_t=>_t.id===U);if(!qe)throw new Error(`Persona not found: ${U}`);const on=new Date().toISOString(),En={...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}:{},...Dt!==void 0?{allowedMcpTools:Dt}:{},updatedAt:on};return R(_t=>_t.map(js=>js.id===U?En:js)),En},deletePersona:async U=>{console.log("[MockGrackle] deletePersona",U),R(ae=>ae.filter(de=>de.id!==U))},domainHook:ss},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:ss},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(U=!1)=>{u(m_(U))},liveMessages:BH,loadTranscript:async()=>{},handleStreamMessage:()=>{},domainHook:ss},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?Ds.filter(je=>!je.workspaceId||je.workspaceId===ae):Ds,pe=U.toLowerCase(),ye=de.filter(je=>{var Le,Ue,Dt;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)))||((Dt=je.category)==null?void 0:Dt.toLowerCase().includes(pe))});le(ye);const tt=new Set(ye.map(je=>je.id));se(Ga.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?Ds.filter(pe=>!pe.workspaceId||pe.workspaceId===U):Ds;le(ae);const de=new Set(ae.map(pe=>pe.id));se(Ga.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 u_?u_[U]:void 0;if(ae)B(ae);else{const de=Ds.find(pe=>pe.id===U);if(de){const pe=Ga.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=Ga.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=Ds.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}`)),Dt=Ga.filter(qe=>je.has(qe.source)&&je.has(qe.target)&&!Ue.has(`${qe.source}|${qe.target}|${qe.type}`));return Dt.length>0?[...Le,...Dt]:Le}),[...ae,...tt]})},loadRecent:async U=>{if(console.log("[MockGrackle] knowledge.loadRecent",U),me.current=U,U){const ae=Ds.filter(pe=>!pe.workspaceId||pe.workspaceId===U);le(ae);const de=new Set(ae.map(pe=>pe.id));se(Ga.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else le(Ds),se(Ga);ce("")},handleEvent:()=>!1,domainHook:ss},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:ds}),[s,r,d,p,g,$,b,x,j,N,D,E,O,Y,ne,Z,H,F,ee,et,$s,an,ks,zs,ga,Oi,Xt,Qa,ei,va,Ss,we,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi,ds]);return a.jsx(bh.Provider,{value:$i,children:t})}const jk=3e3,FH=jk;function KH(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 x=()=>{!_&&!m&&(_=!0,o("connected"))};v=setTimeout(x,FH);try{const N=Be.streamEvents({});for await(const C of N){if(x(),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(N){if(clearTimeout(v),N instanceof da&&N.code===z_.Unauthenticated){window.location.href=oC;return}}clearTimeout(v),m||(o("connecting"),(T=p.current)==null||T.call(p),g=setTimeout(()=>{b().catch(()=>{})},jk))}return b().catch(()=>{}),()=>{m=!0,clearTimeout(g),clearTimeout(v)}},[]),{connectionStatus:s}}const bm=["core","orchestration","scheduling"],Tk=y.createContext({pluginNames:[...bm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function ZH({children:t}){const[s,o]=y.useState([...bm]),[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(x=>x.name)),c(_.sandboxPort),u(_.sandboxOrigin),m(!1))}).catch(_=>{b||(o([...bm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),a.jsx(Tk.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:p,error:g},children:t})}function Ld(){return y.useContext(Tk)}function kh(){const{sandboxPort:t,sandboxOrigin:s}=Ld();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 YH=new Set(["dashboard","chat","environments","coordination","settings"]),JH=new Set(["tasks"]),WH=new Set(["knowledge"]),Nk={core:{navItems:id.filter(t=>YH.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:id.filter(t=>JH.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:id.filter(t=>WH.has(t.view)),domainHookKeys:["knowledge"]}};function XH(t){return t.flatMap(s=>{var o;return((o=Nk[s])==null?void 0:o.navItems)??[]})}function QH(t){return new Set(t.flatMap(s=>{var o;return((o=Nk[s])==null?void 0:o.domainHookKeys)??[]}))}function e9(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function g_(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 t9(t){return{sessionId:t.sessionId,eventType:$_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function v_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:ej(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function y_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:tj(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 n9(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function s9(t){return{claude:nj(t.claude),github:Rc(t.github),copilot:Rc(t.copilot),codex:Rc(t.codex),goose:Rc(t.goose)}}function a9(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function i9(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function Bp(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 o9(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Lp(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 Jc(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 zp(t){return{source:t.fromId,target:t.toId,type:t.type}}function r9(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function l9(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(r9),selfEcho:t.selfEcho}}function xs(){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 b_=5e3;function Fr(t){return t instanceof da?t.message:"Operation failed"}function c9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[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(e9))}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 bk("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})},b_)}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(Fr(R))}},[]),x=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(Fr(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})},b_)}catch(A){d(E=>{const R={...E};return delete R[C],R}),p(Fr(A))}},[]),j=y.useCallback(async C=>{p("");try{await Be.stopEnvironment({id:C})}catch(D){p(Fr(D))}},[]),T=y.useCallback(async C=>{p("");try{await Be.removeEnvironment({id:C})}catch(D){p(Fr(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:x,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:T,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>g(),onDisconnect:()=>{},handleEvent:v}}}const $p=new Set(["pending","running","idle"]),d9=new Set(["completed","failed","interrupted","hibernating","suspended"]),__=["pending","running","idle"];function u9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[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(g_);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:d9.has(Z)&&$p.has(ne.status)?{...ne,status:Z,...le.endReason!==void 0?{endReason:le.endReason}:{}}:$p.has(Z)&&$p.has(ne.status)&&__.indexOf(Z)>__.indexOf(ne.status)?{...ne,status:Z}:ne})})}catch{}},[r]),x=y.useCallback(M=>{if(M.type!=="session_event")return!1;if(!_H(M.payload))return bk("session_event","payload is not a valid SessionEvent"),!0;const $=M.payload;let Y=0;if(d(V=>{const ne=[...V,$];return ne.length>Co?(Y=ne.length-Co,ne.slice(-Co)):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=_k($.content),ne=xk($.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=>{x({type:"session_event",payload:M})},[x]),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{}},[_]),N=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(t9);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>Co?(V=se.length-Co,se.slice(-Co)):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(g_);b(V=>({...V,[M]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:T,sendInput:N,kill:C,stopGraceful:D,loadSessionEvents:A,clearEvents:E,loadTaskSessions:R,handleMessage:x,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function x_(t){return t instanceof da?t.message:"Operation failed"}function f9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(!1),[u,p]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Be.listWorkspaces({}));s(C.workspaces.map(v_))}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=v_(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 da?V.message:"Failed to create workspace";Y==null||Y(ne)}},[]),_=y.useCallback(async C=>{try{await Be.archiveWorkspace({id:C})}catch{}},[]),x=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(x_(A))}},[m]),T=y.useCallback(async(C,D)=>{try{p(""),await Be.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){p(x_(A))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:_,updateWorkspace:x,linkEnvironment:j,unlinkEnvironment:T,linkOperationError:u,clearLinkOperationError:S,handleEvent:g,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:g}}}function p9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async E=>{try{const O=(await zn.listTasks({workspaceId:E})).tasks.map(y_);s(M=>[...M.filter($=>$.workspaceId!==E),...O])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(zn.listTasks({}))).tasks.map(y_);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},[]),x=y.useCallback(async(E,R,O,M,$,Y,V,ne,le,Z)=>{try{await zn.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 da?se.message:"Failed to create task";Z==null||Z(H)}},[]),S=y.useCallback(async(E,R,O,M)=>{d(E);try{await zn.startTask({taskId:E,personaId:R||"",environmentId:O||"",notes:M||""})}catch($){if($ instanceof da&&$.code===z_.ResourceExhausted)return;throw d(void 0),$}},[]),j=y.useCallback(async E=>{try{await zn.stopTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await zn.completeTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await zn.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,R,O,M,$)=>{try{await zn.updateTask({id:E,title:R,description:O,dependsOn:M,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await zn.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:x,startTask:S,stopTask:j,completeTask:T,resumeTask:N,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function m9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const g=await r(Be.listTokens({}));s(g.tokens.map(n9))}catch{}},[r]),d=y.useCallback(g=>g.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(g,v,b,_,x)=>{try{await Be.setToken({name:g,value:v,type:b,envVar:_,filePath:x})}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 h9(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const m=await r(Be.getCredentialProviders({}));s(s9(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(kH(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 g9(){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(a9)),d(_.error)}catch{}},[]),g=y.useCallback(async(b,_)=>{p(!0),r("");try{await Be.createCodespace({repo:b,machine:_??""}),p(!1),await m()}catch(x){p(!1);const S=x instanceof da?x.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 v9(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await Be.listDockerContainers({});s(u.containers.map(i9)),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 y9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const v=await r(zn.listPersonas({}));s(v.personas.map(Bp))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,b,_,x,S,j,T,N,C)=>{const D=await zn.createPersona({name:v,description:b,systemPrompt:_,runtime:x||"",model:S||"",maxTurns:j||0,type:T||"agent",script:N||"",allowedMcpTools:C||[]}),A=Bp(D);return s(E=>[...E.filter(R=>R.id!==A.id),A]),A},[]),p=y.useCallback(async(v,b,_,x,S,j,T,N,C,D)=>{const A={id:v};b!==void 0&&(A.name=b),_!==void 0&&(A.description=_),x!==void 0&&(A.systemPrompt=x),S!==void 0&&(A.runtime=S),j!==void 0&&(A.model=j),T!==void 0&&(A.maxTurns=T),N!==void 0&&(A.type=N),C!==void 0&&(A.script=C),D!==void 0&&(A.allowedMcpTools={tools:D});const E=await zn.updatePersona(A),R=Bp(E);return s(O=>O.map(M=>M.id===R.id?R:M)),R},[]),m=y.useCallback(async v=>{await zn.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 b9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Bc.listSchedules({}));s(b.schedules.map(Lp))}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,_,x,S,j,T)=>{const N=await Bc.createSchedule({title:b,description:_,scheduleExpression:x,personaId:S,workspaceId:j||"",parentTaskId:T||""}),C=Lp(N);return s(D=>[...D.filter(A=>A.id!==C.id),C]),C},[]),m=y.useCallback(async(b,_)=>{const x={id:b};_.title!==void 0&&(x.title=_.title),_.description!==void 0&&(x.description=_.description),_.scheduleExpression!==void 0&&(x.scheduleExpression=_.scheduleExpression),_.personaId!==void 0&&(x.personaId=_.personaId),_.enabled!==void 0&&(x.enabled=_.enabled);const S=await Bc.updateSchedule(x),j=Lp(S);return s(T=>T.map(N=>N.id===j.id?j:N)),j},[]),g=y.useCallback(async b=>{await Bc.deleteSchedule({id:b}),s(_=>_.filter(x=>x.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 _9(t){if(t)try{return JSON.parse(t)}catch{return}}function x9(){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(""),x=y.useCallback(async E=>{const R=E??"";_.current=R,b(""),g(!0);try{const O=await Lc.listRecentKnowledgeNodes({limit:30,workspaceId:R}),M=new Map,$=[];for(const Y of O.nodes)M.set(Y.id,Jc(Y));for(const Y of O.edges)$.push(zp(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 Lc.searchKnowledge({query:E,limit:20,workspaceId:_.current}),O=new Map,M=[];for(const $ of R.results){$.node&&O.set($.node.id,Jc($.node,$.edges.length));for(const Y of $.edges)M.push(zp(Y))}s(O),r(M)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{x(_.current).catch(()=>{})},[x]),T=y.useCallback(async E=>{p(E);try{const R=await Lc.getKnowledgeNode({id:E});if(!R.node){d(void 0);return}d({node:Jc(R.node,R.edges.length),edges:R.edges.map(O=>({fromId:O.fromId,toId:O.toId,type:O.type,metadata:_9(O.metadataJson)}))})}catch{d(void 0)}},[]),N=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async E=>{try{const R=await Lc.expandKnowledgeNode({id:E,depth:1});s(O=>{const M=new Map(O);for(const $ of R.nodes)M.has($.id)||M.set($.id,Jc($));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=zp(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:N,expandNode:C,loadRecent:x,handleEvent:D,domainHook:A}}function k9(){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:Od("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 Wc=500;function S9(){const[t,s]=y.useState([]),[o,r]=y.useState({}),[c,d]=y.useState(!1),[u,p]=y.useState(!1),{loading:m,track:g}=xs(),v=y.useRef(0),b=y.useCallback(async(T=!1)=>{const N=v.current;try{const C=await g(Be.listStreams({includeInternal:T}));v.current===N&&(s(C.streams.map(l9)),p(!1))}catch{v.current===N&&p(!0)}finally{v.current===N&&d(!0)}},[g]),_=y.useCallback(async(T,N)=>{let C;try{C=(await Be.getStreamTranscript({streamId:T,beforeSeq:N??"",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>Wc?E.slice(E.length-Wc):E;return{...D,[T]:R}})},[]),x=y.useCallback(T=>{r(N=>{const C=N[T.streamId]??[];if(C.some(E=>E.seq===T.seq))return N;const D=[...C,T],A=D.length>Wc?D.slice(D.length-Wc):D;return{...N,[T.streamId]:A}})},[]),S=y.useCallback(T=>!1,[]);return{streams:t,streamsLoading:m,streamsLoadedOnce:c,streamsLoadError:u,loadStreams:b,liveMessages:o,loadTranscript:_,handleStreamMessage:x,handleEvent:S,domainHook:{onConnect:b,onDisconnect:()=>{v.current+=1,s([]),r({}),d(!1),p(!1)},handleEvent:S}}}function j9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),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 T9(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),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,_,x,S)=>{const j=await Be.addGitHubAccount({label:b,token:_,username:x,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 x=await Be.updateGitHubAccount({id:b,..._});s(S=>S.map(j=>j.id===x.id?{...j,label:x.label,username:x.username,isDefault:x.isDefault}:_.isDefault?{...j,isDefault:!1}:j))},[]),m=y.useCallback(async b=>{await Be.removeGitHubAccount({id:b}),s(_=>_.filter(x=>x.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 N9(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Ld(),p=QH(u),m=c9(),g=u9(),v=f9(),b=p9(),_=m9(),x=h9(),S=g9(),j=v9(),T=y9(),N=b9(),C=x9(),D=k9(),A=S9(),E=j9(),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")?[x.domainHook]:[],...p.has("codespaces")?[S.domainHook]:[],...p.has("dockerContainers")?[j.domainHook]:[],...p.has("personas")?[T.domainHook]:[],...p.has("schedules")?[N.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}=KH({onSessionEvent:F=>{g.handleSessionEvent({sessionId:F.sessionId,eventType:$_(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]:o9(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:x.credentialProviders,credentialsLoading:x.credentialsLoading,updateCredentialProviders:x.updateCredentialProviders,domainHook:x.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},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:N.schedules,schedulesLoading:N.schedulesLoading,createSchedule:N.createSchedule,updateSchedule:N.updateSchedule,deleteSchedule:N.deleteSchedule,domainHook:N.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=N9();return a.jsx(bh.Provider,{value:s,children:t})}function C9(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 E9(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 A9={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 D9(t){return A9[t]}function M9(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=D9(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 R9(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=M9(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const I9="_dashboard_16pzm_1",O9="_kpiStrip_16pzm_11",B9="_kpiCard_16pzm_23",L9="_kpiValue_16pzm_68",z9="_kpiLabel_16pzm_76",$9="_bodyGrid_16pzm_84",H9="_section_16pzm_96",P9="_sectionHeader_16pzm_109",U9="_sectionIcon_16pzm_118",V9="_sectionTitle_16pzm_123",q9="_sectionCount_16pzm_131",G9="_sectionBody_16pzm_138",F9="_emptyHint_16pzm_143",K9="_sessionRow_16pzm_150",Z9="_sessionPrompt_16pzm_177",Y9="_sessionEnv_16pzm_186",J9="_sessionRuntime_16pzm_192",W9="_sessionStatus_16pzm_198",X9="_statusDot_16pzm_207",Q9="_attentionRow_16pzm_233",eP="_attentionTitle_16pzm_259",tP="_attentionMeta_16pzm_267",nP="_reasonBadge_16pzm_274",sP="_bottomGrid_16pzm_301",aP="_envRow_16pzm_312",iP="_envName_16pzm_323",oP="_envStatusBadge_16pzm_333",rP="_workspaceRow_16pzm_369",lP="_workspaceTop_16pzm_395",cP="_workspaceName_16pzm_401",dP="_workspaceCounts_16pzm_407",uP="_progressBar_16pzm_415",fP="_progressFill_16pzm_422",he={dashboard:I9,kpiStrip:O9,kpiCard:B9,kpiValue:L9,kpiLabel:z9,bodyGrid:$9,section:H9,sectionHeader:P9,sectionIcon:U9,sectionTitle:V9,sectionCount:q9,sectionBody:G9,emptyHint:F9,sessionRow:K9,sessionPrompt:Z9,sessionEnv:Y9,sessionRuntime:J9,sessionStatus:W9,statusDot:X9,attentionRow:Q9,attentionTitle:eP,attentionMeta:tP,reasonBadge:nP,bottomGrid:sP,envRow:aP,envName:iP,envStatusBadge:oP,workspaceRow:rP,workspaceTop:lP,workspaceName:cP,workspaceCounts:dP,progressBar:uP,progressFill:fP};function pP(){return a.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[a.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:he.kpiCard,children:[a.jsx(Te,{width:"3rem",height:"2rem"}),a.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>a.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"70%",height:"0.875rem"})]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"9rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.envRow,children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"6rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx(Te,{width:"50%",height:"0.875rem"}),a.jsx(Te,{width:"2rem",height:"0.75rem"})]}),a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const mP={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Xc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function hP(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 Qc({value:t,label:s,accent:o,index:r,testId:c}){return a.jsxs(Pt.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:mP,initial:"hidden",animate:"visible",custom:r,children:[a.jsx("span",{className:he.kpiValue,children:t}),a.jsx("span",{className:he.kpiLabel,children:s})]})}function gP(){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=xt(),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(()=>DH(d,o,p),[d,o,p]),_=y.useMemo(()=>RH(d,p),[d,p]),x=y.useMemo(()=>MH(o,t),[o,t]),S=y.useMemo(()=>IH(t,o),[t,o,p]);return d.length===0&&o.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?a.jsx(pP,{}):a.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[a.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[a.jsx(Qc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),a.jsx(Qc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),a.jsx(Qc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),a.jsx(Qc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),a.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),a.jsx("span",{className:he.sectionCount,children:_.length})]}),a.jsx("div",{className:he.sectionBody,children:_.length===0?a.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:T,environmentName:N})=>a.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>g(Mm(T.id)),"data-testid":"session-row",children:[a.jsx("span",{className:he.sessionPrompt,title:T.prompt,children:T.prompt||"—"}),a.jsx("span",{className:he.sessionEnv,children:N}),a.jsx("span",{className:he.sessionRuntime,children:T.runtime}),a.jsxs("span",{className:he.sessionStatus,children:[a.jsx("span",{className:he.statusDot,"data-status":T.status}),T.status]})]},T.id))})]}),a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),a.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),a.jsx("span",{className:he.sectionCount,children:x.length})]}),a.jsx("div",{className:he.sectionBody,children:x.length===0?a.jsx("div",{className:he.emptyHint,children:"All clear"}):x.map(({task:T,reason:N,workspaceName:C})=>a.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>g(ls(T.id)),"data-testid":"attention-row",children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx("span",{className:he.reasonBadge,"data-reason":N,children:N}),T.title]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx("span",{children:C})})]},T.id))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),a.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),a.jsx("span",{className:he.sectionCount,children:p.length})]}),a.jsx("div",{className:he.sectionBody,children:p.length===0?a.jsx("div",{className:he.emptyHint,children:"No environments configured"}):p.map(T=>a.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[a.jsx("span",{className:he.envName,children:T.displayName}),a.jsx("span",{className:he.envStatusBadge,"data-status":T.status,children:T.status})]},T.id))})]}),a.jsxs(Pt.div,{className:he.section,variants:Xc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),a.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),a.jsx("span",{className:he.sectionCount,children:t.length})]}),a.jsx("div",{className:he.sectionBody,children:S.length===0?a.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:T,totalTasks:N,completedTasks:C,workingTasks:D,failedTasks:A})=>{const E=N>0?Math.round(C/N*100):0;return a.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>g(wi(T.id,T.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx("span",{className:he.workspaceName,children:T.name}),a.jsxs("span",{className:he.workspaceCounts,"aria-label":hP(C,N,D,A),children:[C,"/",N,D>0&&a.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),A>0&&a.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",A]})]})]}),N>0&&a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},T.id)})})]})]})]})}const vP="_panelContainer_1udy7_1",yP="_emptyState_1udy7_8",bP="_workspaceSummary_1udy7_17",_P="_workspaceSummaryTitle_1udy7_28",xP="_workspaceSummarySubtitle_1udy7_32",kP="_header_1udy7_36",SP="_headerInfo_1udy7_71",jP="_headerTitle_1udy7_106",TP="_taskStatusBadge_1udy7_128",NP="_taskBranch_1udy7_137",wP="_taskBlockedBadge_1udy7_143",CP="_tabBar_1udy7_277",EP="_tab_1udy7_277",AP="_active_1udy7_303",DP="_eventScroll_1udy7_308",MP="_overviewContent_1udy7_325",RP="_overviewDashboard_1udy7_334",IP="_overviewHero_1udy7_340",OP="_overviewSection_1udy7_347",BP="_overviewLabel_1udy7_353",LP="_envRow_1udy7_360",zP="_timeline_1udy7_366",$P="_timelineRow_1udy7_372",HP="_waitingMessage_1udy7_379",PP="_errorMessage_1udy7_383",UP="_emptyCta_1udy7_387",VP="_ctaTitle_1udy7_399",qP="_ctaDescription_1udy7_405",GP="_ctaButton_1udy7_412",FP="_workspaceHeader_1udy7_533",KP="_workspaceName_1udy7_558",ZP="_workspaceMeta_1udy7_571",YP="_metaRow_1udy7_579",JP="_metaLabel_1udy7_592",WP="_metaValue_1udy7_607",XP="_archiveButton_1udy7_617",QP="_repoLink_1udy7_647",eU="_metaToggle_1udy7_657",tU="_metaToggleArrow_1udy7_678",nU="_metaToggleArrowOpen_1udy7_683",sU="_progressBarContainer_1udy7_687",aU="_progressBar_1udy7_687",iU="_progressFill_1udy7_703",oU="_progressLabel_1udy7_710",rU="_metaTimestamps_1udy7_717",lU="_metaTimestamp_1udy7_717",cU="_metaPlaceholder_1udy7_739",dU="_linkedEnvList_1udy7_744",uU="_linkedEnvChip_1udy7_750",fU="_chipDismiss_1udy7_762",pU="_linkError_1udy7_777",mU="_linkEnvSelect_1udy7_782",W={panelContainer:vP,emptyState:yP,workspaceSummary:bP,workspaceSummaryTitle:_P,workspaceSummarySubtitle:xP,header:kP,headerInfo:SP,headerTitle:jP,taskStatusBadge:TP,taskBranch:NP,taskBlockedBadge:wP,tabBar:CP,tab:EP,active:AP,eventScroll:DP,overviewContent:MP,overviewDashboard:RP,overviewHero:IP,overviewSection:OP,overviewLabel:BP,envRow:LP,timeline:zP,timelineRow:$P,waitingMessage:HP,errorMessage:PP,emptyCta:UP,ctaTitle:VP,ctaDescription:qP,ctaButton:GP,workspaceHeader:FP,workspaceName:KP,workspaceMeta:ZP,metaRow:YP,metaLabel:JP,metaValue:WP,archiveButton:XP,repoLink:QP,metaToggle:eU,metaToggleArrow:tU,metaToggleArrowOpen:nU,progressBarContainer:sU,progressBar:aU,progressFill:iU,progressLabel:oU,metaTimestamps:rU,metaTimestamp:lU,metaPlaceholder:cU,linkedEnvList:dU,linkedEnvChip:uU,chipDismiss:fU,linkError:pU,linkEnvSelect:mU};function hU(){return a.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function gU(){return a.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function vU(){const{workspaces:{workspaces:t},environments:{environments:s}}=pt(),o=xt(),r=s.length>0;return t.length>0?a.jsx(gP,{}):a.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[a.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),a.jsx("button",{className:W.ctaButton,onClick:()=>o(px),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&a.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const yU="_panelContainer_1rih4_1",bU="_chatHeader_1rih4_9",_U="_chatHeaderInfo_1rih4_38",xU="_chatHeaderActions_1rih4_44",kU="_emptyState_1rih4_64",SU="_emptyTitle_1rih4_76",jU="_emptyDescription_1rih4_82",TU="_emptyHint_1rih4_88",ra={panelContainer:yU,chatHeader:bU,chatHeaderInfo:_U,chatHeaderActions:xU,emptyState:kU,emptyTitle:SU,emptyDescription:jU,emptyHint:TU};function k_(){return a.jsx("div",{className:ra.panelContainer,"aria-hidden":"true",children:a.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function NU({hasLocalEnvironment:t}){return a.jsxs("div",{className:ra.emptyState,"data-testid":"chat-empty-state",children:[a.jsx("div",{className:ra.emptyTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:ra.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&a.jsx("div",{className:ra.emptyHint,children:"Go to Settings → Environments to add one."})]})}function wU(){const t=kh(),{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:x,spawn:S},environments:{environments:j,provisionEnvironment:T},personas:{personas:N}}=pt(),{showToast:C}=pn(),D=y.useRef(void 0),[A,E]=y.useState(),R=s.find(le=>le.id===Ic),O=R!=null&&R.latestSessionId?c.find(le=>le.id===R.latestSessionId)??(m[Ic]??[]).find(le=>le.id===R.latestSessionId):void 0;y.useEffect(()=>{g(Ic).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 xh(_h(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&&(x(O.id,A).catch(()=>{C("Failed to send message","error")}),E(void 0))},[A,V,O==null?void 0:O.id,x,C]);const ne=y.useCallback((le,Z,se,H)=>{H&&E(H),r(le,Z,se).catch(()=>{})},[r]);return!R&&(d||o)?a.jsx(k_,{}):R!=null&&R.latestSessionId&&!O?a.jsx(k_,{}):a.jsxs("div",{className:ra.panelContainer,"data-testid":"chat-page",children:[Y&&a.jsxs("div",{className:ra.chatHeader,children:[a.jsxs("span",{className:ra.chatHeaderInfo,children:["Session: ",O.id.slice(0,8)," | ",O.runtime," | ",O.status]}),a.jsx("div",{className:ra.chatHeaderActions,children:a.jsx(hx,{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(()=>{})}}]})})]}),a.jsx(mh,{events:M,eventsDropped:p,sandboxProxyUrl:t,emptyState:a.jsx(NU,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&a.jsx(jd,{mode:Y?"send":"start",sessionId:Y?O.id:void 0,taskId:Ic,environmentId:Y?O.environmentId:$.id,personas:N,environments:j,onSendInput:(le,Z)=>{x(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 CU="_container_h5uod_1",EU="_toolbar_h5uod_9",AU="_viewToggle_h5uod_18",DU="_toolbarControls_h5uod_23",MU="_internalsToggle_h5uod_30",RU="_refreshButton_h5uod_39",IU="_toggleButton_h5uod_53",OU="_toggleActive_h5uod_67",as={container:CU,toolbar:EU,viewToggle:AU,toolbarControls:DU,internalsToggle:MU,refreshButton:RU,toggleButton:IU,toggleActive:OU};function BU(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c,liveMessages:d,loadTranscript:u},sessions:{sessions:p},tasks:{tasks:m}}=pt(),{resolvedThemeId:g}=yh(),[v,b]=y.useState("list"),[_,x]=y.useState(!1),[S,j]=y.useState(void 0),[T,N]=y.useState(!1);y.useEffect(()=>{if(S===void 0){N(!1);return}let E=!0;return N(!0),u(S).then(()=>{E&&N(!1)}).catch(()=>{E&&N(!1)}),()=>{E=!1}},[S,u]);const C=y.useRef(!1);y.useEffect(()=>{if(!C.current){C.current=!0;return}c(_).catch(()=>{})},[_,c]);const D=y.useCallback(()=>{c(_).catch(()=>{})},[c,_]),A=S!==void 0?t.find(E=>E.id===S):void 0;return a.jsxs("div",{className:as.container,"data-testid":"coordination-page",children:[a.jsxs("div",{className:as.toolbar,children:[a.jsxs("div",{className:as.viewToggle,role:"group","aria-label":"Coordination view","data-testid":"coordination-view-toggle",children:[a.jsx("button",{type:"button",className:v==="list"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="list","data-testid":"coordination-view-list",onClick:()=>b("list"),children:"List"}),a.jsx("button",{type:"button",className:v==="graph"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="graph","data-testid":"coordination-view-graph",onClick:()=>b("graph"),children:"Graph"})]}),a.jsxs("div",{className:as.toolbarControls,children:[a.jsxs("label",{className:as.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:_,onChange:E=>x(E.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),a.jsx("button",{type:"button",className:as.refreshButton,onClick:D,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:"Refresh"})]})]}),v==="list"?a.jsx(ez,{streams:t,sessions:p,tasks:m,loading:s,loadError:r,loadedOnce:o,showInternals:_,onToggleInternals:x,selectedStreamId:S,onSelectStream:j,onRefresh:D,hideHeaderControls:!0}):a.jsx(T$,{streams:t,sessions:p,selectedStreamId:S,onSelectStream:j,recentMessages:d,resolvedThemeId:g}),A&&a.jsx($z,{stream:A,messages:d[A.id]??[],transcriptLoading:T,onClose:()=>j(void 0)})]})}function LU(){const t=NH(),[s]=Dm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=pt(),{showToast:g}=pn();return a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:t}),a.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),a.jsx(jd,{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 zU(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsxs("div",{className:W.header,children:[a.jsx("span",{children:a.jsx(Te,{width:"10rem",height:"0.875rem"})}),a.jsx("span",{className:W.headerInfo,children:a.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),a.jsx("div",{className:W.eventScroll,children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function $U({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return a.jsxs("div",{className:W.header,children:[a.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Ho((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Rs(s.costMillicents??0)}`:""]}),a.jsxs("span",{className:W.headerInfo,children:[s&&a.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&a.jsx(hx,{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 HU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return a.jsx("div",{className:s?W.errorMessage:W.waitingMessage,children:o})}function PU(){const{sessionId:t}=ma(),s=kh(),{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:x,provisionEnvironment:S}}=pt(),{showToast:j}=pn(),T=y.useRef(void 0),N=wH(t),C=c.find(E=>E.id===t)??void 0,D=y.useMemo(()=>{const E=t?o.filter(R=>R.sessionId===t):[];return xh(_h(E))},[o,t]);if(y.useEffect(()=>{t&&t!==T.current&&(T.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return a.jsx(zU,{});if(!t)return a.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 a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:N}),a.jsx($U,{sessionId:t,session:C,isActive:A,onStop:()=>{p(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),a.jsx(mh,{events:D,eventsDropped:r,emptyState:a.jsx(HU,{session:C}),onShowToast:j,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:x,personas:_,onForward:(E,R)=>g(E,R)}),A&&a.jsx(jd,{mode:"send",sessionId:t,environmentId:C.environmentId,personas:_,environments:x,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 UU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Za(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&&UU(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 VU(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.workspaceHeader,children:a.jsx("span",{className:W.workspaceName,children:a.jsx(Te,{width:"12rem",height:"1.25rem"})})}),a.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:a.jsx(Te,{width:"4rem",height:"0.625rem"})}),a.jsxs("div",{className:W.progressBarContainer,children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),a.jsx(Te,{width:"2rem",height:"0.625rem"})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),a.jsx("span",{className:W.tab,children:"Board"}),a.jsx("span",{className:W.tab,children:"Tasks"})]}),a.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>a.jsx(um,{lines:2},s))})]})}function S_(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 Hp=100;function qU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function GU(){const{workspaceId:t,environmentId:s}=ma(),o=xt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m,linkEnvironment:g,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:_},personas:{personas:x},sessions:{sessions:S},usageCache:j,loadUsage:T}=pt(),{resolvedThemeId:N}=yh(),[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=CH(t,ne,d,c);Za({key:"1"},()=>D("graph")),Za({key:"2"},()=>D("board")),Za({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?a.jsx(VU,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:le}),a.jsxs("div",{className:W.workspaceHeader,children:[a.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:a.jsx(zt,{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>Hp)return`Max ${Hp} characters`},maxLength:Hp,fieldId:"name",activeFieldId:R,onActivate:O,ariaLabel:"Workspace name",renderDisplay:ee=>ee||t||void 0,"data-testid":"edit-name"})}),a.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),a.jsxs("button",{className:W.metaToggle,onClick:()=>$(!M),"aria-expanded":!M,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[a.jsx("span",{className:`${W.metaToggleArrow} ${M?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!M&&a.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Description"}),a.jsx("div",{className:W.metaValue,children:a.jsx(fm,{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?a.jsx("span",{className:W.overviewMarkdown,children:a.jsx(_m,{remarkPlugins:[xm],children:ee})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Repository"}),a.jsx("div",{className:W.metaValue,children:a.jsx(zt,{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=qU(ee);return ce?a.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:ee}):ee?a.jsx("span",{children:ee}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Environments"}),a.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:V?a.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const ee=[...new Set(V.linkedEnvironmentIds)];return ee.length===0?a.jsx("span",{className:W.metaPlaceholder,children:"None"}):ee.map(ce=>{const me=c.find(xe=>xe.id===ce);return a.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,a.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:a.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:[a.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>a.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&a.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,a.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):a.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Persona"}),a.jsx("div",{className:W.metaValue,children:a.jsx(_d,{value:(V==null?void 0:V.defaultPersonaId)||"",onSave:ee=>{V&&m(V.id,{defaultPersonaId:ee}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...x.map(ee=>({value:ee.id,label:ee.name}))],fieldId:"defaultPersonaId",activeFieldId:R,onActivate:O,renderDisplay:ee=>{const ce=x.find(me=>me.id===ee);if(ce)return a.jsx("span",{children:ce.name})},placeholder:(V==null?void 0:V.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Worktrees"}),a.jsx("div",{className:W.metaValue,children:a.jsx(Z5,{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"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Working Dir"}),a.jsx("div",{className:W.metaValue,children:a.jsx(zt,{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&&a.jsxs("div",{className:W.metaTimestamps,children:[a.jsxs("span",{className:W.metaTimestamp,children:["Created ",S_(V.createdAt)]}),V.updatedAt&&V.updatedAt!==V.createdAt&&a.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",S_(V.updatedAt)]})]})]}),F>0&&a.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),a.jsxs("span",{className:W.progressLabel,children:[B,"/",F]})]}),se&&se.costMillicents>0&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Usage: ",Rs(se.costMillicents)," (",se.sessionCount," session",se.sessionCount!==1?"s":"",")"]})}),V&&(V.tokenBudget>0||V.costBudgetMillicents>0)&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",V.tokenBudget>0&&a.jsxs(a.Fragment,{children:["Tokens: ",Ho(((se==null?void 0:se.inputTokens)??0)+((se==null?void 0:se.outputTokens)??0))," / ",Ho(V.tokenBudget)]}),V.tokenBudget>0&&V.costBudgetMillicents>0&&" | ",V.costBudgetMillicents>0&&a.jsxs(a.Fragment,{children:["Cost: ",Rs((se==null?void 0:se.costMillicents)??0)," / ",Rs(V.costBudgetMillicents)]})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>D("graph"),children:"Graph"}),a.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),a.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&F>0&&a.jsxs("div",{className:W.workspaceSummary,children:[a.jsx("span",{className:W.workspaceSummaryTitle,children:`${B}/${F} tasks complete`}),a.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&F===0&&a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{className:W.ctaButton,onClick:()=>o(Ri(t,void 0,ne)),children:"Create Task"}),a.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&a.jsx(W$,{workspaceId:t,environmentId:ne,tasks:r,sessions:S,personas:x,environments:c}),C==="graph"&&a.jsx(uC,{workspaceId:t,environmentId:ne,tasks:r,resolvedThemeId:N}),a.jsx(_s,{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 FU="_container_3pgew_1",KU="_header_3pgew_8",ZU="_headerTitle_3pgew_35",YU="_headerActions_3pgew_44",JU="_body_3pgew_51",WU="_btnPrimary_3pgew_63",XU="_btnGhost_3pgew_94",QU="_error_3pgew_116",Fa={container:FU,header:KU,headerTitle:ZU,headerActions:YU,body:JU,btnPrimary:WU,btnGhost:XU,error:QU};function eV(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 tV=[{label:"Home",url:Fo},{label:"New Workspace",url:void 0}];function nV(){const[t]=Dm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=pt(),{showToast:u}=pn(),p=xt(),[m,g]=y.useState(()=>{var T;return lH(void 0,s||((T=o[0])==null?void 0:T.id))}),[v,b]=y.useState(),[_,x]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||g(T=>{var N;return T.environmentId?T:{...T,environmentId:((N=o[0])==null?void 0:N.id)??""}})},[o,s,m.environmentId]);const S=()=>{const T=eV(m);if(T){b(T),x(void 0);return}b(void 0),x(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,N=>{u("Workspace created","success"),p(wi(N.id,N.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},N=>{x(N)}).catch(()=>{})},j=()=>{p(s?$o(s):Fo,{replace:!0})};return a.jsxs("div",{className:Fa.container,children:[a.jsxs("div",{className:Fa.header,children:[a.jsx("div",{className:Fa.headerTitle,children:a.jsx(ha,{segments:tV})}),a.jsxs("div",{className:Fa.headerActions,children:[a.jsx("button",{className:Fa.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),a.jsx("button",{className:Fa.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?a.jsx(F1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),a.jsxs("div",{className:Fa.body,children:[a.jsx(dH,{values:m,onChange:T=>{g(T),b(void 0),x(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&a.jsx("div",{className:Fa.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function j_(){const{workspaceId:t,environmentId:s}=ma(),[o]=Dm(),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}=pn();return a.jsx(ik,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,x,S,j,T,N,C,D,A)=>{u(b,_,x,S,j,T,N,C,D,A).catch(()=>{})},onUpdateTask:(b,_,x,S,j)=>{p(b,_,x,S,j).catch(()=>{})},onShowToast:v})}function sV(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.header,children:a.jsxs("span",{className:W.headerTitle,children:[a.jsx(Te,{width:"12rem",height:"1rem"}),a.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),a.jsx("span",{className:W.tab,children:"Stream"})]}),a.jsx("div",{className:W.overviewContent,children:a.jsxs("div",{className:W.overviewDashboard,children:[a.jsx("div",{className:W.overviewHero,children:a.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Description"}),a.jsx(dm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Environment"}),a.jsxs("div",{className:W.envRow,children:[a.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),a.jsx(dm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Timeline"}),a.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:W.timelineRow,children:[a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Eo(){const{taskId:t,workspaceId:s,environmentId:o}=ma(),r=kh(),c=Wt(),d=xt(),{showToast:u}=pn(),{sessions:{events:p,eventsDropped:m,sessions:g,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:x,spawn:S,kill:j},tasks:{tasks:T,tasksLoading:N,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,bt]=y.useState(void 0),[lt,Pe]=y.useState(""),[ke,ct]=y.useState(ee),ue=y.useRef(ge),Re=y.useRef(ee),Q=T.find(we=>we.id===t),nt=(Q==null?void 0:Q.workspaceId)||void 0,re=Y.find(we=>we.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 we=M.find(Ve=>Ve.status==="connected");Pe((we==null?void 0:we.id)??M[0].id)}}},[lt,re==null?void 0:re.linkedEnvironmentIds[0],M]);const ve=Q?b[Q.id]??[]:[];let et;ot&&ve.some(we=>we.id===ot)?et=ot:et=(Q==null?void 0:Q.latestSessionId)||void 0;const an=()=>{De(!0)},ks=()=>{if(!Q)return;E(Q.id).catch(()=>{}),De(!1);const we=o??(re==null?void 0:re.linkedEnvironmentIds[0]);d(Q.workspaceId&&we?wi(Q.workspaceId,we):"/",{replace:!0})};y.useEffect(()=>{(Q==null?void 0:Q.id)!==se.current&&(se.current=Q==null?void 0:Q.id,bt(void 0),Pe(""),ct(ee))},[Q==null?void 0:Q.id,ee]),y.useEffect(()=>{if(!(Q!=null&&Q.id))return;const we=Q.id!==B.current,Ve=Q.latestSessionId!==F.current;(we||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 we=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&&!(we&&ge!=="overview")&&me(Ve)}},[Q==null?void 0:Q.status,ce,ge]);const ds=y.useMemo(()=>new Map(T.map(we=>[we.id,we])),[T]),zs=y.useMemo(()=>{const we=et?p.filter(Ve=>Ve.sessionId===et):[];return xh(_h(we))},[p,et]),ga=Q?Q.dependsOn.some(we=>{const Ve=ds.get(we);return Ve!==void 0&&Ve.status!=="complete"}):!1,Oi=y.useMemo(()=>EH(t,o,Y,M,ds),[t,o,Y,M,ds]);y.useEffect(()=>{et&&et!==Z.current&&(Z.current=et,v(et).catch(()=>{}))},[et,v]);const Xt=ve.reduce((we,Ve)=>we+(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,Xt]);const Qa=Q?`task:${Q.id}`:"",ei=Qa in ne?ne[Qa]:void 0,va=Q?`task_tree:${Q.id}`:"",$s=Q&&Q.childTaskIds.length>0&&va in ne?ne[va]:void 0,Ss=we=>{me(we),d(ls(t,we==="overview"?void 0:we,s,o))};return Za({key:"1"},()=>Ss("overview")),Za({key:"2"},()=>Ss("stream")),!Q&&N?a.jsx(sV,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(ha,{segments:Oi}),a.jsxs("div",{className:W.header,children:[a.jsxs("span",{className:W.headerTitle,children:[a.jsx("span",{"data-testid":"task-title",children:(Q==null?void 0:Q.title)||t}),Q&&a.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:Q.status}),(Q==null?void 0:Q.branch)&&a.jsx("span",{className:W.taskBranch,children:Q.branch}),ga&&a.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),Q&&a.jsx(bL,{task:Q,sessionId:et,isBlocked:ga,onStart:()=>{C(Q.id,void 0,lt).catch(we=>{const Ve=we instanceof da?we.message:"Failed to start task";u(Ve,"error")})},onResume:()=>{A(Q.id).catch(()=>{})},onStop:()=>{D(Q.id).catch(()=>{})},onPause:()=>{et&&j(et).catch(()=>{})},onDelete:an,onEdit:()=>ct(!0)})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>Ss("overview"),children:"Overview"}),a.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>Ss("stream"),children:"Stream"})]}),a.jsxs(os,{mode:"wait",children:[ce==="overview"&&a.jsx(Pt.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?a.jsx(ik,{mode:"edit",taskId:Q.id,workspaceId:nt,environmentId:o,tasks:T,workspaces:Y,personas:V,onCreateTask:(we,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi)=>{R(we,Ve,_n,mn,Ut,Cn,Qt,Bi,Li,zi).catch(()=>{})},onUpdateTask:(we,Ve,_n,mn,Ut)=>{O(we,Ve,_n,mn,Ut).catch(()=>{})},onEditDone:()=>{ee?d(ls(Q.id,void 0,s,o),{replace:!0}):ct(!1)},onShowToast:u}):Q?a.jsx(o8,{task:Q,tasksById:ds,environments:M,workspaces:Y,taskSessions:ve,selectedEnvId:lt,taskUsage:ei,treeUsage:$s}):a.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&a.jsxs(Pt.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[a.jsx(w6,{taskSessions:ve,selectedSessionId:et,onSelect:we=>bt(we)}),a.jsx(mh,{events:zs,eventsDropped:m,sandboxProxyUrl:r,emptyState:!et&&Q?ga?a.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:a.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(Q.id,void 0,lt).catch(we=>{const Ve=we instanceof da?we.message:"Failed to start task";u(Ve,"error")})},children:"Start Task"}),a.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):et&&zs.length===0?a.jsx("div",{className:W.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream")]}),(()=>{if(!Q||Q.status!=="working"&&Q.status!=="paused")return;const we=et?g.find(Ve=>Ve.id===et):void 0;if(!(!we||we.status==="stopped"))return a.jsx(jd,{mode:"send",sessionId:we.id,environmentId:we.environmentId,personas:V,environments:M,onSendInput:(Ve,_n)=>{x(Ve,_n).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ve,_n,mn)=>{S(Ve,_n,mn,void 0,nt).catch(()=>{})},onStartTask:(Ve,_n,mn)=>{C(Ve,_n,mn).catch(()=>{})},onProvisionEnvironment:Ve=>{$(Ve).catch(()=>{})},onShowToast:u})})(),Q&&a.jsx(_s,{isOpen:xe,title:"Delete Task?",description:`"${Q.title}" will be permanently removed.`,onConfirm:ks,onCancel:()=>De(!1)})]})}function aV(){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:x}=pn();return a.jsx(ok,{mode:"new",environments:t,githubAccounts:_,onAddEnvironment:(S,j,T,N)=>{s(S,j,T,N).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:x})}function iV(){const{environmentId:t}=ma(),{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:x}}=pt(),{showToast:S}=pn();return a.jsx(ok,{mode:"edit",environmentId:t,environments:s,githubAccounts:x,onAddEnvironment:(j,T,N,C)=>{o(j,T,N,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 oV="_layout_11u79_1",rV="_content_11u79_8",lV="_tabPanel_11u79_14",sl={layout:oV,content:rV,tabPanel:lV};function cV(){const t=TH();return a.jsxs("div",{className:sl.layout,children:[a.jsx(ha,{segments:t}),a.jsx("div",{className:sl.content,children:a.jsx(Mi,{})})]})}const dV="_container_144a4_1",uV="_envHeader_144a4_6",fV="_envTitleRow_144a4_10",pV="_statusDot_144a4_16",mV="_envName_144a4_21",hV="_statusBadge_144a4_27",gV="_envMeta_144a4_33",vV="_metaTag_144a4_39",yV="_actions_144a4_51",bV="_provisionMessage_144a4_59",_V="_errorMessage_144a4_64",xV="_section_144a4_69",kV="_sectionHeader_144a4_73",SV="_cardList_144a4_121",jV="_card_144a4_121",TV="_cardHeader_144a4_138",NV="_cardName_144a4_144",wV="_cardActions_144a4_149",CV="_cardDescription_144a4_154",EV="_cardMeta_144a4_160",AV="_repoLink_144a4_166",DV="_empty_144a4_174",MV="_errorHint_144a4_180",RV="_btnPrimary_144a4_186",IV="_btnOutline_144a4_220",OV="_btnSmall_144a4_247",BV="_btnDanger_144a4_273",Me={container:dV,envHeader:uV,envTitleRow:fV,statusDot:pV,envName:mV,statusBadge:hV,envMeta:gV,metaTag:vV,actions:yV,provisionMessage:bV,errorMessage:_V,section:xV,sectionHeader:kV,cardList:SV,card:jV,cardHeader:TV,cardName:NV,cardActions:wV,cardDescription:CV,cardMeta:EV,repoLink:AV,empty:DV,errorHint:MV,btnPrimary:RV,btnOutline:IV,btnSmall:OV,btnDanger:BV};function LV(){return a.jsxs("div",{className:Me.container,"aria-hidden":"true",children:[a.jsxs("div",{className:Me.envHeader,children:[a.jsxs("div",{className:Me.envTitleRow,children:[a.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),a.jsx(Te,{width:"12rem",height:"1.5rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem"})]}),a.jsxs("div",{className:Me.envMeta,children:[a.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),a.jsxs("div",{className:Me.actions,children:[a.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),a.jsxs("div",{className:Me.section,children:[a.jsx("div",{className:Me.sectionHeader,children:a.jsx("h3",{style:{margin:0},children:"Workspaces"})}),a.jsxs("div",{className:Me.cardList,children:[a.jsx(um,{lines:2}),a.jsx(um,{lines:2})]})]})]})}const zV={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function $V(){const{environmentId:t}=ma(),s=xt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:_,clearLinkOperationError:x},sessions:{sessions:S}}=pt(),[j,T]=y.useState(!1),[N,C]=y.useState(!1),[D,A]=y.useState(void 0),E=o.find(B=>B.id===t);if(!E&&r)return a.jsx(LV,{});if(!t||!E)return a.jsx($n,{to:zo,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),$=zV[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(zo,{replace:!0})},se=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=B=>{g(B).catch(()=>{}),A(void 0)};return a.jsxs("div",{className:Me.container,children:[a.jsx(_s,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:Z,onCancel:()=>T(!1)}),a.jsx(_s,{isOpen:N,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)}),a.jsxs("div",{className:Me.envHeader,children:[a.jsxs("div",{className:Me.envTitleRow,children:[a.jsx("span",{className:Me.statusDot,style:{color:$},children:"●"}),a.jsx("h2",{className:Me.envName,children:E.displayName||E.id}),a.jsx("span",{className:Me.statusBadge,style:{color:$},children:E.status})]}),a.jsxs("div",{className:Me.envMeta,children:[a.jsxs("span",{className:Me.metaTag,children:["Adapter: ",E.adapterType]}),O.length>0&&a.jsxs("span",{className:Me.metaTag,children:[O.length," session",O.length!==1?"s":""]}),M>0&&a.jsxs("span",{className:Me.metaTag,children:["Cost: ",Rs(M)]})]})]}),a.jsxs("div",{className:Me.actions,children:[Y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Me.btnPrimary,onClick:()=>s(cx(E.id)),children:"New Chat"}),a.jsx("button",{className:Me.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),a.jsx("button",{className:Me.btnOutline,onClick:()=>C(!0),disabled:le!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),ne&&a.jsx("button",{className:Me.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),V&&le!==void 0&&a.jsx("span",{className:Me.provisionMessage,children:le.message}),E.status==="error"&&(le==null?void 0:le.stage)==="error"&&a.jsx("span",{className:Me.errorMessage,children:le.message}),a.jsx("button",{className:Me.btnOutline,onClick:()=>s(tC(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),a.jsx("button",{className:Me.btnDanger,onClick:()=>T(!0),children:"Delete"})]}),a.jsxs("div",{className:Me.section,children:[a.jsxs("div",{className:Me.sectionHeader,children:[a.jsx("h3",{children:"Workspaces"}),a.jsx("button",{className:Me.btnPrimary,onClick:()=>s(`${px}?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:a.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:[a.jsx("option",{value:"",children:"+ Link Workspace"}),B.map(F=>a.jsx("option",{value:F.id,children:F.name},F.id))]})})()]}),_&&a.jsxs("p",{className:Me.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,a.jsx("button",{className:Me.btnSmall,onClick:x,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),R.length===0&&a.jsx("p",{className:Me.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),a.jsx("div",{className:Me.cardList,"data-testid":"linked-workspaces-list",children:R.map(B=>a.jsx(HV,{workspace:B,confirmArchiveId:D,onOpen:()=>s(wi(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 HV({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 a.jsxs("div",{className:Me.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[a.jsxs("div",{className:Me.cardHeader,children:[a.jsx("strong",{className:Me.cardName,children:t.name}),a.jsxs("div",{className:Me.cardActions,children:[a.jsx("button",{className:Me.btnSmall,onClick:o,children:"Open"}),a.jsx("button",{className:Me.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),p?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Me.btnDanger,onClick:c,children:"Confirm"}),a.jsx("button",{className:Me.btnSmall,onClick:d,children:"Cancel"})]}):a.jsx("button",{className:Me.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&a.jsx("p",{className:Me.cardDescription,children:t.description}),t.repoUrl&&a.jsx("div",{className:Me.cardMeta,children:m?a.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Me.repoLink,children:t.repoUrl}):a.jsx("span",{children:t.repoUrl})})]})}const PV={credentials:"Credentials","github-accounts":"GitHub Accounts",personas:"Personas",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function UV(){const s=Wt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=PV[s],r=jH(o);return a.jsxs("div",{className:sl.layout,children:[a.jsx(ha,{segments:r}),a.jsx("div",{className:sl.content,children:a.jsx("div",{className:sl.tabPanel,children:a.jsx(Mi,{})},s)})]})}function VV(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=pt(),{showToast:d}=pn();return a.jsxs(a.Fragment,{children:[a.jsx($8,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),a.jsx(VB,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function qV(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=pt(),{showToast:u}=pn();return a.jsx(l8,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}function GV(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=pt(),{showToast:c}=pn(),d=xt();return a.jsx(X8,{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(sC),onNavigateToPersona:u=>d(dx(u))})}const FV="_container_1ooin_1",KV="_form_1ooin_7",ZV="_formActions_1ooin_75",YV="_editableSection_1ooin_82",JV="_defaultBadge_1ooin_93",WV="_typeToggle_1ooin_107",XV="_scriptEditor_1ooin_121",QV="_optional_1ooin_128",vs={container:FV,form:KV,formActions:ZV,editableSection:YV,defaultBadge:JV,typeToggle:WV,scriptEditor:XV,optional:QV},T_=[{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)"}],N_=[{value:"genaiscript",label:"genaiscript"}],eq="0";function w_(){const{personaId:t}=ma(),s=xt(),{showToast:o}=pn(),{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 a.jsx($n,{to:np,replace:!0});const b=[{label:"Settings",url:ji},{label:"Personas",url:np},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return a.jsxs("div",{className:vs.container,children:[a.jsx(ha,{segments:b}),a.jsx(tq,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(np)},showToast:o})]})}function tq({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=xt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,x]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[T,N]=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),x(t.description),j(t.systemPrompt);const ue=t.type==="script"?"script":"agent";N(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"?N("genaiscript"):T==="genaiscript"&&N("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(dx(Re.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},bt=()=>{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,an=ue==="script"?String(Re):M;lt(()=>c(t.id,ue==="name"?String(Re):v,ue==="description"?String(Re):_,et,nt,re,ve,Q,an),()=>{if(ue==="type"){const ks=String(Re)==="script"?"script":"agent";O(ks),N(nt)}ue==="runtime"&&N(String(Re)),ue==="name"&&b(String(Re)),ue==="description"&&x(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 a.jsxs(a.Fragment,{children:[ge?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsx("p",{children:"Loading persona..."})]}):s?a.jsxs("form",{onSubmit:ke,className:vs.form,children:[a.jsx("h3",{children:"Create Persona"}),a.jsxs("div",{className:vs.typeToggle,"data-testid":"persona-type-toggle",children:[a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:R==="agent",onChange:()=>F("agent")}),"Agent"]}),a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"script",checked:R==="script",onChange:()=>F("script")}),"Script"]})]}),a.jsxs("label",{children:["Name",a.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"})]}),a.jsxs("label",{children:["Description",a.jsx("input",{type:"text",value:_,onChange:ue=>x(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Runtime",a.jsx("select",{value:T,onChange:ue=>N(ue.target.value),"data-testid":"persona-runtime-select",children:(R==="script"?N_:T_).map(ue=>a.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),R==="agent"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model",a.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx("input",{type:"number",value:A,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.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"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model ",a.jsx("span",{className:vs.optional,children:"(optional)"}),a.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"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),a.jsxs("label",{children:["Script",a.jsx("textarea",{value: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:vs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),R==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(o_,{selectedTools:Y,onChange:V})]}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),xe&&a.jsx(sn,{type:"button",variant:"ghost",size:"md",onClick:ct,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&a.jsx("span",{className:vs.defaultBadge,children:"App Default"}),a.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>le(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:vs.editableSection,children:[a.jsxs("label",{children:["Name",a.jsx(zt,{value:v,onSave:ue=>{Pe("name",ue)},validate:ue=>Me(ue,"Name"),fieldId:"persona-name",activeFieldId:Z,onActivate:se,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),a.jsxs("label",{children:["Description",a.jsx(zt,{value:_,onSave:ue=>{Pe("description",ue)},fieldId:"persona-description",activeFieldId:Z,onActivate:se,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Type",a.jsx(_d,{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"})]}),a.jsxs("label",{children:["Runtime",a.jsx(_d,{value:T,onSave:ue=>{Pe("runtime",ue)},options:R==="script"?T_:j_,fieldId:"persona-runtime",activeFieldId:Z,onActivate:se,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),a.jsxs("label",{children:["Model",R==="script"?" (optional)":"",a.jsx(zt,{value:C,onSave:ue=>{Pe("model",ue)},validate:R==="agent"?ue=>Me(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"})]}),a.jsxs("label",{children:["Max Turns",a.jsx(zt,{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:KV,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx(fm,{value:S,onSave:ue=>{Pe("systemPrompt",ue)},validate:ue=>Me(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"&&a.jsxs("label",{children:["Script",a.jsx(fm,{value:D,onSave:ue=>{Pe("script",ue)},validate:ue=>Me(ue,"Script"),fieldId:"persona-script",activeFieldId:Z,onActivate:se,placeholder:`script({ model: "openai:gpt-4o" });
748
+ $\`Summarize the current tasks.\`;`,rows:20,className:vs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),R==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(o_,{selectedTools:Y,onChange:V})]}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),xe&&a.jsx(sn,{type:"button",variant:"ghost",size:"md",onClick:ct,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&a.jsx("span",{className:vs.defaultBadge,children:"App Default"}),a.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>le(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:vs.editableSection,children:[a.jsxs("label",{children:["Name",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Description",a.jsx(zt,{value:_,onSave:ue=>{Pe("description",ue)},fieldId:"persona-description",activeFieldId:Z,onActivate:se,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Type",a.jsx(_d,{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"})]}),a.jsxs("label",{children:["Runtime",a.jsx(_d,{value:T,onSave:ue=>{Pe("runtime",ue)},options:R==="script"?N_:T_,fieldId:"persona-runtime",activeFieldId:Z,onActivate:se,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),a.jsxs("label",{children:["Model",R==="script"?" (optional)":"",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Max Turns",a.jsx(zt,{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:eq,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx(fm,{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"&&a.jsxs("label",{children:["Script",a.jsx(fm,{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"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(o_,{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&&a.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,a.jsx(_s,{isOpen:ne,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:bt,onCancel:()=>le(!1)})]})}function YV(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=pt(),{showToast:c}=pn(),d=xt();return a.jsx(j7,{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(tC),onNavigateToSchedule:u=>d(dx(u))})}const JV="_container_1g4qh_1",WV="_form_1g4qh_7",XV="_formActions_1g4qh_66",QV="_editableSection_1g4qh_73",eq="_helperText_1g4qh_84",tq="_metaSection_1g4qh_90",nq="_optional_1g4qh_108",sq="_readonlyValue_1g4qh_113",Ln={container:JV,form:WV,formActions:XV,editableSection:QV,helperText:eq,metaSection:tq,optional:nq,readonlyValue:sq};function N_(){const{scheduleId:t}=ma(),s=xt(),{showToast:o}=pn(),{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 a.jsx($n,{to:sp,replace:!0});const _=[{label:"Settings",url:ji},{label:"Schedules",url:sp},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return a.jsxs("div",{className:Ln.container,children:[a.jsx(ha,{segments:_}),a.jsx(aq,{existing:b,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(sp)},showToast:o})]})}function aq({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var H;const g=xt(),[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,M]=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),M(t.workspaceId))},[s,t,R]);const D=!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(dx(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 a.jsxs(a.Fragment,{children:[D?a.jsxs("div",{className:Ln.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsx("p",{children:"Loading schedule..."})]}):s?a.jsxs("form",{onSubmit:ne,className:Ln.form,children:[a.jsx("h3",{children:"Create Schedule"}),a.jsxs("label",{children:["Title",a.jsx("input",{type:"text",value:v,onChange:B=>b(B.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description ",a.jsx("span",{className:Ln.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:_,onChange:B=>k(B.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.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"}),a.jsxs("p",{className:Ln.helperText,children:["Interval: ",a.jsx("code",{children:"30s"}),", ",a.jsx("code",{children:"5m"}),", ",a.jsx("code",{children:"1h"}),", ",a.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",a.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),a.jsxs("label",{children:["Persona",a.jsxs("select",{value:T,onChange:B=>w(B.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[a.jsx("option",{value:"",children:"Select a persona..."}),Y.map(B=>a.jsx("option",{value:B.value,children:B.label},B.value))]})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Ln.optional,children:"(optional)"}),a.jsx("select",{value:C,onChange:B=>M(B.target.value),"data-testid":"schedule-detail-workspace",children:V.map(B=>a.jsx("option",{value:B.value,children:B.label},B.value))})]}),a.jsxs("div",{className:Ln.formActions,children:[a.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:Ln.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsxs("div",{className:Ln.formActions,children:[a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),a.jsx(sn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),a.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:Ln.editableSection,children:[a.jsxs("label",{children:["Title",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Description",a.jsx(zt,{value:_,onSave:B=>{le("description",B)},fieldId:"schedule-description",activeFieldId:R,onActivate:O,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Persona",a.jsx(_d,{value:T,onSave:B=>{le("personaId",B)},options:Y,fieldId:"schedule-persona",activeFieldId:R,onActivate:O,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Ln.optional,children:"(optional — set at creation)"}),a.jsx("span",{className:Ln.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(B=>B.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),a.jsxs("div",{className:Ln.metaSection,children:[t.lastRunAt?a.jsxs("span",{children:["Last run: ",mm(t.lastRunAt)]}):a.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?a.jsxs("span",{children:["Next run: ",ok(t.nextRunAt)]}):null,t.runCount>0&&a.jsxs("span",{children:["Total runs: ",t.runCount]}),a.jsxs("span",{children:["Created: ",mm(t.createdAt)]})]})]}):null,a.jsx(_s,{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 iq(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=yh();return a.jsx(PB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function oq(){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 rq(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=pt(),r=oq();return a.jsxs(a.Fragment,{children:[r&&a.jsx(XO,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),a.jsx(qB,{connectionStatus:t,environments:s,sessions:o})]})}function lq(){return a.jsx(I8,{})}function cq(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=pt();return a.jsx(a8,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const C_=Ri();function dq(){const t=xt();return Za({key:"?"},()=>{t(nC)}),Za({key:"n"},()=>{t(C_)}),Za({key:"N"},()=>{t(C_)}),a.jsx(a.Fragment,{})}function zd(t){const s=fH();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function uq(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=pt(),o=y.useMemo(()=>a.jsx(CO,{workspaces:t,tasks:s}),[t,s]);return zd(o),a.jsx(Di,{})}function fq(){const{environments:{environments:t}}=pt(),s=y.useMemo(()=>a.jsx(YI,{environments:t}),[t]);return zd(s),a.jsx(Di,{})}function pq(){const t=y.useMemo(()=>a.jsx(E7,{}),[]);return zd(t),a.jsx(Di,{})}function mq(){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(()=>a.jsx(aI,{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 zd(u),a.jsx(Di,{})}const hq="_wizard_1260s_1",gq="_container_1260s_10",vq="_stepContent_1260s_19",yq="_logoArea_1260s_28",bq="_logoImage_1260s_32",_q="_heading_1260s_41",xq="_tagline_1260s_49",kq="_subtitle_1260s_56",Sq="_featureList_1260s_64",jq="_runtimeGrid_1260s_89",Tq="_runtimeCard_1260s_101",wq="_runtimeName_1260s_133",Nq="_runtimeDescription_1260s_139",Cq="_buttonRow_1260s_144",Eq="_primaryButton_1260s_151",Aq="_ghostButton_1260s_185",Mq="_dots_1260s_213",Dq="_dot_1260s_213",Xe={wizard:hq,container:gq,stepContent:vq,logoArea:yq,logoImage:bq,heading:_q,tagline:xq,subtitle:kq,featureList:Sq,runtimeGrid:jq,runtimeCard:Tq,runtimeName:wq,runtimeDescription:Nq,buttonRow:Cq,primaryButton:Eq,ghostButton:Aq,dots:Mq,dot:Dq};function Rq({onNext:t}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-welcome",children:[a.jsx("div",{className:Xe.logoArea,children:a.jsx("img",{src:Od("grackle-logo.png"),alt:"Grackle",className:Xe.logoImage})}),a.jsx("h1",{className:Xe.heading,children:"Welcome to Grackle"}),a.jsx("p",{className:Xe.tagline,children:"Multi-agent orchestration for software teams"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function Iq({onNext:t,onBack:s}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-about",children:[a.jsx("h2",{className:Xe.heading,children:"What is Grackle?"}),a.jsxs("ul",{className:Xe.featureList,children:[a.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),a.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),a.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),a.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),a.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const Oq=[{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 Bq({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-runtime",children:[a.jsx("h2",{className:Xe.heading,children:"Choose Your Runtime"}),a.jsx("p",{className:Xe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),a.jsx("div",{className:Xe.runtimeGrid,children:Oq.map(u=>a.jsxs("button",{type:"button",className:Xe.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[a.jsx("span",{className:Xe.runtimeName,children:u.name}),a.jsx("span",{className:Xe.runtimeDescription,children:u.description})]},u.id))}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:o,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function Lq(){return typeof Notification<"u"}function zq({onFinish:t,onBack:s,finishDisabled:o}){const r=Lq(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-notifications",children:[a.jsx("h2",{className:Xe.heading,children:"Stay in the Loop"}),a.jsx("p",{className:Xe.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?a.jsx("p",{className:Xe.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const $q=4,E_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function Hq(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=pt(),{showToast:c}=pn(),d=xt(),[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=E_[j]??"sonnet";T.push(s(_.id,void 0,void 0,void 0,j,C))}const w=t.find(C=>C.id===py);if(w&&j!==w.runtime){const C=E_[j]??"sonnet";T.push(s(py,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?a.jsx($n,{to:"/",replace:!0}):a.jsx("div",{className:Xe.wizard,"data-testid":"setup-wizard",children:a.jsxs("div",{className:Xe.container,children:[a.jsx(os,{mode:"wait",children:a.jsxs(Pt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&a.jsx(Rq,{onNext:()=>p(1)}),u===1&&a.jsx(Iq,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&a.jsx(Bq,{currentRuntime:m,onFinish:k,onBack:()=>p(1),finishDisabled:!_}),u===3&&a.jsx(zq,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),a.jsx("div",{className:Xe.dots,children:Array.from({length:$q},(j,T)=>a.jsx("span",{className:Xe.dot,"data-active":T===u},T))})]})})}const Pq="_root_zndgp_1",Uq="_body_zndgp_7",Vq="_main_zndgp_19",qq="_sidebarWrapper_zndgp_26",Gq="_overlay_zndgp_51",Wr={root:Pq,body:Uq,main:Vq,sidebarWrapper:qq,overlay:Gq},Fq=y.lazy(()=>$_(()=>import("./KnowledgePage-C7xIczVk.js"),__vite__mapDeps([3,1,2,4,5])).then(t=>({default:t.KnowledgePage}))),wk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function Kq({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=pt(),{toasts:d,dismissToast:u}=pn(),p=Wt(),m=uH(),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]),a.jsxs(a.Fragment,{children:[a.jsx(vI,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?_:void 0,sidebarOpen:v}),a.jsx(TI,{tabs:t}),a.jsxs("div",{className:Wr.body,children:[g&&a.jsx("div",{className:Wr.sidebarWrapper,"data-sidebar-open":v,children:a.jsx(MI,{content:m})}),g&&v&&a.jsx("div",{className:Wr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),a.jsxs("div",{className:Wr.main,children:[a.jsx(Di,{}),a.jsx($I,{sessions:r,tasks:c,environments:o})]})]}),a.jsx(PO,{toasts:d,onDismiss:u}),a.jsx(dq,{})]})}function Zq(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=pt(),{pluginNames:p}=Ld(),{showToast:m}=pn();x9(s,m),w9(c,m),k9(o,r,m);const g=xt(),v=Wt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Dm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return a.jsx($n,{to:"/setup",replace:!0});const b=GH(p);return a.jsx(dH,{children:a.jsxs("div",{className:Wr.root,children:[wk&&a.jsx(MC,{}),a.jsx(Kq,{tabs:b})]})})}function Pp(){const{workspaceId:t}=ma(),{workspaces:{workspaces:s}}=pt(),o=Wt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:a.jsx($n,{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 a.jsx($n,{to:m,replace:!0})}function Yq(){const{pluginNames:t}=Ld(),s=t.includes("orchestration"),o=t.includes("knowledge");return a.jsxs(gN,{children:[a.jsx(Ee,{path:"setup",element:a.jsx(Hq,{})}),a.jsxs(Ee,{element:a.jsx(Zq,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx(dU,{})}),a.jsx(Ee,{path:"sessions/new",element:a.jsx(AU,{})}),a.jsx(Ee,{path:"chat",element:a.jsx(_U,{})}),a.jsx(Ee,{path:"chat/:streamId",element:a.jsx($n,{to:"/coordination",replace:!0})}),a.jsx(Ee,{path:"coordination",element:a.jsx(EU,{})}),a.jsx(Ee,{path:"sessions/:sessionId",element:a.jsx(IU,{})}),o&&a.jsx(Ee,{element:a.jsx(mq,{}),children:a.jsx(Ee,{path:"knowledge",element:a.jsx(y.Suspense,{fallback:a.jsx(F1,{}),children:a.jsx(Fq,{})})})}),s&&a.jsxs(Ee,{element:a.jsx(uq,{}),children:[a.jsx(Ee,{path:"tasks",element:a.jsx(lU,{})}),a.jsx(Ee,{path:"tasks/new",element:a.jsx(S_,{})}),a.jsx(Ee,{path:"tasks/:taskId",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"tasks/:taskId/edit",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"tasks/:taskId/stream",element:a.jsx(Eo,{})})]}),a.jsxs(Ee,{element:a.jsx(fq,{}),children:[a.jsx(Ee,{path:"workspaces",element:a.jsx($n,{to:"/environments",replace:!0})}),a.jsx(Ee,{path:"workspaces/new",element:a.jsx(YU,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId",element:a.jsx(zU,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:a.jsx(S_,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:a.jsx(Eo,{})}),a.jsxs(Ee,{path:"environments",element:a.jsx(nV,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx(cU,{})}),a.jsx(Ee,{path:"new",element:a.jsx(WU,{})}),a.jsx(Ee,{path:":environmentId",element:a.jsx(DV,{})}),a.jsx(Ee,{path:":environmentId/edit",element:a.jsx(XU,{})})]})]}),a.jsx(Ee,{element:a.jsx(pq,{}),children:a.jsxs(Ee,{path:"settings",element:a.jsx(OV,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx($n,{to:"credentials",replace:!0})}),a.jsx(Ee,{path:"environments",element:a.jsx($n,{to:"/environments",replace:!0})}),a.jsx(Ee,{path:"credentials",element:a.jsx(BV,{})}),a.jsx(Ee,{path:"github-accounts",element:a.jsx(LV,{})}),a.jsx(Ee,{path:"tokens",element:a.jsx($n,{to:"../credentials",replace:!0})}),a.jsx(Ee,{path:"personas",element:a.jsx(zV,{})}),a.jsx(Ee,{path:"personas/new",element:a.jsx(w_,{})}),a.jsx(Ee,{path:"personas/:personaId",element:a.jsx(w_,{})}),a.jsx(Ee,{path:"schedules",element:a.jsx(YV,{})}),a.jsx(Ee,{path:"schedules/new",element:a.jsx(N_,{})}),a.jsx(Ee,{path:"schedules/:scheduleId",element:a.jsx(N_,{})}),a.jsx(Ee,{path:"appearance",element:a.jsx(iq,{})}),a.jsx(Ee,{path:"shortcuts",element:a.jsx(lq,{})}),a.jsx(Ee,{path:"plugins",element:a.jsx(cq,{})}),a.jsx(Ee,{path:"about",element:a.jsx(rq,{})})]})}),a.jsx(Ee,{path:"*",element:a.jsx($n,{to:"/",replace:!0})})]})]})}const Jq=1e4;function Wq(){const{onboardingCompleted:t}=pt(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),Jq);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return a.jsx(os,{mode:"wait",children:r?a.jsx(Pt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:a.jsx(F1,{})},"splash"):a.jsx(Pt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:a.jsx(PN,{basename:"/".replace(/\/$/,""),children:a.jsx(Yq,{})})},"app")})}function Xq(){const t=wk?zH:_9;return a.jsx(PH,{children:a.jsx(cH,{children:a.jsx(iH,{children:a.jsx(t,{children:a.jsx(Wq,{})})})})})}lj.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(Xq,{})}));export{ha as B,px as K,pt as a,Dm as s,ls as t,xt as u};
755
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),R==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(o_,{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&&a.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,a.jsx(_s,{isOpen:ne,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:bt,onCancel:()=>le(!1)})]})}function nq(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=pt(),{showToast:c}=pn(),d=xt();return a.jsx(w7,{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(aC),onNavigateToSchedule:u=>d(ux(u))})}const sq="_container_1g4qh_1",aq="_form_1g4qh_7",iq="_formActions_1g4qh_66",oq="_editableSection_1g4qh_73",rq="_helperText_1g4qh_84",lq="_metaSection_1g4qh_90",cq="_optional_1g4qh_108",dq="_readonlyValue_1g4qh_113",Ln={container:sq,form:aq,formActions:iq,editableSection:oq,helperText:rq,metaSection:lq,optional:cq,readonlyValue:dq};function C_(){const{scheduleId:t}=ma(),s=xt(),{showToast:o}=pn(),{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(x=>x.id===t);if(!v&&!c&&r.length>0&&!b)return a.jsx($n,{to:sp,replace:!0});const _=[{label:"Settings",url:ji},{label:"Schedules",url:sp},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return a.jsxs("div",{className:Ln.container,children:[a.jsx(ha,{segments:_}),a.jsx(uq,{existing:b,isNew:v,personas:m,workspaces:g,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:p,onDone:()=>{s(sp)},showToast:o})]})}function uq({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:p,showToast:m}){var H;const g=xt(),[v,b]=y.useState((t==null?void 0:t.title)??""),[_,x]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[T,N]=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),x(t.description),j(t.scheduleExpression),N(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(ux(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"&&x(String(F)),B==="scheduleExpression"&&j(String(F)),B==="personaId"&&N(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 a.jsxs(a.Fragment,{children:[M?a.jsxs("div",{className:Ln.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsx("p",{children:"Loading schedule..."})]}):s?a.jsxs("form",{onSubmit:ne,className:Ln.form,children:[a.jsx("h3",{children:"Create Schedule"}),a.jsxs("label",{children:["Title",a.jsx("input",{type:"text",value:v,onChange:B=>b(B.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description ",a.jsx("span",{className:Ln.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:_,onChange:B=>x(B.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.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"}),a.jsxs("p",{className:Ln.helperText,children:["Interval: ",a.jsx("code",{children:"30s"}),", ",a.jsx("code",{children:"5m"}),", ",a.jsx("code",{children:"1h"}),", ",a.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",a.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),a.jsxs("label",{children:["Persona",a.jsxs("select",{value:T,onChange:B=>N(B.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[a.jsx("option",{value:"",children:"Select a persona..."}),Y.map(B=>a.jsx("option",{value:B.value,children:B.label},B.value))]})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Ln.optional,children:"(optional)"}),a.jsx("select",{value:C,onChange:B=>D(B.target.value),"data-testid":"schedule-detail-workspace",children:V.map(B=>a.jsx("option",{value:B.value,children:B.label},B.value))})]}),a.jsxs("div",{className:Ln.formActions,children:[a.jsx(sn,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:Ln.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsxs("div",{className:Ln.formActions,children:[a.jsx(sn,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),a.jsx(sn,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:Z,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),a.jsx(sn,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:Ln.editableSection,children:[a.jsxs("label",{children:["Title",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Description",a.jsx(zt,{value:_,onSave:B=>{le("description",B)},fieldId:"schedule-description",activeFieldId:R,onActivate:O,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx(zt,{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"})]}),a.jsxs("label",{children:["Persona",a.jsx(_d,{value:T,onSave:B=>{le("personaId",B)},options:Y,fieldId:"schedule-persona",activeFieldId:R,onActivate:O,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Ln.optional,children:"(optional — set at creation)"}),a.jsx("span",{className:Ln.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(B=>B.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),a.jsxs("div",{className:Ln.metaSection,children:[t.lastRunAt?a.jsxs("span",{children:["Last run: ",mm(t.lastRunAt)]}):a.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?a.jsxs("span",{children:["Next run: ",rk(t.nextRunAt)]}):null,t.runCount>0&&a.jsxs("span",{children:["Total runs: ",t.runCount]}),a.jsxs("span",{children:["Created: ",mm(t.createdAt)]})]})]}):null,a.jsx(_s,{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 fq(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=yh();return a.jsx(qB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function pq(){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 mq(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=pt(),r=pq();return a.jsxs(a.Fragment,{children:[r&&a.jsx(tB,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),a.jsx(KB,{connectionStatus:t,environments:s,sessions:o})]})}function hq(){return a.jsx(L8,{})}function gq(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=pt();return a.jsx(r8,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const E_=Ri();function vq(){const t=xt();return Za({key:"?"},()=>{t(iC)}),Za({key:"n"},()=>{t(E_)}),Za({key:"N"},()=>{t(E_)}),a.jsx(a.Fragment,{})}function zd(t){const s=bH();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function yq(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=pt(),o=y.useMemo(()=>a.jsx(DO,{workspaces:t,tasks:s}),[t,s]);return zd(o),a.jsx(Mi,{})}function bq(){const{environments:{environments:t}}=pt(),s=y.useMemo(()=>a.jsx(XI,{environments:t}),[t]);return zd(s),a.jsx(Mi,{})}function _q(){const t=y.useMemo(()=>a.jsx(M7,{}),[]);return zd(t),a.jsx(Mi,{})}function xq(){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(()=>a.jsx(rI,{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 zd(u),a.jsx(Mi,{})}const kq="_wizard_1260s_1",Sq="_container_1260s_10",jq="_stepContent_1260s_19",Tq="_logoArea_1260s_28",Nq="_logoImage_1260s_32",wq="_heading_1260s_41",Cq="_tagline_1260s_49",Eq="_subtitle_1260s_56",Aq="_featureList_1260s_64",Dq="_runtimeGrid_1260s_89",Mq="_runtimeCard_1260s_101",Rq="_runtimeName_1260s_133",Iq="_runtimeDescription_1260s_139",Oq="_buttonRow_1260s_144",Bq="_primaryButton_1260s_151",Lq="_ghostButton_1260s_185",zq="_dots_1260s_213",$q="_dot_1260s_213",Xe={wizard:kq,container:Sq,stepContent:jq,logoArea:Tq,logoImage:Nq,heading:wq,tagline:Cq,subtitle:Eq,featureList:Aq,runtimeGrid:Dq,runtimeCard:Mq,runtimeName:Rq,runtimeDescription:Iq,buttonRow:Oq,primaryButton:Bq,ghostButton:Lq,dots:zq,dot:$q};function Hq({onNext:t}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-welcome",children:[a.jsx("div",{className:Xe.logoArea,children:a.jsx("img",{src:Od("grackle-logo.png"),alt:"Grackle",className:Xe.logoImage})}),a.jsx("h1",{className:Xe.heading,children:"Welcome to Grackle"}),a.jsx("p",{className:Xe.tagline,children:"Multi-agent orchestration for software teams"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function Pq({onNext:t,onBack:s}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-about",children:[a.jsx("h2",{className:Xe.heading,children:"What is Grackle?"}),a.jsxs("ul",{className:Xe.featureList,children:[a.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),a.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),a.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),a.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),a.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const Uq=[{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 Vq({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-runtime",children:[a.jsx("h2",{className:Xe.heading,children:"Choose Your Runtime"}),a.jsx("p",{className:Xe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),a.jsx("div",{className:Xe.runtimeGrid,children:Uq.map(u=>a.jsxs("button",{type:"button",className:Xe.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[a.jsx("span",{className:Xe.runtimeName,children:u.name}),a.jsx("span",{className:Xe.runtimeDescription,children:u.description})]},u.id))}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:o,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function qq(){return typeof Notification<"u"}function Gq({onFinish:t,onBack:s,finishDisabled:o}){const r=qq(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-notifications",children:[a.jsx("h2",{className:Xe.heading,children:"Stay in the Loop"}),a.jsx("p",{className:Xe.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?a.jsx("p",{className:Xe.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const Fq=4,A_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function Kq(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=pt(),{showToast:c}=pn(),d=xt(),[u,p]=y.useState(0),[m,g]=y.useState("claude-code"),[v,b]=y.useState(!1),_=t.find(j=>j.id==="claude-code"),x=y.useCallback(j=>{g(j),p(3)},[]),S=y.useCallback(()=>{const j=m;b(!0);const T=[];if(_&&j!==_.runtime){const C=A_[j]??"sonnet";T.push(s(_.id,void 0,void 0,void 0,j,C))}const N=t.find(C=>C.id===py);if(N&&j!==N.runtime){const C=A_[j]??"sonnet";T.push(s(py,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?a.jsx($n,{to:"/",replace:!0}):a.jsx("div",{className:Xe.wizard,"data-testid":"setup-wizard",children:a.jsxs("div",{className:Xe.container,children:[a.jsx(os,{mode:"wait",children:a.jsxs(Pt.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&a.jsx(Hq,{onNext:()=>p(1)}),u===1&&a.jsx(Pq,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&a.jsx(Vq,{currentRuntime:m,onFinish:x,onBack:()=>p(1),finishDisabled:!_}),u===3&&a.jsx(Gq,{onFinish:S,onBack:()=>p(2),finishDisabled:v})]},u)}),a.jsx("div",{className:Xe.dots,children:Array.from({length:Fq},(j,T)=>a.jsx("span",{className:Xe.dot,"data-active":T===u},T))})]})})}const Zq="_root_zndgp_1",Yq="_body_zndgp_7",Jq="_main_zndgp_19",Wq="_sidebarWrapper_zndgp_26",Xq="_overlay_zndgp_51",Wr={root:Zq,body:Yq,main:Jq,sidebarWrapper:Wq,overlay:Xq},Qq=y.lazy(()=>H_(()=>import("./KnowledgePage-BnKWZKuh.js"),__vite__mapDeps([3,1,2,4,5])).then(t=>({default:t.KnowledgePage}))),wk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function eG({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=pt(),{toasts:d,dismissToast:u}=pn(),p=Wt(),m=yH(),g=m!==void 0,[v,b]=y.useState(!1),_=y.useCallback(()=>b(x=>!x),[]);return y.useEffect(()=>{b(!1)},[p.pathname]),y.useEffect(()=>{if(!v)return;const x=S=>{S.key==="Escape"&&b(!1)};return document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}},[v]),a.jsxs(a.Fragment,{children:[a.jsx(_I,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:g?_:void 0,sidebarOpen:v}),a.jsx(CI,{tabs:t}),a.jsxs("div",{className:Wr.body,children:[g&&a.jsx("div",{className:Wr.sidebarWrapper,"data-sidebar-open":v,children:a.jsx(II,{content:m})}),g&&v&&a.jsx("div",{className:Wr.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),a.jsxs("div",{className:Wr.main,children:[a.jsx(Mi,{}),a.jsx(UI,{sessions:r,tasks:c,environments:o})]})]}),a.jsx(qO,{toasts:d,onDismiss:u}),a.jsx(vq,{})]})}function tG(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=pt(),{pluginNames:p}=Ld(),{showToast:m}=pn();C9(s,m),R9(c,m),E9(o,r,m);const g=xt(),v=Wt();if(y.useEffect(()=>{t&&!v.pathname.includes("/tasks/")&&g(Mm(t),{replace:!0})},[t,g,v.pathname]),d==="connected"&&u===!1)return a.jsx($n,{to:"/setup",replace:!0});const b=XH(p);return a.jsx(vH,{children:a.jsxs("div",{className:Wr.root,children:[wk&&a.jsx(IC,{}),a.jsx(eG,{tabs:b})]})})}function Pp(){const{workspaceId:t}=ma(),{workspaces:{workspaces:s}}=pt(),o=Wt(),r=s.find(g=>g.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:a.jsx($n,{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 a.jsx($n,{to:m,replace:!0})}function nG(){const{pluginNames:t}=Ld(),s=t.includes("orchestration"),o=t.includes("knowledge");return a.jsxs(bw,{children:[a.jsx(Ee,{path:"setup",element:a.jsx(Kq,{})}),a.jsxs(Ee,{element:a.jsx(tG,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx(vU,{})}),a.jsx(Ee,{path:"sessions/new",element:a.jsx(LU,{})}),a.jsx(Ee,{path:"chat",element:a.jsx(wU,{})}),a.jsx(Ee,{path:"chat/:streamId",element:a.jsx($n,{to:"/coordination",replace:!0})}),a.jsx(Ee,{path:"coordination",element:a.jsx(BU,{})}),a.jsx(Ee,{path:"sessions/:sessionId",element:a.jsx(PU,{})}),o&&a.jsx(Ee,{element:a.jsx(xq,{}),children:a.jsx(Ee,{path:"knowledge",element:a.jsx(y.Suspense,{fallback:a.jsx(K1,{}),children:a.jsx(Qq,{})})})}),s&&a.jsxs(Ee,{element:a.jsx(yq,{}),children:[a.jsx(Ee,{path:"tasks",element:a.jsx(hU,{})}),a.jsx(Ee,{path:"tasks/new",element:a.jsx(j_,{})}),a.jsx(Ee,{path:"tasks/:taskId",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"tasks/:taskId/edit",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"tasks/:taskId/stream",element:a.jsx(Eo,{})})]}),a.jsxs(Ee,{element:a.jsx(bq,{}),children:[a.jsx(Ee,{path:"workspaces",element:a.jsx($n,{to:"/environments",replace:!0})}),a.jsx(Ee,{path:"workspaces/new",element:a.jsx(nV,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:a.jsx(Pp,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId",element:a.jsx(GU,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:a.jsx(j_,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:a.jsx(Eo,{})}),a.jsx(Ee,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:a.jsx(Eo,{})}),a.jsxs(Ee,{path:"environments",element:a.jsx(cV,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx(gU,{})}),a.jsx(Ee,{path:"new",element:a.jsx(aV,{})}),a.jsx(Ee,{path:":environmentId",element:a.jsx($V,{})}),a.jsx(Ee,{path:":environmentId/edit",element:a.jsx(iV,{})})]})]}),a.jsx(Ee,{element:a.jsx(_q,{}),children:a.jsxs(Ee,{path:"settings",element:a.jsx(UV,{}),children:[a.jsx(Ee,{index:!0,element:a.jsx($n,{to:"credentials",replace:!0})}),a.jsx(Ee,{path:"environments",element:a.jsx($n,{to:"/environments",replace:!0})}),a.jsx(Ee,{path:"credentials",element:a.jsx(VV,{})}),a.jsx(Ee,{path:"github-accounts",element:a.jsx(qV,{})}),a.jsx(Ee,{path:"tokens",element:a.jsx($n,{to:"../credentials",replace:!0})}),a.jsx(Ee,{path:"personas",element:a.jsx(GV,{})}),a.jsx(Ee,{path:"personas/new",element:a.jsx(w_,{})}),a.jsx(Ee,{path:"personas/:personaId",element:a.jsx(w_,{})}),a.jsx(Ee,{path:"schedules",element:a.jsx(nq,{})}),a.jsx(Ee,{path:"schedules/new",element:a.jsx(C_,{})}),a.jsx(Ee,{path:"schedules/:scheduleId",element:a.jsx(C_,{})}),a.jsx(Ee,{path:"appearance",element:a.jsx(fq,{})}),a.jsx(Ee,{path:"shortcuts",element:a.jsx(hq,{})}),a.jsx(Ee,{path:"plugins",element:a.jsx(gq,{})}),a.jsx(Ee,{path:"about",element:a.jsx(mq,{})})]})}),a.jsx(Ee,{path:"*",element:a.jsx($n,{to:"/",replace:!0})})]})]})}const sG=1e4;function aG(){const{onboardingCompleted:t}=pt(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),sG);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return a.jsx(os,{mode:"wait",children:r?a.jsx(Pt.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:a.jsx(K1,{})},"splash"):a.jsx(Pt.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:a.jsx(qw,{basename:"/".replace(/\/$/,""),children:a.jsx(nG,{})})},"app")})}function iG(){const t=wk?GH:w9;return a.jsx(ZH,{children:a.jsx(gH,{children:a.jsx(fH,{children:a.jsx(t,{children:a.jsx(aG,{})})})})})}uj.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(iG,{})}));export{ha as B,mx as K,pt as a,Mm as s,ls as t,xt as u};