@grackle-ai/web 0.89.4 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,695 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-P3bqvNAI.js","assets/dagview-Dv4uDOZ5.js","assets/grpc-CRztlRZY.js","assets/markdown-Bpil_wz-.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as BS,a as LS,b as _,j as r,d as Dv,H as Rv,P as Mv,i as zS,B as US,c as $S,C as PS,M as VS}from"./dagview-Dv4uDOZ5.js";import{c as HS,a as qS,G as GS,f as FS,M as ZS,A as qb,D as Gb,W as KS,O as YS,b as JS,C as Wc,d as WS,e as Fb,w as XS,t as QS,p as hc,g as eT,R as br,S as Iv}from"./grpc-CRztlRZY.js";import{v as tT,r as nT,t as gc,i as sT,f as aT,M as Xc,a as Qc}from"./markdown-Bpil_wz-.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();var kf={exports:{}},_r={},Sf={exports:{}},Tf={};/**
3
- * @license React
4
- * scheduler.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var Ov;function iT(){return Ov||(Ov=1,(function(t){function s(B,Z){var ne=B.length;B.push(Z);e:for(;0<ne;){var re=ne-1>>>1,ue=B[re];if(0<c(ue,Z))B[re]=Z,B[ne]=ue,ne=re;else break e}}function i(B){return B.length===0?null:B[0]}function o(B){if(B.length===0)return null;var Z=B[0],ne=B.pop();if(ne!==Z){B[0]=ne;e:for(var re=0,ue=B.length,Ze=ue>>>1;re<Ze;){var je=2*(re+1)-1,Te=B[je],Ie=je+1,le=B[Ie];if(0>c(Te,ne))Ie<ue&&0>c(le,Te)?(B[re]=le,B[Ie]=ne,re=Ie):(B[re]=Te,B[je]=ne,re=je);else if(Ie<ue&&0>c(le,ne))B[re]=le,B[Ie]=ne,re=Ie;else break e}}return Z}function c(B,Z){var ne=B.sortIndex-Z.sortIndex;return ne!==0?ne:B.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,p=d.now();t.unstable_now=function(){return d.now()-p}}var h=[],g=[],v=1,y=null,b=3,k=!1,S=!1,w=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function I(B){for(var Z=i(g);Z!==null;){if(Z.callback===null)o(g);else if(Z.startTime<=B)o(g),Z.sortIndex=Z.expirationTime,s(h,Z);else break;Z=i(g)}}function R(B){if(w=!1,I(B),!S)if(i(h)!==null)S=!0,D||(D=!0,ae());else{var Z=i(g);Z!==null&&ee(R,Z.startTime-B)}}var D=!1,q=-1,$=5,Y=-1;function G(){return j?!0:!(t.unstable_now()-Y<$)}function Q(){if(j=!1,D){var B=t.unstable_now();Y=B;var Z=!0;try{e:{S=!1,w&&(w=!1,C(q),q=-1),k=!0;var ne=b;try{t:{for(I(B),y=i(h);y!==null&&!(y.expirationTime>B&&G());){var re=y.callback;if(typeof re=="function"){y.callback=null,b=y.priorityLevel;var ue=re(y.expirationTime<=B);if(B=t.unstable_now(),typeof ue=="function"){y.callback=ue,I(B),Z=!0;break t}y===i(h)&&o(h),I(B)}else o(h);y=i(h)}if(y!==null)Z=!0;else{var Ze=i(g);Ze!==null&&ee(R,Ze.startTime-B),Z=!1}}break e}finally{y=null,b=ne,k=!1}Z=void 0}}finally{Z?ae():D=!1}}}var ae;if(typeof E=="function")ae=function(){E(Q)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,ie=me.port2;me.port1.onmessage=Q,ae=function(){ie.postMessage(null)}}else ae=function(){N(Q,0)};function ee(B,Z){q=N(function(){B(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(B){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ne=b;b=Z;try{return B()}finally{b=ne}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(B,Z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ne=b;b=B;try{return Z()}finally{b=ne}},t.unstable_scheduleCallback=function(B,Z,ne){var re=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?re+ne:re):ne=re,B){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=ne+ue,B={id:v++,callback:Z,priorityLevel:B,startTime:ne,expirationTime:ue,sortIndex:-1},ne>re?(B.sortIndex=ne,s(g,B),i(h)===null&&B===i(g)&&(w?(C(q),q=-1):w=!0,ee(R,ne-re))):(B.sortIndex=ue,s(h,B),S||k||(S=!0,D||(D=!0,ae()))),B},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(B){var Z=b;return function(){var ne=b;b=Z;try{return B.apply(this,arguments)}finally{b=ne}}}})(Tf)),Tf}var Bv;function oT(){return Bv||(Bv=1,Sf.exports=iT()),Sf.exports}/**
11
- * @license React
12
- * react-dom-client.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var Lv;function rT(){if(Lv)return _r;Lv=1;var t=oT(),s=BS(),i=LS();function o(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var n=e,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a:null}function d(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 h(e){if(u(e)!==e)throw Error(o(188))}function g(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(o(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return h(f),e;if(m===l)return h(f),n;m=m.sibling}throw Error(o(188))}if(a.return!==l.return)a=f,l=m;else{for(var x=!1,T=f.child;T;){if(T===a){x=!0,a=f,l=m;break}if(T===l){x=!0,l=f,a=m;break}T=T.sibling}if(!x){for(T=m.child;T;){if(T===a){x=!0,a=m,l=f;break}if(T===l){x=!0,l=m,a=f;break}T=T.sibling}if(!x)throw Error(o(189))}}if(a.alternate!==l)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function ae(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function ie(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case N:return"Profiler";case j:return"StrictMode";case R:return"Suspense";case D:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case E:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case I:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return n=e.displayName||null,n!==null?n:ie(e.type)||"Memo";case $:n=e._payload,e=e._init;try{return ie(e(n))}catch{}}return null}var ee=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ue=-1;function Ze(e){return{current:e}}function je(e){0>ue||(e.current=re[ue],re[ue]=null,ue--)}function Te(e,n){ue++,re[ue]=e.current,e.current=n}var Ie=Ze(null),le=Ze(null),ve=Ze(null),de=Ze(null);function Oe(e,n){switch(Te(ve,n),Te(le,e),Te(Ie,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?ev(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=ev(n),e=tv(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(Ie),Te(Ie,e)}function bt(){je(Ie),je(le),je(ve)}function yn(e){e.memoizedState!==null&&Te(de,e);var n=Ie.current,a=tv(n,e.type);n!==a&&(Te(le,e),Te(Ie,a))}function L(e){le.current===e&&(je(Ie),je(le)),de.current===e&&(je(de),hr._currentValue=ne)}var Me,et;function tt(e){if(Me===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Me=n&&n[1]||"",et=-1<a.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Me+e+et}var qe=!1;function ls(e,n){if(!e||qe)return"";qe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(K){var F=K}Reflect.construct(e,[],X)}else{try{X.call()}catch(K){F=K}e.call(X.prototype)}}else{try{throw Error()}catch(K){F=K}(X=e())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.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 m=l.DetermineComponentFrameRoot(),x=m[0],T=m[1];if(x&&T){var M=x.split(`
21
- `),H=T.split(`
22
- `);for(f=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;if(l===M.length||f===H.length)for(l=M.length-1,f=H.length-1;1<=l&&0<=f&&M[l]!==H[f];)f--;for(;1<=l&&0<=f;l--,f--)if(M[l]!==H[f]){if(l!==1||f!==1)do if(l--,f--,0>f||M[l]!==H[f]){var J=`
23
- `+M[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=f);break}}}finally{qe=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?tt(a):""}function Qs(e,n){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==n&&n!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return ls(e.type,!1);case 11:return ls(e.type.render,!1);case 1:return ls(e.type,!0);case 31:return tt("Activity");default:return""}}function Dn(e){try{var n="",a=null;do n+=Qs(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var Kn=Object.prototype.hasOwnProperty,cs=t.unstable_scheduleCallback,ea=t.unstable_cancelCallback,Yn=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Ce=t.unstable_now,cn=t.unstable_getCurrentPriorityLevel,bn=t.unstable_ImmediatePriority,ks=t.unstable_UserBlockingPriority,us=t.unstable_NormalPriority,ki=t.unstable_LowPriority,za=t.unstable_IdlePriority,Si=t.log,Qr=t.unstable_setDisableYieldValue,ta=null,Qt=null;function Jn(e){if(typeof Si=="function"&&Qr(e),Qt&&typeof Qt.setStrictMode=="function")try{Qt.setStrictMode(ta,e)}catch{}}var en=Math.clz32?Math.clz32:nl,el=Math.log,tl=Math.LN2;function nl(e){return e>>>=0,e===0?32:31-(el(e)/tl|0)|0}var Ua=256,$a=262144,Pa=4194304;function Ss(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 P(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,m=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var T=l&134217727;return T!==0?(l=T&~m,l!==0?f=Ss(l):(x&=T,x!==0?f=Ss(x):a||(a=T&~e,a!==0&&(f=Ss(a))))):(T=l&~m,T!==0?f=Ss(T):x!==0?f=Ss(x):a||(a=l&~e,a!==0&&(f=Ss(a)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,a=n&-n,m>=a||m===32&&(a&4194048)!==0)?n:f}function te(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function oe(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 ce(){var e=Pa;return Pa<<=1,(Pa&62914560)===0&&(Pa=4194304),e}function fe(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ze(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ye(e,n,a,l,f,m){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var T=e.entanglements,M=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-en(a),X=1<<J;T[J]=0,M[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var K=F[J];K!==null&&(K.lane&=-536870913)}a&=~X}l!==0&&Ae(e,l,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(x&~n))}function Ae(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-en(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ge(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-en(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function ct(e,n){var a=n&-n;return a=(a&42)!==0?1:Fe(a),(a&(e.suspendedLanes|n))!==0?0:a}function Fe(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 Ut(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ft(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:Tv(e.type))}function Et(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var sn=Math.random().toString(36).slice(2),ft="__reactFiber$"+sn,Vt="__reactProps$"+sn,Ti="__reactContainer$"+sn,fu="__reactEvents$"+sn,wx="__reactListeners$"+sn,Nx="__reactHandles$"+sn,Pm="__reactResources$"+sn,Ao="__reactMarker$"+sn;function pu(e){delete e[ft],delete e[Vt],delete e[fu],delete e[wx],delete e[Nx]}function wi(e){var n=e[ft];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ti]||a[ft]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=lv(e);e!==null;){if(a=e[ft])return a;e=lv(e)}return n}e=a,a=e.parentNode}return null}function Ni(e){if(e=e[ft]||e[Ti]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Do(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function ji(e){var n=e[Pm];return n||(n=e[Pm]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ht(e){e[Ao]=!0}var Vm=new Set,Hm={};function Va(e,n){Ci(e,n),Ci(e+"Capture",n)}function Ci(e,n){for(Hm[e]=n,e=0;e<n.length;e++)Vm.add(n[e])}var jx=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]*$"),qm={},Gm={};function Cx(e){return Kn.call(Gm,e)?!0:Kn.call(qm,e)?!1:jx.test(e)?Gm[e]=!0:(qm[e]=!0,!1)}function sl(e,n,a){if(Cx(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+a)}}function al(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function Ts(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function Rn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fm(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ex(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,m=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,m.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function mu(e){if(!e._valueTracker){var n=Fm(e)?"checked":"value";e._valueTracker=Ex(e,n,""+e[n])}}function Zm(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=Fm(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function il(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 Ax=/[\n"\\]/g;function Mn(e){return e.replace(Ax,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function hu(e,n,a,l,f,m,x,T){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=""+Rn(n)):e.value!==""+Rn(n)&&(e.value=""+Rn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?gu(e,x,Rn(n)):a!=null?gu(e,x,Rn(a)):l!=null&&e.removeAttribute("value"),f==null&&m!=null&&(e.defaultChecked=!!m),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.name=""+Rn(T):e.removeAttribute("name")}function Km(e,n,a,l,f,m,x,T){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),n!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){mu(e);return}a=a!=null?""+Rn(a):"",n=n!=null?""+Rn(n):a,T||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=T?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),mu(e)}function gu(e,n,a){n==="number"&&il(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ei(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+Rn(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function Ym(e,n,a){if(n!=null&&(n=""+Rn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Rn(a):""}function Jm(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(o(92));if(ee(l)){if(1<l.length)throw Error(o(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Rn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),mu(e)}function Ai(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Dx=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 Wm(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||Dx.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function Xm(e,n,a){if(n!=null&&typeof n!="object")throw Error(o(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&Wm(e,f,l)}else for(var m in n)n.hasOwnProperty(m)&&Wm(e,m,n[m])}function vu(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 Rx=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"]]),Mx=/^[\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 ol(e){return Mx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ws(){}var yu=null;function bu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Di=null,Ri=null;function Qm(e){var n=Ni(e);if(n&&(e=n.stateNode)){var a=e[Vt]||null;e:switch(e=n.stateNode,n.type){case"input":if(hu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Mn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[Vt]||null;if(!f)throw Error(o(90));hu(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===e.form&&Zm(l)}break e;case"textarea":Ym(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ei(e,!!a.multiple,n,!1)}}}var _u=!1;function eh(e,n,a){if(_u)return e(n,a);_u=!0;try{var l=e(n);return l}finally{if(_u=!1,(Di!==null||Ri!==null)&&(Zl(),Di&&(n=Di,e=Ri,Ri=Di=null,Qm(n),e)))for(n=0;n<e.length;n++)Qm(e[n])}}function Ro(e,n){var a=e.stateNode;if(a===null)return null;var l=a[Vt]||null;if(l===null)return null;a=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(o(231,n,typeof a));return a}var Ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xu=!1;if(Ns)try{var Mo={};Object.defineProperty(Mo,"passive",{get:function(){xu=!0}}),window.addEventListener("test",Mo,Mo),window.removeEventListener("test",Mo,Mo)}catch{xu=!1}var na=null,ku=null,rl=null;function th(){if(rl)return rl;var e,n=ku,a=n.length,l,f="value"in na?na.value:na.textContent,m=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[m-l];l++);return rl=f.slice(e,1<l?1-l:void 0)}function ll(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 cl(){return!0}function nh(){return!1}function un(e){function n(a,l,f,m,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=x,this.currentTarget=null;for(var T in e)e.hasOwnProperty(T)&&(a=e[T],this[T]=a?a(m):m[T]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?cl:nh,this.isPropagationStopped=nh,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=cl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=cl)},persist:function(){},isPersistent:cl}),n}var Ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ul=un(Ha),Io=y({},Ha,{view:0,detail:0}),Ix=un(Io),Su,Tu,Oo,dl=y({},Io,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nu,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!==Oo&&(Oo&&e.type==="mousemove"?(Su=e.screenX-Oo.screenX,Tu=e.screenY-Oo.screenY):Tu=Su=0,Oo=e),Su)},movementY:function(e){return"movementY"in e?e.movementY:Tu}}),sh=un(dl),Ox=y({},dl,{dataTransfer:0}),Bx=un(Ox),Lx=y({},Io,{relatedTarget:0}),wu=un(Lx),zx=y({},Ha,{animationName:0,elapsedTime:0,pseudoElement:0}),Ux=un(zx),$x=y({},Ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Px=un($x),Vx=y({},Ha,{data:0}),ah=un(Vx),Hx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qx={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"},Gx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Fx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Gx[e])?!!n[e]:!1}function Nu(){return Fx}var Zx=y({},Io,{key:function(e){if(e.key){var n=Hx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ll(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nu,charCode:function(e){return e.type==="keypress"?ll(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ll(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Kx=un(Zx),Yx=y({},dl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ih=un(Yx),Jx=y({},Io,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nu}),Wx=un(Jx),Xx=y({},Ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qx=un(Xx),ek=y({},dl,{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}),tk=un(ek),nk=y({},Ha,{newState:0,oldState:0}),sk=un(nk),ak=[9,13,27,32],ju=Ns&&"CompositionEvent"in window,Bo=null;Ns&&"documentMode"in document&&(Bo=document.documentMode);var ik=Ns&&"TextEvent"in window&&!Bo,oh=Ns&&(!ju||Bo&&8<Bo&&11>=Bo),rh=" ",lh=!1;function ch(e,n){switch(e){case"keyup":return ak.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Mi=!1;function ok(e,n){switch(e){case"compositionend":return uh(n);case"keypress":return n.which!==32?null:(lh=!0,rh);case"textInput":return e=n.data,e===rh&&lh?null:e;default:return null}}function rk(e,n){if(Mi)return e==="compositionend"||!ju&&ch(e,n)?(e=th(),rl=ku=na=null,Mi=!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 oh&&n.locale!=="ko"?null:n.data;default:return null}}var lk={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 dh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!lk[e.type]:n==="textarea"}function fh(e,n,a,l){Di?Ri?Ri.push(l):Ri=[l]:Di=l,n=ec(n,"onChange"),0<n.length&&(a=new ul("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Lo=null,zo=null;function ck(e){K0(e,0)}function fl(e){var n=Do(e);if(Zm(n))return e}function ph(e,n){if(e==="change")return n}var mh=!1;if(Ns){var Cu;if(Ns){var Eu="oninput"in document;if(!Eu){var hh=document.createElement("div");hh.setAttribute("oninput","return;"),Eu=typeof hh.oninput=="function"}Cu=Eu}else Cu=!1;mh=Cu&&(!document.documentMode||9<document.documentMode)}function gh(){Lo&&(Lo.detachEvent("onpropertychange",vh),zo=Lo=null)}function vh(e){if(e.propertyName==="value"&&fl(zo)){var n=[];fh(n,zo,e,bu(e)),eh(ck,n)}}function uk(e,n,a){e==="focusin"?(gh(),Lo=n,zo=a,Lo.attachEvent("onpropertychange",vh)):e==="focusout"&&gh()}function dk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fl(zo)}function fk(e,n){if(e==="click")return fl(n)}function pk(e,n){if(e==="input"||e==="change")return fl(n)}function mk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var _n=typeof Object.is=="function"?Object.is:mk;function Uo(e,n){if(_n(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!Kn.call(n,f)||!_n(e[f],n[f]))return!1}return!0}function yh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function bh(e,n){var a=yh(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=yh(a)}}function _h(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?_h(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function xh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=il(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=il(e.document)}return n}function Au(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 hk=Ns&&"documentMode"in document&&11>=document.documentMode,Ii=null,Du=null,$o=null,Ru=!1;function kh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ru||Ii==null||Ii!==il(l)||(l=Ii,"selectionStart"in l&&Au(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}),$o&&Uo($o,l)||($o=l,l=ec(Du,"onSelect"),0<l.length&&(n=new ul("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ii)))}function qa(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Oi={animationend:qa("Animation","AnimationEnd"),animationiteration:qa("Animation","AnimationIteration"),animationstart:qa("Animation","AnimationStart"),transitionrun:qa("Transition","TransitionRun"),transitionstart:qa("Transition","TransitionStart"),transitioncancel:qa("Transition","TransitionCancel"),transitionend:qa("Transition","TransitionEnd")},Mu={},Sh={};Ns&&(Sh=document.createElement("div").style,"AnimationEvent"in window||(delete Oi.animationend.animation,delete Oi.animationiteration.animation,delete Oi.animationstart.animation),"TransitionEvent"in window||delete Oi.transitionend.transition);function Ga(e){if(Mu[e])return Mu[e];if(!Oi[e])return e;var n=Oi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Sh)return Mu[e]=n[a];return e}var Th=Ga("animationend"),wh=Ga("animationiteration"),Nh=Ga("animationstart"),gk=Ga("transitionrun"),vk=Ga("transitionstart"),yk=Ga("transitioncancel"),jh=Ga("transitionend"),Ch=new Map,Iu="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(" ");Iu.push("scrollEnd");function Wn(e,n){Ch.set(e,n),Va(n,[e])}var pl=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)},In=[],Bi=0,Ou=0;function ml(){for(var e=Bi,n=Ou=Bi=0;n<e;){var a=In[n];In[n++]=null;var l=In[n];In[n++]=null;var f=In[n];In[n++]=null;var m=In[n];if(In[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}m!==0&&Eh(a,f,m)}}function hl(e,n,a,l){In[Bi++]=e,In[Bi++]=n,In[Bi++]=a,In[Bi++]=l,Ou|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Bu(e,n,a,l){return hl(e,n,a,l),gl(e)}function Fa(e,n){return hl(e,null,null,n),gl(e)}function Eh(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=e.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(f=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,f&&n!==null&&(f=31-en(a),e=m.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),m):null}function gl(e){if(50<lr)throw lr=0,Gd=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Li={};function bk(e,n,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xn(e,n,a,l){return new bk(e,n,a,l)}function Lu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function js(e,n){var a=e.alternate;return a===null?(a=xn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Ah(e,n){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function vl(e,n,a,l,f,m){var x=0;if(l=e,typeof e=="function")Lu(e)&&(x=1);else if(typeof e=="string")x=TS(e,a,Ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=xn(31,a,n,f),e.elementType=Y,e.lanes=m,e;case w:return Za(a.children,f,m,n);case j:x=8,f|=24;break;case N:return e=xn(12,a,n,f|2),e.elementType=N,e.lanes=m,e;case R:return e=xn(13,a,n,f),e.elementType=R,e.lanes=m,e;case D:return e=xn(19,a,n,f),e.elementType=D,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:x=10;break e;case C:x=9;break e;case I:x=11;break e;case q:x=14;break e;case $:x=16,l=null;break e}x=29,a=Error(o(130,e===null?"null":typeof e,"")),l=null}return n=xn(x,a,n,f),n.elementType=e,n.type=l,n.lanes=m,n}function Za(e,n,a,l){return e=xn(7,e,l,n),e.lanes=a,e}function zu(e,n,a){return e=xn(6,e,null,n),e.lanes=a,e}function Dh(e){var n=xn(18,null,null,0);return n.stateNode=e,n}function Uu(e,n,a){return n=xn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Rh=new WeakMap;function On(e,n){if(typeof e=="object"&&e!==null){var a=Rh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:Dn(n)},Rh.set(e,n),n)}return{value:e,source:n,stack:Dn(n)}}var zi=[],Ui=0,yl=null,Po=0,Bn=[],Ln=0,sa=null,ds=1,fs="";function Cs(e,n){zi[Ui++]=Po,zi[Ui++]=yl,yl=e,Po=n}function Mh(e,n,a){Bn[Ln++]=ds,Bn[Ln++]=fs,Bn[Ln++]=sa,sa=e;var l=ds;e=fs;var f=32-en(l)-1;l&=~(1<<f),a+=1;var m=32-en(n)+f;if(30<m){var x=f-f%5;m=(l&(1<<x)-1).toString(32),l>>=x,f-=x,ds=1<<32-en(n)+f|a<<f|l,fs=m+e}else ds=1<<m|a<<f|l,fs=e}function $u(e){e.return!==null&&(Cs(e,1),Mh(e,1,0))}function Pu(e){for(;e===yl;)yl=zi[--Ui],zi[Ui]=null,Po=zi[--Ui],zi[Ui]=null;for(;e===sa;)sa=Bn[--Ln],Bn[Ln]=null,fs=Bn[--Ln],Bn[Ln]=null,ds=Bn[--Ln],Bn[Ln]=null}function Ih(e,n){Bn[Ln++]=ds,Bn[Ln++]=fs,Bn[Ln++]=sa,ds=n.id,fs=n.overflow,sa=e}var Zt=null,pt=null,Pe=!1,aa=null,zn=!1,Vu=Error(o(519));function ia(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vo(On(n,e)),Vu}function Oh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[ft]=e,n[Vt]=l,a){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(a=0;a<ur.length;a++)Le(ur[a],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Km(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Jm(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||X0(n.textContent,a)?(l.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),l.onScroll!=null&&Le("scroll",n),l.onScrollEnd!=null&&Le("scrollend",n),l.onClick!=null&&(n.onclick=ws),n=!0):n=!1,n||ia(e,!0)}function Bh(e){for(Zt=e.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Zt=Zt.return}}function $i(e){if(e!==Zt)return!1;if(!Pe)return Bh(e),Pe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||rf(e.type,e.memoizedProps)),a=!a),a&&pt&&ia(e),Bh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=rv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=rv(e)}else n===27?(n=pt,ba(e.type)?(e=ff,ff=null,pt=e):pt=n):pt=Zt?$n(e.stateNode.nextSibling):null;return!0}function Ka(){pt=Zt=null,Pe=!1}function Hu(){var e=aa;return e!==null&&(mn===null?mn=e:mn.push.apply(mn,e),aa=null),e}function Vo(e){aa===null?aa=[e]:aa.push(e)}var qu=Ze(null),Ya=null,Es=null;function oa(e,n,a){Te(qu,n._currentValue),n._currentValue=a}function As(e){e._currentValue=qu.current,je(qu)}function Gu(e,n,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===a)break;e=e.return}}function Fu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var x=f.child;m=m.firstContext;e:for(;m!==null;){var T=m;m=f;for(var M=0;M<n.length;M++)if(T.context===n[M]){m.lanes|=a,T=m.alternate,T!==null&&(T.lanes|=a),Gu(m.return,a,e),l||(x=null);break e}m=T.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(o(341));x.lanes|=a,m=x.alternate,m!==null&&(m.lanes|=a),Gu(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Pi(e,n,a,l){e=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var T=f.type;_n(f.pendingProps.value,x.value)||(e!==null?e.push(T):e=[T])}}else if(f===de.current){if(x=f.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(hr):e=[hr])}f=f.return}e!==null&&Fu(n,e,a,l),n.flags|=262144}function bl(e){for(e=e.firstContext;e!==null;){if(!_n(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ja(e){Ya=e,Es=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return Lh(Ya,e)}function _l(e,n){return Ya===null&&Ja(e),Lh(e,n)}function Lh(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Es===null){if(e===null)throw Error(o(308));Es=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Es=Es.next=n;return a}var _k=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},xk=t.unstable_scheduleCallback,kk=t.unstable_NormalPriority,Ot={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zu(){return{controller:new _k,data:new Map,refCount:0}}function Ho(e){e.refCount--,e.refCount===0&&xk(kk,function(){e.controller.abort()})}var qo=null,Ku=0,Vi=0,Hi=null;function Sk(e,n){if(qo===null){var a=qo=[];Ku=0,Vi=Wd(),Hi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Ku++,n.then(zh,zh),n}function zh(){if(--Ku===0&&qo!==null){Hi!==null&&(Hi.status="fulfilled");var e=qo;qo=null,Vi=0,Hi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Tk(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var Uh=B.S;B.S=function(e,n){k0=Ce(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Sk(e,n),Uh!==null&&Uh(e,n)};var Wa=Ze(null);function Yu(){var e=Wa.current;return e!==null?e:ut.pooledCache}function xl(e,n){n===null?Te(Wa,Wa.current):Te(Wa,n.pool)}function $h(){var e=Yu();return e===null?null:{parent:Ot._currentValue,pool:e}}var qi=Error(o(460)),Ju=Error(o(474)),kl=Error(o(542)),Sl={then:function(){}};function Ph(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vh(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ws,ws),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,qh(e),e;default:if(typeof n.status=="string")n.then(ws,ws);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(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,qh(e),e}throw Qa=n,qi}}function Xa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Qa=a,qi):a}}var Qa=null;function Hh(){if(Qa===null)throw Error(o(459));var e=Qa;return Qa=null,e}function qh(e){if(e===qi||e===kl)throw Error(o(483))}var Gi=null,Go=0;function Tl(e){var n=Go;return Go+=1,Gi===null&&(Gi=[]),Vh(Gi,e,n)}function Fo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function wl(e,n){throw n.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(n),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Gh(e){function n(z,O){if(e){var V=z.deletions;V===null?(z.deletions=[O],z.flags|=16):V.push(O)}}function a(z,O){if(!e)return null;for(;O!==null;)n(z,O),O=O.sibling;return null}function l(z){for(var O=new Map;z!==null;)z.key!==null?O.set(z.key,z):O.set(z.index,z),z=z.sibling;return O}function f(z,O){return z=js(z,O),z.index=0,z.sibling=null,z}function m(z,O,V){return z.index=V,e?(V=z.alternate,V!==null?(V=V.index,V<O?(z.flags|=67108866,O):V):(z.flags|=67108866,O)):(z.flags|=1048576,O)}function x(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function T(z,O,V,W){return O===null||O.tag!==6?(O=zu(V,z.mode,W),O.return=z,O):(O=f(O,V),O.return=z,O)}function M(z,O,V,W){var be=V.type;return be===w?J(z,O,V.props.children,W,V.key):O!==null&&(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Xa(be)===O.type)?(O=f(O,V.props),Fo(O,V),O.return=z,O):(O=vl(V.type,V.key,V.props,null,z.mode,W),Fo(O,V),O.return=z,O)}function H(z,O,V,W){return O===null||O.tag!==4||O.stateNode.containerInfo!==V.containerInfo||O.stateNode.implementation!==V.implementation?(O=Uu(V,z.mode,W),O.return=z,O):(O=f(O,V.children||[]),O.return=z,O)}function J(z,O,V,W,be){return O===null||O.tag!==7?(O=Za(V,z.mode,W,be),O.return=z,O):(O=f(O,V),O.return=z,O)}function X(z,O,V){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=zu(""+O,z.mode,V),O.return=z,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case k:return V=vl(O.type,O.key,O.props,null,z.mode,V),Fo(V,O),V.return=z,V;case S:return O=Uu(O,z.mode,V),O.return=z,O;case $:return O=Xa(O),X(z,O,V)}if(ee(O)||ae(O))return O=Za(O,z.mode,V,null),O.return=z,O;if(typeof O.then=="function")return X(z,Tl(O),V);if(O.$$typeof===E)return X(z,_l(z,O),V);wl(z,O)}return null}function F(z,O,V,W){var be=O!==null?O.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return be!==null?null:T(z,O,""+V,W);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case k:return V.key===be?M(z,O,V,W):null;case S:return V.key===be?H(z,O,V,W):null;case $:return V=Xa(V),F(z,O,V,W)}if(ee(V)||ae(V))return be!==null?null:J(z,O,V,W,null);if(typeof V.then=="function")return F(z,O,Tl(V),W);if(V.$$typeof===E)return F(z,O,_l(z,V),W);wl(z,V)}return null}function K(z,O,V,W,be){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return z=z.get(V)||null,T(O,z,""+W,be);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return z=z.get(W.key===null?V:W.key)||null,M(O,z,W,be);case S:return z=z.get(W.key===null?V:W.key)||null,H(O,z,W,be);case $:return W=Xa(W),K(z,O,V,W,be)}if(ee(W)||ae(W))return z=z.get(V)||null,J(O,z,W,be,null);if(typeof W.then=="function")return K(z,O,V,Tl(W),be);if(W.$$typeof===E)return K(z,O,V,_l(O,W),be);wl(O,W)}return null}function he(z,O,V,W){for(var be=null,Ke=null,ge=O,Re=O=0,$e=null;ge!==null&&Re<V.length;Re++){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var Ye=F(z,ge,V[Re],W);if(Ye===null){ge===null&&(ge=$e);break}e&&ge&&Ye.alternate===null&&n(z,ge),O=m(Ye,O,Re),Ke===null?be=Ye:Ke.sibling=Ye,Ke=Ye,ge=$e}if(Re===V.length)return a(z,ge),Pe&&Cs(z,Re),be;if(ge===null){for(;Re<V.length;Re++)ge=X(z,V[Re],W),ge!==null&&(O=m(ge,O,Re),Ke===null?be=ge:Ke.sibling=ge,Ke=ge);return Pe&&Cs(z,Re),be}for(ge=l(ge);Re<V.length;Re++)$e=K(ge,z,Re,V[Re],W),$e!==null&&(e&&$e.alternate!==null&&ge.delete($e.key===null?Re:$e.key),O=m($e,O,Re),Ke===null?be=$e:Ke.sibling=$e,Ke=$e);return e&&ge.forEach(function(Ta){return n(z,Ta)}),Pe&&Cs(z,Re),be}function ke(z,O,V,W){if(V==null)throw Error(o(151));for(var be=null,Ke=null,ge=O,Re=O=0,$e=null,Ye=V.next();ge!==null&&!Ye.done;Re++,Ye=V.next()){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var Ta=F(z,ge,Ye.value,W);if(Ta===null){ge===null&&(ge=$e);break}e&&ge&&Ta.alternate===null&&n(z,ge),O=m(Ta,O,Re),Ke===null?be=Ta:Ke.sibling=Ta,Ke=Ta,ge=$e}if(Ye.done)return a(z,ge),Pe&&Cs(z,Re),be;if(ge===null){for(;!Ye.done;Re++,Ye=V.next())Ye=X(z,Ye.value,W),Ye!==null&&(O=m(Ye,O,Re),Ke===null?be=Ye:Ke.sibling=Ye,Ke=Ye);return Pe&&Cs(z,Re),be}for(ge=l(ge);!Ye.done;Re++,Ye=V.next())Ye=K(ge,z,Re,Ye.value,W),Ye!==null&&(e&&Ye.alternate!==null&&ge.delete(Ye.key===null?Re:Ye.key),O=m(Ye,O,Re),Ke===null?be=Ye:Ke.sibling=Ye,Ke=Ye);return e&&ge.forEach(function(OS){return n(z,OS)}),Pe&&Cs(z,Re),be}function rt(z,O,V,W){if(typeof V=="object"&&V!==null&&V.type===w&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case k:e:{for(var be=V.key;O!==null;){if(O.key===be){if(be=V.type,be===w){if(O.tag===7){a(z,O.sibling),W=f(O,V.props.children),W.return=z,z=W;break e}}else if(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Xa(be)===O.type){a(z,O.sibling),W=f(O,V.props),Fo(W,V),W.return=z,z=W;break e}a(z,O);break}else n(z,O);O=O.sibling}V.type===w?(W=Za(V.props.children,z.mode,W,V.key),W.return=z,z=W):(W=vl(V.type,V.key,V.props,null,z.mode,W),Fo(W,V),W.return=z,z=W)}return x(z);case S:e:{for(be=V.key;O!==null;){if(O.key===be)if(O.tag===4&&O.stateNode.containerInfo===V.containerInfo&&O.stateNode.implementation===V.implementation){a(z,O.sibling),W=f(O,V.children||[]),W.return=z,z=W;break e}else{a(z,O);break}else n(z,O);O=O.sibling}W=Uu(V,z.mode,W),W.return=z,z=W}return x(z);case $:return V=Xa(V),rt(z,O,V,W)}if(ee(V))return he(z,O,V,W);if(ae(V)){if(be=ae(V),typeof be!="function")throw Error(o(150));return V=be.call(V),ke(z,O,V,W)}if(typeof V.then=="function")return rt(z,O,Tl(V),W);if(V.$$typeof===E)return rt(z,O,_l(z,V),W);wl(z,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,O!==null&&O.tag===6?(a(z,O.sibling),W=f(O,V),W.return=z,z=W):(a(z,O),W=zu(V,z.mode,W),W.return=z,z=W),x(z)):a(z,O)}return function(z,O,V,W){try{Go=0;var be=rt(z,O,V,W);return Gi=null,be}catch(ge){if(ge===qi||ge===kl)throw ge;var Ke=xn(29,ge,null,z.mode);return Ke.lanes=W,Ke.return=z,Ke}finally{}}}var ei=Gh(!0),Fh=Gh(!1),ra=!1;function Wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xu(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 la(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ca(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=gl(e),Eh(e,null,a),n}return hl(e,l,n,a),gl(e)}function Zo(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ge(e,a)}}function Qu(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=x:m=m.next=x,a=a.next}while(a!==null);m===null?f=m=n:m=m.next=n}else f=m=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var ed=!1;function Ko(){if(ed){var e=Hi;if(e!==null)throw e}}function Yo(e,n,a,l){ed=!1;var f=e.updateQueue;ra=!1;var m=f.firstBaseUpdate,x=f.lastBaseUpdate,T=f.shared.pending;if(T!==null){f.shared.pending=null;var M=T,H=M.next;M.next=null,x===null?m=H:x.next=H,x=M;var J=e.alternate;J!==null&&(J=J.updateQueue,T=J.lastBaseUpdate,T!==x&&(T===null?J.firstBaseUpdate=H:T.next=H,J.lastBaseUpdate=M))}if(m!==null){var X=f.baseState;x=0,J=H=M=null,T=m;do{var F=T.lane&-536870913,K=F!==T.lane;if(K?(Ue&F)===F:(l&F)===F){F!==0&&F===Vi&&(ed=!0),J!==null&&(J=J.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var he=e,ke=T;F=n;var rt=a;switch(ke.tag){case 1:if(he=ke.payload,typeof he=="function"){X=he.call(rt,X,F);break e}X=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ke.payload,F=typeof he=="function"?he.call(rt,X,F):he,F==null)break e;X=y({},X,F);break e;case 2:ra=!0}}F=T.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[F]:K.push(F))}else K={lane:F,tag:T.tag,payload:T.payload,callback:T.callback,next:null},J===null?(H=J=K,M=X):J=J.next=K,x|=F;if(T=T.next,T===null){if(T=f.shared.pending,T===null)break;K=T,T=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);J===null&&(M=X),f.baseState=M,f.firstBaseUpdate=H,f.lastBaseUpdate=J,m===null&&(f.shared.lanes=0),ma|=x,e.lanes=x,e.memoizedState=X}}function Zh(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Kh(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Zh(a[e],n)}var Fi=Ze(null),Nl=Ze(0);function Yh(e,n){e=Us,Te(Nl,e),Te(Fi,n),Us=e|n.baseLanes}function td(){Te(Nl,Us),Te(Fi,Fi.current)}function nd(){Us=Nl.current,je(Fi),je(Nl)}var kn=Ze(null),Un=null;function ua(e){var n=e.alternate;Te(At,At.current&1),Te(kn,e),Un===null&&(n===null||Fi.current!==null||n.memoizedState!==null)&&(Un=e)}function sd(e){Te(At,At.current),Te(kn,e),Un===null&&(Un=e)}function Jh(e){e.tag===22?(Te(At,At.current),Te(kn,e),Un===null&&(Un=e)):da()}function da(){Te(At,At.current),Te(kn,kn.current)}function Sn(e){je(kn),Un===e&&(Un=null),je(At)}var At=Ze(0);function jl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||uf(a)||df(a)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ds=0,De=null,it=null,Bt=null,Cl=!1,Zi=!1,ti=!1,El=0,Jo=0,Ki=null,wk=0;function Tt(){throw Error(o(321))}function ad(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!_n(e[a],n[a]))return!1;return!0}function id(e,n,a,l,f,m){return Ds=m,De=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=e===null||e.memoizedState===null?Mg:_d,ti=!1,m=a(l,f),ti=!1,Zi&&(m=Xh(n,a,l,f)),Wh(e),m}function Wh(e){B.H=Qo;var n=it!==null&&it.next!==null;if(Ds=0,Bt=it=De=null,Cl=!1,Jo=0,Ki=null,n)throw Error(o(300));e===null||Lt||(e=e.dependencies,e!==null&&bl(e)&&(Lt=!0))}function Xh(e,n,a,l){De=e;var f=0;do{if(Zi&&(Ki=null),Jo=0,Zi=!1,25<=f)throw Error(o(301));if(f+=1,Bt=it=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}B.H=Ig,m=n(a,l)}while(Zi);return m}function Nk(){var e=B.H,n=e.useState()[0];return n=typeof n.then=="function"?Wo(n):n,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(De.flags|=1024),n}function od(){var e=El!==0;return El=0,e}function rd(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function ld(e){if(Cl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Cl=!1}Ds=0,Bt=it=De=null,Zi=!1,Jo=El=0,Ki=null}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?De.memoizedState=Bt=e:Bt=Bt.next=e,Bt}function Dt(){if(it===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=it.next;var n=Bt===null?De.memoizedState:Bt.next;if(n!==null)Bt=n,it=e;else{if(e===null)throw De.alternate===null?Error(o(467)):Error(o(310));it=e,e={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},Bt===null?De.memoizedState=Bt=e:Bt=Bt.next=e}return Bt}function Al(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wo(e){var n=Jo;return Jo+=1,Ki===null&&(Ki=[]),e=Vh(Ki,e,n),n=De,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?Mg:_d),e}function Dl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Wo(e);if(e.$$typeof===E)return Kt(e)}throw Error(o(438,String(e)))}function cd(e){var n=null,a=De.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=De.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=Al(),De.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=G;return n.index++,a}function Rs(e,n){return typeof n=="function"?n(e):n}function Rl(e){var n=Dt();return ud(n,it,e)}function ud(e,n,a){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=a;var f=e.baseQueue,m=l.pending;if(m!==null){if(f!==null){var x=f.next;f.next=m.next,m.next=x}n.baseQueue=f=m,l.pending=null}if(m=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var T=x=null,M=null,H=n,J=!1;do{var X=H.lane&-536870913;if(X!==H.lane?(Ue&X)===X:(Ds&X)===X){var F=H.revertLane;if(F===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),X===Vi&&(J=!0);else if((Ds&F)===F){H=H.next,F===Vi&&(J=!0);continue}else X={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(T=M=X,x=m):M=M.next=X,De.lanes|=F,ma|=F;X=H.action,ti&&a(m,X),m=H.hasEagerState?H.eagerState:a(m,X)}else F={lane:X,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(T=M=F,x=m):M=M.next=F,De.lanes|=X,ma|=X;H=H.next}while(H!==null&&H!==n);if(M===null?x=m:M.next=T,!_n(m,e.memoizedState)&&(Lt=!0,J&&(a=Hi,a!==null)))throw a;e.memoizedState=m,e.baseState=x,e.baseQueue=M,l.lastRenderedState=m}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function dd(e){var n=Dt(),a=n.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do m=e(m,x.action),x=x.next;while(x!==f);_n(m,n.memoizedState)||(Lt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function Qh(e,n,a){var l=De,f=Dt(),m=Pe;if(m){if(a===void 0)throw Error(o(407));a=a()}else a=n();var x=!_n((it||f).memoizedState,a);if(x&&(f.memoizedState=a,Lt=!0),f=f.queue,md(ng.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Bt!==null&&Bt.memoizedState.tag&1){if(l.flags|=2048,Yi(9,{destroy:void 0},tg.bind(null,l,f,a,n),null),ut===null)throw Error(o(349));m||(Ds&127)!==0||eg(l,n,a)}return a}function eg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=De.updateQueue,n===null?(n=Al(),De.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function tg(e,n,a,l){n.value=a,n.getSnapshot=l,sg(n)&&ag(e)}function ng(e,n,a){return a(function(){sg(n)&&ag(e)})}function sg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!_n(e,a)}catch{return!0}}function ag(e){var n=Fa(e,2);n!==null&&hn(n,e,2)}function fd(e){var n=an();if(typeof e=="function"){var a=e;if(e=a(),ti){Jn(!0);try{a()}finally{Jn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:e},n}function ig(e,n,a,l){return e.baseState=a,ud(e,it,typeof l=="function"?l:Rs)}function jk(e,n,a,l,f){if(Ol(e))throw Error(o(485));if(e=n.action,e!==null){var m={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){m.listeners.push(x)}};B.T!==null?a(!0):m.isTransition=!1,l(m),a=n.pending,a===null?(m.next=n.pending=m,og(n,m)):(m.next=a.next,n.pending=a.next=m)}}function og(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var m=B.T,x={};B.T=x;try{var T=a(f,l),M=B.S;M!==null&&M(x,T),rg(e,n,T)}catch(H){pd(e,n,H)}finally{m!==null&&x.types!==null&&(m.types=x.types),B.T=m}}else try{m=a(f,l),rg(e,n,m)}catch(H){pd(e,n,H)}}function rg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){lg(e,n,l)},function(l){return pd(e,n,l)}):lg(e,n,a)}function lg(e,n,a){n.status="fulfilled",n.value=a,cg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,og(e,a)))}function pd(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,cg(n),n=n.next;while(n!==l)}e.action=null}function cg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function ug(e,n){return n}function dg(e,n){if(Pe){var a=ut.formState;if(a!==null){e:{var l=De;if(Pe){if(pt){t:{for(var f=pt,m=zn;f.nodeType!==8;){if(!m){f=null;break t}if(f=$n(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){pt=$n(f.nextSibling),l=f.data==="F!";break e}}ia(l)}l=!1}l&&(n=a[0])}}return a=an(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ug,lastRenderedState:n},a.queue=l,a=Ag.bind(null,De,l),l.dispatch=a,l=fd(!1),m=bd.bind(null,De,!1,l.queue),l=an(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=jk.bind(null,De,f,m,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function fg(e){var n=Dt();return pg(n,it,e)}function pg(e,n,a){if(n=ud(e,n,ug)[0],e=Rl(Rs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Wo(n)}catch(x){throw x===qi?kl:x}else l=n;n=Dt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(De.flags|=2048,Yi(9,{destroy:void 0},Ck.bind(null,f,a),null)),[l,m,e]}function Ck(e,n){e.action=n}function mg(e){var n=Dt(),a=it;if(a!==null)return pg(n,a,e);Dt(),n=n.memoizedState,a=Dt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function Yi(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=De.updateQueue,n===null&&(n=Al(),De.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function hg(){return Dt().memoizedState}function Ml(e,n,a,l){var f=an();De.flags|=e,f.memoizedState=Yi(1|n,{destroy:void 0},a,l===void 0?null:l)}function Il(e,n,a,l){var f=Dt();l=l===void 0?null:l;var m=f.memoizedState.inst;it!==null&&l!==null&&ad(l,it.memoizedState.deps)?f.memoizedState=Yi(n,m,a,l):(De.flags|=e,f.memoizedState=Yi(1|n,m,a,l))}function gg(e,n){Ml(8390656,8,e,n)}function md(e,n){Il(2048,8,e,n)}function Ek(e){De.flags|=4;var n=De.updateQueue;if(n===null)n=Al(),De.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function vg(e){var n=Dt().memoizedState;return Ek({ref:n,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function yg(e,n){return Il(4,2,e,n)}function bg(e,n){return Il(4,4,e,n)}function _g(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function xg(e,n,a){a=a!=null?a.concat([e]):null,Il(4,4,_g.bind(null,n,e),a)}function hd(){}function kg(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&ad(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Sg(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&ad(n,l[1]))return l[0];if(l=e(),ti){Jn(!0);try{e()}finally{Jn(!1)}}return a.memoizedState=[l,n],l}function gd(e,n,a){return a===void 0||(Ds&1073741824)!==0&&(Ue&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=T0(),De.lanes|=e,ma|=e,a)}function Tg(e,n,a,l){return _n(a,n)?a:Fi.current!==null?(e=gd(e,a,l),_n(e,n)||(Lt=!0),e):(Ds&42)===0||(Ds&1073741824)!==0&&(Ue&261930)===0?(Lt=!0,e.memoizedState=a):(e=T0(),De.lanes|=e,ma|=e,n)}function wg(e,n,a,l,f){var m=Z.p;Z.p=m!==0&&8>m?m:8;var x=B.T,T={};B.T=T,bd(e,!1,n,a);try{var M=f(),H=B.S;if(H!==null&&H(T,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var J=Tk(M,l);Xo(e,n,J,Nn(e))}else Xo(e,n,l,Nn(e))}catch(X){Xo(e,n,{then:function(){},status:"rejected",reason:X},Nn())}finally{Z.p=m,x!==null&&T.types!==null&&(x.types=T.types),B.T=x}}function Ak(){}function vd(e,n,a,l){if(e.tag!==5)throw Error(o(476));var f=Ng(e).queue;wg(e,f,n,ne,a===null?Ak:function(){return jg(e),a(l)})}function Ng(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:ne},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function jg(e){var n=Ng(e);n.next===null&&(n=e.alternate.memoizedState),Xo(e,n.next.queue,{},Nn())}function yd(){return Kt(hr)}function Cg(){return Dt().memoizedState}function Eg(){return Dt().memoizedState}function Dk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Nn();e=la(a);var l=ca(n,e,a);l!==null&&(hn(l,n,a),Zo(l,n,a)),n={cache:Zu()},e.payload=n;return}n=n.return}}function Rk(e,n,a){var l=Nn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ol(e)?Dg(n,a):(a=Bu(e,n,a,l),a!==null&&(hn(a,e,l),Rg(a,n,l)))}function Ag(e,n,a){var l=Nn();Xo(e,n,a,l)}function Xo(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ol(e))Dg(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var x=n.lastRenderedState,T=m(x,a);if(f.hasEagerState=!0,f.eagerState=T,_n(T,x))return hl(e,n,f,0),ut===null&&ml(),!1}catch{}finally{}if(a=Bu(e,n,f,l),a!==null)return hn(a,e,l),Rg(a,n,l),!0}return!1}function bd(e,n,a,l){if(l={lane:2,revertLane:Wd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ol(e)){if(n)throw Error(o(479))}else n=Bu(e,a,l,2),n!==null&&hn(n,e,2)}function Ol(e){var n=e.alternate;return e===De||n!==null&&n===De}function Dg(e,n){Zi=Cl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Rg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ge(e,a)}}var Qo={readContext:Kt,use:Dl,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};Qo.useEffectEvent=Tt;var Mg={readContext:Kt,use:Dl,useCallback:function(e,n){return an().memoizedState=[e,n===void 0?null:n],e},useContext:Kt,useEffect:gg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ml(4194308,4,_g.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ml(4194308,4,e,n)},useInsertionEffect:function(e,n){Ml(4,2,e,n)},useMemo:function(e,n){var a=an();n=n===void 0?null:n;var l=e();if(ti){Jn(!0);try{e()}finally{Jn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=an();if(a!==void 0){var f=a(n);if(ti){Jn(!0);try{a(n)}finally{Jn(!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=Rk.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var n=an();return e={current:e},n.memoizedState=e},useState:function(e){e=fd(e);var n=e.queue,a=Ag.bind(null,De,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:hd,useDeferredValue:function(e,n){var a=an();return gd(a,e,n)},useTransition:function(){var e=fd(!1);return e=wg.bind(null,De,e.queue,!0,!1),an().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=De,f=an();if(Pe){if(a===void 0)throw Error(o(407));a=a()}else{if(a=n(),ut===null)throw Error(o(349));(Ue&127)!==0||eg(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,gg(ng.bind(null,l,m,e),[e]),l.flags|=2048,Yi(9,{destroy:void 0},tg.bind(null,l,m,a,n),null),a},useId:function(){var e=an(),n=ut.identifierPrefix;if(Pe){var a=fs,l=ds;a=(l&~(1<<32-en(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=El++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=wk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:yd,useFormState:dg,useActionState:dg,useOptimistic:function(e){var n=an();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=bd.bind(null,De,!0,a),a.dispatch=n,[e,n]},useMemoCache:cd,useCacheRefresh:function(){return an().memoizedState=Dk.bind(null,De)},useEffectEvent:function(e){var n=an(),a={impl:e};return n.memoizedState=a,function(){if((Qe&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},_d={readContext:Kt,use:Dl,useCallback:kg,useContext:Kt,useEffect:md,useImperativeHandle:xg,useInsertionEffect:yg,useLayoutEffect:bg,useMemo:Sg,useReducer:Rl,useRef:hg,useState:function(){return Rl(Rs)},useDebugValue:hd,useDeferredValue:function(e,n){var a=Dt();return Tg(a,it.memoizedState,e,n)},useTransition:function(){var e=Rl(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Wo(e),n]},useSyncExternalStore:Qh,useId:Cg,useHostTransitionStatus:yd,useFormState:fg,useActionState:fg,useOptimistic:function(e,n){var a=Dt();return ig(a,it,e,n)},useMemoCache:cd,useCacheRefresh:Eg};_d.useEffectEvent=vg;var Ig={readContext:Kt,use:Dl,useCallback:kg,useContext:Kt,useEffect:md,useImperativeHandle:xg,useInsertionEffect:yg,useLayoutEffect:bg,useMemo:Sg,useReducer:dd,useRef:hg,useState:function(){return dd(Rs)},useDebugValue:hd,useDeferredValue:function(e,n){var a=Dt();return it===null?gd(a,e,n):Tg(a,it.memoizedState,e,n)},useTransition:function(){var e=dd(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Wo(e),n]},useSyncExternalStore:Qh,useId:Cg,useHostTransitionStatus:yd,useFormState:mg,useActionState:mg,useOptimistic:function(e,n){var a=Dt();return it!==null?ig(a,it,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:cd,useCacheRefresh:Eg};Ig.useEffectEvent=vg;function xd(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var kd={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Nn(),f=la(l);f.payload=n,a!=null&&(f.callback=a),n=ca(e,f,l),n!==null&&(hn(n,e,l),Zo(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Nn(),f=la(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=ca(e,f,l),n!==null&&(hn(n,e,l),Zo(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Nn(),l=la(a);l.tag=2,n!=null&&(l.callback=n),n=ca(e,l,a),n!==null&&(hn(n,e,a),Zo(n,e,a))}};function Og(e,n,a,l,f,m,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,m,x):n.prototype&&n.prototype.isPureReactComponent?!Uo(a,l)||!Uo(f,m):!0}function Bg(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&kd.enqueueReplaceState(n,n.state,null)}function ni(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=y({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Lg(e){pl(e)}function zg(e){console.error(e)}function Ug(e){pl(e)}function Bl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function $g(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Sd(e,n,a){return a=la(a),a.tag=3,a.payload={element:null},a.callback=function(){Bl(e,n)},a}function Pg(e){return e=la(e),e.tag=3,e}function Vg(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;e.payload=function(){return f(m)},e.callback=function(){$g(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){$g(n,a,l),typeof f!="function"&&(ha===null?ha=new Set([this]):ha.add(this));var T=l.stack;this.componentDidCatch(l.value,{componentStack:T!==null?T:""})})}function Mk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Pi(n,a,f,!0),a=kn.current,a!==null){switch(a.tag){case 31:case 13:return Un===null?Kl():a.alternate===null&&wt===0&&(wt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Sl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),Kd(e,l,f)),!1;case 22:return a.flags|=65536,l===Sl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),Kd(e,l,f)),!1}throw Error(o(435,a.tag))}return Kd(e,l,f),Kl(),!1}if(Pe)return n=kn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Vu&&(e=Error(o(422),{cause:l}),Vo(On(e,a)))):(l!==Vu&&(n=Error(o(423),{cause:l}),Vo(On(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=On(l,a),f=Sd(e.stateNode,l,f),Qu(e,f),wt!==4&&(wt=2)),!1;var m=Error(o(520),{cause:l});if(m=On(m,a),rr===null?rr=[m]:rr.push(m),wt!==4&&(wt=2),n===null)return!0;l=On(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Sd(a.stateNode,l,e),Qu(a,e),!1;case 1:if(n=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(ha===null||!ha.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Pg(f),Vg(f,e,a,l),Qu(a,f),!1}a=a.return}while(a!==null);return!1}var Td=Error(o(461)),Lt=!1;function Yt(e,n,a,l){n.child=e===null?Fh(n,null,a,l):ei(n,e.child,a,l)}function Hg(e,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var x={};for(var T in l)T!=="ref"&&(x[T]=l[T])}else x=l;return Ja(n),l=id(e,n,a,x,m,f),T=od(),e!==null&&!Lt?(rd(e,n,f),Ms(e,n,f)):(Pe&&T&&$u(n),n.flags|=1,Yt(e,n,l,f),n.child)}function qg(e,n,a,l,f){if(e===null){var m=a.type;return typeof m=="function"&&!Lu(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,Gg(e,n,m,l,f)):(e=vl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Rd(e,f)){var x=m.memoizedProps;if(a=a.compare,a=a!==null?a:Uo,a(x,l)&&e.ref===n.ref)return Ms(e,n,f)}return n.flags|=1,e=js(m,l),e.ref=n.ref,e.return=n,n.child=e}function Gg(e,n,a,l,f){if(e!==null){var m=e.memoizedProps;if(Uo(m,l)&&e.ref===n.ref)if(Lt=!1,n.pendingProps=l=m,Rd(e,f))(e.flags&131072)!==0&&(Lt=!0);else return n.lanes=e.lanes,Ms(e,n,f)}return wd(e,n,a,l,f)}function Fg(e,n,a,l){var f=l.children,m=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(m=m!==null?m.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~m}else l=0,n.child=null;return Zg(e,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(n,m!==null?m.cachePool:null),m!==null?Yh(n,m):td(),Jh(n);else return l=n.lanes=536870912,Zg(e,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(xl(n,m.cachePool),Yh(n,m),da(),n.memoizedState=null):(e!==null&&xl(n,null),td(),da());return Yt(e,n,f,a),n.child}function er(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Zg(e,n,a,l,f){var m=Yu();return m=m===null?null:{parent:Ot._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&xl(n,null),td(),Jh(n),e!==null&&Pi(e,n,l,!0),n.childLanes=f,null}function Ll(e,n){return n=Ul({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Kg(e,n,a){return ei(n,e.child,null,a),e=Ll(n,n.pendingProps),e.flags|=2,Sn(n),n.memoizedState=null,e}function Ik(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(l.mode==="hidden")return e=Ll(n,l),n.lanes=536870912,er(null,e);if(sd(n),(e=pt)?(e=ov(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:sa!==null?{id:ds,overflow:fs}:null,retryLane:536870912,hydrationErrors:null},a=Dh(e),a.return=n,n.child=a,Zt=n,pt=null)):e=null,e===null)throw ia(n);return n.lanes=536870912,null}return Ll(n,l)}var m=e.memoizedState;if(m!==null){var x=m.dehydrated;if(sd(n),f)if(n.flags&256)n.flags&=-257,n=Kg(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Lt||Pi(e,n,a,!1),f=(a&e.childLanes)!==0,Lt||f){if(l=ut,l!==null&&(x=ct(l,a),x!==0&&x!==m.retryLane))throw m.retryLane=x,Fa(e,x),hn(l,e,x),Td;Kl(),n=Kg(e,n,a)}else e=m.treeContext,pt=$n(x.nextSibling),Zt=n,Pe=!0,aa=null,zn=!1,e!==null&&Ih(n,e),n=Ll(n,l),n.flags|=4096;return n}return e=js(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function zl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(o(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function wd(e,n,a,l,f){return Ja(n),a=id(e,n,a,l,void 0,f),l=od(),e!==null&&!Lt?(rd(e,n,f),Ms(e,n,f)):(Pe&&l&&$u(n),n.flags|=1,Yt(e,n,a,f),n.child)}function Yg(e,n,a,l,f,m){return Ja(n),n.updateQueue=null,a=Xh(n,l,a,f),Wh(e),l=od(),e!==null&&!Lt?(rd(e,n,m),Ms(e,n,m)):(Pe&&l&&$u(n),n.flags|=1,Yt(e,n,a,m),n.child)}function Jg(e,n,a,l,f){if(Ja(n),n.stateNode===null){var m=Li,x=a.contextType;typeof x=="object"&&x!==null&&(m=Kt(x)),m=new a(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=kd,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},Wu(n),x=a.contextType,m.context=typeof x=="object"&&x!==null?Kt(x):Li,m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(xd(n,a,x,l),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(x=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),x!==m.state&&kd.enqueueReplaceState(m,m.state,null),Yo(n,l,m,f),Ko(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){m=n.stateNode;var T=n.memoizedProps,M=ni(a,T);m.props=M;var H=m.context,J=a.contextType;x=Li,typeof J=="object"&&J!==null&&(x=Kt(J));var X=a.getDerivedStateFromProps;J=typeof X=="function"||typeof m.getSnapshotBeforeUpdate=="function",T=n.pendingProps!==T,J||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(T||H!==x)&&Bg(n,m,l,x),ra=!1;var F=n.memoizedState;m.state=F,Yo(n,l,m,f),Ko(),H=n.memoizedState,T||F!==H||ra?(typeof X=="function"&&(xd(n,a,X,l),H=n.memoizedState),(M=ra||Og(n,a,M,l,F,H,x))?(J||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=H),m.props=l,m.state=H,m.context=x,l=M):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,Xu(e,n),x=n.memoizedProps,J=ni(a,x),m.props=J,X=n.pendingProps,F=m.context,H=a.contextType,M=Li,typeof H=="object"&&H!==null&&(M=Kt(H)),T=a.getDerivedStateFromProps,(H=typeof T=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==X||F!==M)&&Bg(n,m,l,M),ra=!1,F=n.memoizedState,m.state=F,Yo(n,l,m,f),Ko();var K=n.memoizedState;x!==X||F!==K||ra||e!==null&&e.dependencies!==null&&bl(e.dependencies)?(typeof T=="function"&&(xd(n,a,T,l),K=n.memoizedState),(J=ra||Og(n,a,J,l,F,K,M)||e!==null&&e.dependencies!==null&&bl(e.dependencies))?(H||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,K,M),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,K,M)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),m.props=l,m.state=K,m.context=M,l=J):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),l=!1)}return m=l,zl(e,n),l=(n.flags&128)!==0,m||l?(m=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,e!==null&&l?(n.child=ei(n,e.child,null,f),n.child=ei(n,null,a,f)):Yt(e,n,a,f),n.memoizedState=m.state,e=n.child):e=Ms(e,n,f),e}function Wg(e,n,a,l){return Ka(),n.flags|=256,Yt(e,n,a,l),n.child}var Nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jd(e){return{baseLanes:e,cachePool:$h()}}function Cd(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=wn),e}function Xg(e,n,a){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,x;if((x=m)||(x=e!==null&&e.memoizedState===null?!1:(At.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(f?ua(n):da(),(e=pt)?(e=ov(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:sa!==null?{id:ds,overflow:fs}:null,retryLane:536870912,hydrationErrors:null},a=Dh(e),a.return=n,n.child=a,Zt=n,pt=null)):e=null,e===null)throw ia(n);return df(e)?n.lanes=32:n.lanes=536870912,null}var T=l.children;return l=l.fallback,f?(da(),f=n.mode,T=Ul({mode:"hidden",children:T},f),l=Za(l,f,a,null),T.return=n,l.return=n,T.sibling=l,n.child=T,l=n.child,l.memoizedState=jd(a),l.childLanes=Cd(e,x,a),n.memoizedState=Nd,er(null,l)):(ua(n),Ed(n,T))}var M=e.memoizedState;if(M!==null&&(T=M.dehydrated,T!==null)){if(m)n.flags&256?(ua(n),n.flags&=-257,n=Ad(e,n,a)):n.memoizedState!==null?(da(),n.child=e.child,n.flags|=128,n=null):(da(),T=l.fallback,f=n.mode,l=Ul({mode:"visible",children:l.children},f),T=Za(T,f,a,null),T.flags|=2,l.return=n,T.return=n,l.sibling=T,n.child=l,ei(n,e.child,null,a),l=n.child,l.memoizedState=jd(a),l.childLanes=Cd(e,x,a),n.memoizedState=Nd,n=er(null,l));else if(ua(n),df(T)){if(x=T.nextSibling&&T.nextSibling.dataset,x)var H=x.dgst;x=H,l=Error(o(419)),l.stack="",l.digest=x,Vo({value:l,source:null,stack:null}),n=Ad(e,n,a)}else if(Lt||Pi(e,n,a,!1),x=(a&e.childLanes)!==0,Lt||x){if(x=ut,x!==null&&(l=ct(x,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,Fa(e,l),hn(x,e,l),Td;uf(T)||Kl(),n=Ad(e,n,a)}else uf(T)?(n.flags|=192,n.child=e.child,n=null):(e=M.treeContext,pt=$n(T.nextSibling),Zt=n,Pe=!0,aa=null,zn=!1,e!==null&&Ih(n,e),n=Ed(n,l.children),n.flags|=4096);return n}return f?(da(),T=l.fallback,f=n.mode,M=e.child,H=M.sibling,l=js(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,H!==null?T=js(H,T):(T=Za(T,f,a,null),T.flags|=2),T.return=n,l.return=n,l.sibling=T,n.child=l,er(null,l),l=n.child,T=e.child.memoizedState,T===null?T=jd(a):(f=T.cachePool,f!==null?(M=Ot._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=$h(),T={baseLanes:T.baseLanes|a,cachePool:f}),l.memoizedState=T,l.childLanes=Cd(e,x,a),n.memoizedState=Nd,er(e.child,l)):(ua(n),a=e.child,e=a.sibling,a=js(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Ed(e,n){return n=Ul({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Ul(e,n){return e=xn(22,e,null,n),e.lanes=0,e}function Ad(e,n,a){return ei(n,e.child,null,a),e=Ed(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Qg(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Gu(e.return,n,a)}function Dd(e,n,a,l,f,m){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:m}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=m)}function e0(e,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var x=At.current,T=(x&2)!==0;if(T?(x=x&1|2,n.flags|=128):x&=1,Te(At,x),Yt(e,n,l,a),l=Pe?Po:0,!T&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qg(e,a,n);else if(e.tag===19)Qg(e,a,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&jl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Dd(n,!1,f,a,m,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&jl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Dd(n,!0,a,null,m,l);break;case"together":Dd(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ms(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ma|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Pi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(o(153));if(n.child!==null){for(e=n.child,a=js(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=js(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Rd(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&bl(e)))}function Ok(e,n,a){switch(n.tag){case 3:Oe(n,n.stateNode.containerInfo),oa(n,Ot,e.memoizedState.cache),Ka();break;case 27:case 5:yn(n);break;case 4:Oe(n,n.stateNode.containerInfo);break;case 10:oa(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,sd(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ua(n),n.flags|=128,null):(a&n.child.childLanes)!==0?Xg(e,n,a):(ua(n),e=Ms(e,n,a),e!==null?e.sibling:null);ua(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Pi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return e0(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Te(At,At.current),l)break;return null;case 22:return n.lanes=0,Fg(e,n,a,n.pendingProps);case 24:oa(n,Ot,e.memoizedState.cache)}return Ms(e,n,a)}function t0(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Lt=!0;else{if(!Rd(e,a)&&(n.flags&128)===0)return Lt=!1,Ok(e,n,a);Lt=(e.flags&131072)!==0}else Lt=!1,Pe&&(n.flags&1048576)!==0&&Mh(n,Po,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=Xa(n.elementType),n.type=e,typeof e=="function")Lu(e)?(l=ni(e,l),n.tag=1,n=Jg(null,n,e,l,a)):(n.tag=0,n=wd(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===I){n.tag=11,n=Hg(null,n,e,l,a);break e}else if(f===q){n.tag=14,n=qg(null,n,e,l,a);break e}}throw n=ie(e)||e,Error(o(306,n,""))}}return n;case 0:return wd(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=ni(l,n.pendingProps),Jg(e,n,l,f,a);case 3:e:{if(Oe(n,n.stateNode.containerInfo),e===null)throw Error(o(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,Xu(e,n),Yo(n,l,null,a);var x=n.memoizedState;if(l=x.cache,oa(n,Ot,l),l!==m.cache&&Fu(n,[Ot],a,!0),Ko(),l=x.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=Wg(e,n,l,a);break e}else if(l!==f){f=On(Error(o(424)),n),Vo(f),n=Wg(e,n,l,a);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(pt=$n(e.firstChild),Zt=n,Pe=!0,aa=null,zn=!0,a=Fh(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ka(),l===f){n=Ms(e,n,a);break e}Yt(e,n,l,a)}n=n.child}return n;case 26:return zl(e,n),e===null?(a=fv(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,l=tc(ve.current).createElement(a),l[ft]=n,l[Vt]=e,Jt(l,a,e),Ht(l),n.stateNode=l):n.memoizedState=fv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return yn(n),e===null&&Pe&&(l=n.stateNode=cv(n.type,n.pendingProps,ve.current),Zt=n,zn=!0,f=pt,ba(n.type)?(ff=f,pt=$n(l.firstChild)):pt=f),Yt(e,n,n.pendingProps.children,a),zl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((f=l=pt)&&(l=dS(l,n.type,n.pendingProps,zn),l!==null?(n.stateNode=l,Zt=n,pt=$n(l.firstChild),zn=!1,f=!0):f=!1),f||ia(n)),yn(n),f=n.type,m=n.pendingProps,x=e!==null?e.memoizedProps:null,l=m.children,rf(f,m)?l=null:x!==null&&rf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=id(e,n,Nk,null,null,a),hr._currentValue=f),zl(e,n),Yt(e,n,l,a),n.child;case 6:return e===null&&Pe&&((e=a=pt)&&(a=fS(a,n.pendingProps,zn),a!==null?(n.stateNode=a,Zt=n,pt=null,e=!0):e=!1),e||ia(n)),null;case 13:return Xg(e,n,a);case 4:return Oe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ei(n,null,l,a):Yt(e,n,l,a),n.child;case 11:return Hg(e,n,n.type,n.pendingProps,a);case 7:return Yt(e,n,n.pendingProps,a),n.child;case 8:return Yt(e,n,n.pendingProps.children,a),n.child;case 12:return Yt(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,oa(n,n.type,l.value),Yt(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,Ja(n),f=Kt(f),l=l(f),n.flags|=1,Yt(e,n,l,a),n.child;case 14:return qg(e,n,n.type,n.pendingProps,a);case 15:return Gg(e,n,n.type,n.pendingProps,a);case 19:return e0(e,n,a);case 31:return Ik(e,n,a);case 22:return Fg(e,n,a,n.pendingProps);case 24:return Ja(n),l=Kt(Ot),e===null?(f=Yu(),f===null&&(f=ut,m=Zu(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},Wu(n),oa(n,Ot,f)):((e.lanes&a)!==0&&(Xu(e,n),Yo(n,null,null,a),Ko()),f=e.memoizedState,m=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),oa(n,Ot,l)):(l=m.cache,oa(n,Ot,l),l!==f.cache&&Fu(n,[Ot],a,!0))),Yt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function Is(e){e.flags|=4}function Md(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(C0())e.flags|=8192;else throw Qa=Sl,Ju}else e.flags&=-16777217}function n0(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!vv(n))if(C0())e.flags|=8192;else throw Qa=Sl,Ju}function $l(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ce():536870912,e.lanes|=n,Qi|=n)}function tr(e,n){if(!Pe)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function mt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function Bk(e,n,a){var l=n.pendingProps;switch(Pu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(n),null;case 1:return mt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),As(Ot),bt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&($i(n)?Is(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Hu())),mt(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Is(n),m!==null?(mt(n),n0(n,m)):(mt(n),Md(n,f,null,l,a))):m?m!==e.memoizedState?(Is(n),mt(n),n0(n,m)):(mt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Is(n),mt(n),Md(n,f,e,l,a)),null;case 27:if(L(n),a=ve.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(!l){if(n.stateNode===null)throw Error(o(166));return mt(n),null}e=Ie.current,$i(n)?Oh(n):(e=cv(f,l,a),n.stateNode=e,Is(n))}return mt(n),null;case 5:if(L(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(!l){if(n.stateNode===null)throw Error(o(166));return mt(n),null}if(m=Ie.current,$i(n))Oh(n);else{var x=tc(ve.current);switch(m){case 1:m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=x.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?m.multiple=!0:l.size&&(m.size=l.size);break;default:m=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}m[ft]=n,m[Vt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)m.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=m;e:switch(Jt(m,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&&Is(n)}}return mt(n),Md(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(o(166));if(e=ve.current,$i(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=Zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[ft]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||X0(e.nodeValue,a)),e||ia(n,!0)}else e=tc(e).createTextNode(l),e[ft]=n,n.stateNode=e}return mt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=$i(n),a!==null){if(e===null){if(!l)throw Error(o(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[ft]=n}else Ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),e=!1}else a=Hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(Sn(n),n):(Sn(n),null);if((n.flags&128)!==0)throw Error(o(558))}return mt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=$i(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[ft]=n}else Ka(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;mt(n),f=!1}else f=Hu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(Sn(n),n):(Sn(n),null)}return Sn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),$l(n,n.updateQueue),mt(n),null);case 4:return bt(),e===null&&tf(n.stateNode.containerInfo),mt(n),null;case 10:return As(n.type),mt(n),null;case 19:if(je(At),l=n.memoizedState,l===null)return mt(n),null;if(f=(n.flags&128)!==0,m=l.rendering,m===null)if(f)tr(l,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=jl(e),m!==null){for(n.flags|=128,tr(l,!1),e=m.updateQueue,n.updateQueue=e,$l(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Ah(a,e),a=a.sibling;return Te(At,At.current&1|2),Pe&&Cs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Ce()>Gl&&(n.flags|=128,f=!0,tr(l,!1),n.lanes=4194304)}else{if(!f)if(e=jl(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,$l(n,e),tr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!Pe)return mt(n),null}else 2*Ce()-l.renderingStartTime>Gl&&a!==536870912&&(n.flags|=128,f=!0,tr(l,!1),n.lanes=4194304);l.isBackwards?(m.sibling=n.child,n.child=m):(e=l.last,e!==null?e.sibling=m:n.child=m,l.last=m)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Ce(),e.sibling=null,a=At.current,Te(At,f?a&1|2:a&1),Pe&&Cs(n,l.treeForkCount),e):(mt(n),null);case 22:case 23:return Sn(n),nd(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(mt(n),n.subtreeFlags&6&&(n.flags|=8192)):mt(n),a=n.updateQueue,a!==null&&$l(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&je(Wa),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),As(Ot),mt(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function Lk(e,n){switch(Pu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return As(Ot),bt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return L(n),null;case 31:if(n.memoizedState!==null){if(Sn(n),n.alternate===null)throw Error(o(340));Ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Sn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(o(340));Ka()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return je(At),null;case 4:return bt(),null;case 10:return As(n.type),null;case 22:case 23:return Sn(n),nd(),e!==null&&je(Wa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return As(Ot),null;case 25:return null;default:return null}}function s0(e,n){switch(Pu(n),n.tag){case 3:As(Ot),bt();break;case 26:case 27:case 5:L(n);break;case 4:bt();break;case 31:n.memoizedState!==null&&Sn(n);break;case 13:Sn(n);break;case 19:je(At);break;case 10:As(n.type);break;case 22:case 23:Sn(n),nd(),e!==null&&je(Wa);break;case 24:As(Ot)}}function nr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var m=a.create,x=a.inst;l=m(),x.destroy=l}a=a.next}while(a!==f)}}catch(T){at(n,n.return,T)}}function fa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&e)===e){var x=l.inst,T=x.destroy;if(T!==void 0){x.destroy=void 0,f=n;var M=a,H=T;try{H()}catch(J){at(f,M,J)}}}l=l.next}while(l!==m)}}catch(J){at(n,n.return,J)}}function a0(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Kh(n,a)}catch(l){at(e,e.return,l)}}}function i0(e,n,a){a.props=ni(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){at(e,n,l)}}function sr(e,n){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){at(e,n,f)}}function ps(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){at(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){at(e,n,f)}else a.current=null}function o0(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){at(e,e.return,f)}}function Id(e,n,a){try{var l=e.stateNode;iS(l,e.type,a,n),l[Vt]=n}catch(f){at(e,e.return,f)}}function r0(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ba(e.type)||e.tag===4}function Od(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||r0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ba(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bd(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=ws));else if(l!==4&&(l===27&&ba(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Bd(e,n,a),e=e.sibling;e!==null;)Bd(e,n,a),e=e.sibling}function Pl(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&ba(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Pl(e,n,a),e=e.sibling;e!==null;)Pl(e,n,a),e=e.sibling}function l0(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Jt(n,l,a),n[ft]=e,n[Vt]=a}catch(m){at(e,e.return,m)}}var Os=!1,zt=!1,Ld=!1,c0=typeof WeakSet=="function"?WeakSet:Set,qt=null;function zk(e,n){if(e=e.containerInfo,af=lc,e=xh(e),Au(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var x=0,T=-1,M=-1,H=0,J=0,X=e,F=null;t:for(;;){for(var K;X!==a||f!==0&&X.nodeType!==3||(T=x+f),X!==m||l!==0&&X.nodeType!==3||(M=x+l),X.nodeType===3&&(x+=X.nodeValue.length),(K=X.firstChild)!==null;)F=X,X=K;for(;;){if(X===e)break t;if(F===a&&++H===f&&(T=x),F===m&&++J===l&&(M=x),(K=X.nextSibling)!==null)break;X=F,F=X.parentNode}X=K}a=T===-1||M===-1?null:{start:T,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(of={focusedElem:e,selectionRange:a},lc=!1,qt=n;qt!==null;)if(n=qt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,qt=e;else for(;qt!==null;){switch(n=qt,m=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,a=n,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var he=ni(a.type,f);e=l.getSnapshotBeforeUpdate(he,m),l.__reactInternalSnapshotBeforeUpdate=e}catch(ke){at(a,a.return,ke)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)cf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":cf(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=n.sibling,e!==null){e.return=n.return,qt=e;break}qt=n.return}}function u0(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ls(e,a),l&4&&nr(5,a);break;case 1:if(Ls(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){at(a,a.return,x)}else{var f=ni(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){at(a,a.return,x)}}l&64&&a0(a),l&512&&sr(a,a.return);break;case 3:if(Ls(e,a),l&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{Kh(e,n)}catch(x){at(a,a.return,x)}}break;case 27:n===null&&l&4&&l0(a);case 26:case 5:Ls(e,a),n===null&&l&4&&o0(a),l&512&&sr(a,a.return);break;case 12:Ls(e,a);break;case 31:Ls(e,a),l&4&&p0(e,a);break;case 13:Ls(e,a),l&4&&m0(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Zk.bind(null,a),pS(e,a))));break;case 22:if(l=a.memoizedState!==null||Os,!l){n=n!==null&&n.memoizedState!==null||zt,f=Os;var m=zt;Os=l,(zt=n)&&!m?zs(e,a,(a.subtreeFlags&8772)!==0):Ls(e,a),Os=f,zt=m}break;case 30:break;default:Ls(e,a)}}function d0(e){var n=e.alternate;n!==null&&(e.alternate=null,d0(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&pu(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 _t=null,dn=!1;function Bs(e,n,a){for(a=a.child;a!==null;)f0(e,n,a),a=a.sibling}function f0(e,n,a){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(ta,a)}catch{}switch(a.tag){case 26:zt||ps(a,n),Bs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zt||ps(a,n);var l=_t,f=dn;ba(a.type)&&(_t=a.stateNode,dn=!1),Bs(e,n,a),fr(a.stateNode),_t=l,dn=f;break;case 5:zt||ps(a,n);case 6:if(l=_t,f=dn,_t=null,Bs(e,n,a),_t=l,dn=f,_t!==null)if(dn)try{(_t.nodeType===9?_t.body:_t.nodeName==="HTML"?_t.ownerDocument.body:_t).removeChild(a.stateNode)}catch(m){at(a,n,m)}else try{_t.removeChild(a.stateNode)}catch(m){at(a,n,m)}break;case 18:_t!==null&&(dn?(e=_t,av(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ro(e)):av(_t,a.stateNode));break;case 4:l=_t,f=dn,_t=a.stateNode.containerInfo,dn=!0,Bs(e,n,a),_t=l,dn=f;break;case 0:case 11:case 14:case 15:fa(2,a,n),zt||fa(4,a,n),Bs(e,n,a);break;case 1:zt||(ps(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&i0(a,n,l)),Bs(e,n,a);break;case 21:Bs(e,n,a);break;case 22:zt=(l=zt)||a.memoizedState!==null,Bs(e,n,a),zt=l;break;default:Bs(e,n,a)}}function p0(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ro(e)}catch(a){at(n,n.return,a)}}}function m0(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ro(e)}catch(a){at(n,n.return,a)}}function Uk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new c0),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new c0),n;default:throw Error(o(435,e.tag))}}function Vl(e,n){var a=Uk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=Kk.bind(null,e,l);l.then(f,f)}})}function fn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=e,x=n,T=x;e:for(;T!==null;){switch(T.tag){case 27:if(ba(T.type)){_t=T.stateNode,dn=!1;break e}break;case 5:_t=T.stateNode,dn=!1;break e;case 3:case 4:_t=T.stateNode.containerInfo,dn=!0;break e}T=T.return}if(_t===null)throw Error(o(160));f0(m,x,f),_t=null,dn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)h0(n,e),n=n.sibling}var Xn=null;function h0(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(n,e),pn(e),l&4&&(fa(3,e,e.return),nr(3,e),fa(5,e,e.return));break;case 1:fn(n,e),pn(e),l&512&&(zt||a===null||ps(a,a.return)),l&64&&Os&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=Xn;if(fn(n,e),pn(e),l&512&&(zt||a===null||ps(a,a.return)),l&4){var m=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[Ao]||m[ft]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),Jt(m,l,a),m[ft]=e,Ht(m),l=m;break e;case"link":var x=hv("link","href",f).get(l+(a.href||""));if(x){for(var T=0;T<x.length;T++)if(m=x[T],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(T,1);break t}}m=f.createElement(l),Jt(m,l,a),f.head.appendChild(m);break;case"meta":if(x=hv("meta","content",f).get(l+(a.content||""))){for(T=0;T<x.length;T++)if(m=x[T],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(T,1);break t}}m=f.createElement(l),Jt(m,l,a),f.head.appendChild(m);break;default:throw Error(o(468,l))}m[ft]=e,Ht(m),l=m}e.stateNode=l}else gv(f,e.type,e.stateNode);else e.stateNode=mv(f,l,e.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?gv(f,e.type,e.stateNode):mv(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Id(e,e.memoizedProps,a.memoizedProps)}break;case 27:fn(n,e),pn(e),l&512&&(zt||a===null||ps(a,a.return)),a!==null&&l&4&&Id(e,e.memoizedProps,a.memoizedProps);break;case 5:if(fn(n,e),pn(e),l&512&&(zt||a===null||ps(a,a.return)),e.flags&32){f=e.stateNode;try{Ai(f,"")}catch(he){at(e,e.return,he)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Id(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Ld=!0);break;case 6:if(fn(n,e),pn(e),l&4){if(e.stateNode===null)throw Error(o(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(he){at(e,e.return,he)}}break;case 3:if(ac=null,f=Xn,Xn=nc(n.containerInfo),fn(n,e),Xn=f,pn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{ro(n.containerInfo)}catch(he){at(e,e.return,he)}Ld&&(Ld=!1,g0(e));break;case 4:l=Xn,Xn=nc(e.stateNode.containerInfo),fn(n,e),pn(e),Xn=l;break;case 12:fn(n,e),pn(e);break;case 31:fn(n,e),pn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Vl(e,l)));break;case 13:fn(n,e),pn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ql=Ce()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Vl(e,l)));break;case 22:f=e.memoizedState!==null;var M=a!==null&&a.memoizedState!==null,H=Os,J=zt;if(Os=H||f,zt=J||M,fn(n,e),zt=J,Os=H,pn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||M||Os||zt||si(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){M=a=n;try{if(m=M.stateNode,f)x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{T=M.stateNode;var X=M.memoizedProps.style,F=X!=null&&X.hasOwnProperty("display")?X.display:null;T.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(he){at(M,M.return,he)}}}else if(n.tag===6){if(a===null){M=n;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(he){at(M,M.return,he)}}}else if(n.tag===18){if(a===null){M=n;try{var K=M.stateNode;f?iv(K,!0):iv(M.stateNode,!1)}catch(he){at(M,M.return,he)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Vl(e,a))));break;case 19:fn(n,e),pn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Vl(e,l)));break;case 30:break;case 21:break;default:fn(n,e),pn(e)}}function pn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(r0(l)){a=l;break}l=l.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var f=a.stateNode,m=Od(e);Pl(e,m,f);break;case 5:var x=a.stateNode;a.flags&32&&(Ai(x,""),a.flags&=-33);var T=Od(e);Pl(e,T,x);break;case 3:case 4:var M=a.stateNode.containerInfo,H=Od(e);Bd(e,H,M);break;default:throw Error(o(161))}}catch(J){at(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function g0(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;g0(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ls(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)u0(e,n.alternate,n),n=n.sibling}function si(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:fa(4,n,n.return),si(n);break;case 1:ps(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&i0(n,n.return,a),si(n);break;case 27:fr(n.stateNode);case 26:case 5:ps(n,n.return),si(n);break;case 22:n.memoizedState===null&&si(n);break;case 30:si(n);break;default:si(n)}e=e.sibling}}function zs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,m=n,x=m.flags;switch(m.tag){case 0:case 11:case 15:zs(f,m,a),nr(4,m);break;case 1:if(zs(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(H){at(l,l.return,H)}if(l=m,f=l.updateQueue,f!==null){var T=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)Zh(M[f],T)}catch(H){at(l,l.return,H)}}a&&x&64&&a0(m),sr(m,m.return);break;case 27:l0(m);case 26:case 5:zs(f,m,a),a&&l===null&&x&4&&o0(m),sr(m,m.return);break;case 12:zs(f,m,a);break;case 31:zs(f,m,a),a&&x&4&&p0(f,m);break;case 13:zs(f,m,a),a&&x&4&&m0(f,m);break;case 22:m.memoizedState===null&&zs(f,m,a),sr(m,m.return);break;case 30:break;default:zs(f,m,a)}n=n.sibling}}function zd(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ho(a))}function Ud(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ho(e))}function Qn(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)v0(e,n,a,l),n=n.sibling}function v0(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Qn(e,n,a,l),f&2048&&nr(9,n);break;case 1:Qn(e,n,a,l);break;case 3:Qn(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ho(e)));break;case 12:if(f&2048){Qn(e,n,a,l),e=n.stateNode;try{var m=n.memoizedProps,x=m.id,T=m.onPostCommit;typeof T=="function"&&T(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){at(n,n.return,M)}}else Qn(e,n,a,l);break;case 31:Qn(e,n,a,l);break;case 13:Qn(e,n,a,l);break;case 23:break;case 22:m=n.stateNode,x=n.alternate,n.memoizedState!==null?m._visibility&2?Qn(e,n,a,l):ar(e,n):m._visibility&2?Qn(e,n,a,l):(m._visibility|=2,Ji(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&zd(x,n);break;case 24:Qn(e,n,a,l),f&2048&&Ud(n.alternate,n);break;default:Qn(e,n,a,l)}}function Ji(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,x=n,T=a,M=l,H=x.flags;switch(x.tag){case 0:case 11:case 15:Ji(m,x,T,M,f),nr(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?Ji(m,x,T,M,f):ar(m,x):(J._visibility|=2,Ji(m,x,T,M,f)),f&&H&2048&&zd(x.alternate,x);break;case 24:Ji(m,x,T,M,f),f&&H&2048&&Ud(x.alternate,x);break;default:Ji(m,x,T,M,f)}n=n.sibling}}function ar(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:ar(a,l),f&2048&&zd(l.alternate,l);break;case 24:ar(a,l),f&2048&&Ud(l.alternate,l);break;default:ar(a,l)}n=n.sibling}}var ir=8192;function Wi(e,n,a){if(e.subtreeFlags&ir)for(e=e.child;e!==null;)y0(e,n,a),e=e.sibling}function y0(e,n,a){switch(e.tag){case 26:Wi(e,n,a),e.flags&ir&&e.memoizedState!==null&&wS(a,Xn,e.memoizedState,e.memoizedProps);break;case 5:Wi(e,n,a);break;case 3:case 4:var l=Xn;Xn=nc(e.stateNode.containerInfo),Wi(e,n,a),Xn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ir,ir=16777216,Wi(e,n,a),ir=l):Wi(e,n,a));break;default:Wi(e,n,a)}}function b0(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 or(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];qt=l,x0(l,e)}b0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)_0(e),e=e.sibling}function _0(e){switch(e.tag){case 0:case 11:case 15:or(e),e.flags&2048&&fa(9,e,e.return);break;case 3:or(e);break;case 12:or(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Hl(e)):or(e);break;default:or(e)}}function Hl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];qt=l,x0(l,e)}b0(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:fa(8,n,n.return),Hl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Hl(n));break;default:Hl(n)}e=e.sibling}}function x0(e,n){for(;qt!==null;){var a=qt;switch(a.tag){case 0:case 11:case 15:fa(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ho(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,qt=l;else e:for(a=e;qt!==null;){l=qt;var f=l.sibling,m=l.return;if(d0(l),l===a){qt=null;break e}if(f!==null){f.return=m,qt=f;break e}qt=m}}}var $k={getCacheForType:function(e){var n=Kt(Ot),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Kt(Ot).controller.signal}},Pk=typeof WeakMap=="function"?WeakMap:Map,Qe=0,ut=null,Be=null,Ue=0,st=0,Tn=null,pa=!1,Xi=!1,$d=!1,Us=0,wt=0,ma=0,ai=0,Pd=0,wn=0,Qi=0,rr=null,mn=null,Vd=!1,ql=0,k0=0,Gl=1/0,Fl=null,ha=null,$t=0,ga=null,eo=null,$s=0,Hd=0,qd=null,S0=null,lr=0,Gd=null;function Nn(){return(Qe&2)!==0&&Ue!==0?Ue&-Ue:B.T!==null?Wd():Ft()}function T0(){if(wn===0)if((Ue&536870912)===0||Pe){var e=$a;$a<<=1,($a&3932160)===0&&($a=262144),wn=e}else wn=536870912;return e=kn.current,e!==null&&(e.flags|=32),wn}function hn(e,n,a){(e===ut&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(to(e,0),va(e,Ue,wn,!1)),ze(e,a),((Qe&2)===0||e!==ut)&&(e===ut&&((Qe&2)===0&&(ai|=a),wt===4&&va(e,Ue,wn,!1)),ms(e))}function w0(e,n,a){if((Qe&6)!==0)throw Error(o(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||te(e,n),f=l?qk(e,n):Zd(e,n,!0),m=l;do{if(f===0){Xi&&!l&&va(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!Vk(a)){f=Zd(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var T=e;f=rr;var M=T.current.memoizedState.isDehydrated;if(M&&(to(T,x).flags|=256),x=Zd(T,x,!1),x!==2){if($d&&!M){T.errorRecoveryDisabledLanes|=m,ai|=m,f=4;break e}m=mn,mn=f,m!==null&&(mn===null?mn=m:mn.push.apply(mn,m))}f=x}if(m=!1,f!==2)continue}}if(f===1){to(e,0),va(e,n,0,!0);break}e:{switch(l=e,m=f,m){case 0:case 1:throw Error(o(345));case 4:if((n&4194048)!==n)break;case 6:va(l,n,wn,!pa);break e;case 2:mn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((n&62914560)===n&&(f=ql+300-Ce(),10<f)){if(va(l,n,wn,!pa),P(l,0,!0)!==0)break e;$s=n,l.timeoutHandle=nv(N0.bind(null,l,a,mn,Fl,Vd,n,wn,ai,Qi,pa,m,"Throttled",-0,0),f);break e}N0(l,a,mn,Fl,Vd,n,wn,ai,Qi,pa,m,null,-0,0)}}break}while(!0);ms(e)}function N0(e,n,a,l,f,m,x,T,M,H,J,X,F,K){if(e.timeoutHandle=-1,X=n.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ws},y0(n,m,X);var he=(m&62914560)===m?ql-Ce():(m&4194048)===m?k0-Ce():0;if(he=NS(X,he),he!==null){$s=m,e.cancelPendingCommit=he(I0.bind(null,e,n,m,a,l,f,x,T,M,J,X,null,F,K)),va(e,m,x,!H);return}}I0(e,n,m,a,l,f,x,T,M)}function Vk(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],m=f.getSnapshot;f=f.value;try{if(!_n(m(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function va(e,n,a,l){n&=~Pd,n&=~ai,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var m=31-en(f),x=1<<m;l[m]=-1,f&=~x}a!==0&&Ae(e,a,n)}function Zl(){return(Qe&6)===0?(cr(0),!1):!0}function Fd(){if(Be!==null){if(st===0)var e=Be.return;else e=Be,Es=Ya=null,ld(e),Gi=null,Go=0,e=Be;for(;e!==null;)s0(e.alternate,e),e=e.return;Be=null}}function to(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,lS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),$s=0,Fd(),ut=e,Be=a=js(e.current,null),Ue=n,st=0,Tn=null,pa=!1,Xi=te(e,n),$d=!1,Qi=wn=Pd=ai=ma=wt=0,mn=rr=null,Vd=!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-en(l),m=1<<f;n|=e[f],l&=~m}return Us=n,ml(),a}function j0(e,n){De=null,B.H=Qo,n===qi||n===kl?(n=Hh(),st=3):n===Ju?(n=Hh(),st=4):st=n===Td?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Tn=n,Be===null&&(wt=1,Bl(e,On(n,e.current)))}function C0(){var e=kn.current;return e===null?!0:(Ue&4194048)===Ue?Un===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?e===Un:!1}function E0(){var e=B.H;return B.H=Qo,e===null?Qo:e}function A0(){var e=B.A;return B.A=$k,e}function Kl(){wt=4,pa||(Ue&4194048)!==Ue&&kn.current!==null||(Xi=!0),(ma&134217727)===0&&(ai&134217727)===0||ut===null||va(ut,Ue,wn,!1)}function Zd(e,n,a){var l=Qe;Qe|=2;var f=E0(),m=A0();(ut!==e||Ue!==n)&&(Fl=null,to(e,n)),n=!1;var x=wt;e:do try{if(st!==0&&Be!==null){var T=Be,M=Tn;switch(st){case 8:Fd(),x=6;break e;case 3:case 2:case 9:case 6:kn.current===null&&(n=!0);var H=st;if(st=0,Tn=null,no(e,T,M,H),a&&Xi){x=0;break e}break;default:H=st,st=0,Tn=null,no(e,T,M,H)}}Hk(),x=wt;break}catch(J){j0(e,J)}while(!0);return n&&e.shellSuspendCounter++,Es=Ya=null,Qe=l,B.H=f,B.A=m,Be===null&&(ut=null,Ue=0,ml()),x}function Hk(){for(;Be!==null;)D0(Be)}function qk(e,n){var a=Qe;Qe|=2;var l=E0(),f=A0();ut!==e||Ue!==n?(Fl=null,Gl=Ce()+500,to(e,n)):Xi=te(e,n);e:do try{if(st!==0&&Be!==null){n=Be;var m=Tn;t:switch(st){case 1:st=0,Tn=null,no(e,n,m,1);break;case 2:case 9:if(Ph(m)){st=0,Tn=null,R0(n);break}n=function(){st!==2&&st!==9||ut!==e||(st=7),ms(e)},m.then(n,n);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:Ph(m)?(st=0,Tn=null,R0(n)):(st=0,Tn=null,no(e,n,m,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var T=Be;if(x?vv(x):T.stateNode.complete){st=0,Tn=null;var M=T.sibling;if(M!==null)Be=M;else{var H=T.return;H!==null?(Be=H,Yl(H)):Be=null}break t}}st=0,Tn=null,no(e,n,m,5);break;case 6:st=0,Tn=null,no(e,n,m,6);break;case 8:Fd(),wt=6;break e;default:throw Error(o(462))}}Gk();break}catch(J){j0(e,J)}while(!0);return Es=Ya=null,B.H=l,B.A=f,Qe=a,Be!==null?0:(ut=null,Ue=0,ml(),wt)}function Gk(){for(;Be!==null&&!Yn();)D0(Be)}function D0(e){var n=t0(e.alternate,e,Us);e.memoizedProps=e.pendingProps,n===null?Yl(e):Be=n}function R0(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Yg(a,n,n.pendingProps,n.type,void 0,Ue);break;case 11:n=Yg(a,n,n.pendingProps,n.type.render,n.ref,Ue);break;case 5:ld(n);default:s0(a,n),n=Be=Ah(n,Us),n=t0(a,n,Us)}e.memoizedProps=e.pendingProps,n===null?Yl(e):Be=n}function no(e,n,a,l){Es=Ya=null,ld(n),Gi=null,Go=0;var f=n.return;try{if(Mk(e,f,n,a,Ue)){wt=1,Bl(e,On(a,e.current)),Be=null;return}}catch(m){if(f!==null)throw Be=f,m;wt=1,Bl(e,On(a,e.current)),Be=null;return}n.flags&32768?(Pe||l===1?e=!0:Xi||(Ue&536870912)!==0?e=!1:(pa=e=!0,(l===2||l===9||l===3||l===6)&&(l=kn.current,l!==null&&l.tag===13&&(l.flags|=16384))),M0(n,e)):Yl(n)}function Yl(e){var n=e;do{if((n.flags&32768)!==0){M0(n,pa);return}e=n.return;var a=Bk(n.alternate,n,Us);if(a!==null){Be=a;return}if(n=n.sibling,n!==null){Be=n;return}Be=n=e}while(n!==null);wt===0&&(wt=5)}function M0(e,n){do{var a=Lk(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);wt=6,Be=null}function I0(e,n,a,l,f,m,x,T,M){e.cancelPendingCommit=null;do Jl();while($t!==0);if((Qe&6)!==0)throw Error(o(327));if(n!==null){if(n===e.current)throw Error(o(177));if(m=n.lanes|n.childLanes,m|=Ou,ye(e,a,m,x,T,M),e===ut&&(Be=ut=null,Ue=0),eo=n,ga=e,$s=a,Hd=m,qd=f,S0=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yk(us,function(){return U0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=Z.p,Z.p=2,x=Qe,Qe|=4;try{zk(e,n,a)}finally{Qe=x,Z.p=f,B.T=l}}$t=1,O0(),B0(),L0()}}function O0(){if($t===1){$t=0;var e=ga,n=eo,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{h0(n,e);var m=of,x=xh(e.containerInfo),T=m.focusedElem,M=m.selectionRange;if(x!==T&&T&&T.ownerDocument&&_h(T.ownerDocument.documentElement,T)){if(M!==null&&Au(T)){var H=M.start,J=M.end;if(J===void 0&&(J=H),"selectionStart"in T)T.selectionStart=H,T.selectionEnd=Math.min(J,T.value.length);else{var X=T.ownerDocument||document,F=X&&X.defaultView||window;if(F.getSelection){var K=F.getSelection(),he=T.textContent.length,ke=Math.min(M.start,he),rt=M.end===void 0?ke:Math.min(M.end,he);!K.extend&&ke>rt&&(x=rt,rt=ke,ke=x);var z=bh(T,ke),O=bh(T,rt);if(z&&O&&(K.rangeCount!==1||K.anchorNode!==z.node||K.anchorOffset!==z.offset||K.focusNode!==O.node||K.focusOffset!==O.offset)){var V=X.createRange();V.setStart(z.node,z.offset),K.removeAllRanges(),ke>rt?(K.addRange(V),K.extend(O.node,O.offset)):(V.setEnd(O.node,O.offset),K.addRange(V))}}}}for(X=[],K=T;K=K.parentNode;)K.nodeType===1&&X.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<X.length;T++){var W=X[T];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}lc=!!af,of=af=null}finally{Qe=f,Z.p=l,B.T=a}}e.current=n,$t=2}}function B0(){if($t===2){$t=0;var e=ga,n=eo,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{u0(e,n.alternate,n)}finally{Qe=f,Z.p=l,B.T=a}}$t=3}}function L0(){if($t===4||$t===3){$t=0,Ne();var e=ga,n=eo,a=$s,l=S0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,eo=ga=null,z0(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(ha=null),Ut(a),n=n.stateNode,Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(ta,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=B.T,f=Z.p,Z.p=2,B.T=null;try{for(var m=e.onRecoverableError,x=0;x<l.length;x++){var T=l[x];m(T.value,{componentStack:T.stack})}}finally{B.T=n,Z.p=f}}($s&3)!==0&&Jl(),ms(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Gd?lr++:(lr=0,Gd=e):lr=0,cr(0)}}function z0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Ho(n)))}function Jl(){return O0(),B0(),L0(),U0()}function U0(){if($t!==5)return!1;var e=ga,n=Hd;Hd=0;var a=Ut($s),l=B.T,f=Z.p;try{Z.p=32>a?32:a,B.T=null,a=qd,qd=null;var m=ga,x=$s;if($t=0,eo=ga=null,$s=0,(Qe&6)!==0)throw Error(o(331));var T=Qe;if(Qe|=4,_0(m.current),v0(m,m.current,x,a),Qe=T,cr(0,!1),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(ta,m)}catch{}return!0}finally{Z.p=f,B.T=l,z0(e,n)}}function $0(e,n,a){n=On(a,n),n=Sd(e.stateNode,n,2),e=ca(e,n,2),e!==null&&(ze(e,2),ms(e))}function at(e,n,a){if(e.tag===3)$0(e,e,a);else for(;n!==null;){if(n.tag===3){$0(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ha===null||!ha.has(l))){e=On(a,e),a=Pg(2),l=ca(n,a,2),l!==null&&(Vg(a,l,n,e),ze(l,2),ms(l));break}}n=n.return}}function Kd(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Pk;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||($d=!0,f.add(a),e=Fk.bind(null,e,n,a),n.then(e,e))}function Fk(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ut===e&&(Ue&a)===a&&(wt===4||wt===3&&(Ue&62914560)===Ue&&300>Ce()-ql?(Qe&2)===0&&to(e,0):Pd|=a,Qi===Ue&&(Qi=0)),ms(e)}function P0(e,n){n===0&&(n=ce()),e=Fa(e,n),e!==null&&(ze(e,n),ms(e))}function Zk(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),P0(e,a)}function Kk(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(o(314))}l!==null&&l.delete(n),P0(e,a)}function Yk(e,n){return cs(e,n)}var Wl=null,so=null,Yd=!1,Xl=!1,Jd=!1,ya=0;function ms(e){e!==so&&e.next===null&&(so===null?Wl=so=e:so=so.next=e),Xl=!0,Yd||(Yd=!0,Wk())}function cr(e,n){if(!Jd&&Xl){Jd=!0;do for(var a=!1,l=Wl;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var x=l.suspendedLanes,T=l.pingedLanes;m=(1<<31-en(42|e)+1)-1,m&=f&~(x&~T),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,G0(l,m))}else m=Ue,m=P(l,l===ut?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||te(l,m)||(a=!0,G0(l,m));l=l.next}while(a);Jd=!1}}function Jk(){V0()}function V0(){Xl=Yd=!1;var e=0;ya!==0&&rS()&&(e=ya);for(var n=Ce(),a=null,l=Wl;l!==null;){var f=l.next,m=H0(l,n);m===0?(l.next=null,a===null?Wl=f:a.next=f,f===null&&(so=a)):(a=l,(e!==0||(m&3)!==0)&&(Xl=!0)),l=f}$t!==0&&$t!==5||cr(e),ya!==0&&(ya=0)}function H0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var x=31-en(m),T=1<<x,M=f[x];M===-1?((T&a)===0||(T&l)!==0)&&(f[x]=oe(T,n)):M<=n&&(e.expiredLanes|=T),m&=~T}if(n=ut,a=Ue,a=P(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(st===2||st===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ea(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||te(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&ea(l),Ut(a)){case 2:case 8:a=ks;break;case 32:a=us;break;case 268435456:a=za;break;default:a=us}return l=q0.bind(null,e),a=cs(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&ea(l),e.callbackPriority=2,e.callbackNode=null,2}function q0(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Jl()&&e.callbackNode!==a)return null;var l=Ue;return l=P(e,e===ut?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(w0(e,l,n),H0(e,Ce()),e.callbackNode!=null&&e.callbackNode===a?q0.bind(null,e):null)}function G0(e,n){if(Jl())return null;w0(e,n,!0)}function Wk(){cS(function(){(Qe&6)!==0?cs(bn,Jk):V0()})}function Wd(){if(ya===0){var e=Vi;e===0&&(e=Ua,Ua<<=1,(Ua&261888)===0&&(Ua=256)),ya=e}return ya}function F0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ol(""+e)}function Z0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function Xk(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=F0((f[Vt]||null).action),x=l.submitter;x&&(n=(n=x[Vt]||null)?F0(n.formAction):x.getAttribute("formAction"),n!==null&&(m=n,x=null));var T=new ul("action","action",null,l,f);e.push({event:T,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ya!==0){var M=x?Z0(f,x):new FormData(f);vd(a,{pending:!0,data:M,method:f.method,action:m},null,M)}}else typeof m=="function"&&(T.preventDefault(),M=x?Z0(f,x):new FormData(f),vd(a,{pending:!0,data:M,method:f.method,action:m},m,M))},currentTarget:f}]})}}for(var Xd=0;Xd<Iu.length;Xd++){var Qd=Iu[Xd],Qk=Qd.toLowerCase(),eS=Qd[0].toUpperCase()+Qd.slice(1);Wn(Qk,"on"+eS)}Wn(Th,"onAnimationEnd"),Wn(wh,"onAnimationIteration"),Wn(Nh,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(gk,"onTransitionRun"),Wn(vk,"onTransitionStart"),Wn(yk,"onTransitionCancel"),Wn(jh,"onTransitionEnd"),Ci("onMouseEnter",["mouseout","mouseover"]),Ci("onMouseLeave",["mouseout","mouseover"]),Ci("onPointerEnter",["pointerout","pointerover"]),Ci("onPointerLeave",["pointerout","pointerover"]),Va("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Va("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Va("onBeforeInput",["compositionend","keypress","textInput","paste"]),Va("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Va("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ur="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(" "),tS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ur));function K0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var m=void 0;if(n)for(var x=l.length-1;0<=x;x--){var T=l[x],M=T.instance,H=T.currentTarget;if(T=T.listener,M!==m&&f.isPropagationStopped())break e;m=T,f.currentTarget=H;try{m(f)}catch(J){pl(J)}f.currentTarget=null,m=M}else for(x=0;x<l.length;x++){if(T=l[x],M=T.instance,H=T.currentTarget,T=T.listener,M!==m&&f.isPropagationStopped())break e;m=T,f.currentTarget=H;try{m(f)}catch(J){pl(J)}f.currentTarget=null,m=M}}}}function Le(e,n){var a=n[fu];a===void 0&&(a=n[fu]=new Set);var l=e+"__bubble";a.has(l)||(Y0(n,e,2,!1),a.add(l))}function ef(e,n,a){var l=0;n&&(l|=4),Y0(a,e,l,n)}var Ql="_reactListening"+Math.random().toString(36).slice(2);function tf(e){if(!e[Ql]){e[Ql]=!0,Vm.forEach(function(a){a!=="selectionchange"&&(tS.has(a)||ef(a,!1,e),ef(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ql]||(n[Ql]=!0,ef("selectionchange",!1,n))}}function Y0(e,n,a,l){switch(Tv(n)){case 2:var f=ES;break;case 8:f=AS;break;default:f=vf}a=f.bind(null,n,a,e),f=void 0,!xu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function nf(e,n,a,l,f){var m=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 T=l.stateNode.containerInfo;if(T===f)break;if(x===4)for(x=l.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;T!==null;){if(x=wi(T),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){l=m=x;continue e}T=T.parentNode}}l=l.return}eh(function(){var H=m,J=bu(a),X=[];e:{var F=Ch.get(e);if(F!==void 0){var K=ul,he=e;switch(e){case"keypress":if(ll(a)===0)break e;case"keydown":case"keyup":K=Kx;break;case"focusin":he="focus",K=wu;break;case"focusout":he="blur",K=wu;break;case"beforeblur":case"afterblur":K=wu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=sh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Bx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=Wx;break;case Th:case wh:case Nh:K=Ux;break;case jh:K=Qx;break;case"scroll":case"scrollend":K=Ix;break;case"wheel":K=tk;break;case"copy":case"cut":case"paste":K=Px;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=ih;break;case"toggle":case"beforetoggle":K=sk}var ke=(n&4)!==0,rt=!ke&&(e==="scroll"||e==="scrollend"),z=ke?F!==null?F+"Capture":null:F;ke=[];for(var O=H,V;O!==null;){var W=O;if(V=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||V===null||z===null||(W=Ro(O,z),W!=null&&ke.push(dr(O,W,V))),rt)break;O=O.return}0<ke.length&&(F=new K(F,he,null,a,J),X.push({event:F,listeners:ke}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==yu&&(he=a.relatedTarget||a.fromElement)&&(wi(he)||he[Ti]))break e;if((K||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,K?(he=a.relatedTarget||a.toElement,K=H,he=he?wi(he):null,he!==null&&(rt=u(he),ke=he.tag,he!==rt||ke!==5&&ke!==27&&ke!==6)&&(he=null)):(K=null,he=H),K!==he)){if(ke=sh,W="onMouseLeave",z="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(ke=ih,W="onPointerLeave",z="onPointerEnter",O="pointer"),rt=K==null?F:Do(K),V=he==null?F:Do(he),F=new ke(W,O+"leave",K,a,J),F.target=rt,F.relatedTarget=V,W=null,wi(J)===H&&(ke=new ke(z,O+"enter",he,a,J),ke.target=V,ke.relatedTarget=rt,W=ke),rt=W,K&&he)t:{for(ke=nS,z=K,O=he,V=0,W=z;W;W=ke(W))V++;W=0;for(var be=O;be;be=ke(be))W++;for(;0<V-W;)z=ke(z),V--;for(;0<W-V;)O=ke(O),W--;for(;V--;){if(z===O||O!==null&&z===O.alternate){ke=z;break t}z=ke(z),O=ke(O)}ke=null}else ke=null;K!==null&&J0(X,F,K,ke,!1),he!==null&&rt!==null&&J0(X,rt,he,ke,!0)}}e:{if(F=H?Do(H):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var Ke=ph;else if(dh(F))if(mh)Ke=pk;else{Ke=dk;var ge=uk}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&vu(H.elementType)&&(Ke=ph):Ke=fk;if(Ke&&(Ke=Ke(e,H))){fh(X,Ke,a,J);break e}ge&&ge(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&gu(F,"number",F.value)}switch(ge=H?Do(H):window,e){case"focusin":(dh(ge)||ge.contentEditable==="true")&&(Ii=ge,Du=H,$o=null);break;case"focusout":$o=Du=Ii=null;break;case"mousedown":Ru=!0;break;case"contextmenu":case"mouseup":case"dragend":Ru=!1,kh(X,a,J);break;case"selectionchange":if(hk)break;case"keydown":case"keyup":kh(X,a,J)}var Re;if(ju)e:{switch(e){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Mi?ch(e,a)&&($e="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&($e="onCompositionStart");$e&&(oh&&a.locale!=="ko"&&(Mi||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Mi&&(Re=th()):(na=J,ku="value"in na?na.value:na.textContent,Mi=!0)),ge=ec(H,$e),0<ge.length&&($e=new ah($e,e,null,a,J),X.push({event:$e,listeners:ge}),Re?$e.data=Re:(Re=uh(a),Re!==null&&($e.data=Re)))),(Re=ik?ok(e,a):rk(e,a))&&($e=ec(H,"onBeforeInput"),0<$e.length&&(ge=new ah("onBeforeInput","beforeinput",null,a,J),X.push({event:ge,listeners:$e}),ge.data=Re)),Xk(X,e,H,a,J)}K0(X,n)})}function dr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function ec(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=Ro(e,a),f!=null&&l.unshift(dr(e,f,m)),f=Ro(e,n),f!=null&&l.push(dr(e,f,m))),e.tag===3)return l;e=e.return}return[]}function nS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function J0(e,n,a,l,f){for(var m=n._reactName,x=[];a!==null&&a!==l;){var T=a,M=T.alternate,H=T.stateNode;if(T=T.tag,M!==null&&M===l)break;T!==5&&T!==26&&T!==27||H===null||(M=H,f?(H=Ro(a,m),H!=null&&x.unshift(dr(a,H,M))):f||(H=Ro(a,m),H!=null&&x.push(dr(a,H,M)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var sS=/\r\n?/g,aS=/\u0000|\uFFFD/g;function W0(e){return(typeof e=="string"?e:""+e).replace(sS,`
26
- `).replace(aS,"")}function X0(e,n){return n=W0(n),W0(e)===n}function ot(e,n,a,l,f,m){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ai(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ai(e,""+l);break;case"className":al(e,"class",l);break;case"tabIndex":al(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":al(e,a,l);break;case"style":Xm(e,l,m);break;case"data":if(n!=="object"){al(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ol(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof m=="function"&&(a==="formAction"?(n!=="input"&&ot(e,n,"name",f.name,f,null),ot(e,n,"formEncType",f.formEncType,f,null),ot(e,n,"formMethod",f.formMethod,f,null),ot(e,n,"formTarget",f.formTarget,f,null)):(ot(e,n,"encType",f.encType,f,null),ot(e,n,"method",f.method,f,null),ot(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ol(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ws);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=ol(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":Le("beforetoggle",e),Le("toggle",e),sl(e,"popover",l);break;case"xlinkActuate":Ts(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ts(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ts(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ts(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ts(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ts(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":sl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Rx.get(a)||a,sl(e,a,l))}}function sf(e,n,a,l,f,m){switch(a){case"style":Xm(e,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Ai(e,l):(typeof l=="number"||typeof l=="bigint")&&Ai(e,""+l);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("scrollend",e);break;case"onClick":l!=null&&(e.onclick=ws);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),m=e[Vt]||null,m=m!=null?m[a]:null,typeof m=="function"&&e.removeEventListener(n,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):sl(e,a,l)}}}function Jt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var l=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var x=a[m];if(x!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:ot(e,n,m,x,a,null)}}f&&ot(e,n,"srcSet",a.srcSet,a,null),l&&ot(e,n,"src",a.src,a,null);return;case"input":Le("invalid",e);var T=m=x=f=null,M=null,H=null;for(l in a)if(a.hasOwnProperty(l)){var J=a[l];if(J!=null)switch(l){case"name":f=J;break;case"type":x=J;break;case"checked":M=J;break;case"defaultChecked":H=J;break;case"value":m=J;break;case"defaultValue":T=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,n));break;default:ot(e,n,l,J,a,null)}}Km(e,m,T,M,H,x,f,!1);return;case"select":Le("invalid",e),l=x=m=null;for(f in a)if(a.hasOwnProperty(f)&&(T=a[f],T!=null))switch(f){case"value":m=T;break;case"defaultValue":x=T;break;case"multiple":l=T;default:ot(e,n,f,T,a,null)}n=m,a=x,e.multiple=!!l,n!=null?Ei(e,!!l,n,!1):a!=null&&Ei(e,!!l,a,!0);return;case"textarea":Le("invalid",e),m=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(T=a[x],T!=null))switch(x){case"value":l=T;break;case"defaultValue":f=T;break;case"children":m=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(o(91));break;default:ot(e,n,x,T,a,null)}Jm(e,l,f,m);return;case"option":for(M in a)if(a.hasOwnProperty(M)&&(l=a[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ot(e,n,M,l,a,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(l=0;l<ur.length;l++)Le(ur[l],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("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(H in a)if(a.hasOwnProperty(H)&&(l=a[H],l!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:ot(e,n,H,l,a,null)}return;default:if(vu(n)){for(J in a)a.hasOwnProperty(J)&&(l=a[J],l!==void 0&&sf(e,n,J,l,a,void 0));return}}for(T in a)a.hasOwnProperty(T)&&(l=a[T],l!=null&&ot(e,n,T,l,a,null))}function iS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,x=null,T=null,M=null,H=null,J=null;for(K in a){var X=a[K];if(a.hasOwnProperty(K)&&X!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=X;default:l.hasOwnProperty(K)||ot(e,n,K,null,l,X)}}for(var F in l){var K=l[F];if(X=a[F],l.hasOwnProperty(F)&&(K!=null||X!=null))switch(F){case"type":m=K;break;case"name":f=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":T=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,n));break;default:K!==X&&ot(e,n,F,K,l,X)}}hu(e,x,T,M,H,J,m,f);return;case"select":K=x=T=F=null;for(m in a)if(M=a[m],a.hasOwnProperty(m)&&M!=null)switch(m){case"value":break;case"multiple":K=M;default:l.hasOwnProperty(m)||ot(e,n,m,null,l,M)}for(f in l)if(m=l[f],M=a[f],l.hasOwnProperty(f)&&(m!=null||M!=null))switch(f){case"value":F=m;break;case"defaultValue":T=m;break;case"multiple":x=m;default:m!==M&&ot(e,n,f,m,l,M)}n=T,a=x,l=K,F!=null?Ei(e,!!a,F,!1):!!l!=!!a&&(n!=null?Ei(e,!!a,n,!0):Ei(e,!!a,a?[]:"",!1));return;case"textarea":K=F=null;for(T in a)if(f=a[T],a.hasOwnProperty(T)&&f!=null&&!l.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:ot(e,n,T,null,l,f)}for(x in l)if(f=l[x],m=a[x],l.hasOwnProperty(x)&&(f!=null||m!=null))switch(x){case"value":F=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==m&&ot(e,n,x,f,l,m)}Ym(e,F,K);return;case"option":for(var he in a)if(F=a[he],a.hasOwnProperty(he)&&F!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:ot(e,n,he,null,l,F)}for(M in l)if(F=l[M],K=a[M],l.hasOwnProperty(M)&&F!==K&&(F!=null||K!=null))switch(M){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ot(e,n,M,F,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ke in a)F=a[ke],a.hasOwnProperty(ke)&&F!=null&&!l.hasOwnProperty(ke)&&ot(e,n,ke,null,l,F);for(H in l)if(F=l[H],K=a[H],l.hasOwnProperty(H)&&F!==K&&(F!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(o(137,n));break;default:ot(e,n,H,F,l,K)}return;default:if(vu(n)){for(var rt in a)F=a[rt],a.hasOwnProperty(rt)&&F!==void 0&&!l.hasOwnProperty(rt)&&sf(e,n,rt,void 0,l,F);for(J in l)F=l[J],K=a[J],!l.hasOwnProperty(J)||F===K||F===void 0&&K===void 0||sf(e,n,J,F,l,K);return}}for(var z in a)F=a[z],a.hasOwnProperty(z)&&F!=null&&!l.hasOwnProperty(z)&&ot(e,n,z,null,l,F);for(X in l)F=l[X],K=a[X],!l.hasOwnProperty(X)||F===K||F==null&&K==null||ot(e,n,X,F,l,K)}function Q0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],m=f.transferSize,x=f.initiatorType,T=f.duration;if(m&&T&&Q0(x)){for(x=0,T=f.responseEnd,l+=1;l<a.length;l++){var M=a[l],H=M.startTime;if(H>T)break;var J=M.transferSize,X=M.initiatorType;J&&Q0(X)&&(M=M.responseEnd,x+=J*(M<T?1:(T-H)/(M-H)))}if(--l,n+=8*(m+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 af=null,of=null;function tc(e){return e.nodeType===9?e:e.ownerDocument}function ev(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tv(e,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 rf(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 lf=null;function rS(){var e=window.event;return e&&e.type==="popstate"?e===lf?!1:(lf=e,!0):(lf=null,!1)}var nv=typeof setTimeout=="function"?setTimeout:void 0,lS=typeof clearTimeout=="function"?clearTimeout:void 0,sv=typeof Promise=="function"?Promise:void 0,cS=typeof queueMicrotask=="function"?queueMicrotask:typeof sv<"u"?function(e){return sv.resolve(null).then(e).catch(uS)}:nv;function uS(e){setTimeout(function(){throw e})}function ba(e){return e==="head"}function av(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),ro(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")fr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,fr(a);for(var m=a.firstChild;m;){var x=m.nextSibling,T=m.nodeName;m[Ao]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=x}}else a==="body"&&fr(e.ownerDocument.body);a=f}while(a);ro(n)}function iv(e,n){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function cf(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":cf(a),pu(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function dS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Ao])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==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(m=e.getAttribute("src"),(m!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=$n(e.nextSibling),e===null)break}return null}function fS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=$n(e.nextSibling),e===null))return null;return e}function ov(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=$n(e.nextSibling),e===null))return null;return e}function uf(e){return e.data==="$?"||e.data==="$~"}function df(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function pS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function $n(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 ff=null;function rv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return $n(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function lv(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function cv(e,n,a){switch(n=tc(a),e){case"html":if(e=n.documentElement,!e)throw Error(o(452));return e;case"head":if(e=n.head,!e)throw Error(o(453));return e;case"body":if(e=n.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function fr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);pu(e)}var Pn=new Map,uv=new Set;function nc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ps=Z.d;Z.d={f:mS,r:hS,D:gS,C:vS,L:yS,m:bS,X:xS,S:_S,M:kS};function mS(){var e=Ps.f(),n=Zl();return e||n}function hS(e){var n=Ni(e);n!==null&&n.tag===5&&n.type==="form"?jg(n):Ps.r(e)}var ao=typeof document>"u"?null:document;function dv(e,n,a){var l=ao;if(l&&typeof n=="string"&&n){var f=Mn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),uv.has(f)||(uv.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Jt(n,"link",e),Ht(n),l.head.appendChild(n)))}}function gS(e){Ps.D(e),dv("dns-prefetch",e,null)}function vS(e,n){Ps.C(e,n),dv("preconnect",e,n)}function yS(e,n,a){Ps.L(e,n,a);var l=ao;if(l&&e&&n){var f='link[rel="preload"][as="'+Mn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Mn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Mn(a.imageSizes)+'"]')):f+='[href="'+Mn(e)+'"]';var m=f;switch(n){case"style":m=io(e);break;case"script":m=oo(e)}Pn.has(m)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Pn.set(m,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(pr(m))||n==="script"&&l.querySelector(mr(m))||(n=l.createElement("link"),Jt(n,"link",e),Ht(n),l.head.appendChild(n)))}}function bS(e,n){Ps.m(e,n);var a=ao;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Mn(l)+'"][href="'+Mn(e)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=oo(e)}if(!Pn.has(m)&&(e=y({rel:"modulepreload",href:e},n),Pn.set(m,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(mr(m)))return}l=a.createElement("link"),Jt(l,"link",e),Ht(l),a.head.appendChild(l)}}}function _S(e,n,a){Ps.S(e,n,a);var l=ao;if(l&&e){var f=ji(l).hoistableStyles,m=io(e);n=n||"default";var x=f.get(m);if(!x){var T={loading:0,preload:null};if(x=l.querySelector(pr(m)))T.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Pn.get(m))&&pf(e,a);var M=x=l.createElement("link");Ht(M),Jt(M,"link",e),M._p=new Promise(function(H,J){M.onload=H,M.onerror=J}),M.addEventListener("load",function(){T.loading|=1}),M.addEventListener("error",function(){T.loading|=2}),T.loading|=4,sc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:T},f.set(m,x)}}}function xS(e,n){Ps.X(e,n);var a=ao;if(a&&e){var l=ji(a).hoistableScripts,f=oo(e),m=l.get(f);m||(m=a.querySelector(mr(f)),m||(e=y({src:e,async:!0},n),(n=Pn.get(f))&&mf(e,n),m=a.createElement("script"),Ht(m),Jt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function kS(e,n){Ps.M(e,n);var a=ao;if(a&&e){var l=ji(a).hoistableScripts,f=oo(e),m=l.get(f);m||(m=a.querySelector(mr(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=Pn.get(f))&&mf(e,n),m=a.createElement("script"),Ht(m),Jt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function fv(e,n,a,l){var f=(f=ve.current)?nc(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=io(a.href),a=ji(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=io(a.href);var m=ji(f).hoistableStyles,x=m.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,x),(m=f.querySelector(pr(e)))&&!m._p&&(x.instance=m,x.state.loading=5),Pn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Pn.set(e,a),m||SS(f,e,a,x.state))),n&&l===null)throw Error(o(528,""));return x}if(n&&l!==null)throw Error(o(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=oo(a),a=ji(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function io(e){return'href="'+Mn(e)+'"'}function pr(e){return'link[rel="stylesheet"]['+e+"]"}function pv(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function SS(e,n,a,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),Jt(n,"link",a),Ht(n),e.head.appendChild(n))}function oo(e){return'[src="'+Mn(e)+'"]'}function mr(e){return"script[async]"+e}function mv(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Mn(a.href)+'"]');if(l)return n.instance=l,Ht(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ht(l),Jt(l,"style",f),sc(l,a.precedence,e),n.instance=l;case"stylesheet":f=io(a.href);var m=e.querySelector(pr(f));if(m)return n.state.loading|=4,n.instance=m,Ht(m),m;l=pv(a),(f=Pn.get(f))&&pf(l,f),m=(e.ownerDocument||e).createElement("link"),Ht(m);var x=m;return x._p=new Promise(function(T,M){x.onload=T,x.onerror=M}),Jt(m,"link",l),n.state.loading|=4,sc(m,a.precedence,e),n.instance=m;case"script":return m=oo(a.src),(f=e.querySelector(mr(m)))?(n.instance=f,Ht(f),f):(l=a,(f=Pn.get(m))&&(l=y({},a),mf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Ht(f),Jt(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(o(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,sc(l,a.precedence,e));return n.instance}function sc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,x=0;x<l.length;x++){var T=l[x];if(T.dataset.precedence===n)m=T;else if(m!==f)break}m?m.parentNode.insertBefore(e,m.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function pf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function mf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var ac=null;function hv(e,n,a){if(ac===null){var l=new Map,f=ac=new Map;f.set(a,l)}else f=ac,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var m=a[f];if(!(m[Ao]||m[ft]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var x=m.getAttribute(n)||"";x=e+x;var T=l.get(x);T?T.push(m):l.set(x,[m])}}return l}function gv(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function TS(e,n,a){if(a===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function vv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function wS(e,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=io(l.href),m=n.querySelector(pr(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ic.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Ht(m);return}m=n.ownerDocument||n,l=pv(l),(f=Pn.get(f))&&pf(l,f),m=m.createElement("link"),Ht(m);var x=m;x._p=new Promise(function(T,M){x.onload=T,x.onerror=M}),Jt(m,"link",l),a.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=ic.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var hf=0;function NS(e,n){return e.stylesheets&&e.count===0&&rc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&rc(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&hf===0&&(hf=62500*oS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&rc(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>hf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function ic(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var oc=null;function rc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oc=new Map,n.forEach(jS,e),oc=null,ic.call(e))}function jS(e,n){if(!(n.state.loading&4)){var a=oc.get(e);if(a)var l=a.get(null);else{a=new Map,oc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var x=f[m];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),m=a.get(x)||l,m===l&&a.set(null,f),a.set(x,f),this.count++,l=ic.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var hr={$$typeof:E,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function CS(e,n,a,l,f,m,x,T,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fe(0),this.hiddenUpdates=fe(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function yv(e,n,a,l,f,m,x,T,M,H,J,X){return e=new CS(e,n,a,x,M,H,J,X,T),n=1,m===!0&&(n|=24),m=xn(3,null,null,n),e.current=m,m.stateNode=e,n=Zu(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},Wu(m),e}function bv(e){return e?(e=Li,e):Li}function _v(e,n,a,l,f,m){f=bv(f),l.context===null?l.context=f:l.pendingContext=f,l=la(n),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=ca(e,l,n),a!==null&&(hn(a,e,n),Zo(a,e,n))}function xv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function gf(e,n){xv(e,n),(e=e.alternate)&&xv(e,n)}function kv(e){if(e.tag===13||e.tag===31){var n=Fa(e,67108864);n!==null&&hn(n,e,67108864),gf(e,67108864)}}function Sv(e){if(e.tag===13||e.tag===31){var n=Nn();n=Fe(n);var a=Fa(e,n);a!==null&&hn(a,e,n),gf(e,n)}}var lc=!0;function ES(e,n,a,l){var f=B.T;B.T=null;var m=Z.p;try{Z.p=2,vf(e,n,a,l)}finally{Z.p=m,B.T=f}}function AS(e,n,a,l){var f=B.T;B.T=null;var m=Z.p;try{Z.p=8,vf(e,n,a,l)}finally{Z.p=m,B.T=f}}function vf(e,n,a,l){if(lc){var f=yf(l);if(f===null)nf(e,n,l,cc,a),wv(e,l);else if(RS(f,e,n,a,l))l.stopPropagation();else if(wv(e,l),n&4&&-1<DS.indexOf(e)){for(;f!==null;){var m=Ni(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=Ss(m.pendingLanes);if(x!==0){var T=m;for(T.pendingLanes|=2,T.entangledLanes|=2;x;){var M=1<<31-en(x);T.entanglements[1]|=M,x&=~M}ms(m),(Qe&6)===0&&(Gl=Ce()+500,cr(0))}}break;case 31:case 13:T=Fa(m,2),T!==null&&hn(T,m,2),Zl(),gf(m,2)}if(m=yf(l),m===null&&nf(e,n,l,cc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else nf(e,n,l,null,a)}}function yf(e){return e=bu(e),bf(e)}var cc=null;function bf(e){if(cc=null,e=wi(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return cc=e,null}function Tv(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(cn()){case bn:return 2;case ks:return 8;case us:case ki:return 32;case za:return 268435456;default:return 32}default:return 32}}var _f=!1,_a=null,xa=null,ka=null,gr=new Map,vr=new Map,Sa=[],DS="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 wv(e,n){switch(e){case"focusin":case"focusout":_a=null;break;case"dragenter":case"dragleave":xa=null;break;case"mouseover":case"mouseout":ka=null;break;case"pointerover":case"pointerout":gr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":vr.delete(n.pointerId)}}function yr(e,n,a,l,f,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},n!==null&&(n=Ni(n),n!==null&&kv(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function RS(e,n,a,l,f){switch(n){case"focusin":return _a=yr(_a,e,n,a,l,f),!0;case"dragenter":return xa=yr(xa,e,n,a,l,f),!0;case"mouseover":return ka=yr(ka,e,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return gr.set(m,yr(gr.get(m)||null,e,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,vr.set(m,yr(vr.get(m)||null,e,n,a,l,f)),!0}return!1}function Nv(e){var n=wi(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Et(e.priority,function(){Sv(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Et(e.priority,function(){Sv(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function uc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=yf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);yu=l,a.target.dispatchEvent(l),yu=null}else return n=Ni(a),n!==null&&kv(n),e.blockedOn=a,!1;n.shift()}return!0}function jv(e,n,a){uc(e)&&a.delete(n)}function MS(){_f=!1,_a!==null&&uc(_a)&&(_a=null),xa!==null&&uc(xa)&&(xa=null),ka!==null&&uc(ka)&&(ka=null),gr.forEach(jv),vr.forEach(jv)}function dc(e,n){e.blockedOn===n&&(e.blockedOn=null,_f||(_f=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,MS)))}var fc=null;function Cv(e){fc!==e&&(fc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){fc===e&&(fc=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(bf(l||a)===null)continue;break}var m=Ni(a);m!==null&&(e.splice(n,3),n-=3,vd(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function ro(e){function n(M){return dc(M,e)}_a!==null&&dc(_a,e),xa!==null&&dc(xa,e),ka!==null&&dc(ka,e),gr.forEach(n),vr.forEach(n);for(var a=0;a<Sa.length;a++){var l=Sa[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Sa.length&&(a=Sa[0],a.blockedOn===null);)Nv(a),a.blockedOn===null&&Sa.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],x=f[Vt]||null;if(typeof m=="function")x||Cv(a);else if(x){var T=null;if(m&&m.hasAttribute("formAction")){if(f=m,x=m[Vt]||null)T=x.formAction;else if(bf(f)!==null)continue}else T=x.action;typeof T=="function"?a[l+1]=T:(a.splice(l,3),l-=3),Cv(a)}}}function Ev(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function xf(e){this._internalRoot=e}pc.prototype.render=xf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var a=n.current,l=Nn();_v(a,l,e,n,null,null)},pc.prototype.unmount=xf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;_v(e.current,2,null,e,null,null),Zl(),n[Ti]=null}};function pc(e){this._internalRoot=e}pc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ft();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Sa.length&&n!==0&&n<Sa[a].priority;a++);Sa.splice(a,0,e),a===0&&Nv(e)}};var Av=s.version;if(Av!=="19.2.4")throw Error(o(527,Av,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var IS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mc.isDisabled&&mc.supportsFiber)try{ta=mc.inject(IS),Qt=mc}catch{}}return _r.createRoot=function(e,n){if(!c(e))throw Error(o(299));var a=!1,l="",f=Lg,m=zg,x=Ug;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=yv(e,1,!1,null,null,a,l,null,f,m,x,Ev),e[Ti]=n.current,tf(e),new xf(n)},_r.hydrateRoot=function(e,n,a){if(!c(e))throw Error(o(299));var l=!1,f="",m=Lg,x=zg,T=Ug,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),n=yv(e,1,!0,n,a??null,l,f,M,m,x,T,Ev),n.context=bv(null),a=n.current,l=Nn(),l=Fe(l),f=la(l),f.callback=null,ca(a,f,l),a=l,n.current.lanes=a,ze(n,a),ms(n),e[Ti]=n.current,tf(e),new pc(n)},_r.version="19.2.4",_r}var zv;function lT(){if(zv)return kf.exports;zv=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(),kf.exports=rT(),kf.exports}var cT=lT();const uT="modulepreload",dT=function(t){return"/"+t},Uv={},fT=function(s,i,o){let c=Promise.resolve();if(i&&i.length>0){let d=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),h=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=d(i.map(g=>{if(g=dT(g),g in Uv)return;Uv[g]=!0;const v=g.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${y}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":uT,v||(b.as="script"),b.crossOrigin="",b.href=g,h&&b.setAttribute("nonce",h),document.head.appendChild(b),v)return new Promise((k,S)=>{b.addEventListener("load",k),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return c.then(d=>{for(const p of d||[])p.status==="rejected"&&u(p.reason);return s().catch(u)})},pT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),mT=HS({baseUrl:"/",fetch:pT}),xe=qS(GS,mT),hT="_bar_1xhb4_1",gT="_input_1xhb4_32",vT="_select_1xhb4_67",yT="_btnPrimary_1xhb4_103",bT="_btnGhost_1xhb4_173",_T="_badge_1xhb4_195",xT="_disconnectHint_1xhb4_205",jn={bar:hT,input:gT,select:vT,btnPrimary:yT,btnGhost:bT,badge:_T,disconnectHint:xT};function kT(t,s){if(!t)return!1;const i=s.find(o=>o.id===t);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function ST({environmentId:t,onReconnect:s}){return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:jn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),r.jsx("button",{type:"button",onClick:()=>s(t),className:jn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Lr({mode:t,sessionId:s,environmentId:i,taskId:o,showPersonaSelect:c,personas:u,environments:d,onSendInput:p,onSpawn:h,onStartTask:g,onProvisionEnvironment:v,onShowToast:y}){const[b,k]=_.useState(""),[S,w]=_.useState(""),j=kT(i,d),N=C=>{if(C.preventDefault(),!!b.trim())if(t==="send"){if(!s||j)return;p(s,b),k("")}else if(t==="spawn"){if(!i)return;h(i,b,S),y==null||y("Session started","success"),k(""),w("")}else{if(!o)return;g(o,void 0,i,b),k("")}};return t==="spawn"?r.jsxs("form",{onSubmit:N,className:jn.bar,children:[r.jsx("span",{className:jn.badge,children:"new chat"}),r.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:jn.input}),c&&r.jsxs("select",{value:S,onChange:C=>w(C.target.value),className:jn.select,children:[r.jsx("option",{value:"",children:"(Default)"}),u.map(C=>r.jsx("option",{value:C.id,children:C.name},C.id))]}),r.jsx("button",{type:"submit",disabled:!b.trim()||!i,className:jn.btnPrimary,children:"Go"})]}):t==="start"?r.jsxs("form",{onSubmit:N,className:jn.bar,children:[r.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:jn.input}),r.jsx("button",{type:"submit",disabled:!b.trim(),className:jn.btnPrimary,children:"Send"})]}):r.jsxs("form",{onSubmit:N,className:jn.bar,children:[j&&i&&r.jsx(ST,{environmentId:i,onReconnect:v}),r.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!j,disabled:j,className:jn.input}),r.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:r.jsx("button",{type:"submit",disabled:!b.trim()||j,className:jn.btnPrimary,children:"Send"})})]})}const $v=220,Pv=70,TT=40,wT=60,NT="hierarchy",jT="dependency";function CT(t){return _.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new Dv.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:TT,ranksep:wT});const i=new Map(t.map(d=>[d.id,d])),o=new Map;for(const d of t)if(d.parentTaskId&&i.has(d.parentTaskId)){const p=o.get(d.parentTaskId)||[];p.push(d),o.set(d.parentTaskId,p)}for(const d of t)s.setNode(d.id,{width:$v,height:Pv});const c=[];for(const d of t){if(d.parentTaskId&&i.has(d.parentTaskId)){const p=`hierarchy-${d.parentTaskId}-${d.id}`;s.setEdge(d.parentTaskId,d.id,{},p),c.push({id:p,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:NT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of d.dependsOn)if(i.has(p)){const h=`dependency-${p}-${d.id}`;s.setEdge(p,d.id,{},h),c.push({id:h,source:p,target:d.id,type:"smoothstep",data:{edgeType:jT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return Dv.layout(s),{nodes:t.map(d=>{const p=s.node(d.id),h=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:p.x-$v/2,y:p.y-Pv/2},data:{task:d,childCount:h.length,doneChildCount:h.filter(g=>g.status==="complete").length,hasDependencies:d.dependsOn.length>0}}}),edges:c}},[t])}/**
27
- * @license lucide-react v0.474.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const ET=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Zb=(...t)=>t.filter((s,i,o)=>!!s&&s.trim()!==""&&o.indexOf(s)===i).join(" ").trim();/**
32
- * @license lucide-react v0.474.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */var AT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
- * @license lucide-react v0.474.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const DT=_.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...p},h)=>_.createElement("svg",{ref:h,...AT,width:s,height:s,stroke:t,strokeWidth:o?Number(i)*24/Number(s):i,className:Zb("lucide",c),...p},[...d.map(([g,v])=>_.createElement(g,v)),...Array.isArray(u)?u:[u]]));/**
42
- * @license lucide-react v0.474.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const Xe=(t,s)=>{const i=_.forwardRef(({className:o,...c},u)=>_.createElement(DT,{ref:u,iconNode:s,className:Zb(`lucide-${ET(t)}`,o),...c}));return i.displayName=`${t}`,i};/**
47
- * @license lucide-react v0.474.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const RT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Vv=Xe("ArrowDown",RT);/**
52
- * @license lucide-react v0.474.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const MT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Hv=Xe("ArrowUp",MT);/**
57
- * @license lucide-react v0.474.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const IT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],OT=Xe("Ban",IT);/**
62
- * @license lucide-react v0.474.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const BT=[["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"}]],LT=Xe("Brain",BT);/**
67
- * @license lucide-react v0.474.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const zT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],To=Xe("Check",zT);/**
72
- * @license lucide-react v0.474.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const UT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kb=Xe("ChevronDown",UT);/**
77
- * @license lucide-react v0.474.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const $T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xs=Xe("ChevronRight",$T);/**
82
- * @license lucide-react v0.474.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const PT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ra=Xe("Circle",PT);/**
87
- * @license lucide-react v0.474.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const VT=[["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"}]],HT=Xe("ClipboardList",VT);/**
92
- * @license lucide-react v0.474.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const qT=[["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"}]],GT=Xe("Clipboard",qT);/**
97
- * @license lucide-react v0.474.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const FT=[["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"}]],ZT=Xe("Cog",FT);/**
102
- * @license lucide-react v0.474.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const KT=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],YT=Xe("CornerDownRight",KT);/**
107
- * @license lucide-react v0.474.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const JT=[["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"}]],WT=Xe("FilePen",JT);/**
112
- * @license lucide-react v0.474.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const XT=[["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"}]],QT=Xe("FileText",XT);/**
117
- * @license lucide-react v0.474.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const e2=[["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"}]],t2=Xe("House",e2);/**
122
- * @license lucide-react v0.474.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const n2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Pp=Xe("Info",n2);/**
127
- * @license lucide-react v0.474.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const s2=[["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"}]],a2=Xe("Key",s2);/**
132
- * @license lucide-react v0.474.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const i2=[["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"}]],o2=Xe("Keyboard",i2);/**
137
- * @license lucide-react v0.474.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const r2=[["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"}]],l2=Xe("ListChecks",r2);/**
142
- * @license lucide-react v0.474.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const c2=[["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"}]],u2=Xe("List",c2);/**
147
- * @license lucide-react v0.474.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const d2=[["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"}]],f2=Xe("Loader",d2);/**
152
- * @license lucide-react v0.474.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const p2=[["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"}]],m2=Xe("Menu",p2);/**
157
- * @license lucide-react v0.474.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const h2=[["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"}]],g2=Xe("MessageSquare",h2);/**
162
- * @license lucide-react v0.474.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const v2=[["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"}]],y2=Xe("Monitor",v2);/**
167
- * @license lucide-react v0.474.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const b2=[["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"}]],_2=Xe("Palette",b2);/**
172
- * @license lucide-react v0.474.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const x2=[["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"}]],k2=Xe("Pause",x2);/**
177
- * @license lucide-react v0.474.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const S2=[["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"}]],T2=Xe("Pencil",S2);/**
182
- * @license lucide-react v0.474.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const w2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Yb=Xe("Search",w2);/**
187
- * @license lucide-react v0.474.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const N2=[["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"}]],j2=Xe("Settings",N2);/**
192
- * @license lucide-react v0.474.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const C2=[["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"}]],Vp=Xe("TriangleAlert",C2);/**
197
- * @license lucide-react v0.474.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const E2=[["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"}]],A2=Xe("User",E2);/**
202
- * @license lucide-react v0.474.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const D2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yi=Xe("X",D2),Hp=8,kt=12,Gt=14,Mt=16,pp={not_started:{color:"var(--text-tertiary)",icon:r.jsx(Ra,{size:kt}),label:"Not Started"},working:{color:"var(--accent-green)",icon:r.jsx(Ra,{size:kt,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:r.jsx(k2,{size:kt}),label:"Paused"},complete:{color:"var(--accent-green)",icon:r.jsx(To,{size:kt}),label:"Complete"},failed:{color:"var(--accent-red)",icon:r.jsx(yi,{size:kt}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:r.jsx(OT,{size:kt}),label:"Blocked"}};function Ma(t){return t==="blocked"?pp.blocked:pp[Gr(t)]}const R2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function M2(t){return R2[Gr(t)]??"statusPending"}const I2=["working","paused","failed","not_started","blocked","complete"],qv=["not_started","working","paused","complete","failed"],O2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Gr(t){return t in pp&&t!=="blocked"?t:O2[t]??"not_started"}const B2={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"},L2="_dagContainer_js4w6_1",z2="_taskNode_js4w6_26",U2="_taskNodeBorder_js4w6_54",$2="_taskNodeContent_js4w6_60",P2="_taskNodeHeader_js4w6_70",V2="_taskNodeIcon_js4w6_77",H2="_taskNodeTitle_js4w6_82",q2="_taskNodeBadges_js4w6_90",G2="_childBadge_js4w6_95",F2="_depBadge_js4w6_107",Z2="_handle_js4w6_119",K2="_emptyCta_js4w6_126",Y2="_ctaDescription_js4w6_137",J2="_ctaButton_js4w6_144",ln={dagContainer:L2,taskNode:z2,taskNodeBorder:U2,taskNodeContent:$2,taskNodeHeader:P2,taskNodeIcon:V2,taskNodeTitle:H2,taskNodeBadges:q2,childBadge:G2,depBadge:F2,handle:Z2,emptyCta:K2,ctaDescription:Y2,ctaButton:J2};function W2({data:t}){const{task:s,childCount:i,doneChildCount:o,hasDependencies:c}=t,u=Ma(s.status);return r.jsxs("div",{className:ln.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[r.jsx(Rv,{type:"target",position:Mv.Top,className:ln.handle}),r.jsx("div",{className:ln.taskNodeBorder,style:{backgroundColor:u.color}}),r.jsxs("div",{className:ln.taskNodeContent,children:[r.jsxs("div",{className:ln.taskNodeHeader,children:[r.jsx("span",{className:ln.taskNodeIcon,style:{color:u.color},children:u.icon}),r.jsx("span",{className:ln.taskNodeTitle,children:s.title})]}),r.jsxs("div",{className:ln.taskNodeBadges,children:[i>0&&r.jsxs("span",{className:ln.childBadge,children:[o,"/",i]}),c&&r.jsx("span",{className:ln.depBadge,children:"dep"})]})]}),r.jsx(Rv,{type:"source",position:Mv.Bottom,className:ln.handle})]})}/**
207
- * react-router v7.13.2
208
- *
209
- * Copyright (c) Remix Software Inc.
210
- *
211
- * This source code is licensed under the MIT license found in the
212
- * LICENSE.md file in the root directory of this source tree.
213
- *
214
- * @license MIT
215
- */var Gv="popstate";function Fv(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function X2(t={}){function s(o,c){var g;let u=(g=c.state)==null?void 0:g.masked,{pathname:d,search:p,hash:h}=u||o.location;return mp("",{pathname:d,search:p,hash:h},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,c){return typeof c=="string"?c:zr(c)}return ew(s,i,null,t)}function gt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Fn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function Q2(){return Math.random().toString(36).substring(2,10)}function Zv(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 mp(t,s,i=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?wo(s):s,state:i,key:s&&s.key||o||Q2(),unstable_mask:c}}function zr({pathname:t="/",search:s="",hash:i=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function wo(t){let s={};if(t){let i=t.indexOf("#");i>=0&&(s.hash=t.substring(i),t=t.substring(0,i));let o=t.indexOf("?");o>=0&&(s.search=t.substring(o),t=t.substring(0,o)),t&&(s.pathname=t)}return s}function ew(t,s,i,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,p="POP",h=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function y(){p="POP";let j=v(),N=j==null?null:j-g;g=j,h&&h({action:p,location:w.location,delta:N})}function b(j,N){p="PUSH";let C=Fv(j)?j:mp(w.location,j,N);g=v()+1;let E=Zv(C,g),I=w.createHref(C.unstable_mask||C);try{d.pushState(E,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;c.location.assign(I)}u&&h&&h({action:p,location:w.location,delta:1})}function k(j,N){p="REPLACE";let C=Fv(j)?j:mp(w.location,j,N);g=v();let E=Zv(C,g),I=w.createHref(C.unstable_mask||C);d.replaceState(E,"",I),u&&h&&h({action:p,location:w.location,delta:0})}function S(j){return tw(j)}let w={get action(){return p},get location(){return t(c,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(Gv,y),h=j,()=>{c.removeEventListener(Gv,y),h=null}},createHref(j){return s(c,j)},createURL:S,encodeLocation(j){let N=S(j);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:b,replace:k,go(j){return d.go(j)}};return w}function tw(t,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),gt(i,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:zr(t);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function Jb(t,s,i="/"){return nw(t,s,i,!1)}function nw(t,s,i,o){let c=typeof s=="string"?wo(s):s,u=Ys(c.pathname||"/",i);if(u==null)return null;let d=Wb(t);sw(d);let p=null;for(let h=0;p==null&&h<d.length;++h){let g=Qb(u);p=fw(d[h],g,o)}return p}function Wb(t,s=[],i=[],o="",c=!1){let u=(d,p,h=c,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:p,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;gt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let y=vs([o,v.relativePath]),b=i.concat(v);d.children&&d.children.length>0&&(gt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),Wb(d.children,s,b,y,h)),!(d.path==null&&!d.index)&&s.push({path:y,score:uw(y,d.index),routesMeta:b})};return t.forEach((d,p)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,p);else for(let g of Xb(d.path))u(d,p,!0,g)}),s}function Xb(t){let s=t.split("/");if(s.length===0)return[];let[i,...o]=s,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=Xb(o.join("/")),p=[];return p.push(...d.map(h=>h===""?u:[u,h].join("/"))),c&&p.push(...d),p.map(h=>t.startsWith("/")&&h===""?"/":h)}function sw(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:dw(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var aw=/^:[\w-]+$/,iw=3,ow=2,rw=1,lw=10,cw=-2,Kv=t=>t==="*";function uw(t,s){let i=t.split("/"),o=i.length;return i.some(Kv)&&(o+=cw),s&&(o+=ow),i.filter(c=>!Kv(c)).reduce((c,u)=>c+(aw.test(u)?iw:u===""?rw:lw),o)}function dw(t,s){return t.length===s.length&&t.slice(0,-1).every((o,c)=>o===s[c])?t[t.length-1]-s[s.length-1]:0}function fw(t,s,i=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let p=0;p<o.length;++p){let h=o[p],g=p===o.length-1,v=u==="/"?s:s.slice(u.length)||"/",y=Ur({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),b=h.route;if(!y&&g&&i&&!o[o.length-1].route.index&&(y=Ur({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!y)return null;Object.assign(c,y.params),d.push({params:c,pathname:vs([u,y.pathname]),pathnameBase:vw(vs([u,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(u=vs([u,y.pathnameBase]))}return d}function Ur(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,o]=pw(t.path,t.caseSensitive,t.end),c=s.match(i);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:y},b)=>{if(v==="*"){let S=p[b]||"";d=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[b];return y&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:t}}function pw(t,s=!1,i=!0){Fn(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 o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,p,h,g,v)=>{if(o.push({paramName:p,isOptional:h!=null}),h){let y=v.charAt(g+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),o]}function Qb(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Fn(!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 Ys(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,o=t.charAt(i);return o&&o!=="/"?null:t.slice(i)||"/"}var mw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function hw(t,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof t=="string"?wo(t):t,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=Yv(i.substring(1),"/"):u=Yv(i,s)):u=s,{pathname:u,search:yw(o),hash:bw(c)}}function Yv(t,s){let i=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function wf(t,s,i,o){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function gw(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function qp(t){let s=gw(t);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function eu(t,s,i,o=!1){let c;typeof t=="string"?c=wo(t):(c={...t},gt(!c.pathname||!c.pathname.includes("?"),wf("?","pathname","search",c)),gt(!c.pathname||!c.pathname.includes("#"),wf("#","pathname","hash",c)),gt(!c.search||!c.search.includes("#"),wf("#","search","hash",c)));let u=t===""||c.pathname==="",d=u?"/":c.pathname,p;if(d==null)p=i;else{let y=s.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),y-=1;c.pathname=b.join("/")}p=y>=0?s[y]:"/"}let h=hw(c,p),g=d&&d!=="/"&&d.endsWith("/"),v=(u||d===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var vs=t=>t.join("/").replace(/\/\/+/g,"/"),vw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),yw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,bw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,_w=class{constructor(t,s,i,o=!1){this.status=t,this.statusText=s||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function xw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function kw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var e_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function t_(t,s){let i=t;if(typeof i!="string"||!mw.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(e_)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),p=Ys(d.pathname,s);d.origin===u.origin&&p!=null?i=p+d.search+d.hash:c=!0}catch{Fn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var n_=["POST","PUT","PATCH","DELETE"];new Set(n_);var Sw=["GET",...n_];new Set(Sw);var No=_.createContext(null);No.displayName="DataRouter";var tu=_.createContext(null);tu.displayName="DataRouterState";var Tw=_.createContext(!1),s_=_.createContext({isTransitioning:!1});s_.displayName="ViewTransition";var ww=_.createContext(new Map);ww.displayName="Fetchers";var Nw=_.createContext(null);Nw.displayName="Await";var An=_.createContext(null);An.displayName="Navigation";var Fr=_.createContext(null);Fr.displayName="Location";var Zn=_.createContext({outlet:null,matches:[],isDataRoute:!1});Zn.displayName="Route";var Gp=_.createContext(null);Gp.displayName="RouteError";var a_="REACT_ROUTER_ERROR",jw="REDIRECT",Cw="ROUTE_ERROR_RESPONSE";function Ew(t){if(t.startsWith(`${a_}:${jw}:{`))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 Aw(t){if(t.startsWith(`${a_}:${Cw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new _w(s.status,s.statusText,s.data)}catch{}}function Dw(t,{relative:s}={}){gt(bi(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=_.useContext(An),{hash:c,pathname:u,search:d}=Zr(t,{relative:s}),p=u;return i!=="/"&&(p=u==="/"?i:vs([i,u])),o.createHref({pathname:p,search:d,hash:c})}function bi(){return _.useContext(Fr)!=null}function Pt(){return gt(bi(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(Fr).location}function Nt(t){gt(bi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Pt();return _.useMemo(()=>Ur(t,Qb(s)),[s,t])}var i_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o_(t){_.useContext(An).static||_.useLayoutEffect(t)}function nu(){let{isDataRoute:t}=_.useContext(Zn);return t?Fw():Rw()}function Rw(){gt(bi(),"useNavigate() may be used only in the context of a <Router> component.");let t=_.useContext(No),{basename:s,navigator:i}=_.useContext(An),{matches:o}=_.useContext(Zn),{pathname:c}=Pt(),u=JSON.stringify(qp(o)),d=_.useRef(!1);return o_(()=>{d.current=!0}),_.useCallback((h,g={})=>{if(Fn(d.current,i_),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=eu(h,JSON.parse(u),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:vs([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,u,c,t])}var Mw=_.createContext(null);function Iw(t){let s=_.useContext(Zn).outlet;return _.useMemo(()=>s&&_.createElement(Mw.Provider,{value:t},s),[s,t])}function rs(){let{matches:t}=_.useContext(Zn),s=t[t.length-1];return s?s.params:{}}function Zr(t,{relative:s}={}){let{matches:i}=_.useContext(Zn),{pathname:o}=Pt(),c=JSON.stringify(qp(i));return _.useMemo(()=>eu(t,JSON.parse(c),o,s==="path"),[t,c,o,s])}function Ow(t,s){return r_(t,s)}function r_(t,s,i){var j;gt(bi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=_.useContext(An),{matches:c}=_.useContext(Zn),u=c[c.length-1],d=u?u.params:{},p=u?u.pathname:"/",h=u?u.pathnameBase:"/",g=u&&u.route;{let N=g&&g.path||"";c_(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.
216
-
217
- Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let v=Pt(),y;if(s){let N=typeof s=="string"?wo(s):s;gt(h==="/"||((j=N.pathname)==null?void 0:j.startsWith(h)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${N.pathname}" was given in the \`location\` prop.`),y=N}else y=v;let b=y.pathname||"/",k=b;if(h!=="/"){let N=h.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(N.length).join("/")}let S=Jb(t,{pathname:k});Fn(g||S!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Fn(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 "${y.pathname}${y.search}${y.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 w=$w(S&&S.map(N=>Object.assign({},N,{params:Object.assign({},d,N.params),pathname:vs([h,o.encodeLocation?o.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?h:vs([h,o.encodeLocation?o.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),c,i);return s&&w?_.createElement(Fr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},w):w}function Bw(){let t=Gw(),s=xw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:u},"ErrorBoundary")," or"," ",_.createElement("code",{style:u},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},s),i?_.createElement("pre",{style:c},i):null,d)}var Lw=_.createElement(Bw,null),l_=class extends _.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 i=Aw(t.digest);i&&(t=i)}let s=t!==void 0?_.createElement(Zn.Provider,{value:this.props.routeContext},_.createElement(Gp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?_.createElement(zw,{error:t},s):s}};l_.contextType=Tw;var Nf=new WeakMap;function zw({children:t,error:s}){let{basename:i}=_.useContext(An);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=Ew(s.digest);if(o){let c=Nf.get(s);if(c)throw c;let u=t_(o.location,i);if(e_&&!Nf.get(s))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw Nf.set(s,d),d}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function Uw({routeContext:t,match:s,children:i}){let o=_.useContext(No);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),_.createElement(Zn.Provider,{value:t},i)}function $w(t,s=[],i){let o=i==null?void 0:i.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(s.length===0&&!o.initialized&&o.matches.length>0)t=o.matches;else return null}let c=t,u=o==null?void 0:o.errors;if(u!=null){let v=c.findIndex(y=>y.route.id&&(u==null?void 0:u[y.route.id])!==void 0);gt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,p=-1;if(i&&o){d=o.renderFallback;for(let v=0;v<c.length;v++){let y=c[v];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(p=v),y.route.id){let{loaderData:b,errors:k}=o,S=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!k||k[y.route.id]===void 0);if(y.route.lazy||S){i.isStatic&&(d=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=o&&h?(v,y)=>{var b,k;h(v,{location:o.location,params:((k=(b=o.matches)==null?void 0:b[0])==null?void 0:k.params)??{},unstable_pattern:kw(o.matches),errorInfo:y})}:void 0;return c.reduceRight((v,y,b)=>{let k,S=!1,w=null,j=null;o&&(k=u&&y.route.id?u[y.route.id]:void 0,w=y.route.errorElement||Lw,d&&(p<0&&b===0?(c_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):p===b&&(S=!0,j=y.route.hydrateFallbackElement||null)));let N=s.concat(c.slice(0,b+1)),C=()=>{let E;return k?E=w:S?E=j:y.route.Component?E=_.createElement(y.route.Component,null):y.route.element?E=y.route.element:E=v,_.createElement(Uw,{match:y,routeContext:{outlet:v,matches:N,isDataRoute:o!=null},children:E})};return o&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?_.createElement(l_,{location:o.location,revalidation:o.revalidation,component:w,error:k,children:C(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:g}):C()},null)}function Fp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pw(t){let s=_.useContext(No);return gt(s,Fp(t)),s}function Vw(t){let s=_.useContext(tu);return gt(s,Fp(t)),s}function Hw(t){let s=_.useContext(Zn);return gt(s,Fp(t)),s}function Zp(t){let s=Hw(t),i=s.matches[s.matches.length-1];return gt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function qw(){return Zp("useRouteId")}function Gw(){var o;let t=_.useContext(Gp),s=Vw("useRouteError"),i=Zp("useRouteError");return t!==void 0?t:(o=s.errors)==null?void 0:o[i]}function Fw(){let{router:t}=Pw("useNavigate"),s=Zp("useNavigate"),i=_.useRef(!1);return o_(()=>{i.current=!0}),_.useCallback(async(c,u={})=>{Fn(i.current,i_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...u}))},[t,s])}var Jv={};function c_(t,s,i){!s&&!Jv[t]&&(Jv[t]=!0,Fn(!1,i))}_.memo(Zw);function Zw({routes:t,future:s,state:i,isStatic:o,onError:c}){return r_(t,void 0,{state:i,isStatic:o,onError:c})}function is({to:t,replace:s,state:i,relative:o}){gt(bi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=_.useContext(An);Fn(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:u}=_.useContext(Zn),{pathname:d}=Pt(),p=nu(),h=eu(t,qp(u),d,o==="path"),g=JSON.stringify(h);return _.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:o})},[p,g,o,s,i]),null}function Ba(t){return Iw(t.context)}function Se(t){gt(!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 Kw({basename:t="/",children:s=null,location:i,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){gt(!bi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),h=_.useMemo(()=>({basename:p,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[p,c,u,d]);typeof i=="string"&&(i=wo(i));let{pathname:g="/",search:v="",hash:y="",state:b=null,key:k="default",unstable_mask:S}=i,w=_.useMemo(()=>{let j=Ys(g,p);return j==null?null:{location:{pathname:j,search:v,hash:y,state:b,key:k,unstable_mask:S},navigationType:o}},[p,g,v,y,b,k,o,S]);return Fn(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:_.createElement(An.Provider,{value:h},_.createElement(Fr.Provider,{children:s,value:w}))}function Yw({children:t,location:s}){return Ow(hp(t),s)}function hp(t,s=[]){let i=[];return _.Children.forEach(t,(o,c)=>{if(!_.isValidElement(o))return;let u=[...s,c];if(o.type===_.Fragment){i.push.apply(i,hp(o.props.children,u));return}gt(o.type===Se,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),gt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=hp(o.props.children,u)),i.push(d)}),i}var Dc="get",Rc="application/x-www-form-urlencoded";function su(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Jw(t){return su(t)&&t.tagName.toLowerCase()==="button"}function Ww(t){return su(t)&&t.tagName.toLowerCase()==="form"}function Xw(t){return su(t)&&t.tagName.toLowerCase()==="input"}function Qw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function eN(t,s){return t.button===0&&(!s||s==="_self")&&!Qw(t)}function gp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,i)=>{let o=t[i];return s.concat(Array.isArray(o)?o.map(c=>[i,c]):[[i,o]])},[]))}function tN(t,s){let i=gp(t);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var vc=null;function nN(){if(vc===null)try{new FormData(document.createElement("form"),0),vc=!1}catch{vc=!0}return vc}var sN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jf(t){return t!=null&&!sN.has(t)?(Fn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Rc}"`),null):t}function aN(t,s){let i,o,c,u,d;if(Ww(t)){let p=t.getAttribute("action");o=p?Ys(p,s):null,i=t.getAttribute("method")||Dc,c=jf(t.getAttribute("enctype"))||Rc,u=new FormData(t)}else if(Jw(t)||Xw(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 h=t.getAttribute("formaction")||p.getAttribute("action");if(o=h?Ys(h,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||Dc,c=jf(t.getAttribute("formenctype"))||jf(p.getAttribute("enctype"))||Rc,u=new FormData(p,t),!nN()){let{name:g,type:v,value:y}=t;if(v==="image"){let b=g?`${g}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else g&&u.append(g,y)}}else{if(su(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Dc,o=null,c=Rc,d=t}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:i.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Kp(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function iN(t,s,i,o){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:s&&Ys(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function oN(t,s){if(t.id in s)return s[t.id];try{let i=await import(t.module);return s[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rN(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 lN(t,s,i){let o=await Promise.all(t.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await oN(u,i);return d.links?d.links():[]}return[]}));return fN(o.flat(1).filter(rN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Wv(t,s,i,o,c,u){let d=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,p=(h,g)=>{var v;return i[g].pathname!==h.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==h.params["*"]};return u==="assets"?s.filter((h,g)=>d(h,g)||p(h,g)):u==="data"?s.filter((h,g)=>{var y;let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(d(h,g)||p(h,g))return!0;if(h.route.shouldRevalidate){let b=h.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((y=i[0])==null?void 0:y.params)||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function cN(t,s,{includeHydrateFallback:i}={}){return uN(t.map(o=>{let c=s.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function uN(t){return[...new Set(t)]}function dN(t){let s={},i=Object.keys(t).sort();for(let o of i)s[o]=t[o];return s}function fN(t,s){let i=new Set;return new Set(s),t.reduce((o,c)=>{let u=JSON.stringify(dN(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function u_(){let t=_.useContext(No);return Kp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function pN(){let t=_.useContext(tu);return Kp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Yp=_.createContext(void 0);Yp.displayName="FrameworkContext";function d_(){let t=_.useContext(Yp);return Kp(t,"You must render this element inside a <HydratedRouter> element"),t}function mN(t,s){let i=_.useContext(Yp),[o,c]=_.useState(!1),[u,d]=_.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:y}=s,b=_.useRef(null);_.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let w=N=>{N.forEach(C=>{d(C.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[t]),_.useEffect(()=>{if(o){let w=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(w)}}},[o]);let k=()=>{c(!0)},S=()=>{c(!1),d(!1)};return i?t!=="intent"?[u,b,{}]:[u,b,{onFocus:xr(p,k),onBlur:xr(h,S),onMouseEnter:xr(g,k),onMouseLeave:xr(v,S),onTouchStart:xr(y,k)}]:[!1,b,{}]}function xr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function hN({page:t,...s}){let{router:i}=u_(),o=_.useMemo(()=>Jb(i.routes,t,i.basename),[i.routes,t,i.basename]);return o?_.createElement(vN,{page:t,matches:o,...s}):null}function gN(t){let{manifest:s,routeModules:i}=d_(),[o,c]=_.useState([]);return _.useEffect(()=>{let u=!1;return lN(t,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[t,s,i]),o}function vN({page:t,matches:s,...i}){let o=Pt(),{future:c,manifest:u,routeModules:d}=d_(),{basename:p}=u_(),{loaderData:h,matches:g}=pN(),v=_.useMemo(()=>Wv(t,s,g,u,o,"data"),[t,s,g,u,o]),y=_.useMemo(()=>Wv(t,s,g,u,o,"assets"),[t,s,g,u,o]),b=_.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,j=!1;if(s.forEach(C=>{var I;let E=u.routes[C.route.id];!E||!E.hasLoader||(!v.some(R=>R.route.id===C.route.id)&&C.route.id in h&&((I=d[C.route.id])!=null&&I.shouldRevalidate)||E.hasClientLoader?j=!0:w.add(C.route.id))}),w.size===0)return[];let N=iN(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&N.searchParams.set("_routes",s.filter(C=>w.has(C.route.id)).map(C=>C.route.id).join(",")),[N.pathname+N.search]},[p,c.unstable_trailingSlashAwareDataRequests,h,o,u,v,s,t,d]),k=_.useMemo(()=>cN(y,u),[y,u]),S=gN(y);return _.createElement(_.Fragment,null,b.map(w=>_.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),k.map(w=>_.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),S.map(({key:w,link:j})=>_.createElement("link",{key:w,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function yN(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var bN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{bN&&(window.__reactRouterVersion="7.13.2")}catch{}function _N({basename:t,children:s,unstable_useTransitions:i,window:o}){let c=_.useRef();c.current==null&&(c.current=X2({window:o,v5Compat:!0}));let u=c.current,[d,p]=_.useState({action:u.action,location:u.location}),h=_.useCallback(g=>{i===!1?p(g):_.startTransition(()=>p(g))},[i]);return _.useLayoutEffect(()=>u.listen(h),[u,h]),_.createElement(Kw,{basename:t,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var f_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Jp=_.forwardRef(function({onClick:s,discover:i="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:p,state:h,target:g,to:v,preventScrollReset:y,viewTransition:b,unstable_defaultShouldRevalidate:k,...S},w){let{basename:j,navigator:N,unstable_useTransitions:C}=_.useContext(An),E=typeof v=="string"&&f_.test(v),I=t_(v,j);v=I.to;let R=Dw(v,{relative:c}),D=Pt(),q=null;if(p){let ee=eu(p,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);j!=="/"&&(ee.pathname=ee.pathname==="/"?j:vs([j,ee.pathname])),q=N.createHref(ee)}let[$,Y,G]=mN(o,S),Q=TN(v,{replace:d,unstable_mask:p,state:h,target:g,preventScrollReset:y,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ae(ee){s&&s(ee),ee.defaultPrevented||Q(ee)}let me=!(I.isExternal||u),ie=_.createElement("a",{...S,...G,href:(me?q:void 0)||I.absoluteURL||R,onClick:me?ae:s,ref:yN(w,Y),target:g,"data-discover":!E&&i==="render"?"true":void 0});return $&&!E?_.createElement(_.Fragment,null,ie,_.createElement(hN,{page:R})):ie});Jp.displayName="Link";var xN=_.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:p,children:h,...g},v){let y=Zr(d,{relative:g.relative}),b=Pt(),k=_.useContext(tu),{navigator:S,basename:w}=_.useContext(An),j=k!=null&&EN(y)&&p===!0,N=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,C=b.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;i||(C=C.toLowerCase(),E=E?E.toLowerCase():null,N=N.toLowerCase()),E&&w&&(E=Ys(E,w)||E);const I=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let R=C===N||!c&&C.startsWith(N)&&C.charAt(I)==="/",D=E!=null&&(E===N||!c&&E.startsWith(N)&&E.charAt(N.length)==="/"),q={isActive:R,isPending:D,isTransitioning:j},$=R?s:void 0,Y;typeof o=="function"?Y=o(q):Y=[o,R?"active":null,D?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let G=typeof u=="function"?u(q):u;return _.createElement(Jp,{...g,"aria-current":$,className:Y,ref:v,style:G,to:d,viewTransition:p},typeof h=="function"?h(q):h)});xN.displayName="NavLink";var kN=_.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=Dc,action:p,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:w}=_.useContext(An),j=jN(),N=CN(p,{relative:g}),C=d.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&f_.test(p),I=R=>{if(h&&h(R),R.defaultPrevented)return;R.preventDefault();let D=R.nativeEvent.submitter,q=(D==null?void 0:D.getAttribute("formmethod"))||d,$=()=>j(D||R.currentTarget,{fetcherKey:s,method:q,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:b});w&&i!==!1?_.startTransition(()=>$()):$()};return _.createElement("form",{ref:S,method:C,action:N,onSubmit:o?h:I,...k,"data-discover":!E&&t==="render"?"true":void 0})});kN.displayName="Form";function SN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function p_(t){let s=_.useContext(No);return gt(s,SN(t)),s}function TN(t,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=nu(),y=Pt(),b=Zr(t,{relative:d});return _.useCallback(k=>{if(eN(k,s)){k.preventDefault();let S=i!==void 0?i:zr(y)===zr(b),w=()=>v(t,{replace:S,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h});g?_.startTransition(()=>w()):w()}},[y,v,b,i,o,c,s,t,u,d,p,h,g])}function Wp(t){Fn(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=_.useRef(gp(t)),i=_.useRef(!1),o=Pt(),c=_.useMemo(()=>tN(o.search,i.current?null:s.current),[o.search]),u=nu(),d=_.useCallback((p,h)=>{const g=gp(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var wN=0,NN=()=>`__${String(++wN)}__`;function jN(){let{router:t}=p_("useSubmit"),{basename:s}=_.useContext(An),i=qw(),o=t.fetch,c=t.navigate;return _.useCallback(async(u,d={})=>{let{action:p,method:h,encType:g,formData:v,body:y}=aN(u,s);if(d.navigate===!1){let b=d.fetcherKey||NN();await o(b,i,d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||h,formEncType:d.encType||g,flushSync:d.flushSync})}else await c(d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||h,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,s,i])}function CN(t,{relative:s}={}){let{basename:i}=_.useContext(An),o=_.useContext(Zn);gt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Zr(t||".",{relative:s})},d=Pt();if(t==null){u.search=d.search;let p=new URLSearchParams(u.search),h=p.getAll("index");if(h.some(v=>v==="")){p.delete("index"),h.filter(y=>y).forEach(y=>p.append("index",y));let v=p.toString();u.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:vs([i,u.pathname])),zr(u)}function EN(t,{relative:s}={}){let i=_.useContext(s_);gt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=p_("useViewTransitionState"),c=Zr(t,{relative:s});if(!i.isTransitioning)return!1;let u=Ys(i.currentLocation.pathname,o)||i.currentLocation.pathname,d=Ys(i.nextLocation.pathname,o)||i.nextLocation.pathname;return Ur(c.pathname,d)!=null||Ur(c.pathname,u)!=null}function yt(){const t=nu();return _.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function Xp(t){return`/sessions/${encodeURIComponent(t)}`}function mi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function os(t,s,i,o){const c=encodeURIComponent(t);let u;return i&&o?u=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?u=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:u=`/tasks/${c}`,s?`${u}/${s}`:u}function _i(t,s,i){const o=new URLSearchParams;t&&o.set("workspace",t),s&&o.set("parent",s);const c=o.toString();if(t&&i){const u=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${u}?parent=${encodeURIComponent(s)}`:u}return c?`/tasks/new?${c}`:"/tasks/new"}function m_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const bo="/environments",AN="/environments/new";function hi(t){return`/environments/${encodeURIComponent(t)}`}function DN(t){return`/environments/${encodeURIComponent(t)}/edit`}const yo="/settings",RN="/settings/credentials",Cf="/settings/personas",MN="/settings/personas/new";function h_(t){return`/settings/personas/${encodeURIComponent(t)}`}const IN="/settings/shortcuts",ON="/pair",BN="/chat",gi="/",LN="/tasks",g_="/workspaces/new",v_="/knowledge",au="/findings";function zN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:au}function vp(t,s,i){const o=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${o}`:`/findings/${o}`}const UN=B2,$N={task:W2};function PN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:o}){const c=yt(),u=_.useMemo(()=>i.filter(y=>y.workspaceId===t),[i,t]),{nodes:d,edges:p}=CT(u),h=_.useMemo(()=>{const y=getComputedStyle(document.documentElement),b={};for(const[k,S]of Object.entries(UN))b[k]=y.getPropertyValue(S).trim()||"#6b7a8d";return b},[o]),g=_.useCallback((y,b)=>{c(os(b.id,void 0,t,s))},[c,t,s]),v=_.useCallback(y=>{const b=y.data;return h[b.task.status]||h.pending},[h]);return u.length===0?r.jsxs("div",{className:ln.emptyCta,children:[r.jsx("button",{className:ln.ctaButton,onClick:()=>c(_i(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:ln.ctaDescription,children:"Create tasks to see the dependency graph"})]}):r.jsx("div",{className:ln.dagContainer,children:r.jsxs(zS,{nodes:d,edges:p,nodeTypes:$N,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[r.jsx(US,{variant:$S.Dots,gap:24,size:1,color:"var(--text-disabled)"}),r.jsx(PS,{showInteractive:!1}),r.jsx(VS,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const VN="_breadcrumbs_17or2_1",HN="_list_17or2_11",qN="_item_17or2_21",GN="_separator_17or2_28",FN="_link_17or2_34",ZN="_current_17or2_57",lo={breadcrumbs:VN,list:HN,item:qN,separator:GN,link:FN,current:ZN};function xs({segments:t}){return r.jsx("nav",{className:lo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:r.jsx("ol",{className:lo.list,children:t.map((s,i)=>{const o=i===t.length-1;return r.jsxs("li",{className:lo.item,children:[i>0&&r.jsx("span",{className:lo.separator,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),s.url&&!o?r.jsx(Jp,{className:lo.link,to:s.url,title:s.label,children:s.label}):r.jsx("span",{className:lo.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const KN="_btn_dwk2o_1",YN="_sm_dwk2o_22",JN="_md_dwk2o_28",WN="_lg_dwk2o_34",XN="_primary_dwk2o_40",QN="_danger_dwk2o_55",ej="_outline_dwk2o_70",tj="_ghost_dwk2o_80",Ef={btn:KN,sm:YN,md:JN,lg:WN,primary:XN,danger:QN,outline:ej,ghost:tj},Gs=_.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const p=[Ef.btn,Ef[s],Ef[i],o].filter(Boolean).join(" ");return r.jsx("button",{ref:d,className:p,...u,children:c})}),nj="_copyButton_1bqk0_1",sj={copyButton:nj},aj=2e3;function gn({text:t,className:s,"data-testid":i}){const[o,c]=_.useState(!1),u=_.useRef(void 0);_.useEffect(()=>()=>{u.current!==void 0&&clearTimeout(u.current)},[]);const d=_.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),u.current!==void 0&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=void 0},aj)}catch{}},[t]);return r.jsx("button",{type:"button",className:`${sj.copyButton} ${s??""}`,onClick:()=>{d().catch(()=>{})},"aria-label":o?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:o?r.jsx(To,{size:Gt,"aria-hidden":"true"}):r.jsx(GT,{size:Gt,"aria-hidden":"true"})})}const ij="_banner_bxqlh_1",oj="_label_bxqlh_15",rj="_text_bxqlh_25",lj="_link_bxqlh_29",yc={banner:ij,label:oj,text:rj,link:lj};function cj(){return r.jsxs("div",{className:yc.banner,"data-testid":"demo-banner",children:[r.jsx("span",{className:yc.label,children:"DEMO"}),r.jsxs("span",{className:yc.text,children:["This is an interactive demo with mock data."," ",r.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:yc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const uj="_container_og0yp_1",dj="_chevronButton_og0yp_6",fj="_mainButton_og0yp_6",pj="_sm_og0yp_34",mj="_md_og0yp_34",hj="_lg_og0yp_34",gj="_primary_og0yp_57",vj="_danger_og0yp_70",yj="_outline_og0yp_83",bj="_ghost_og0yp_92",_j="_dropdown_og0yp_100",xj="_option_og0yp_113",kj="_optionLabel_og0yp_130",Sj="_optionDesc_og0yp_135",Vs={container:uj,chevronButton:dj,mainButton:fj,sm:pj,md:mj,lg:hj,primary:gj,danger:vj,outline:yj,ghost:bj,dropdown:_j,option:xj,optionLabel:kj,optionDesc:Sj};function y_({label:t,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,p]=_.useState(!1),h=_.useRef(null);_.useEffect(()=>{if(!d)return;function b(k){h.current&&k.target instanceof Node&&!h.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[d]),_.useEffect(()=>{if(!d)return;function b(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[d]);const g=Vs[o]||"",v=Vs[c]||"",y=()=>{d&&p(!1),s()};return r.jsxs("div",{ref:h,className:Vs.container,"data-testid":u,children:[r.jsx("button",{type:"button",className:`${Vs.mainButton} ${g} ${v}`,onClick:y,"data-testid":u?`${u}-main`:void 0,children:t}),r.jsx("button",{type:"button",className:`${Vs.chevronButton} ${g} ${v}`,onClick:()=>p(b=>!b),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:r.jsx(Kb,{size:Gt,"aria-hidden":"true"})}),d&&r.jsx("div",{className:Vs.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((b,k)=>r.jsxs("button",{type:"button",className:Vs.option,onClick:()=>{b.onClick(),p(!1)},children:[r.jsx("span",{className:Vs.optionLabel,children:b.label}),b.description&&r.jsx("span",{className:Vs.optionDesc,children:b.description})]},k))})]})}function yp(){yp=function(c,u){return new i(c,void 0,u)};var t=RegExp.prototype,s=new WeakMap;function i(c,u,d){var p=new RegExp(c,u);return s.set(p,d||s.get(c)),Uc(p,i.prototype)}function o(c,u){var d=s.get(u);return Object.keys(d).reduce(function(p,h){var g=d[h];if(typeof g=="number")p[h]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[h]=c[g[v]]}return p},Object.create(null))}return(function(c,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),u&&Uc(c,u)})(i,RegExp),i.prototype.exec=function(c){var u=t.exec.call(this,c);if(u){u.groups=o(u,this);var d=u.indices;d&&(d.groups=o(d,this))}return u},i.prototype[Symbol.replace]=function(c,u){if(typeof u=="string"){var d=s.get(this);return t[Symbol.replace].call(this,c,u.replace(/\$<([^>]+)>/g,function(h,g){var v=d[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof u=="function"){var p=this;return t[Symbol.replace].call(this,c,function(){var h=arguments;return typeof h[h.length-1]!="object"&&(h=[].slice.call(h)).push(o(h,p)),u.apply(this,h)})}return t[Symbol.replace].call(this,c,u)},yp.apply(this,arguments)}function Uc(t,s){return Uc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Uc(t,s)}function Xv(t,s){(s==null||s>t.length)&&(s=t.length);for(var i=0,o=new Array(s);i<s;i++)o[i]=t[i];return o}function Af(t,s){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=(function(c,u){if(c){if(typeof c=="string")return Xv(c,u);var d=Object.prototype.toString.call(c).slice(8,-1);return d==="Object"&&c.constructor&&(d=c.constructor.name),d==="Map"||d==="Set"?Array.from(c):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?Xv(c,u):void 0}})(t))||s){i&&(t=i);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
218
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Tj=(function(t){return function(s){return s===void 0&&(s={}),(function(o,c){if(c&&!o.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(o){tT(o,"element",i)};function i(o,c,u){var d,p;if(u&&u.tagName==="pre"&&o.tagName==="code"){var h=(o==null||(d=o.data)==null?void 0:d.meta)||(o==null||(p=o.properties)==null?void 0:p.metastring)||"";o.properties.className?typeof o.properties.className=="boolean"?o.properties.className=[]:Array.isArray(o.properties.className)||(o.properties.className=[o.properties.className]):o.properties.className=[];var g,v,y=(function(R){for(var D,q=Af(R.properties.className);!(D=q()).done;){var $=D.value;if($.slice(0,9)==="language-")return $.slice(9).toLowerCase()}return null})(o);if(!y&&s.defaultLanguage&&o.properties.className.push("language-"+(y=s.defaultLanguage)),o.properties.className.push("code-highlight"),y)try{var b,k;k=(b=y)!=null&&b.includes("diff-")?y.split("-")[1]:y,g=t.highlight(gc(o),k),u.properties.className=(u.properties.className||[]).concat("language-"+k)}catch(R){if(!s.ignoreMissing||!/Unknown language/.test(R.message))throw R;g=o}else g=o;g.children=(v=1,function R(D){return D.reduce(function(q,$){if($.type==="text"){var Y=$.value,G=(Y.match(/\n/g)||"").length;if(G===0)$.position={start:{line:v,column:1},end:{line:v,column:1}},q.push($);else for(var Q,ae=Y.split(`
219
- `),me=Af(ae.entries());!(Q=me()).done;){var ie=Q.value,ee=ie[0],B=ie[1];q.push({type:"text",value:ee===ae.length-1?B:B+`
220
- `,position:{start:{line:v+ee,column:1},end:{line:v+ee,column:1}}})}return v+=G,q}if(Object.prototype.hasOwnProperty.call($,"children")){var Z=v;return $.children=R($.children),q.push($),$.position={start:{line:Z,column:1},end:{line:v,column:1}},q}return q.push($),q},[])})(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,w=(function(R){var D=/{([\d,-]+)}/,q=R.split(",").map(function(G){return G.trim()}).join();if(D.test(q)){var $=D.exec(q)[1],Y=sT($);return function(G){return Y.includes(G+1)}}return function(){return!1}})(h),j=(function(R){var D=yp(/showLineNumbers=(\d+)/i,{lines:1});if(D.test(R)){var q=D.exec(R);return Number(q.groups.lines)}return 1})(h),N=(function(R){for(var D=new Array(R),q=0;q<R;q++)D[q]={type:"element",tagName:"span",properties:{className:[]},children:[]};return D})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var R,D,q=S.value,$=q[0],Y=q[1];Y.properties.className=["code-line"];var G=aT(g,function(Q){return Q.position.start.line<=$+1&&Q.position.end.line>=$+1});Y.children=G.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(y))&&!C.some(function(Q){return h.toLowerCase().includes(Q)})&&(Y.properties.line=[($+j).toString()],Y.properties.className.push("line-number")),w($)&&Y.properties.className.push("highlight-line"),(y==="diff"||(R=y)!=null&&R.includes("diff-"))&&gc(Y).substring(0,1)==="-"?Y.properties.className.push("deleted"):(y==="diff"||(D=y)!=null&&D.includes("diff-"))&&gc(Y).substring(0,1)==="+"&&Y.properties.className.push("inserted")},I=Af(N.entries());!(S=I()).done;)E();N.length>0&&gc(N[N.length-1]).trim()===""&&N.pop(),o.children=N}}}})(nT);function b_(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 _o(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const Qv=new Set(["grackle"]);function jo(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const o=t.slice(5,i);if(Qv.has(o))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(Qv.has(i))return t.slice(s+1)}return t}const wj={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",powershell:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata",finding_post:"finding",finding_list:"finding",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function Nj(t){const s=jo(t);return wj[s.toLowerCase()]??"generic"}const jj="_card_qkm9i_2",Cj="_cardBlue_qkm9i_20",Ej="_cardOrange_qkm9i_24",Aj="_cardGreen_qkm9i_28",Dj="_cardPurple_qkm9i_32",Rj="_cardNeutral_qkm9i_36",Mj="_cardRed_qkm9i_40",Ij="_cardTeal_qkm9i_44",Oj="_header_qkm9i_48",Bj="_icon_qkm9i_55",Lj="_toolName_qkm9i_64",zj="_fileName_qkm9i_71",Uj="_badge_qkm9i_80",$j="_spacer_qkm9i_87",Pj="_bodyToggle_qkm9i_91",Vj="_chevron_qkm9i_109",Hj="_chevronExpanded_qkm9i_115",qj="_pre_qkm9i_119",Gj="_diffAdd_qkm9i_143",Fj="_diffRemove_qkm9i_155",Zj="_diffContext_qkm9i_167",Kj="_diffHeader_qkm9i_176",Yj="_diffLine_qkm9i_182",Jj="_exitOk_qkm9i_188",Wj="_exitError_qkm9i_194",Xj="_exitPending_qkm9i_200",Qj="_copyButtonInline_qkm9i_214",eC="_inProgress_qkm9i_228",tC="_metadata_qkm9i_232",nC="_metadataPrefix_qkm9i_239",A={card:jj,cardBlue:Cj,cardOrange:Ej,cardGreen:Aj,cardPurple:Dj,cardNeutral:Rj,cardRed:Mj,cardTeal:Ij,header:Oj,icon:Bj,toolName:Lj,fileName:zj,badge:Uj,spacer:$j,bodyToggle:Pj,chevron:Vj,chevronExpanded:Hj,pre:qj,diffAdd:Gj,diffRemove:Fj,diffContext:Zj,diffHeader:Kj,diffLine:Yj,exitOk:Jj,exitError:Wj,exitPending:Xj,copyButtonInline:Qj,inProgress:eC,metadata:tC,metadataPrefix:nC};function sC(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 aC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Df=5;function ey({tool:t,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=_.useState(!1),p=sC(s),h=aC(p),g=i===void 0,v=o?A.cardRed:c?A.cardGreen:A.cardBlue,y=c?"var(--accent-green)":"var(--accent-blue)",b=c?r.jsx(WT,{size:Gt}):r.jsx(QT,{size:Gt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(i==null?void 0:i.split(`
221
- `))??[],w=S.length>Df,j=u?S:S.slice(0,Df);return r.jsxs("div",{className:`${A.card} ${v} ${g?A.inProgress:""}`,"data-testid":k,children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,children:b}),r.jsx("span",{className:A.toolName,style:{color:y},children:t}),h&&r.jsx("span",{className:A.fileName,title:p,children:h}),!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,children:[S.length," lines"]})]}),!g&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-content",children:j.map((N,C)=>r.jsxs("span",{className:A.diffLine,children:[r.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))}),w&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${u?A.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),u?"collapse":`${S.length-Df} more lines`]})]})]})}function iC(t){const s=t.split(`
222
- `),i=[];for(const o of s)o.startsWith("diff --git")||o.startsWith("index ")||(o.startsWith("--- ")||o.startsWith("+++ "))&&!o.startsWith("---- ")&&!o.startsWith("++++ ")||(o.startsWith("@@")?i.push({type:"header",content:o}):o.startsWith("+")?i.push({type:"add",content:o.slice(1)}):o.startsWith("-")?i.push({type:"remove",content:o.slice(1)}):o.startsWith(" ")?i.push({type:"context",content:o.slice(1)}):o===""&&i.push({type:"context",content:""}));return i}function oC(t,s){const i=t.split(`
223
- `),o=s.split(`
224
- `),c=[];for(const u of i)c.push({type:"remove",content:u});for(const u of o)c.push({type:"add",content:u});return c}function rC(t){let s=0,i=0;for(const o of t)o.type==="add"&&s++,o.type==="remove"&&i++;return{added:s,removed:i}}function lC(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 cC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,i=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),o=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&o!==void 0)return{oldStr:i,newStr:o}}function uC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function dC(t,s){if(s){let o=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(o=c.detailedContent)}catch{}if(o.includes("@@")||o.startsWith("diff ")){const c=iC(o);if(c.length>0)return c}}const i=cC(t);if(i)return oC(i.oldStr,i.newStr)}const Rf=5;function fC({tool:t,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=_.useState(!1),p=lC(s),h=uC(p),g=i===void 0,v=dC(s,c),y=v?rC(v):null,b=((v==null?void 0:v.length)??0)>Rf,k=u?v:v==null?void 0:v.slice(0,Rf);return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardOrange} ${g?A.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,children:r.jsx(T2,{size:Gt})}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-yellow)"},children:t}),h&&r.jsx("span",{className:A.fileName,title:p,children:h}),y&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-diff-stats",children:[r.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",y.added]})," ",r.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",y.removed]})]})]}),!g&&!o&&(v||i)&&r.jsx(gn,{text:v?v.map(S=>`${S.type==="add"?"+":S.type==="remove"?"-":S.type==="header"?"":" "}${S.content}`).join(`
225
- `):i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&k&&k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-diff",children:k.map((S,w)=>{let j=A.diffContext;return S.type==="add"&&(j=A.diffAdd),S.type==="remove"&&(j=A.diffRemove),S.type==="header"&&(j=A.diffHeader),r.jsx("span",{className:`${A.diffLine} ${j}`,children:S.content},w)})}),b&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${u?A.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),u?"collapse":`${((v==null?void 0:v.length)??0)-Rf} more lines`]})]}),!o&&!v&&!g&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-content",children:i})]})}const pC=/^\[exit (\d+)\]\s*/;function mC(t){const s=pC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function hC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function gC(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'(.+?)'\s*$/i.exec(t);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"(.+?)"\s*$/i.exec(t);return i?i[1]:t}const Mf=3;function vC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=hC(s),p=gC(d),h=i===void 0,g=i?mC(i):null,v=(g==null?void 0:g.output.split(`
226
- `))??[],y=v.length>Mf,b=c?v:v.slice(0,Mf),k=g==null?void 0:g.exitCode,S=o||k!==void 0&&k!==0;return r.jsxs("div",{className:`${A.card} ${S?A.cardRed:A.cardNeutral}`,"data-testid":"tool-card-shell",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),r.jsx("span",{className:A.fileName,style:{flex:1,color:"var(--text-primary)"},title:d!==p?d:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&r.jsxs("span",{className:k===0?A.exitOk:A.exitError,"data-testid":"tool-card-exit-code",children:[k===0?r.jsx(To,{size:kt,"aria-hidden":"true"}):r.jsx(yi,{size:kt,"aria-hidden":"true"})," ","exit ",k]}),!h&&g&&g.output.length>0&&r.jsx(gn,{text:g.output,"data-testid":"tool-card-copy",className:A.copyButtonInline}),h&&r.jsx("span",{className:A.exitPending,"data-testid":"tool-card-pending",children:r.jsx(f2,{size:kt,"aria-hidden":"true"})})]}),!h&&g&&g.output.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-output",children:b.join(`
227
- `)}),y&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),c?"collapse":`${v.length-Mf} more lines`]})]})]})}function yC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,i=typeof s.pattern=="string"?s.pattern:"",o=typeof s.path=="string"?s.path:"";return{pattern:i,path:o}}const If=5;function bC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),{pattern:d,path:p}=yC(s),h=i===void 0,g=(i==null?void 0:i.split(`
228
- `).filter(b=>b.length>0))??[],v=g.length>If,y=c?g:g.slice(0,If);return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardPurple} ${h?A.inProgress:""}`,"data-testid":"tool-card-search",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,children:r.jsx(Yb,{size:Gt})}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),d&&r.jsxs("span",{className:A.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),p&&r.jsxs("span",{className:A.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!h&&!o&&g.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&y.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-results",children:y.join(`
229
- `)}),v&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),c?"collapse":`${g.length-If} more matches`]})]})]})}const _C="_progressBar_14f5c_1",xC="_progressFill_14f5c_9",kC="_activeTask_14f5c_16",SC="_activeIcon_14f5c_27",TC="_todoPulse_14f5c_1",wC="_activeText_14f5c_34",NC="_checklist_14f5c_48",jC="_item_14f5c_55",CC="_itemIcon_14f5c_65",EC="_itemText_14f5c_73",AC="_pending_14f5c_78",DC="_in_progress_14f5c_85",RC="_completed_14f5c_97",MC="_emptyMessage_14f5c_108",es={progressBar:_C,progressFill:xC,activeTask:kC,activeIcon:SC,todoPulse:TC,activeText:wC,checklist:NC,item:jC,itemIcon:CC,itemText:EC,pending:AC,in_progress:DC,completed:RC,emptyMessage:MC},IC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function OC(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(i=>typeof i=="object"&&i!==null&&typeof i.content=="string"&&typeof i.status=="string").map(i=>({content:i.content,activeForm:typeof i.activeForm=="string"?i.activeForm:void 0,status:ty(i.status)})):Array.isArray(s.plan)?s.plan.filter(i=>typeof i=="object"&&i!==null&&typeof i.step=="string"&&typeof i.status=="string").map(i=>({content:i.step,status:ty(i.status)})):typeof s.content=="string"?BC(s.content):[]}function ty(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function BC(t){const s=t.split(`
230
- `),i=[];for(const o of s){const c=IC.exec(o.trim());if(c){const u=c[1],d=c[2].trim();let p="pending";u==="x"||u==="X"?p="completed":(u==="~"||u==="/"||u==="!")&&(p="in_progress"),i.push({content:d,status:p})}}return i}function LC(t){switch(t){case"completed":return r.jsx(To,{size:kt});case"in_progress":return r.jsx(Ra,{size:kt,fill:"currentColor"});default:return r.jsx(Ra,{size:kt})}}function zC({args:t}){const s=OC(t),i=s.filter(u=>u.status==="completed").length,o=s.find(u=>u.status==="in_progress"),c=s.length===0;return r.jsxs("div",{className:`${A.card} ${A.cardBlue}`,"data-testid":"tool-card-todo",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,children:r.jsx(l2,{size:Gt})}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&r.jsx("div",{className:es.progressBar,"data-testid":"tool-card-todo-bar",children:r.jsx("div",{className:es.progressFill,style:{width:`${i/s.length*100}%`}})}),o&&r.jsxs("div",{className:es.activeTask,"data-testid":"tool-card-todo-active",children:[r.jsx("span",{className:es.activeIcon,children:r.jsx(Ra,{size:kt,fill:"currentColor"})}),r.jsx("span",{className:es.activeText,children:o.activeForm||o.content})]}),!c&&r.jsx("div",{className:es.checklist,"data-testid":"tool-card-todo-list",children:s.map((u,d)=>r.jsxs("div",{className:`${es.item} ${es[u.status]}`,"data-testid":"tool-card-todo-item",children:[r.jsx("span",{className:es.itemIcon,children:LC(u.status)}),r.jsx("span",{className:es.itemText,children:u.content})]},d))}),c&&r.jsx("div",{className:es.emptyMessage,children:"All items completed and cleared."})]})}function UC(t,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const o of Object.values(i))if(typeof o=="string")return o;return t}function $C({tool:t,args:s}){const i=UC(t,s);return r.jsxs("div",{className:A.metadata,"data-testid":"tool-card-metadata",children:[r.jsx("span",{className:A.metadataPrefix,children:r.jsx(YT,{size:kt})}),i]})}function PC(t){if(t==null||typeof t!="object")return{};const s=t;return{title:typeof s.title=="string"?s.title:void 0,category:typeof s.category=="string"?s.category:void 0,tags:Array.isArray(s.tags)?s.tags:void 0}}function VC(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const Of=5,Bf=5;function HC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=jo(t),p=PC(s),h=i===void 0,{single:g,list:v}=VC(i),y=(g==null?void 0:g.title)??p.title,b=v?void 0:(g==null?void 0:g.category)??p.category,k=v?void 0:(g==null?void 0:g.tags)??p.tags;return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardPurple} ${h?A.inProgress:""}`,"data-testid":"tool-card-finding",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"💡"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),y&&r.jsxs("span",{className:A.fileName,"data-testid":"tool-card-finding-title",children:['"',y,'"']}),b&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsx("span",{className:A.badge,"data-testid":"tool-card-finding-category",children:b})]}),v&&!b&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),k&&k.length>0&&r.jsx("div",{className:A.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:k.map((S,w)=>r.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},w))}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&(g==null?void 0:g.content)&&r.jsx(r.Fragment,{children:(()=>{const S=g.content.split(`
231
- `),w=S.length>Bf,j=c?g.content:S.slice(0,Bf).join(`
232
- `);return r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-finding-content",children:j}),w&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${S.length-Bf} more lines`]})]})})()}),!o&&v&&v.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Of)).map((S,w)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${w+1}`}`).join(`
233
- `)}),v.length>Of&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Of} more findings`]})]})]})}function qC(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 GC(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null){const i=s;return typeof i.sessionId=="string"?{sessionId:i.sessionId,single:i}:{single:i}}}catch{}return{}}function ny(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function FC(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 Lf=5;function ZC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=jo(t),p=qC(s),h=i===void 0,{single:g,list:v,sessionId:y}=GC(i),b=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardBlue} ${h?A.inProgress:""}`,"data-testid":"tool-card-task",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"📋"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-blue)"},children:d}),b&&r.jsxs("span",{className:A.fileName,"data-testid":"tool-card-task-title",children:['"',b,'"']}),!b&&p.taskId&&r.jsx("span",{className:A.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,style:{color:FC(k)},"data-testid":"tool-card-task-status",children:[ny(k)," ",k]})]}),v&&!k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),h&&!b&&!p.taskId&&s!==null&&s!==void 0&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&y&&r.jsxs("div",{className:A.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",y]}),!o&&g&&!v&&!y&&r.jsx("pre",{className:A.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(`
234
- `)}),!o&&v&&v.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Lf)).map(S=>{const w=ny(S.status),j=S.title??S.id??"untitled";return`${w} ${j}`}).join(`
235
- `)}),v.length>Lf&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Lf} more tasks`]})]})]})}function KC(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 YC(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s,o=typeof i.workpad=="object"&&i.workpad!==null?i.workpad:i;return{status:typeof o.status=="string"?o.status:void 0,summary:typeof o.summary=="string"?o.summary:void 0,extra:typeof o.extra=="object"&&o.extra!==null?o.extra:void 0}}catch{}return{}}function JC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=jo(t),p=KC(s),h=i===void 0,g=YC(i),v=g.status??p.status,y=g.summary??p.summary;return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardGreen} ${h?A.inProgress:""}`,"data-testid":"tool-card-workpad",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"📓"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-green, #4ade80)"},children:d}),v&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsx("span",{className:A.badge,"data-testid":"tool-card-workpad-status",children:v})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),y&&r.jsx("pre",{className:A.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:y}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&!y&&!v&&!g.extra&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-result",children:i}),!o&&g.extra&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function WC(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 XC(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;if(Array.isArray(i.results))return{results:i.results.filter(o=>o!==null&&typeof o=="object")};if(typeof i.node=="object"&&i.node!==null){const o=Array.isArray(i.edges)?i.edges.length:0;return{node:i.node,edgeCount:o}}if(typeof i.id=="string")return{node:i}}catch{}return{}}const zf=5;function QC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=jo(t),p=WC(s),h=i===void 0,g=XC(i);return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardPurple} ${h?A.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"🧠"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),p.query&&r.jsxs("span",{className:A.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&r.jsx("span",{className:A.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),h&&s!==null&&s!==void 0&&!p.query&&!p.id&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&g.results&&g.results.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,zf)).map(v=>{var k,S,w;const y=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((w=v.node)==null?void 0:w.id)??"node",b=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${y}${b}`}).join(`
236
- `)}),g.results.length>zf&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-zf} more results`]})]}),!o&&g.node&&!g.results&&r.jsx("pre",{className:A.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(`
237
- `)})]})}function eE(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 tE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;return{sessionId:typeof i.sessionId=="string"?i.sessionId:void 0,fd:typeof i.fd=="number"?i.fd:void 0,fds:Array.isArray(i.fds)?i.fds.filter(o=>o!==null&&typeof o=="object"):void 0,success:typeof i.success=="boolean"?i.success:void 0,output:typeof i.output=="string"?i.output:void 0}}catch{}return{}}function nE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=jo(t),p=eE(s),h=i===void 0,g=tE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const y=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardOrange} ${h?A.inProgress:""}`,"data-testid":"tool-card-ipc",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"🔀"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:d}),v&&r.jsx("span",{className:A.fileName,"data-testid":"tool-card-ipc-info",children:v}),y&&r.jsx("span",{className:A.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:y}),g.fds&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsx("span",{className:A.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),h&&!y&&!v&&s!==null&&s!==void 0&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&g.sessionId&&r.jsxs("div",{className:A.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}`]}),!o&&g.output&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!o&&g.fds&&g.fds.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(b=>{const k=[`fd:${b.fd??"?"}`,b.permission??"",b.deliveryMode??""];return b.streamName&&k.push(b.streamName),b.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
238
- `)}),g.fds.length>5&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function sE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Uf=8;function aE({args:t,result:s,isError:i}){const[o,c]=_.useState(!1),u=sE(t),d=s===void 0,p=(s==null?void 0:s.split(`
239
- `))??[],h=p.length>Uf,g=o?s:p.slice(0,Uf).join(`
240
- `);return r.jsxs("div",{className:`${A.card} ${i?A.cardRed:A.cardNeutral} ${d?A.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,"aria-hidden":"true",children:"🔧"}),r.jsx("span",{className:A.toolName,children:"ToolSearch"}),u&&r.jsxs("span",{className:A.fileName,"data-testid":"tool-card-tool-search-query",children:['"',u,'"']}),!d&&!i&&s&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:A.spacer}),r.jsxs("span",{className:A.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]}),r.jsx(gn,{text:s,"data-testid":"tool-card-copy",className:A.copyButtonInline})]})]}),d&&!u&&t!==null&&t!==void 0&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:s}),!i&&!d&&s&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-tool-search-result",children:g}),h&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":o,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${o?A.chevronExpanded:""}`,children:"▸"}),o?"collapse":`${p.length-Uf} more lines`]})]})]})}function iE(t){const s=/^mcp__(.+?)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function oE(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 i=JSON.stringify(t);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const $f=5;function rE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),{display:d}=iE(t),p=oE(s),h=i===void 0,g=(i==null?void 0:i.split(`
241
- `))??[],v=g.length>$f,y=c?i:g.slice(0,$f).join(`
242
- `);let b="";if(s!=null)try{b=JSON.stringify(s,null,2)}catch{b=String(s)}return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardBlue} ${h?A.inProgress:""}`,"data-testid":"tool-card-generic",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,children:r.jsx(ZT,{size:Gt,"aria-hidden":"true"})}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-blue)"},children:d}),p&&r.jsx("span",{className:A.fileName,children:p}),!h&&!o&&i&&r.jsx(gn,{text:i,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),h&&b&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-args",children:b}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-result",children:y}),v&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),c?"collapse":`${g.length-$f} more lines`]})]})]})}const lE="_badgePill_o7eqc_1",cE="_modelBadge_o7eqc_14",uE="_backgroundBadge_o7eqc_26",dE="_backgroundDot_o7eqc_36",fE="_backgroundDotPulsing_o7eqc_41",pE="_description_o7eqc_55",mE="_statusLine_o7eqc_62",hE="_statusCompleted_o7eqc_72",gE="_statusRunning_o7eqc_77",vE="_statusError_o7eqc_83",yE="_promptToggle_o7eqc_88",ts={badgePill:lE,modelBadge:cE,backgroundBadge:uE,backgroundDot:dE,backgroundDotPulsing:fE,description:pE,statusLine:mE,statusCompleted:hE,statusRunning:gE,statusError:vE,promptToggle:yE};function bE(t,s){if(s==null||typeof s!="object")return{};const i=s;return t.toLowerCase()==="read_agent"?{agentId:typeof i.agent_id=="string"?i.agent_id:void 0,isPoll:!0}:typeof i.agent_type=="string"||typeof i.name=="string"?{agentType:typeof i.agent_type=="string"?i.agent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.mode==="background",agentName:typeof i.name=="string"?i.name:void 0}:{agentType:typeof i.subagent_type=="string"?i.subagent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.run_in_background===!0,model:typeof i.model=="string"?i.model:void 0,isResume:typeof i.resume=="string"&&i.resume.length>0}}const _E=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function xE(t){const s=_E.exec(t);if(!s)return;const i=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:i?i.trim():void 0}}const Pf=5;function kE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),[d,p]=_.useState(!1),h=bE(t,s),g=i===void 0,v=h.isPoll&&i?xE(i):void 0,y=(v==null?void 0:v.content)??i,b=(y==null?void 0:y.split(`
243
- `))??[],k=b.length>Pf,S=c?y:b.slice(0,Pf).join(`
244
- `),w=h.isPoll?"Subagent":"Agent";return r.jsxs("div",{className:`${A.card} ${o?A.cardRed:A.cardTeal} ${g?A.inProgress:""}`,"data-testid":"tool-card-agent",children:[r.jsxs("div",{className:A.header,children:[r.jsx("span",{className:A.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),r.jsx("span",{className:A.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:w}),h.agentType&&r.jsx("span",{className:ts.badgePill,"data-testid":"tool-card-agent-type",children:h.agentType}),h.model&&r.jsx("span",{className:ts.modelBadge,"data-testid":"tool-card-agent-model",children:h.model}),h.isBackground&&r.jsxs("span",{className:ts.backgroundBadge,"data-testid":"tool-card-agent-background",children:[r.jsx("span",{className:g?ts.backgroundDotPulsing:ts.backgroundDot,children:"●"}),"BG"]}),h.agentName&&r.jsx("span",{className:A.fileName,"data-testid":"tool-card-agent-name",children:h.agentName}),h.agentId&&r.jsx("span",{className:A.fileName,"data-testid":"tool-card-agent-id",children:h.agentId}),r.jsx("span",{className:A.spacer}),g&&!h.isBackground&&r.jsx("span",{className:A.exitPending,"data-testid":"tool-card-pending",children:"●"}),!g&&!o&&y&&r.jsx(gn,{text:y,"data-testid":"tool-card-copy",className:A.copyButtonInline})]}),h.description&&r.jsx("div",{className:ts.description,"data-testid":"tool-card-agent-description",children:h.isResume?`Resuming: ${h.description}`:h.description}),v&&r.jsxs("div",{className:ts.statusLine,"data-testid":"tool-card-agent-status",children:[r.jsx("span",{className:v.status==="completed"?ts.statusCompleted:v.status==="running"?ts.statusRunning:ts.statusError,children:v.status}),v.metadata&&r.jsx("span",{children:v.metadata})]}),h.prompt&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:ts.promptToggle,onClick:()=>{p(j=>!j)},"aria-expanded":d,"data-testid":"tool-card-prompt-toggle",children:[r.jsx("span",{className:`${A.chevron} ${d?A.chevronExpanded:""}`,children:"▸"}),"prompt"]}),d&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-prompt",children:h.prompt})]}),o&&i&&r.jsx("pre",{className:A.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&y&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:A.pre,"data-testid":"tool-card-result",children:S}),k&&r.jsxs("button",{type:"button",className:A.bodyToggle,onClick:()=>{u(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${A.chevron} ${c?A.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${b.length-Pf} more lines`]})]})]})}function Vf(t){switch(Nj(t.tool)){case"file-read":return r.jsx(ey,{...t});case"file-edit":return r.jsx(fC,{...t});case"file-write":return r.jsx(ey,{...t,writeVariant:!0});case"shell":return r.jsx(vC,{...t});case"search":return r.jsx(bC,{...t});case"todo":return r.jsx(zC,{...t});case"metadata":return r.jsx($C,{...t});case"finding":return r.jsx(HC,{...t});case"task":return r.jsx(ZC,{...t});case"workpad":return r.jsx(JC,{...t});case"knowledge":return r.jsx(QC,{...t});case"ipc":return r.jsx(nE,{...t});case"tool-search":return r.jsx(aE,{...t});case"agent":return r.jsx(kE,{...t});default:return r.jsx(rE,{...t})}}const SE="_systemContextEvent_8n7q0_1",TE="_systemContextHeader_8n7q0_7",wE="_systemContextBadge_8n7q0_28",NE="_systemContextToggle_8n7q0_37",jE="_systemContextPre_8n7q0_43",CE="_systemContextEllipsis_8n7q0_54",EE="_systemEvent_8n7q0_58",AE="_systemTimestamp_8n7q0_65",DE="_textEvent_8n7q0_69",RE="_messageCopyButton_8n7q0_75",ME="_codeBlockWrapper_8n7q0_159",IE="_codeBlockCopyButton_8n7q0_162",OE="_errorEvent_8n7q0_166",BE="_statusEvent_8n7q0_174",LE="_userInputEvent_8n7q0_183",zE="_userInputContent_8n7q0_189",UE="_signalEvent_8n7q0_206",$E="_signalBadge_8n7q0_217",PE="_signalContent_8n7q0_226",VE="_usageEvent_8n7q0_231",HE="_usageBadge_8n7q0_238",qE="_defaultEvent_8n7q0_247",Ct={systemContextEvent:SE,systemContextHeader:TE,systemContextBadge:wE,systemContextToggle:NE,systemContextPre:jE,systemContextEllipsis:CE,systemEvent:EE,systemTimestamp:AE,textEvent:DE,messageCopyButton:RE,codeBlockWrapper:ME,codeBlockCopyButton:IE,errorEvent:OE,statusEvent:BE,userInputEvent:LE,userInputContent:zE,signalEvent:UE,signalBadge:$E,signalContent:PE,usageEvent:VE,usageBadge:HE,defaultEvent:qE},sy=3;function GE({content:t}){const[s,i]=_.useState(!1),o=t.split(`
245
- `),c=o.length>sy,u=s?t:o.slice(0,sy).join(`
246
- `);return r.jsxs("div",{className:Ct.systemContextEvent,"data-testid":"system-context-event",children:[r.jsxs("button",{type:"button",className:Ct.systemContextHeader,onClick:()=>{i(d=>!d)},"aria-expanded":s,children:[r.jsx("span",{className:Ct.systemContextBadge,children:"SYSTEM PROMPT"}),c&&r.jsx("span",{className:Ct.systemContextToggle,"aria-hidden":"true",children:s?r.jsx(Kb,{size:kt}):r.jsx(Xs,{size:kt})})]}),r.jsxs("pre",{className:Ct.systemContextPre,children:[u,!s&&c&&r.jsx("span",{className:Ct.systemContextEllipsis,children:"…"})]})]})}function FE({time:t,content:s}){return r.jsxs("div",{className:Ct.systemEvent,children:[r.jsxs("span",{className:Ct.systemTimestamp,children:["[",t,"]"]})," ",s]})}function bp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(bp).join(""):t!=null&&typeof t=="object"&&"props"in t?bp(t.props.children):""}function ZE({children:t,node:s,...i}){const o=bp(t);return r.jsxs("div",{className:Ct.codeBlockWrapper,children:[r.jsx("pre",{...i,children:t}),r.jsx(gn,{text:o,"data-testid":"copy-code-block",className:Ct.codeBlockCopyButton})]})}const KE={pre:ZE};function YE({content:t}){return r.jsxs("div",{className:Ct.textEvent,children:[r.jsx(gn,{text:t,"data-testid":"copy-message",className:Ct.messageCopyButton}),r.jsx(Xc,{remarkPlugins:[Qc],rehypePlugins:[Tj],components:KE,children:t})]})}function JE({content:t}){return r.jsxs("div",{className:Ct.errorEvent,children:["Error: ",t]})}function WE({content:t}){return r.jsxs("div",{className:Ct.statusEvent,children:["--- ",t," ---"]})}function XE({content:t}){return r.jsx("div",{className:Ct.userInputEvent,children:r.jsx("span",{className:Ct.userInputContent,children:t})})}function QE({content:t}){return r.jsxs("div",{className:Ct.signalEvent,"data-testid":"signal-event",children:[r.jsx("span",{className:Ct.signalBadge,children:"SIGNAL"}),r.jsx("span",{className:Ct.signalContent,children:t})]})}function eA({content:t}){let s=t;try{const i=JSON.parse(t),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=b_(o+c),d=_o(Number(i.cost_usd)||0);s=`${u} tokens · ${d}`}catch{}return r.jsx("div",{className:Ct.usageEvent,"data-testid":"usage-event",children:r.jsx("span",{className:Ct.usageBadge,children:s})})}function tA({content:t}){return r.jsx("div",{className:Ct.defaultEvent,children:t})}function nA({event:t,toolUseCtx:s,settled:i}){const o=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return r.jsx(GE,{content:t.content})}catch{}return r.jsx(FE,{time:o,content:t.content})}case"text":case"output":return r.jsx(YE,{content:t.content});case"tool_use":{let c="",u={};try{const d=JSON.parse(t.content);c=d.tool||"",u=d.args}catch{}return r.jsx(Vf,{tool:c,args:u,result:i?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const d=JSON.parse(t.content);typeof d.content=="string"&&(u=d.content)}catch{}return s?r.jsx(Vf,{tool:s.tool,args:s.args,result:u,isError:c,detailedResult:s.detailedResult}):r.jsx(Vf,{tool:"Tool output",args:void 0,result:u,isError:c})}case"error":return r.jsx(JE,{content:t.content});case"status":return r.jsx(WE,{content:t.content});case"user_input":return r.jsx(XE,{content:t.content});case"signal":return r.jsx(QE,{content:t.content});case"usage":return r.jsx(eA,{content:t.content});default:return r.jsx(tA,{content:t.content})}}const Qp=_.createContext({});function em(t){const s=_.useRef(null);return s.current===null&&(s.current=t()),s.current}const iu=_.createContext(null),tm=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class sA extends _.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const o=this.props.sizeRef.current;o.height=i.offsetHeight||0,o.width=i.offsetWidth||0,o.top=i.offsetTop,o.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function aA({children:t,isPresent:s}){const i=_.useId(),o=_.useRef(null),c=_.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=_.useContext(tm);return _.useInsertionEffect(()=>{const{width:d,height:p,top:h,left:g}=c.current;if(s||!o.current||!d||!p)return;o.current.dataset.motionPopId=i;const v=document.createElement("style");return u&&(v.nonce=u),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
247
- [data-motion-pop-id="${i}"] {
248
- position: absolute !important;
249
- width: ${d}px !important;
250
- height: ${p}px !important;
251
- top: ${h}px !important;
252
- left: ${g}px !important;
253
- }
254
- `),()=>{document.head.removeChild(v)}},[s]),r.jsx(sA,{isPresent:s,childRef:o,sizeRef:c,children:_.cloneElement(t,{ref:o})})}const iA=({children:t,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const p=em(oA),h=_.useId(),g=_.useCallback(y=>{p.set(y,!0);for(const b of p.values())if(!b)return;o&&o()},[p,o]),v=_.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:y=>(p.set(y,!1),()=>p.delete(y))}),u?[Math.random(),g]:[i,g]);return _.useMemo(()=>{p.forEach((y,b)=>p.set(b,!1))},[i]),_.useEffect(()=>{!i&&!p.size&&o&&o()},[i]),d==="popLayout"&&(t=r.jsx(aA,{isPresent:i,children:t})),r.jsx(iu.Provider,{value:v,children:t})};function oA(){return new Map}function __(t=!0){const s=_.useContext(iu);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=_.useId();_.useEffect(()=>{t&&c(u)},[t]);const d=_.useCallback(()=>t&&o&&o(u),[u,o,t]);return!i&&o?[!1,d]:[!0]}const bc=t=>t.key||"";function ay(t){const s=[];return _.Children.forEach(t,i=>{_.isValidElement(i)&&s.push(i)}),s}const nm=typeof window<"u",x_=nm?_.useLayoutEffect:_.useEffect,_s=({children:t,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[p,h]=__(d),g=_.useMemo(()=>ay(t),[t]),v=d&&!p?[]:g.map(bc),y=_.useRef(!0),b=_.useRef(g),k=em(()=>new Map),[S,w]=_.useState(g),[j,N]=_.useState(g);x_(()=>{y.current=!1,b.current=g;for(let I=0;I<j.length;I++){const R=bc(j[I]);v.includes(R)?k.delete(R):k.get(R)!==!0&&k.set(R,!1)}},[j,v.length,v.join("-")]);const C=[];if(g!==S){let I=[...g];for(let R=0;R<j.length;R++){const D=j[R],q=bc(D);v.includes(q)||(I.splice(R,0,D),C.push(D))}u==="wait"&&C.length&&(I=C),N(ay(I)),w(g);return}const{forceRender:E}=_.useContext(Qp);return r.jsx(r.Fragment,{children:j.map(I=>{const R=bc(I),D=d&&!p?!1:g===j||v.includes(R),q=()=>{if(k.has(R))k.set(R,!0);else return;let $=!0;k.forEach(Y=>{Y||($=!1)}),$&&(E==null||E(),N(b.current),d&&(h==null||h()),o&&o())};return r.jsx(iA,{isPresent:D,initial:!y.current||i?void 0:!1,custom:D?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:D?void 0:q,children:I},R)})})},Cn=t=>t;let k_=Cn;const rA={useManualTiming:!1};function lA(t){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(g){u.has(g)&&(h.schedule(g),t()),g(d)}const h={schedule:(g,v=!1,y=!1)=>{const k=y&&o?s:i;return v&&u.add(g),k.has(g)||k.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(d=g,o){c=!0;return}o=!0,[s,i]=[i,s],s.forEach(p),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const _c=["read","resolveKeyframes","update","preRender","render","postRender"],cA=40;function S_(t,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=_c.reduce((N,C)=>(N[C]=lA(u),N),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:y,postRender:b}=d,k=()=>{const N=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(N-c.timestamp,cA),1),c.timestamp=N,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),y.process(c),b.process(c),c.isProcessing=!1,i&&s&&(o=!1,t(k))},S=()=>{i=!0,o=!0,c.isProcessing||t(k)};return{schedule:_c.reduce((N,C)=>{const E=d[C];return N[C]=(I,R=!1,D=!1)=>(i||S(),E.schedule(I,R,D)),N},{}),cancel:N=>{for(let C=0;C<_c.length;C++)d[_c[C]].cancel(N)},state:c,steps:d}}const{schedule:vt,cancel:Ia,state:Wt,steps:Hf}=S_(typeof requestAnimationFrame<"u"?requestAnimationFrame:Cn,!0),T_=_.createContext({strict:!1}),iy={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"]},xo={};for(const t in iy)xo[t]={isEnabled:s=>iy[t].some(i=>!!s[i])};function uA(t){for(const s in t)xo[s]={...xo[s],...t[s]}}const dA=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 $c(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||dA.has(t)}let w_=t=>!$c(t);function fA(t){t&&(w_=s=>s.startsWith("on")?!$c(s):t(s))}try{fA(require("@emotion/is-prop-valid").default)}catch{}function pA(t,s,i){const o={};for(const c in t)c==="values"&&typeof t.values=="object"||(w_(c)||i===!0&&$c(c)||!s&&!$c(c)||t.draggable&&c.startsWith("onDrag"))&&(o[c]=t[c]);return o}function mA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...o)=>t(...o);return new Proxy(i,{get:(o,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const ou=_.createContext({});function $r(t){return typeof t=="string"||Array.isArray(t)}function ru(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const sm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],am=["initial",...sm];function lu(t){return ru(t.animate)||am.some(s=>$r(t[s]))}function N_(t){return!!(lu(t)||t.variants)}function hA(t,s){if(lu(t)){const{initial:i,animate:o}=t;return{initial:i===!1||$r(i)?i:void 0,animate:$r(o)?o:void 0}}return t.inherit!==!1?s:{}}function gA(t){const{initial:s,animate:i}=hA(t,_.useContext(ou));return _.useMemo(()=>({initial:s,animate:i}),[oy(s),oy(i)])}function oy(t){return Array.isArray(t)?t.join(" "):t}const vA=Symbol.for("motionComponentSymbol");function fo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function yA(t,s,i){return _.useCallback(o=>{o&&t.onMount&&t.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):fo(i)&&(i.current=o))},[s])}const im=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),bA="framerAppearId",j_="data-"+im(bA),{schedule:om}=S_(queueMicrotask,!1),C_=_.createContext({});function _A(t,s,i,o,c){var u,d;const{visualElement:p}=_.useContext(ou),h=_.useContext(T_),g=_.useContext(iu),v=_.useContext(tm).reducedMotion,y=_.useRef(null);o=o||h.renderer,!y.current&&o&&(y.current=o(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const b=y.current,k=_.useContext(C_);b&&!b.projection&&c&&(b.type==="html"||b.type==="svg")&&xA(y.current,i,c,k);const S=_.useRef(!1);_.useInsertionEffect(()=>{b&&S.current&&b.update(i,g)});const w=i[j_],j=_.useRef(!!w&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,w))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,w)));return x_(()=>{b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),om.render(b.render),j.current&&b.animationState&&b.animationState.animateChanges())}),_.useEffect(()=>{b&&(!j.current&&b.animationState&&b.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var N;(N=window.MotionHandoffMarkAsComplete)===null||N===void 0||N.call(window,w)}),j.current=!1))}),b}function xA(t,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:p,layoutScroll:h,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:E_(t.parent)),t.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||p&&fo(p),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function E_(t){if(t)return t.options.allowProjection!==!1?t.projection:E_(t.parent)}function kA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;t&&uA(t);function p(g,v){let y;const b={..._.useContext(tm),...g,layoutId:SA(g)},{isStatic:k}=b,S=gA(g),w=o(g,k);if(!k&&nm){TA();const j=wA(b);y=j.MeasureLayout,S.visualElement=_A(c,w,b,s,j.ProjectionNode)}return r.jsxs(ou.Provider,{value:S,children:[y&&S.visualElement?r.jsx(y,{visualElement:S.visualElement,...b}):null,i(c,g,yA(w,S.visualElement,v),w,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(d=(u=c.displayName)!==null&&u!==void 0?u:c.name)!==null&&d!==void 0?d:""})`}`;const h=_.forwardRef(p);return h[vA]=c,h}function SA({layoutId:t}){const s=_.useContext(Qp).id;return s&&t!==void 0?s+"-"+t:t}function TA(t,s){_.useContext(T_).strict}function wA(t){const{drag:s,layout:i}=xo;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const NA=["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 rm(t){return typeof t!="string"||t.includes("-")?!1:!!(NA.indexOf(t)>-1||/[A-Z]/u.test(t))}function ry(t){const s=[{},{}];return t==null||t.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function lm(t,s,i,o){if(typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,u]=ry(o);s=s(i!==void 0?i:t.custom,c,u)}return s}const _p=t=>Array.isArray(t),jA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),CA=t=>_p(t)?t[t.length-1]||0:t,nn=t=>!!(t&&t.getVelocity);function Mc(t){const s=nn(t)?t.get():t;return jA(s)?s.toValue():s}function EA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:AA(o,c,u,t),renderState:s()};return i&&(d.onMount=p=>i({props:o,current:p,...d}),d.onUpdate=p=>i(p)),d}const A_=t=>(s,i)=>{const o=_.useContext(ou),c=_.useContext(iu),u=()=>EA(t,s,o,c);return i?u():em(u)};function AA(t,s,i,o){const c={},u=o(t,{});for(const b in u)c[b]=Mc(u[b]);let{initial:d,animate:p}=t;const h=lu(t),g=N_(t);s&&g&&!h&&t.inherit!==!1&&(d===void 0&&(d=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const y=v?p:d;if(y&&typeof y!="boolean"&&!ru(y)){const b=Array.isArray(y)?y:[y];for(let k=0;k<b.length;k++){const S=lm(t,b[k]);if(S){const{transitionEnd:w,transition:j,...N}=S;for(const C in N){let E=N[C];if(Array.isArray(E)){const I=v?E.length-1:0;E=E[I]}E!==null&&(c[C]=E)}for(const C in w)c[C]=w[C]}}}return c}const Co=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],xi=new Set(Co),D_=t=>s=>typeof s=="string"&&s.startsWith(t),R_=D_("--"),DA=D_("var(--"),cm=t=>DA(t)?RA.test(t.split("/*")[0].trim()):!1,RA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,M_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Js=(t,s,i)=>i>s?s:i<t?t:i,Eo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Pr={...Eo,transform:t=>Js(0,1,t)},xc={...Eo,default:1},Kr=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Aa=Kr("deg"),ys=Kr("%"),we=Kr("px"),MA=Kr("vh"),IA=Kr("vw"),ly={...ys,parse:t=>ys.parse(t)/100,transform:t=>ys.transform(t*100)},OA={borderWidth:we,borderTopWidth:we,borderRightWidth:we,borderBottomWidth:we,borderLeftWidth:we,borderRadius:we,radius:we,borderTopLeftRadius:we,borderTopRightRadius:we,borderBottomRightRadius:we,borderBottomLeftRadius:we,width:we,maxWidth:we,height:we,maxHeight:we,top:we,right:we,bottom:we,left:we,padding:we,paddingTop:we,paddingRight:we,paddingBottom:we,paddingLeft:we,margin:we,marginTop:we,marginRight:we,marginBottom:we,marginLeft:we,backgroundPositionX:we,backgroundPositionY:we},BA={rotate:Aa,rotateX:Aa,rotateY:Aa,rotateZ:Aa,scale:xc,scaleX:xc,scaleY:xc,scaleZ:xc,skew:Aa,skewX:Aa,skewY:Aa,distance:we,translateX:we,translateY:we,translateZ:we,x:we,y:we,z:we,perspective:we,transformPerspective:we,opacity:Pr,originX:ly,originY:ly,originZ:we},cy={...Eo,transform:Math.round},um={...OA,...BA,zIndex:cy,size:we,fillOpacity:Pr,strokeOpacity:Pr,numOctaves:cy},LA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},zA=Co.length;function UA(t,s,i){let o="",c=!0;for(let u=0;u<zA;u++){const d=Co[u],p=t[d];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(d.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||i){const g=M_(p,um[d]);if(!h){c=!1;const v=LA[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function dm(t,s,i){const{style:o,vars:c,transformOrigin:u}=t;let d=!1,p=!1;for(const h in s){const g=s[h];if(xi.has(h)){d=!0;continue}else if(R_(h)){c[h]=g;continue}else{const v=M_(g,um[h]);h.startsWith("origin")?(p=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=UA(s,t.transform,i):o.transform&&(o.transform="none")),p){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const $A={offset:"stroke-dashoffset",array:"stroke-dasharray"},PA={offset:"strokeDashoffset",array:"strokeDasharray"};function VA(t,s,i=1,o=0,c=!0){t.pathLength=1;const u=c?$A:PA;t[u.offset]=we.transform(-o);const d=we.transform(s),p=we.transform(i);t[u.array]=`${d} ${p}`}function uy(t,s,i){return typeof t=="string"?t:we.transform(s+i*t)}function HA(t,s,i){const o=uy(s,t.x,t.width),c=uy(i,t.y,t.height);return`${o} ${c}`}function fm(t,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...g},v,y){if(dm(t,g,y),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:b,style:k,dimensions:S}=t;b.transform&&(S&&(k.transform=b.transform),delete b.transform),S&&(c!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=HA(S,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(b.x=s),i!==void 0&&(b.y=i),o!==void 0&&(b.scale=o),d!==void 0&&VA(b,d,p,h,!1)}const pm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),I_=()=>({...pm(),attrs:{}}),mm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function O_(t,{style:s,vars:i},o,c){Object.assign(t.style,s,c&&c.getProjectionStyles(o));for(const u in i)t.style.setProperty(u,i[u])}const B_=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 L_(t,s,i,o){O_(t,s,void 0,o);for(const c in s.attrs)t.setAttribute(B_.has(c)?c:im(c),s.attrs[c])}const Pc={};function qA(t){Object.assign(Pc,t)}function z_(t,{layout:s,layoutId:i}){return xi.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Pc[t]||t==="opacity")}function hm(t,s,i){var o;const{style:c}=t,u={};for(const d in c)(nn(c[d])||s.style&&nn(s.style[d])||z_(d,t)||((o=i==null?void 0:i.getValue(d))===null||o===void 0?void 0:o.liveStyle)!==void 0)&&(u[d]=c[d]);return u}function U_(t,s,i){const o=hm(t,s,i);for(const c in t)if(nn(t[c])||nn(s[c])){const u=Co.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=t[c]}return o}function GA(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 dy=["x","y","width","height","cx","cy","r"],FA={useVisualState:A_({scrapeMotionValuesFromProps:U_,createRenderState:I_,onUpdate:({props:t,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!t.drag;if(!u){for(const p in c)if(xi.has(p)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let p=0;p<dy.length;p++){const h=dy[p];t[h]!==s[h]&&(d=!0)}d&&vt.read(()=>{GA(i,o),vt.render(()=>{fm(o,c,mm(i.tagName),t.transformTemplate),L_(i,o)})})}})},ZA={useVisualState:A_({scrapeMotionValuesFromProps:hm,createRenderState:pm})};function $_(t,s,i){for(const o in s)!nn(s[o])&&!z_(o,i)&&(t[o]=s[o])}function KA({transformTemplate:t},s){return _.useMemo(()=>{const i=pm();return dm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function YA(t,s){const i=t.style||{},o={};return $_(o,i,t),Object.assign(o,KA(t,s)),o}function JA(t,s){const i={},o=YA(t,s);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=o,i}function WA(t,s,i,o){const c=_.useMemo(()=>{const u=I_();return fm(u,s,mm(o),t.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(t.style){const u={};$_(u,t.style,t),c.style={...u,...c.style}}return c}function XA(t=!1){return(i,o,c,{latestValues:u},d)=>{const h=(rm(i)?WA:JA)(o,u,d,i),g=pA(o,typeof i=="string",t),v=i!==_.Fragment?{...g,...h,ref:c}:{},{children:y}=o,b=_.useMemo(()=>nn(y)?y.get():y,[y]);return _.createElement(i,{...v,children:b})}}function QA(t,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...rm(o)?FA:ZA,preloadedFeatures:t,useRender:XA(c),createVisualElement:s,Component:o};return kA(d)}}function P_(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let o=0;o<i;o++)if(s[o]!==t[o])return!1;return!0}function cu(t,s,i){const o=t.getProps();return lm(o,s,i!==void 0?i:o.custom,t)}function gm(t,s){return t?t[s]||t.default||t:void 0}const V_=new Set(["width","height","top","left","right","bottom",...Co]);let Ic;function eD(){Ic=void 0}const bs={now:()=>(Ic===void 0&&bs.set(Wt.isProcessing||rA.useManualTiming?Wt.timestamp:performance.now()),Ic),set:t=>{Ic=t,queueMicrotask(eD)}};function vm(t,s){t.indexOf(s)===-1&&t.push(s)}function ym(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class bm{constructor(){this.subscriptions=[]}add(s){return vm(this.subscriptions,s),()=>ym(this.subscriptions,s)}notify(s,i,o){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,o);else for(let u=0;u<c;u++){const d=this.subscriptions[u];d&&d(s,i,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function H_(t,s){return s?t*(1e3/s):0}const fy=30,tD=t=>!isNaN(parseFloat(t));class nD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=bs.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=bs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=tD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,i){this.events[s]||(this.events[s]=new bm);const o=this.events[s].add(i);return s==="change"?()=>{o(),vt.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,o){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-o}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=bs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>fy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,fy);return H_(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(s){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=s(i),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Vr(t,s){return new nD(t,s)}function sD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Vr(i))}function aD(t,s){const i=cu(t,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const p=CA(u[d]);sD(t,d,p)}}function iD(t){return!!(nn(t)&&t.add)}function xp(t,s){const i=t.getValue("willChange");if(iD(i))return i.add(s)}function q_(t){return t.props[j_]}function _m(t){let s;return()=>(s===void 0&&(s=t()),s)}const oD=_m(()=>window.ScrollTimeline!==void 0);class rD{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,i){for(let o=0;o<this.animations.length;o++)this.animations[o][s]=i}attachTimeline(s,i){const o=this.animations.map(c=>{if(oD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{o.forEach((c,u)=>{c&&c(),this.animations[u].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class lD extends rD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Fs=t=>t*1e3,Zs=t=>t/1e3;function xm(t){return typeof t=="function"}function py(t,s){t.timeline=s,t.onfinish=null}const km=t=>Array.isArray(t)&&typeof t[0]=="number",cD={linearEasing:void 0};function uD(t,s){const i=_m(t);return()=>{var o;return(o=cD[s])!==null&&o!==void 0?o:i()}}const Vc=uD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ko=(t,s,i)=>{const o=s-t;return o===0?1:(i-t)/o},G_=(t,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=t(ko(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function F_(t){return!!(typeof t=="function"&&Vc()||!t||typeof t=="string"&&(t in kp||Vc())||km(t)||Array.isArray(t)&&t.every(F_))}const Nr=([t,s,i,o])=>`cubic-bezier(${t}, ${s}, ${i}, ${o})`,kp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Nr([0,.65,.55,1]),circOut:Nr([.55,0,1,.45]),backIn:Nr([.31,.01,.66,-.59]),backOut:Nr([.33,1.53,.69,.99])};function Z_(t,s){if(t)return typeof t=="function"&&Vc()?G_(t,s):km(t)?Nr(t):Array.isArray(t)?t.map(i=>Z_(i,s)||kp.easeOut):kp[t]}const K_=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,dD=1e-7,fD=12;function pD(t,s,i,o,c){let u,d,p=0;do d=s+(i-s)/2,u=K_(d,o,c)-t,u>0?i=d:s=d;while(Math.abs(u)>dD&&++p<fD);return d}function Yr(t,s,i,o){if(t===s&&i===o)return Cn;const c=u=>pD(u,0,1,t,i);return u=>u===0||u===1?u:K_(c(u),s,o)}const Y_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,J_=t=>s=>1-t(1-s),W_=Yr(.33,1.53,.69,.99),Sm=J_(W_),X_=Y_(Sm),Q_=t=>(t*=2)<1?.5*Sm(t):.5*(2-Math.pow(2,-10*(t-1))),Tm=t=>1-Math.sin(Math.acos(t)),e1=J_(Tm),t1=Y_(Tm),n1=t=>/^0[^.\s]+$/u.test(t);function mD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||n1(t):!0}const Dr=t=>Math.round(t*1e5)/1e5,wm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hD(t){return t==null}const gD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Nm=(t,s)=>i=>!!(typeof i=="string"&&gD.test(i)&&i.startsWith(t)||s&&!hD(i)&&Object.prototype.hasOwnProperty.call(i,s)),s1=(t,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,p]=o.match(wm);return{[t]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},vD=t=>Js(0,255,t),qf={...Eo,transform:t=>Math.round(vD(t))},di={test:Nm("rgb","red"),parse:s1("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:o=1})=>"rgba("+qf.transform(t)+", "+qf.transform(s)+", "+qf.transform(i)+", "+Dr(Pr.transform(o))+")"};function yD(t){let s="",i="",o="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),o=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),o=t.substring(3,4),c=t.substring(4,5),s+=s,i+=i,o+=o,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(o,16),alpha:c?parseInt(c,16)/255:1}}const Sp={test:Nm("#"),parse:yD,transform:di.transform},po={test:Nm("hsl","hue"),parse:s1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(t)+", "+ys.transform(Dr(s))+", "+ys.transform(Dr(i))+", "+Dr(Pr.transform(o))+")"},tn={test:t=>di.test(t)||Sp.test(t)||po.test(t),parse:t=>di.test(t)?di.parse(t):po.test(t)?po.parse(t):Sp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?di.transform(t):po.transform(t)},bD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function _D(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(wm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(bD))===null||i===void 0?void 0:i.length)||0)>0}const a1="number",i1="color",xD="var",kD="var(",my="${}",SD=/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 Hr(t){const s=t.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const p=s.replace(SD,h=>(tn.test(h)?(o.color.push(u),c.push(i1),i.push(tn.parse(h))):h.startsWith(kD)?(o.var.push(u),c.push(xD),i.push(h)):(o.number.push(u),c.push(a1),i.push(parseFloat(h))),++u,my)).split(my);return{values:i,split:p,indexes:o,types:c}}function o1(t){return Hr(t).values}function r1(t){const{split:s,types:i}=Hr(t),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const p=i[d];p===a1?u+=Dr(c[d]):p===i1?u+=tn.transform(c[d]):u+=c[d]}return u}}const TD=t=>typeof t=="number"?0:t;function wD(t){const s=o1(t);return r1(t)(s.map(TD))}const Oa={test:_D,parse:o1,createTransformer:r1,getAnimatableNone:wD},ND=new Set(["brightness","contrast","saturate","opacity"]);function jD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[o]=i.match(wm)||[];if(!o)return t;const c=i.replace(o,"");let u=ND.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const CD=/\b([a-z-]*)\(.*?\)/gu,Tp={...Oa,getAnimatableNone:t=>{const s=t.match(CD);return s?s.map(jD).join(" "):t}},ED={...um,color:tn,backgroundColor:tn,outlineColor:tn,fill:tn,stroke:tn,borderColor:tn,borderTopColor:tn,borderRightColor:tn,borderBottomColor:tn,borderLeftColor:tn,filter:Tp,WebkitFilter:Tp},jm=t=>ED[t];function l1(t,s){let i=jm(t);return i!==Tp&&(i=Oa),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const AD=new Set(["auto","none","0"]);function DD(t,s,i){let o=0,c;for(;o<t.length&&!c;){const u=t[o];typeof u=="string"&&!AD.has(u)&&Hr(u).values.length&&(c=t[o]),o++}if(c&&i)for(const u of s)t[u]=l1(i,c)}const hy=t=>t===Eo||t===we,gy=(t,s)=>parseFloat(t.split(", ")[s]),vy=(t,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return gy(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?gy(u[1],t):0}},RD=new Set(["x","y","z"]),MD=Co.filter(t=>!RD.has(t));function ID(t){const s=[];return MD.forEach(i=>{const o=t.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const So={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),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:vy(4,13),y:vy(5,14)};So.translateX=So.x;So.translateY=So.y;const pi=new Set;let wp=!1,Np=!1;function c1(){if(Np){const t=Array.from(pi).filter(o=>o.needsMeasurement),s=new Set(t.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=ID(o);c.length&&(i.set(o,c),o.render())}),t.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var p;(p=o.getValue(u))===null||p===void 0||p.set(d)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Np=!1,wp=!1,pi.forEach(t=>t.complete()),pi.clear()}function u1(){pi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Np=!0)})}function OD(){u1(),c1()}class Cm{constructor(s,i,o,c,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=o,this.motionValue=c,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(pi.add(this),wp||(wp=!0,vt.read(u1),vt.resolveKeyframes(c1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:o,motionValue:c}=this;for(let u=0;u<s.length;u++)if(s[u]===null)if(u===0){const d=c==null?void 0:c.get(),p=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,p);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=p),c&&d===void 0&&c.set(s[0])}else s[u]=s[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),pi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,pi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const d1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),BD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function LD(t){const s=BD.exec(t);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function f1(t,s,i=1){const[o,c]=LD(t);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return d1(d)?parseFloat(d):d}return cm(c)?f1(c,s,i+1):c}const p1=t=>s=>s.test(t),zD={test:t=>t==="auto",parse:t=>t},m1=[Eo,we,ys,Aa,IA,MA,zD],yy=t=>m1.find(p1(t));class h1 extends Cm{constructor(s,i,o,c,u){super(s,i,o,c,u,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:o}=this;if(!i||!i.current)return;super.readKeyframes();for(let h=0;h<s.length;h++){let g=s[h];if(typeof g=="string"&&(g=g.trim(),cm(g))){const v=f1(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!V_.has(o)||s.length!==2)return;const[c,u]=s,d=yy(c),p=yy(u);if(d!==p)if(hy(d)&&hy(p))for(let h=0;h<s.length;h++){const g=s[h];typeof g=="string"&&(s[h]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,o=[];for(let c=0;c<s.length;c++)mD(s[c])&&o.push(c);o.length&&DD(s,o,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:o}=this;if(!s||!s.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=So[o](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(o,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:o,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const u=i.getValue(o);u&&u.jump(this.measuredOrigin,!1);const d=c.length-1,p=c[d];c[d]=So[o](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const by=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Oa.test(t)||t==="0")&&!t.startsWith("url("));function UD(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function $D(t,s,i,o){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=t[t.length-1],d=by(c,s),p=by(u,s);return!d||!p?!1:UD(t)||(i==="spring"||xm(i))&&o}const PD=t=>t!==null;function uu(t,{repeat:s,repeatType:i="loop"},o){const c=t.filter(PD),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const VD=40;class g1{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=bs.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>VD?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&OD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=bs.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:p,onUpdate:h,isGenerator:g}=this.options;if(!g&&!$D(s,o,c,u))if(d)this.options.duration=0;else{h&&h(uu(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const jp=2e4;function v1(t){let s=0;const i=50;let o=t.next(s);for(;!o.done&&s<jp;)s+=i,o=t.next(s);return s>=jp?1/0:s}const St=(t,s,i)=>t+(s-t)*i;function Gf(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function HD({hue:t,saturation:s,lightness:i,alpha:o}){t/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const p=i<.5?i*(1+s):i+s-i*s,h=2*i-p;c=Gf(h,p,t+1/3),u=Gf(h,p,t),d=Gf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Hc(t,s){return i=>i>0?s:t}const Ff=(t,s,i)=>{const o=t*t,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},qD=[Sp,di,po],GD=t=>qD.find(s=>s.test(t));function _y(t){const s=GD(t);if(!s)return!1;let i=s.parse(t);return s===po&&(i=HD(i)),i}const xy=(t,s)=>{const i=_y(t),o=_y(s);if(!i||!o)return Hc(t,s);const c={...i};return u=>(c.red=Ff(i.red,o.red,u),c.green=Ff(i.green,o.green,u),c.blue=Ff(i.blue,o.blue,u),c.alpha=St(i.alpha,o.alpha,u),di.transform(c))},FD=(t,s)=>i=>s(t(i)),Jr=(...t)=>t.reduce(FD),Cp=new Set(["none","hidden"]);function ZD(t,s){return Cp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function KD(t,s){return i=>St(t,s,i)}function Em(t){return typeof t=="number"?KD:typeof t=="string"?cm(t)?Hc:tn.test(t)?xy:WD:Array.isArray(t)?y1:typeof t=="object"?tn.test(t)?xy:YD:Hc}function y1(t,s){const i=[...t],o=i.length,c=t.map((u,d)=>Em(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function YD(t,s){const i={...t,...s},o={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(o[c]=Em(t[c])(t[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function JD(t,s){var i;const o=[],c={color:0,var:0,number:0};for(let u=0;u<s.values.length;u++){const d=s.types[u],p=t.indexes[d][c[d]],h=(i=t.values[p])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const WD=(t,s)=>{const i=Oa.createTransformer(s),o=Hr(t),c=Hr(s);return o.indexes.var.length===c.indexes.var.length&&o.indexes.color.length===c.indexes.color.length&&o.indexes.number.length>=c.indexes.number.length?Cp.has(t)&&!c.values.length||Cp.has(s)&&!o.values.length?ZD(t,s):Jr(y1(JD(o,c),c.values),i):Hc(t,s)};function b1(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?St(t,s,i):Em(t)(t,s)}const XD=5;function _1(t,s,i){const o=Math.max(s-XD,0);return H_(i-t(o),s-o)}const jt={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},Zf=.001;function QD({duration:t=jt.duration,bounce:s=jt.bounce,velocity:i=jt.velocity,mass:o=jt.mass}){let c,u,d=1-s;d=Js(jt.minDamping,jt.maxDamping,d),t=Js(jt.minDuration,jt.maxDuration,Zs(t)),d<1?(c=g=>{const v=g*d,y=v*t,b=v-i,k=Ep(g,d),S=Math.exp(-y);return Zf-b/k*S},u=g=>{const y=g*d*t,b=y*i+i,k=Math.pow(d,2)*Math.pow(g,2)*t,S=Math.exp(-y),w=Ep(Math.pow(g,2),d);return(-c(g)+Zf>0?-1:1)*((b-k)*S)/w}):(c=g=>{const v=Math.exp(-g*t),y=(g-i)*t+1;return-Zf+v*y},u=g=>{const v=Math.exp(-g*t),y=(i-g)*(t*t);return v*y});const p=5/t,h=tR(c,u,p);if(t=Fs(t),isNaN(h))return{stiffness:jt.stiffness,damping:jt.damping,duration:t};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:t}}}const eR=12;function tR(t,s,i){let o=i;for(let c=1;c<eR;c++)o=o-t(o)/s(o);return o}function Ep(t,s){return t*Math.sqrt(1-s*s)}const nR=["duration","bounce"],sR=["stiffness","damping","mass"];function ky(t,s){return s.some(i=>t[i]!==void 0)}function aR(t){let s={velocity:jt.velocity,stiffness:jt.stiffness,damping:jt.damping,mass:jt.mass,isResolvedFromDuration:!1,...t};if(!ky(t,sR)&&ky(t,nR))if(t.visualDuration){const i=t.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Js(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:jt.mass,stiffness:c,damping:u}}else{const i=QD(t);s={...s,...i,mass:jt.mass},s.isResolvedFromDuration=!0}return s}function x1(t=jt.visualDuration,s=jt.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],p={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:y,velocity:b,isResolvedFromDuration:k}=aR({...i,velocity:-Zs(i.velocity||0)}),S=b||0,w=g/(2*Math.sqrt(h*v)),j=d-u,N=Zs(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?jt.restSpeed.granular:jt.restSpeed.default),c||(c=C?jt.restDelta.granular:jt.restDelta.default);let E;if(w<1){const R=Ep(N,w);E=D=>{const q=Math.exp(-w*N*D);return d-q*((S+w*N*j)/R*Math.sin(R*D)+j*Math.cos(R*D))}}else if(w===1)E=R=>d-Math.exp(-N*R)*(j+(S+N*j)*R);else{const R=N*Math.sqrt(w*w-1);E=D=>{const q=Math.exp(-w*N*D),$=Math.min(R*D,300);return d-q*((S+w*N*j)*Math.sinh($)+R*j*Math.cosh($))/R}}const I={calculatedDuration:k&&y||null,next:R=>{const D=E(R);if(k)p.done=R>=y;else{let q=0;w<1&&(q=R===0?Fs(S):_1(E,R,D));const $=Math.abs(q)<=o,Y=Math.abs(d-D)<=c;p.done=$&&Y}return p.value=p.done?d:D,p},toString:()=>{const R=Math.min(v1(I),jp),D=G_(q=>I.next(R*q).value,R,30);return R+"ms "+D}};return I}function Sy({keyframes:t,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:p,max:h,restDelta:g=.5,restSpeed:v}){const y=t[0],b={done:!1,value:y},k=$=>p!==void 0&&$<p||h!==void 0&&$>h,S=$=>p===void 0?h:h===void 0||Math.abs(p-$)<Math.abs(h-$)?p:h;let w=i*s;const j=y+w,N=d===void 0?j:d(j);N!==j&&(w=N-y);const C=$=>-w*Math.exp(-$/o),E=$=>N+C($),I=$=>{const Y=C($),G=E($);b.done=Math.abs(Y)<=g,b.value=b.done?N:G};let R,D;const q=$=>{k(b.value)&&(R=$,D=x1({keyframes:[b.value,S(b.value)],velocity:_1(E,$,b.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return q(0),{calculatedDuration:null,next:$=>{let Y=!1;return!D&&R===void 0&&(Y=!0,I($),q($)),R!==void 0&&$>=R?D.next($-R):(!Y&&I($),b)}}}const iR=Yr(.42,0,1,1),oR=Yr(0,0,.58,1),k1=Yr(.42,0,.58,1),rR=t=>Array.isArray(t)&&typeof t[0]!="number",lR={linear:Cn,easeIn:iR,easeInOut:k1,easeOut:oR,circIn:Tm,circInOut:t1,circOut:e1,backIn:Sm,backInOut:X_,backOut:W_,anticipate:Q_},Ty=t=>{if(km(t)){k_(t.length===4);const[s,i,o,c]=t;return Yr(s,i,o,c)}else if(typeof t=="string")return lR[t];return t};function cR(t,s,i){const o=[],c=i||b1,u=t.length-1;for(let d=0;d<u;d++){let p=c(t[d],t[d+1]);if(s){const h=Array.isArray(s)?s[d]||Cn:s;p=Jr(h,p)}o.push(p)}return o}function uR(t,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=t.length;if(k_(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=cR(s,o,c),h=p.length,g=v=>{if(d&&v<t[0])return s[0];let y=0;if(h>1)for(;y<t.length-2&&!(v<t[y+1]);y++);const b=ko(t[y],t[y+1],v);return p[y](b)};return i?v=>g(Js(t[0],t[u-1],v)):g}function dR(t,s){const i=t[t.length-1];for(let o=1;o<=s;o++){const c=ko(0,s,o);t.push(St(i,1,c))}}function fR(t){const s=[0];return dR(s,t.length-1),s}function pR(t,s){return t.map(i=>i*s)}function mR(t,s){return t.map(()=>s||k1).splice(0,t.length-1)}function qc({duration:t=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=rR(o)?o.map(Ty):Ty(o),u={done:!1,value:s[0]},d=pR(i&&i.length===s.length?i:fR(s),t),p=uR(d,s,{ease:Array.isArray(c)?c:mR(s,c)});return{calculatedDuration:t,next:h=>(u.value=p(h),u.done=h>=t,u)}}const hR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>vt.update(s,!0),stop:()=>Ia(s),now:()=>Wt.isProcessing?Wt.timestamp:bs.now()}},gR={decay:Sy,inertia:Sy,tween:qc,keyframes:qc,spring:x1},vR=t=>t/100;class Am extends g1{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:i,motionValue:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Cm,p=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,p,i,o,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u,velocity:d=0}=this.options,p=xm(i)?i:gR[i]||qc;let h,g;p!==qc&&typeof s[0]!="number"&&(h=Jr(vR,b1(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});u==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=v1(v));const{calculatedDuration:y}=v,b=y+c,k=b*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:y,resolvedDuration:b,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:o}=this;if(!o){const{keyframes:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:p,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:y}=o;if(this.startTime===null)return u.next(0);const{delay:b,repeat:k,repeatType:S,repeatDelay:w,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const N=this.currentTime-b*(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 E=this.currentTime,I=u;if(k){const $=Math.min(this.currentTime,v)/y;let Y=Math.floor($),G=$%1;!G&&$>=1&&(G=1),G===1&&Y--,Y=Math.min(Y,k+1),!!(Y%2)&&(S==="reverse"?(G=1-G,w&&(G-=w/y)):S==="mirror"&&(I=d)),E=Js(0,1,G)*y}const R=C?{done:!1,value:h[0]}:I.next(E);p&&(R.value=p(R.value));let{done:D}=R;!C&&g!==null&&(D=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const q=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return q&&c!==void 0&&(R.value=uu(h,this.options,c)),j&&j(R.value),q&&this.finish(),R}get duration(){const{resolved:s}=this;return s?Zs(s.calculatedDuration):0}get time(){return Zs(this.currentTime)}set time(s){s=Fs(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const i=this.playbackSpeed!==s;this.playbackSpeed=s,i&&(this.time=Zs(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=hR,onPlay:i,startTime:o}=this.options;this.driver||(this.driver=s(u=>this.tick(u))),i&&i();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=o??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const yR=new Set(["opacity","clipPath","filter","transform"]);function bR(t,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:p="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=Z_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const _R=_m(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Gc=10,xR=2e4;function kR(t){return xm(t.type)||t.type==="spring"||!F_(t.ease)}function SR(t,s){const i=new Am({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:t[0]};const c=[];let u=0;for(;!o.done&&u<xR;)o=i.sample(u),c.push(o.value),u+=Gc;return{times:void 0,keyframes:c,duration:u-Gc,ease:"linear"}}const S1={anticipate:Q_,backInOut:X_,circInOut:t1};function TR(t){return t in S1}class wy extends g1{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new h1(u,(d,p)=>this.onKeyframesResolved(d,p),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:p,name:h,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof u=="string"&&Vc()&&TR(u)&&(u=S1[u]),kR(this.options)){const{onComplete:y,onUpdate:b,motionValue:k,element:S,...w}=this.options,j=SR(s,w);s=j.keyframes,s.length===1&&(s[1]=s[0]),o=j.duration,c=j.times,u=j.ease,d="keyframes"}const v=bR(p.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(py(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:y}=this.options;p.set(uu(s,this.options,i)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:o,times:c,type:d,ease:u,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Zs(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Zs(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Fs(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return Cn;const{animation:o}=i;py(o,s)}return Cn}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:i,keyframes:o,duration:c,type:u,ease:d,times:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:y,element:b,...k}=this.options,S=new Am({...k,keyframes:o,duration:c,type:u,ease:d,times:p,isGenerator:!0}),w=Fs(this.time);g.setWithVelocity(S.sample(w-Gc).value,S.sample(w).value,Gc)}const{onStop:h}=this.options;h&&h(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:i,name:o,repeatDelay:c,repeatType:u,damping:d,type:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return _R()&&o&&yR.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&p!=="inertia"}}const wR={type:"spring",stiffness:500,damping:25,restSpeed:10},NR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),jR={type:"keyframes",duration:.8},CR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ER=(t,{keyframes:s})=>s.length>2?jR:xi.has(t)?t.startsWith("scale")?NR(s[1]):wR:CR;function AR({when:t,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:p,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Dm=(t,s,i,o={},c,u)=>d=>{const p=gm(o,t)||{},h=p.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Fs(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:b=>{s.set(b),p.onUpdate&&p.onUpdate(b)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:u?void 0:c};AR(p)||(v={...v,...ER(t,v)}),v.duration&&(v.duration=Fs(v.duration)),v.repeatDelay&&(v.repeatDelay=Fs(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let y=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(y=!0)),y&&!u&&s.get()!==void 0){const b=uu(v.keyframes,p);if(b!==void 0)return vt.update(()=>{v.onUpdate(b),v.onComplete()}),new lD([])}return!u&&wy.supports(v)?new wy(v):new Am(v)};function DR({protectedKeys:t,needsAnimating:s},i){const o=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function T1(t,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=t.getDefaultTransition(),transitionEnd:p,...h}=s;o&&(d=o);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const y in h){const b=t.getValue(y,(u=t.latestValues[y])!==null&&u!==void 0?u:null),k=h[y];if(k===void 0||v&&DR(v,y))continue;const S={delay:i,...gm(d||{},y)};let w=!1;if(window.MotionHandoffAnimation){const N=q_(t);if(N){const C=window.MotionHandoffAnimation(N,y,vt);C!==null&&(S.startTime=C,w=!0)}}xp(t,y),b.start(Dm(y,b,k,t.shouldReduceMotion&&V_.has(y)?{type:!1}:S,t,w));const j=b.animation;j&&g.push(j)}return p&&Promise.all(g).then(()=>{vt.update(()=>{p&&aD(t,p)})}),g}function Ap(t,s,i={}){var o;const c=cu(t,s,i.type==="exit"?(o=t.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(T1(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:y,staggerDirection:b}=u;return RR(t,s,v+g,y,b,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,p]:[p,d];return g().then(()=>v())}else return Promise.all([d(),p(i.delay)])}function RR(t,s,i=0,o=0,c=1,u){const d=[],p=(t.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>p-g*o;return Array.from(t.variantChildren).sort(MR).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Ap(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function MR(t,s){return t.sortNodePosition(s)}function IR(t,s,i={}){t.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Ap(t,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Ap(t,s,i);else{const c=typeof s=="function"?cu(t,s,i.custom):s;o=Promise.all(T1(t,c,i))}return o.then(()=>{t.notify("AnimationComplete",s)})}const OR=am.length;function w1(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?w1(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<OR;i++){const o=am[i],c=t.props[o];($r(c)||c===!1)&&(s[o]=c)}return s}const BR=[...sm].reverse(),LR=sm.length;function zR(t){return s=>Promise.all(s.map(({animation:i,options:o})=>IR(t,i,o)))}function UR(t){let s=zR(t),i=Ny(),o=!0;const c=h=>(g,v)=>{var y;const b=cu(t,v,h==="exit"?(y=t.presenceContext)===null||y===void 0?void 0:y.custom:void 0);if(b){const{transition:k,transitionEnd:S,...w}=b;g={...g,...w,...S}}return g};function u(h){s=h(t)}function d(h){const{props:g}=t,v=w1(t.parent)||{},y=[],b=new Set;let k={},S=1/0;for(let j=0;j<LR;j++){const N=BR[j],C=i[N],E=g[N]!==void 0?g[N]:v[N],I=$r(E),R=N===h?C.isActive:null;R===!1&&(S=j);let D=E===v[N]&&E!==g[N]&&I;if(D&&o&&t.manuallyAnimateOnMount&&(D=!1),C.protectedKeys={...k},!C.isActive&&R===null||!E&&!C.prevProp||ru(E)||typeof E=="boolean")continue;const q=$R(C.prevProp,E);let $=q||N===h&&C.isActive&&!D&&I||j>S&&I,Y=!1;const G=Array.isArray(E)?E:[E];let Q=G.reduce(c(N),{});R===!1&&(Q={});const{prevResolvedValues:ae={}}=C,me={...ae,...Q},ie=Z=>{$=!0,b.has(Z)&&(Y=!0,b.delete(Z)),C.needsAnimating[Z]=!0;const ne=t.getValue(Z);ne&&(ne.liveStyle=!1)};for(const Z in me){const ne=Q[Z],re=ae[Z];if(k.hasOwnProperty(Z))continue;let ue=!1;_p(ne)&&_p(re)?ue=!P_(ne,re):ue=ne!==re,ue?ne!=null?ie(Z):b.add(Z):ne!==void 0&&b.has(Z)?ie(Z):C.protectedKeys[Z]=!0}C.prevProp=E,C.prevResolvedValues=Q,C.isActive&&(k={...k,...Q}),o&&t.blockInitialAnimation&&($=!1),$&&(!(D&&q)||Y)&&y.push(...G.map(Z=>({animation:Z,options:{type:N}})))}if(b.size){const j={};b.forEach(N=>{const C=t.getBaseTarget(N),E=t.getValue(N);E&&(E.liveStyle=!0),j[N]=C??null}),y.push({animation:j})}let w=!!y.length;return o&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(w=!1),o=!1,w?s(y):Promise.resolve()}function p(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(b=>{var k;return(k=b.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const y=d(h);for(const b in i)i[b].protectedKeys={};return y}return{animateChanges:d,setActive:p,setAnimateFunction:u,getState:()=>i,reset:()=>{i=Ny(),o=!0}}}function $R(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!P_(s,t):!1}function ii(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ny(){return{animate:ii(!0),whileInView:ii(),whileHover:ii(),whileTap:ii(),whileDrag:ii(),whileFocus:ii(),exit:ii()}}class La{constructor(s){this.isMounted=!1,this.node=s}update(){}}class PR extends La{constructor(s){super(s),s.animationState||(s.animationState=UR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();ru(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:i}=this.node.prevProps||{};s!==i&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let VR=0;class HR extends La{constructor(){super(...arguments),this.id=VR++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===o)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const qR={animation:{Feature:PR},exit:{Feature:HR}},as={x:!1,y:!1};function N1(){return as.x||as.y}function GR(t){return t==="x"||t==="y"?as[t]?null:(as[t]=!0,()=>{as[t]=!1}):as.x||as.y?null:(as.x=as.y=!0,()=>{as.x=as.y=!1})}const Rm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function qr(t,s,i,o={passive:!0}){return t.addEventListener(s,i,o),()=>t.removeEventListener(s,i)}function Wr(t){return{point:{x:t.pageX,y:t.pageY}}}const FR=t=>s=>Rm(s)&&t(s,Wr(s));function Rr(t,s,i,o){return qr(t,s,FR(i),o)}const jy=(t,s)=>Math.abs(t-s);function ZR(t,s){const i=jy(t.x,s.x),o=jy(t.y,s.y);return Math.sqrt(i**2+o**2)}class j1{constructor(s,i,{transformPagePoint:o,contextWindow:c,dragSnapToOrigin:u=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=Yf(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,k=ZR(y.offset,{x:0,y:0})>=3;if(!b&&!k)return;const{point:S}=y,{timestamp:w}=Wt;this.history.push({...S,timestamp:w});const{onStart:j,onMove:N}=this.handlers;b||(j&&j(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),N&&N(this.lastMoveEvent,y)},this.handlePointerMove=(y,b)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=Kf(b,this.transformPagePoint),vt.update(this.updatePoint,!0)},this.handlePointerUp=(y,b)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Yf(y.type==="pointercancel"?this.lastMoveEventInfo:Kf(b,this.transformPagePoint),this.history);this.startEvent&&k&&k(y,j),S&&S(y,j)},!Rm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=Wr(s),p=Kf(d,this.transformPagePoint),{point:h}=p,{timestamp:g}=Wt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Yf(p,this.history)),this.removeListeners=Jr(Rr(this.contextWindow,"pointermove",this.handlePointerMove),Rr(this.contextWindow,"pointerup",this.handlePointerUp),Rr(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ia(this.updatePoint)}}function Kf(t,s){return s?{point:s(t.point)}:t}function Cy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Yf({point:t},s){return{point:t,delta:Cy(t,C1(s)),offset:Cy(t,KR(s)),velocity:YR(s,.1)}}function KR(t){return t[0]}function C1(t){return t[t.length-1]}function YR(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,o=null;const c=C1(t);for(;i>=0&&(o=t[i],!(c.timestamp-o.timestamp>Fs(s)));)i--;if(!o)return{x:0,y:0};const u=Zs(c.timestamp-o.timestamp);if(u===0)return{x:0,y:0};const d={x:(c.x-o.x)/u,y:(c.y-o.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const E1=1e-4,JR=1-E1,WR=1+E1,A1=.01,XR=0-A1,QR=0+A1;function En(t){return t.max-t.min}function e3(t,s,i){return Math.abs(t-s)<=i}function Ey(t,s,i,o=.5){t.origin=o,t.originPoint=St(s.min,s.max,t.origin),t.scale=En(i)/En(s),t.translate=St(i.min,i.max,t.origin)-t.originPoint,(t.scale>=JR&&t.scale<=WR||isNaN(t.scale))&&(t.scale=1),(t.translate>=XR&&t.translate<=QR||isNaN(t.translate))&&(t.translate=0)}function Mr(t,s,i,o){Ey(t.x,s.x,i.x,o?o.originX:void 0),Ey(t.y,s.y,i.y,o?o.originY:void 0)}function Ay(t,s,i){t.min=i.min+s.min,t.max=t.min+En(s)}function t3(t,s,i){Ay(t.x,s.x,i.x),Ay(t.y,s.y,i.y)}function Dy(t,s,i){t.min=s.min-i.min,t.max=t.min+En(s)}function Ir(t,s,i){Dy(t.x,s.x,i.x),Dy(t.y,s.y,i.y)}function n3(t,{min:s,max:i},o){return s!==void 0&&t<s?t=o?St(s,t,o.min):Math.max(t,s):i!==void 0&&t>i&&(t=o?St(i,t,o.max):Math.min(t,i)),t}function Ry(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function s3(t,{top:s,left:i,bottom:o,right:c}){return{x:Ry(t.x,i,c),y:Ry(t.y,s,o)}}function My(t,s){let i=s.min-t.min,o=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,o]=[o,i]),{min:i,max:o}}function a3(t,s){return{x:My(t.x,s.x),y:My(t.y,s.y)}}function i3(t,s){let i=.5;const o=En(t),c=En(s);return c>o?i=ko(s.min,s.max-o,t.min):o>c&&(i=ko(t.min,t.max-c,s.min)),Js(0,1,i)}function o3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Dp=.35;function r3(t=Dp){return t===!1?t=0:t===!0&&(t=Dp),{x:Iy(t,"left","right"),y:Iy(t,"top","bottom")}}function Iy(t,s,i){return{min:Oy(t,s),max:Oy(t,i)}}function Oy(t,s){return typeof t=="number"?t:t[s]||0}const By=()=>({translate:0,scale:1,origin:0,originPoint:0}),mo=()=>({x:By(),y:By()}),Ly=()=>({min:0,max:0}),Rt=()=>({x:Ly(),y:Ly()});function Gn(t){return[t("x"),t("y")]}function D1({top:t,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:t,max:o}}}function l3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function c3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),o=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function Jf(t){return t===void 0||t===1}function Rp({scale:t,scaleX:s,scaleY:i}){return!Jf(t)||!Jf(s)||!Jf(i)}function ci(t){return Rp(t)||R1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function R1(t){return zy(t.x)||zy(t.y)}function zy(t){return t&&t!=="0%"}function Fc(t,s,i){const o=t-i,c=s*o;return i+c}function Uy(t,s,i,o,c){return c!==void 0&&(t=Fc(t,c,o)),Fc(t,i,o)+s}function Mp(t,s=0,i=1,o,c){t.min=Uy(t.min,s,i,o,c),t.max=Uy(t.max,s,i,o,c)}function M1(t,{x:s,y:i}){Mp(t.x,s.translate,s.scale,s.originPoint),Mp(t.y,i.translate,i.scale,i.originPoint)}const $y=.999999999999,Py=1.0000000000001;function u3(t,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let p=0;p<c;p++){u=i[p],d=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(o&&u.options.layoutScroll&&u.scroll&&u!==u.root&&go(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,M1(t,d)),o&&ci(u.latestValues)&&go(t,u.latestValues))}s.x<Py&&s.x>$y&&(s.x=1),s.y<Py&&s.y>$y&&(s.y=1)}function ho(t,s){t.min=t.min+s,t.max=t.max+s}function Vy(t,s,i,o,c=.5){const u=St(t.min,t.max,c);Mp(t,s,i,u,o)}function go(t,s){Vy(t.x,s.x,s.scaleX,s.scale,s.originX),Vy(t.y,s.y,s.scaleY,s.scale,s.originY)}function I1(t,s){return D1(c3(t.getBoundingClientRect(),s))}function d3(t,s,i){const o=I1(t,i),{scroll:c}=s;return c&&(ho(o.x,c.offset.x),ho(o.y,c.offset.y)),o}const O1=({current:t})=>t?t.ownerDocument.defaultView:null,f3=new WeakMap;class p3{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=Rt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:y}=this.getProps();y?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(Wr(v).point)},u=(v,y)=>{const{drag:b,dragPropagation:k,onDragStart:S}=this.getProps();if(b&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=GR(b),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Gn(j=>{let N=this.getAxisMotionValue(j).get()||0;if(ys.test(N)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[j];E&&(N=En(E)*(parseFloat(N)/100))}}this.originPoint[j]=N}),S&&vt.postRender(()=>S(v,y)),xp(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},d=(v,y)=>{const{dragPropagation:b,dragDirectionLock:k,onDirectionLock:S,onDrag:w}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:j}=y;if(k&&this.currentDirection===null){this.currentDirection=m3(j),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",y.point,j),this.updateAxis("y",y.point,j),this.visualElement.render(),w&&w(v,y)},p=(v,y)=>this.stop(v,y),h=()=>Gn(v=>{var y;return this.getAnimationState(v)==="paused"&&((y=this.getAxisMotionValue(v).animation)===null||y===void 0?void 0:y.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new j1(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:O1(this.visualElement)})}stop(s,i){const o=this.isDragging;if(this.cancel(),!o)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&vt.postRender(()=>u(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,o){const{drag:c}=this.getProps();if(!o||!kc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=n3(d,this.constraints[s],this.elastic[s])),u.set(d)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:o}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,u=this.constraints;i&&fo(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=s3(c.layoutBox,i):this.constraints=!1,this.elastic=r3(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Gn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=o3(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!fo(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=d3(o,c.root,this.visualElement.getTransformPagePoint());let d=a3(c.layout.layoutBox,u);if(i){const p=i(l3(d));this.hasMutatedConstraints=!!p,p&&(d=D1(p))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},g=Gn(v=>{if(!kc(v,i,this.currentDirection))return;let y=h&&h[v]||{};d&&(y={min:0,max:0});const b=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:o?s[v]:0,bounceStiffness:b,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...u,...y};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return xp(this.visualElement,s),o.start(Dm(s,o,0,i,this.visualElement,!1))}stopAnimation(){Gn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Gn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,o=this.visualElement.getProps(),c=o[i];return c||this.visualElement.getValue(s,(o.initial?o.initial[s]:void 0)||0)}snapToCursor(s){Gn(i=>{const{drag:o}=this.getProps();if(!kc(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:p}=c.layout.layoutBox[i];u.set(s[i]-St(d,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!fo(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Gn(d=>{const p=this.getAxisMotionValue(d);if(p&&this.constraints!==!1){const h=p.get();c[d]=i3({min:h,max:h},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),Gn(d=>{if(!kc(d,s,null))return;const p=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];p.set(St(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;f3.set(this.visualElement,this);const s=this.visualElement.current,i=Rr(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();fo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),vt.read(o);const d=qr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Gn(v=>{const y=this.getAxisMotionValue(v);y&&(this.originPoint[v]+=h[v].translate,y.set(y.get()+h[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=Dp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:p}}}function kc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function m3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class h3 extends La{constructor(s){super(s),this.removeGroupControls=Cn,this.removeListeners=Cn,this.controls=new p3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Cn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Hy=t=>(s,i)=>{t&&vt.postRender(()=>t(s,i))};class g3 extends La{constructor(){super(...arguments),this.removePointerDownListener=Cn}onPointerDown(s){this.session=new j1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:O1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Hy(s),onStart:Hy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&vt.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=Rr(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 Oc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qy(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const kr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(we.test(t))t=parseFloat(t);else return t;const i=qy(t,s.target.x),o=qy(t,s.target.y);return`${i}% ${o}%`}},v3={correct:(t,{treeScale:s,projectionDelta:i})=>{const o=t,c=Oa.parse(t);if(c.length>5)return o;const u=Oa.createTransformer(t),d=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=p,c[1+d]/=h;const g=St(p,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class y3 extends _.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;qA(b3),u&&(i.group&&i.group.add(u),o&&o.register&&c&&o.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),Oc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:o,drag:c,isPresent:u}=this.props,d=o.projection;return d&&(d.isPresent=u,c||s.layoutDependency!==i||i===void 0?d.willUpdate():this.safeToRemove(),s.isPresent!==u&&(u?d.promote():d.relegate()||vt.postRender(()=>{const p=d.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),om.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function B1(t){const[s,i]=__(),o=_.useContext(Qp);return r.jsx(y3,{...t,layoutGroup:o,switchLayoutGroup:_.useContext(C_),isPresent:s,safeToRemove:i})}const b3={borderRadius:{...kr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:kr,borderTopRightRadius:kr,borderBottomLeftRadius:kr,borderBottomRightRadius:kr,boxShadow:v3};function _3(t,s,i){const o=nn(t)?t:Vr(t);return o.start(Dm("",o,s,i)),o.animation}function x3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const k3=(t,s)=>t.depth-s.depth;class S3{constructor(){this.children=[],this.isDirty=!1}add(s){vm(this.children,s),this.isDirty=!0}remove(s){ym(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(k3),this.isDirty=!1,this.children.forEach(s)}}function T3(t,s){const i=bs.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(Ia(o),t(u-s))};return vt.read(o,!0),()=>Ia(o)}const L1=["TopLeft","TopRight","BottomLeft","BottomRight"],w3=L1.length,Gy=t=>typeof t=="string"?parseFloat(t):t,Fy=t=>typeof t=="number"||we.test(t);function N3(t,s,i,o,c,u){c?(t.opacity=St(0,i.opacity!==void 0?i.opacity:1,j3(o)),t.opacityExit=St(s.opacity!==void 0?s.opacity:1,0,C3(o))):u&&(t.opacity=St(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<w3;d++){const p=`border${L1[d]}Radius`;let h=Zy(s,p),g=Zy(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||Fy(h)===Fy(g)?(t[p]=Math.max(St(Gy(h),Gy(g),o),0),(ys.test(g)||ys.test(h))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=St(s.rotate||0,i.rotate||0,o))}function Zy(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const j3=z1(0,.5,e1),C3=z1(.5,.95,Cn);function z1(t,s,i){return o=>o<t?0:o>s?1:i(ko(t,s,o))}function Ky(t,s){t.min=s.min,t.max=s.max}function Vn(t,s){Ky(t.x,s.x),Ky(t.y,s.y)}function Yy(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Jy(t,s,i,o,c){return t-=s,t=Fc(t,1/i,o),c!==void 0&&(t=Fc(t,1/c,o)),t}function E3(t,s=0,i=1,o=.5,c,u=t,d=t){if(ys.test(s)&&(s=parseFloat(s),s=St(d.min,d.max,s/100)-d.min),typeof s!="number")return;let p=St(u.min,u.max,o);t===u&&(p-=s),t.min=Jy(t.min,s,i,p,c),t.max=Jy(t.max,s,i,p,c)}function Wy(t,s,[i,o,c],u,d){E3(t,s[i],s[o],s[c],s.scale,u,d)}const A3=["x","scaleX","originX"],D3=["y","scaleY","originY"];function Xy(t,s,i,o){Wy(t.x,s,A3,i?i.x:void 0,o?o.x:void 0),Wy(t.y,s,D3,i?i.y:void 0,o?o.y:void 0)}function Qy(t){return t.translate===0&&t.scale===1}function U1(t){return Qy(t.x)&&Qy(t.y)}function eb(t,s){return t.min===s.min&&t.max===s.max}function R3(t,s){return eb(t.x,s.x)&&eb(t.y,s.y)}function tb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function $1(t,s){return tb(t.x,s.x)&&tb(t.y,s.y)}function nb(t){return En(t.x)/En(t.y)}function sb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class M3{constructor(){this.members=[]}add(s){vm(this.members,s),s.scheduleRender()}remove(s){if(ym(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let o;for(let c=i;c>=0;c--){const u=this.members[c];if(u.isPresent!==!1){o=u;break}}return o?(this.promote(o),!0):!1}promote(s,i){const o=this.lead;if(s!==o&&(this.prevLead=o,this.lead=s,s.show(),o)){o.instance&&o.scheduleRender(),s.scheduleRender(),s.resumeFrom=o,i&&(s.resumeFrom.preserveOpacity=!0),o.snapshot&&(s.snapshot=o.snapshot,s.snapshot.latestValues=o.animationValues||o.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:o}=s;i.onExitComplete&&i.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function I3(t,s,i){let o="";const c=t.x.translate/s.x,u=t.y.translate/s.y,d=(i==null?void 0:i.z)||0;if((c||u||d)&&(o=`translate3d(${c}px, ${u}px, ${d}px) `),(s.x!==1||s.y!==1)&&(o+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:y,rotateY:b,skewX:k,skewY:S}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),y&&(o+=`rotateX(${y}deg) `),b&&(o+=`rotateY(${b}deg) `),k&&(o+=`skewX(${k}deg) `),S&&(o+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,h=t.y.scale*s.y;return(p!==1||h!==1)&&(o+=`scale(${p}, ${h})`),o||"none"}const ui={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},jr=typeof window<"u"&&window.MotionDebug!==void 0,Wf=["","X","Y","Z"],O3={visibility:"hidden"},ab=1e3;let B3=0;function Xf(t,s,i,o){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),o&&(o[t]=0))}function P1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=q_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",vt,!(c||u))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&P1(o)}function V1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},p=s==null?void 0:s()){this.id=B3++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,jr&&(ui.totalNodes=ui.resolvedTargetDeltas=ui.recalculatedProjection=0),this.nodes.forEach(U3),this.nodes.forEach(q3),this.nodes.forEach(G3),this.nodes.forEach($3),jr&&window.MotionDebug.record(ui)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,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 h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new S3)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new bm),this.eventHandlers.get(d).add(p)}notifyListeners(d,...p){const h=this.eventHandlers.get(d);h&&h.notify(...p)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=x3(d),this.instance=d;const{layoutId:h,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||h)&&(this.isLayoutDirty=!0),t){let y;const b=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=T3(b,250),Oc.hasAnimatedSinceResize&&(Oc.hasAnimatedSinceResize=!1,this.nodes.forEach(ob))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:b,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||J3,{onLayoutAnimationStart:j,onLayoutAnimationComplete:N}=v.getProps(),C=!this.targetLayout||!$1(this.targetLayout,S)||k,E=!b&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||b&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,E);const I={...gm(w,"layout"),onPlay:j,onComplete:N};(v.shouldReduceMotion||this.options.layoutRoot)&&(I.delay=0,I.type=!1),this.startAnimation(I)}else b||ob(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ia(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(F3),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&P1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const y=this.path[v];y.shouldResetTransform=!0,y.updateScroll("snapshot"),y.options.layoutRoot&&y.willUpdate(!1)}const{layoutId:p,layout:h}=this.options;if(p===void 0&&!h)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(ib);return}this.isUpdating||this.nodes.forEach(V3),this.isUpdating=!1,this.nodes.forEach(H3),this.nodes.forEach(L3),this.nodes.forEach(z3),this.clearAllSnapshots();const p=bs.now();Wt.delta=Js(0,1e3/60,p-Wt.timestamp),Wt.timestamp=p,Wt.isProcessing=!0,Hf.update.process(Wt),Hf.preRender.process(Wt),Hf.render.process(Wt),Wt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,om.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(P3),this.sharedNodes.forEach(Z3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,vt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){vt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Rt(),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,d?d.layoutBox:void 0)}updateScroll(d="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(p=!1),p){const h=o(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!U1(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(p||ci(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const p=this.measurePageBox();let h=this.removeElementScroll(p);return d&&(h=this.removeTransform(h)),W3(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:p}=this.options;if(!p)return Rt();const h=p.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(X3))){const{scroll:v}=this.root;v&&(ho(h.x,v.offset.x),ho(h.y,v.offset.y))}return h}removeElementScroll(d){var p;const h=Rt();if(Vn(h,d),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return h;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:y,options:b}=v;v!==this.root&&y&&b.layoutScroll&&(y.wasRoot&&Vn(h,d),ho(h.x,y.offset.x),ho(h.y,y.offset.y))}return h}applyTransform(d,p=!1){const h=Rt();Vn(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&go(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),ci(v.latestValues)&&go(h,v.latestValues)}return ci(this.latestValues)&&go(h,this.latestValues),h}removeTransform(d){const p=Rt();Vn(p,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!ci(g.latestValues))continue;Rp(g.latestValues)&&g.updateSnapshot();const v=Rt(),y=g.measurePageBox();Vn(v,y),Xy(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return ci(this.latestValues)&&Xy(p,this.latestValues),p}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Wt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!1){var p;const h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==h;if(!(d||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:b}=this.options;if(!(!this.layout||!(y||b))){if(this.resolvedRelativeTargetAt=Wt.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Ir(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Vn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Rt(),this.targetWithTransforms=Rt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),t3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Vn(this.target,this.layout.layoutBox),M1(this.target,this.targetDelta)):Vn(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=Rt(),this.relativeTargetOrigin=Rt(),Ir(this.relativeTargetOrigin,this.target,k.target),Vn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}jr&&ui.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Rp(this.parent.latestValues)||R1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var d;const p=this.getLead(),h=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Wt.timestamp&&(g=!1),g)return;const{layout:v,layoutId:y}=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||y))return;Vn(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,k=this.treeScale.y;u3(this.layoutCorrected,this.treeScale,this.path,h),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Rt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Yy(this.prevProjectionDelta.x,this.projectionDelta.x),Yy(this.prevProjectionDelta.y,this.projectionDelta.y)),Mr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==k||!sb(this.projectionDelta.x,this.prevProjectionDelta.x)||!sb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),jr&&ui.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=mo(),this.projectionDelta=mo(),this.projectionDeltaWithTransform=mo()}setAnimationOrigin(d,p=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},y=mo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const b=Rt(),k=h?h.source:void 0,S=this.layout?this.layout.source:void 0,w=k!==S,j=this.getStack(),N=!j||j.members.length<=1,C=!!(w&&!N&&this.options.crossfade===!0&&!this.path.some(Y3));this.animationProgress=0;let E;this.mixTargetDelta=I=>{const R=I/1e3;rb(y.x,d.x,R),rb(y.y,d.y,R),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ir(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),K3(this.relativeTarget,this.relativeTargetOrigin,b,R),E&&R3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Rt()),Vn(E,this.relativeTarget)),w&&(this.animationValues=v,N3(v,g,this.latestValues,R,C,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ia(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=vt.update(()=>{Oc.hasAnimatedSinceResize=!0,this.currentAnimation=_3(0,ab,{...d,onUpdate:p=>{this.mixTargetDelta(p),d.onUpdate&&d.onUpdate(p)},onComplete:()=>{d.onComplete&&d.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ab),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:p,target:h,layout:g,latestValues:v}=d;if(!(!p||!h||!g)){if(this!==d&&this.layout&&g&&H1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Rt();const y=En(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+y;const b=En(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+b}Vn(p,h),go(p,v),Mr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new M3),this.sharedNodes.get(d).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 d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:p}=this.options;return p?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:p}=this.options;return p?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:p,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let p=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const g={};h.z&&Xf("z",d,g,this.animationValues);for(let v=0;v<Wf.length;v++)Xf(`rotate${Wf[v]}`,d,g,this.animationValues),Xf(`skew${Wf[v]}`,d,g,this.animationValues);d.render();for(const v in g)d.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);d.scheduleRender()}getProjectionStyles(d){var p,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return O3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Mc(d==null?void 0:d.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const y=this.getLead();if(!this.projectionDelta||!this.layout||!y.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Mc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!ci(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const b=y.animationValues||y.latestValues;this.applyTransformsToTarget(),g.transform=I3(this.projectionDeltaWithTransform,this.treeScale,b),v&&(g.transform=v(b,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,y.animationValues?g.opacity=y===this?(h=(p=b.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:g.opacity=y===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const w in Pc){if(b[w]===void 0)continue;const{correct:j,applyTo:N}=Pc[w],C=g.transform==="none"?b[w]:j(b[w],y);if(N){const E=N.length;for(let I=0;I<E;I++)g[N[I]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=y===this?Mc(d==null?void 0:d.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var p;return(p=d.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(ib),this.root.sharedNodes.clear()}}}function L3(t){t.updateLayout()}function z3(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:o,measuredBox:c}=t.layout,{animationType:u}=t.options,d=i.source!==t.layout.source;u==="size"?Gn(y=>{const b=d?i.measuredBox[y]:i.layoutBox[y],k=En(b);b.min=o[y].min,b.max=b.min+k}):H1(u,i.layoutBox,o)&&Gn(y=>{const b=d?i.measuredBox[y]:i.layoutBox[y],k=En(o[y]);b.max=b.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+k)});const p=mo();Mr(p,o,i.layoutBox);const h=mo();d?Mr(h,t.applyTransform(c,!0),i.measuredBox):Mr(h,o,i.layoutBox);const g=!U1(p);let v=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:b,layout:k}=y;if(b&&k){const S=Rt();Ir(S,i.layoutBox,b.layoutBox);const w=Rt();Ir(w,o,k.layoutBox),$1(S,w)||(v=!0),y.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:o}=t.options;o&&o()}t.options.transition=void 0}function U3(t){jr&&ui.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 $3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function P3(t){t.clearSnapshot()}function ib(t){t.clearMeasurements()}function V3(t){t.isLayoutDirty=!1}function H3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function ob(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function q3(t){t.resolveTargetDelta()}function G3(t){t.calcProjection()}function F3(t){t.resetSkewAndRotation()}function Z3(t){t.removeLeadSnapshot()}function rb(t,s,i){t.translate=St(s.translate,0,i),t.scale=St(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function lb(t,s,i,o){t.min=St(s.min,i.min,o),t.max=St(s.max,i.max,o)}function K3(t,s,i,o){lb(t.x,s.x,i.x,o),lb(t.y,s.y,i.y,o)}function Y3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const J3={duration:.45,ease:[.4,0,.1,1]},cb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),ub=cb("applewebkit/")&&!cb("chrome/")?Math.round:Cn;function db(t){t.min=ub(t.min),t.max=ub(t.max)}function W3(t){db(t.x),db(t.y)}function H1(t,s,i){return t==="position"||t==="preserve-aspect"&&!e3(nb(s),nb(i),.2)}function X3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const Q3=V1({attachResizeListener:(t,s)=>qr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Qf={current:void 0},q1=V1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Qf.current){const t=new Q3({});t.mount(window),t.setOptions({layoutScroll:!0}),Qf.current=t}return Qf.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),eM={pan:{Feature:g3},drag:{Feature:h3,ProjectionNode:q1,MeasureLayout:B1}};function tM(t,s,i){var o;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(t);return u?Array.from(u):[]}return Array.from(t)}function G1(t,s){const i=tM(t),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function fb(t){return s=>{s.pointerType==="touch"||N1()||t(s)}}function nM(t,s,i={}){const[o,c,u]=G1(t,i),d=fb(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=fb(y=>{g(y),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(p=>{p.addEventListener("pointerenter",d,c)}),u}function pb(t,s,i){const{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&vt.postRender(()=>u(s,Wr(s)))}class sM extends La{mount(){const{current:s}=this.node;s&&(this.unmount=nM(s,i=>(pb(this.node,i,"Start"),o=>pb(this.node,o,"End"))))}unmount(){}}class aM extends La{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=Jr(qr(this.node.current,"focus",()=>this.onFocus()),qr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const F1=(t,s)=>s?t===s?!0:F1(t,s.parentElement):!1,iM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function oM(t){return iM.has(t.tagName)||t.tabIndex!==-1}const Cr=new WeakSet;function mb(t){return s=>{s.key==="Enter"&&t(s)}}function ep(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const rM=(t,s)=>{const i=t.currentTarget;if(!i)return;const o=mb(()=>{if(Cr.has(i))return;ep(i,"down");const c=mb(()=>{ep(i,"up")}),u=()=>ep(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",u,s)});i.addEventListener("keydown",o,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",o),s)};function hb(t){return Rm(t)&&!N1()}function lM(t,s,i={}){const[o,c,u]=G1(t,i),d=p=>{const h=p.currentTarget;if(!hb(p)||Cr.has(h))return;Cr.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",b),!(!hb(k)||!Cr.has(h))&&(Cr.delete(h),typeof g=="function"&&g(k,{success:S}))},y=k=>{v(k,i.useGlobalTarget||F1(h,k.target))},b=k=>{v(k,!1)};window.addEventListener("pointerup",y,c),window.addEventListener("pointercancel",b,c)};return o.forEach(p=>{!oM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",d,c),p.addEventListener("focus",g=>rM(g,c),c)}),u}function gb(t,s,i){const{props:o}=t;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&vt.postRender(()=>u(s,Wr(s)))}class cM extends La{mount(){const{current:s}=this.node;s&&(this.unmount=lM(s,i=>(gb(this.node,i,"Start"),(o,{success:c})=>gb(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ip=new WeakMap,tp=new WeakMap,uM=t=>{const s=Ip.get(t.target);s&&s(t)},dM=t=>{t.forEach(uM)};function fM({root:t,...s}){const i=t||document;tp.has(i)||tp.set(i,{});const o=tp.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(dM,{root:t,...s})),o[c]}function pM(t,s,i){const o=fM(s);return Ip.set(t,i),o.observe(t),()=>{Ip.delete(t),o.unobserve(t)}}const mM={some:0,all:1};class hM extends La{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:o,amount:c="some",once:u}=s,d={root:i?i.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:mM[c]},p=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,u&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:y}=this.node.getProps(),b=g?v:y;b&&b(h)};return pM(this.node.current,d,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(gM(s,i))&&this.startObserver()}unmount(){}}function gM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const vM={inView:{Feature:hM},tap:{Feature:cM},focus:{Feature:aM},hover:{Feature:sM}},yM={layout:{ProjectionNode:q1,MeasureLayout:B1}},Zc={current:null},Mm={current:!1};function Z1(){if(Mm.current=!0,!!nm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Zc.current=t.matches;t.addListener(s),s()}else Zc.current=!1}const bM=[...m1,tn,Oa],_M=t=>bM.find(p1(t)),vb=new WeakMap;function xM(t,s,i){for(const o in s){const c=s[o],u=i[o];if(nn(c))t.addValue(o,c);else if(nn(u))t.addValue(o,Vr(c,{owner:t}));else if(u!==c)if(t.hasValue(o)){const d=t.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=t.getStaticValue(o);t.addValue(o,Vr(d!==void 0?d:c,{owner:t}))}}for(const o in i)s[o]===void 0&&t.removeValue(o);return s}const yb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class kM{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Cm,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,vt.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=d;this.onUpdate=v,this.latestValues=h,this.baseTarget={...h},this.initialValues=i.initial?{...h}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=o,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!u,this.isControllingVariants=lu(i),this.isVariantNode=N_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:y,...b}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in b){const S=b[k];h[k]!==void 0&&nn(S)&&S.set(h[k],!1)}}mount(s){this.current=s,vb.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,o)=>this.bindToMotionValue(o,i)),Mm.current||Z1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Zc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){vb.delete(this.current),this.projection&&this.projection.unmount(),Ia(this.notifyUpdate),Ia(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const o=xi.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&vt.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0)}),u=i.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),u(),d&&d(),i.owner&&i.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in xo){const i=xo[s];if(!i)continue;const{isEnabled:o,Feature:c}=i;if(!this.features[s]&&c&&o(this.props)&&(this.features[s]=new c(this)),this.features[s]){const u=this.features[s];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let o=0;o<yb.length;o++){const c=yb[o];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const u="on"+c,d=s[u];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=xM(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const o=this.values.get(s);i!==o&&(o&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let o=this.values.get(s);return o===void 0&&i!==void 0&&(o=Vr(i===null?void 0:i,{owner:this}),this.addValue(s,o)),o}readValue(s,i){var o;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(o=this.getBaseTargetFromProps(this.props,s))!==null&&o!==void 0?o:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(d1(c)||n1(c))?c=parseFloat(c):!_M(c)&&Oa.test(i)&&(c=l1(s,i)),this.setBaseTarget(s,nn(c)?c.get():c)),nn(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:o}=this.props;let c;if(typeof o=="string"||typeof o=="object"){const d=lm(this.props,o,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);d&&(c=d[s])}if(o&&c!==void 0)return c;const u=this.getBaseTargetFromProps(this.props,s);return u!==void 0&&!nn(u)?u:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new bm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class K1 extends kM{constructor(){super(...arguments),this.KeyframeResolver=h1}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:o}){delete i[s],delete o[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;nn(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function SM(t){return window.getComputedStyle(t)}class TM extends K1{constructor(){super(...arguments),this.type="html",this.renderInstance=O_}readValueFromInstance(s,i){if(xi.has(i)){const o=jm(i);return o&&o.default||0}else{const o=SM(s),c=(R_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return I1(s,i)}build(s,i,o){dm(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return hm(s,i,o)}}class wM extends K1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(xi.has(i)){const o=jm(i);return o&&o.default||0}return i=B_.has(i)?i:im(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return U_(s,i,o)}build(s,i,o){fm(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){L_(s,i,o,c)}mount(s){this.isSVGTag=mm(s.tagName),super.mount(s)}}const NM=(t,s)=>rm(t)?new wM(s):new TM(s,{allowProjection:t!==_.Fragment}),jM=QA({...qR,...vM,...eM,...yM},NM),It=mA(jM);function CM(){!Mm.current&&Z1();const[t]=_.useState(Zc.current);return t}const EM="_overlay_cmicx_1",AM="_dialog_cmicx_11",DM="_title_cmicx_30",RM="_description_cmicx_38",MM="_actions_cmicx_45",IM="_cancelButton_cmicx_52",OM="_confirmButton_cmicx_79",oi={overlay:EM,dialog:AM,title:DM,description:RM,actions:MM,cancelButton:IM,confirmButton:OM};function vi({isOpen:t,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=_.useId(),p=_.useId();return r.jsx(_s,{children:t&&r.jsx(It.div,{className:oi.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:h=>{h.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?p:void 0,children:r.jsxs(It.div,{className:oi.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:h=>h.stopPropagation(),children:[r.jsx("h3",{id:d,className:oi.title,children:s}),i&&r.jsx("p",{id:p,className:oi.description,children:i}),r.jsxs("div",{className:oi.actions,children:[r.jsx("button",{type:"button",className:oi.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),r.jsx("button",{type:"button",className:oi.confirmButton,onClick:c,children:o})]})]})})})}const BM="_spinner_1uyt1_1",LM="_spin_1uyt1_1",zM="_sm_1uyt1_14",UM="_md_1uyt1_20",$M="_lg_1uyt1_26",PM="_xl_1uyt1_32",bb={spinner:BM,spin:LM,sm:zM,md:UM,lg:$M,xl:PM};function Y1({size:t="md",className:s,label:i="Loading",liveRegion:o=!1}){return r.jsx("span",{className:`${bb.spinner} ${bb[t]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const VM="_splash_1bn1g_1",HM="_logo_1bn1g_11",_b={splash:VM,logo:HM};function J1(){return r.jsxs("div",{className:_b.splash,"data-testid":"splash-screen",children:[r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:_b.logo}),r.jsx(Y1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const W1=50;function qM(t,s,i,o,c=W1){return o?t<c:s-t-i<c}function GM(t,s){const i=s-t;return i>0?i:0}function FM({scrollRef:t,contentLength:s,isReversed:i}){const[o,c]=_.useState(!0),u=_.useRef(0),d=_.useRef(!1),p=_.useRef(0);_.useEffect(()=>{const g=t.current;if(!g)return;let v=!0;const y=()=>{p.current||(p.current=requestAnimationFrame(()=>{p.current=0;const b=qM(g.scrollTop,g.scrollHeight,g.clientHeight,i,W1);b!==v&&(v=b,c(b))}))};return g.addEventListener("scroll",y,{passive:!0}),()=>{g.removeEventListener("scroll",y),p.current&&(cancelAnimationFrame(p.current),p.current=0)}},[t,i]),_.useLayoutEffect(()=>{const g=t.current;!g||d.current||(d.current=!0,i?g.scrollTop=0:g.scrollTop=g.scrollHeight,c(!0))},[t,i]),_.useLayoutEffect(()=>{const g=t.current;if(g){if(i&&!o){const v=GM(u.current,g.scrollHeight);v>0&&(g.scrollTop+=v)}o&&(i?g.scrollTo({top:0,behavior:"smooth"}):g.scrollTo({top:g.scrollHeight,behavior:"smooth"})),u.current=g.scrollHeight}},[s,o,i,t]);const h=_.useCallback(()=>{const g=t.current;if(!g)return;const v=i?0:g.scrollHeight;g.scrollTo({top:v,behavior:"smooth"}),c(!0)},[t,i]);return{isAtAnchor:o,scrollToAnchor:h}}const ZM="_wrapper_1rtuy_1",KM="_scrollContainer_1rtuy_9",YM="_toolbar_1rtuy_15",JM="_directionToggle_1rtuy_22",WM="_scrollToAnchor_1rtuy_60",XM="_scrollToAnchorBottom_1rtuy_84",QM="_scrollToAnchorTop_1rtuy_88",e6="_eventOverflowWarning_1rtuy_92",Da={wrapper:ZM,scrollContainer:KM,toolbar:YM,directionToggle:JM,scrollToAnchor:WM,scrollToAnchorBottom:XM,scrollToAnchorTop:QM,eventOverflowWarning:e6},X1="grackle-stream-direction";function t6(){try{return localStorage.getItem(X1)==="reversed"}catch{return!1}}function n6({eventsDropped:t}){return t<=0?r.jsx(r.Fragment,{}):r.jsxs("div",{className:Da.eventOverflowWarning,role:"alert",children:[r.jsx(Vp,{size:Gt,"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 Im({events:t,eventsDropped:s,emptyState:i}){const o=_.useRef(null),[c,u]=_.useState(t6),d=CM(),p=_.useMemo(()=>c?[...t].reverse():t,[t,c]),{isAtAnchor:h,scrollToAnchor:g}=FM({scrollRef:o,contentLength:t.length,isReversed:c}),v=()=>{const k=!c;u(k);try{localStorage.setItem(X1,k?"reversed":"default")}catch{}},y=d?0:.2,b=c?-8:8;return r.jsxs("div",{className:Da.wrapper,children:[r.jsx("div",{className:Da.toolbar,children:r.jsx("button",{className:Da.directionToggle,onClick:v,title:c?"Showing newest first":"Showing oldest first","aria-label":c?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:c?r.jsx(Vv,{size:Gt,"aria-hidden":"true"}):r.jsx(Hv,{size:Gt,"aria-hidden":"true"})})}),r.jsxs("div",{ref:o,className:Da.scrollContainer,"data-testid":"event-stream-scroll",children:[t.length===0&&i,r.jsx(n6,{eventsDropped:s}),r.jsx(_s,{initial:!1,children:p.map((k,S)=>{const w=c?t.length-1-S:S;return r.jsx(It.div,{initial:{opacity:0,y:b},animate:{opacity:1,y:0},transition:{duration:y,ease:"easeOut"},children:r.jsx(nA,{event:k,toolUseCtx:k.toolUseCtx,settled:k.settled})},`${k.sessionId}-${k.timestamp}-${w}`)})})]}),r.jsx(_s,{children:!h&&r.jsxs(It.button,{className:`${Da.scrollToAnchor} ${c?Da.scrollToAnchorTop:Da.scrollToAnchorBottom}`,onClick:g,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[c?r.jsx(Hv,{size:Gt,"aria-hidden":"true"}):r.jsx(Vv,{size:Gt,"aria-hidden":"true"})," New events"]})})]})}function Om(t){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=_.useState(""),[y,b]=_.useState(""),k=_.useRef(!1),S=u===c,w=_.useCallback(q=>{v(q),b("")},[]),j=_.useCallback(()=>{b("")},[]),N=_.useCallback(()=>{k.current=!1,d==null||d(null),v(""),b("")},[d]),C=_.useCallback(()=>{const q=h?g.trim():g;if(o){const Y=o(g);if(Y){b(Y);return}}const $=h?s.trim():s;if(q===$){N();return}i(q),N()},[g,s,h,o,i,N]),E=_.useCallback(()=>{k.current=!0,d==null||d(c),v(s),b("")},[c,s,d]),I=_.useCallback(q=>{if(k.current){k.current=!1;return}q.relatedTarget instanceof HTMLElement&&q.relatedTarget.dataset.editAction===c||C()},[c,C]),R=_.useCallback(q=>{q.key==="Escape"?N():q.key==="Enter"&&p&&C()},[N,p,C]),D=(()=>{if(!S)return!1;const q=h?s.trim():s;return(h?g.trim():g)!==q})();return _.useEffect(()=>{!S&&(g!==""||y!=="")&&(v(""),b(""))},[S,g,y]),{isEditing:S,draft:g,error:y,isDirty:D,startEdit:E,cancelEdit:N,save:C,setDraft:w,clearError:j,handleBlur:I,handleKeyDown:R,ignoreInitialBlurRef:k}}const s6="_editFieldWrapper_yuzty_1",a6="_editInput_yuzty_10",i6="_editTextarea_yuzty_42",o6="_editSelect_yuzty_78",r6="_editError_yuzty_111",l6="_editInputInvalid_yuzty_118",c6="_editHint_yuzty_123",u6="_unsavedDot_yuzty_132",d6="_metaValueClickable_yuzty_140",f6="_editButton_yuzty_159",p6="_metaPlaceholder_yuzty_175",m6="_worktreeToggle_yuzty_180",We={editFieldWrapper:s6,editInput:a6,editTextarea:i6,editSelect:o6,editError:r6,editInputInvalid:l6,editHint:c6,unsavedDot:u6,metaValueClickable:d6,editButton:f6,metaPlaceholder:p6,worktreeToggle:m6};function Xt(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,maxLength:y,ariaLabel:b,"data-testid":k}=t,S=_.useRef(null),w=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!0,trimOnSave:!0});if(_.useEffect(()=>{if(w.isEditing){const N=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(N)}},[w.isEditing]),c==="create"){const N=E=>{h==null||h(E.target.value)},C=o==null?void 0:o(s);return r.jsxs("div",{className:We.editFieldWrapper,children:[r.jsx("input",{className:`${We.editInput} ${C?We.editInputInvalid:""}`,value:s,onChange:N,maxLength:y,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),C&&r.jsx("span",{className:We.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return r.jsxs("div",{className:We.editFieldWrapper,children:[r.jsx("input",{ref:S,className:`${We.editInput} ${w.error?We.editInputInvalid:""}`,value:w.draft,onChange:N=>w.setDraft(N.target.value),onBlur:w.handleBlur,onKeyDown:w.handleKeyDown,maxLength:y,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),w.isDirty&&r.jsx("span",{className:We.unsavedDot,title:"Unsaved changes"}),w.error&&r.jsx("span",{className:We.editError,"data-testid":"edit-error",children:w.error}),r.jsx("span",{className:We.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:We.metaValueClickable,onClick:()=>w.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),w.startEdit())},title:"Click to edit","aria-label":b,"data-testid":k?`${k}-button`:void 0,children:[j!==void 0?j:s?r.jsx("span",{children:s}):r.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function Op(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:y,"data-testid":b}=t,k=_.useRef(null),S=Om({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});if(_.useEffect(()=>{if(S.isEditing){const j=window.setTimeout(()=>{var N;(N=k.current)==null||N.focus()},0);return()=>window.clearTimeout(j)}},[S.isEditing]),c==="create"){const j=C=>{h==null||h(C.target.value)},N=o==null?void 0:o(s);return r.jsxs("div",{className:We.editFieldWrapper,children:[r.jsx("textarea",{className:`${We.editTextarea} ${N?We.editInputInvalid:""}`,value:s,onChange:j,placeholder:v,"aria-label":y,"data-testid":b?`${b}-input`:void 0}),N&&r.jsx("span",{className:We.editError,"data-testid":"edit-error",children:N})]})}if(S.isEditing)return r.jsxs("div",{className:We.editFieldWrapper,children:[r.jsx("textarea",{ref:k,className:`${We.editTextarea} ${S.error?We.editInputInvalid:""}`,value:S.draft,onChange:j=>S.setDraft(j.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:y,"aria-label":y,"data-testid":b?`${b}-input`:void 0}),S.isDirty&&r.jsx("span",{className:We.unsavedDot,title:"Unsaved changes"}),S.error&&r.jsx("span",{className:We.editError,"data-testid":"edit-error",children:S.error}),r.jsx("span",{className:We.editHint,children:"Tab to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:We.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":y,"data-testid":b?`${b}-button`:void 0,children:[w!==void 0?w:s?r.jsx("span",{children:s}):r.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function Kc(t){var E;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:y,"data-testid":b}=t,k=_.useRef(null),S=Om({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});_.useEffect(()=>{if(S.isEditing){const I=window.setTimeout(()=>{var R;(R=k.current)==null||R.focus()},0);return()=>window.clearTimeout(I)}},[S.isEditing]);const w=_.useCallback(I=>{const R=I.target.value;S.ignoreInitialBlurRef.current=!1,R!==s&&i(R),S.cancelEdit()},[s,i,S]),j=_.useCallback(I=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}I.relatedTarget instanceof HTMLElement&&I.relatedTarget.dataset.editAction===u||S.cancelEdit()},[u,S]);if(o==="create")return r.jsx("select",{className:We.editSelect,value:s,onChange:I=>h==null?void 0:h(I.target.value),"aria-label":y,"data-testid":b?`${b}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});if(S.isEditing)return r.jsx("select",{ref:k,className:We.editSelect,value:S.draft,onChange:w,onBlur:j,title:y,"aria-label":y,"data-testid":b?`${b}-select`:void 0,children:c.map(I=>r.jsx("option",{value:I.value,children:I.label},I.value))});const N=g==null?void 0:g(s),C=(E=c.find(I=>I.value===s))==null?void 0:E.label;return r.jsxs("button",{type:"button",className:We.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":y,"data-testid":b?`${b}-button`:void 0,children:[N!==void 0?N:C?r.jsx("span",{children:C}):r.jsx("span",{className:We.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:We.editButton,"aria-hidden":"true",children:"✏️"})]})}function h6(t){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=t;return r.jsxs("label",{className:We.worktreeToggle,"data-testid":u,children:[r.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),r.jsx("span",{children:o})]})}const g6="_envRow_1e1r5_1",v6="_envDot_1e1r5_7",y6="_envDotGreen_1e1r5_14",b6="_envDotYellow_1e1r5_18",_6="_envDotRed_1e1r5_22",x6="_envDotGray_1e1r5_26",vo={envRow:g6,envDot:v6,envDotGreen:y6,envDotYellow:b6,envDotRed:_6,envDotGray:x6};function k6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?vo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?vo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?vo.envDotRed:vo.envDotGray}function S6(t){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:p,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=t,y=o.find(S=>S.id===s),b=[...c?[{value:"",label:"None"}]:[],...o.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(y)return r.jsxs("span",{className:vo.envRow,children:[r.jsx("span",{className:`${vo.envDot} ${k6(y.status)}`}),y.displayName]})};return r.jsx(Kc,{value:s,onSave:i,options:b,fieldId:u,activeFieldId:d,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const T6="_nav_1snmp_1",w6="_searchForm_1snmp_8",N6="_searchInput_1snmp_15",j6="_searchButton_1snmp_33",C6="_clearButton_1snmp_68",E6="_workspaceSelect_1snmp_85",A6="_listHeader_1snmp_99",D6="_nodeList_1snmp_108",R6="_nodeItem_1snmp_116",M6="_indicator_1snmp_129",I6="_label_1snmp_136",O6="_badge_1snmp_145",Hn={nav:T6,searchForm:w6,searchInput:N6,searchButton:j6,clearButton:C6,workspaceSelect:E6,listHeader:A6,nodeList:D6,nodeItem:R6,indicator:M6,label:I6,badge:O6};function B6({nodes:t,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:p}){const[h,g]=_.useState(""),v=_.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),y=_.useCallback(()=>{g(""),u()},[u]),b=_.useCallback(S=>{d(S)},[d]),k=_.useCallback(S=>{g(""),p(S)},[p]);return r.jsxs("div",{className:Hn.nav,"data-testid":"knowledge-nav",children:[r.jsxs("form",{className:Hn.searchForm,onSubmit:v,children:[r.jsx("input",{className:Hn.searchInput,type:"text",placeholder:"Search...",value:h,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input"}),r.jsx("button",{type:"submit",className:Hn.searchButton,disabled:i,children:"Go"})]}),o&&r.jsx("button",{type:"button",className:Hn.clearButton,onClick:y,children:"Clear search"}),r.jsxs("select",{className:Hn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter",children:[r.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>r.jsx("option",{value:S.id,children:S.name},S.id))]}),r.jsxs("div",{className:Hn.listHeader,children:["Nodes (",t.length,")"]}),r.jsx("ul",{className:Hn.nodeList,children:t.map(S=>r.jsxs("li",{className:Hn.nodeItem,onClick:()=>{b(S.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),b(S.id))},role:"button",tabIndex:0,children:[r.jsx("span",{className:Hn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),r.jsx("span",{className:Hn.label,children:S.label}),r.jsx("span",{className:Hn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const L6="_container_1mq5u_1",z6="_hamburger_1mq5u_33",U6="_brand_1mq5u_49",$6="_brandLogo_1mq5u_68",P6="_info_1mq5u_75",V6="_connectionLabel_1mq5u_90",H6="_connectionDot_1mq5u_103",q6="_connected_1mq5u_106",G6="_disconnected_1mq5u_110",Hs={container:L6,hamburger:z6,brand:U6,brandLogo:$6,info:P6,connectionLabel:V6,connectionDot:H6,connected:q6,disconnected:G6};function F6({connected:t,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=yt(),d=s.length,p=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return r.jsxs("div",{className:Hs.container,children:[o&&r.jsx("button",{type:"button",className:Hs.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:r.jsx(m2,{size:Mt,"aria-hidden":"true"})}),r.jsxs("button",{type:"button",className:Hs.brand,onClick:()=>u(gi),title:"Home",children:[r.jsx("img",{src:"/icon-192x192.png",alt:"",className:Hs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),r.jsxs("div",{className:Hs.info,children:[r.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[r.jsx("span",{className:`${Hs.connectionDot} ${t?Hs.connected:Hs.disconnected}`,"aria-hidden":"true",children:r.jsx(Ra,{size:Hp,fill:"currentColor"})})," ",r.jsx("span",{className:Hs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),r.jsxs("span",{children:[p,"/",d," env",d!==1?"s":""]}),r.jsxs("span",{children:[h," active"]})]})]})}const Z6="_nav_13gkc_1",K6="_tab_13gkc_35",Y6="_tabIcon_13gkc_68",J6="_tabLabel_13gkc_79",W6="_tabActive_13gkc_84",Sr={nav:Z6,tab:K6,tabIcon:Y6,tabLabel:J6,tabActive:W6},ri=[{view:"dashboard",label:"Dashboard",icon:r.jsx(t2,{size:Mt}),route:gi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:r.jsx(g2,{size:Mt}),route:BN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:r.jsx(HT,{size:Mt}),route:LN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:r.jsx(y2,{size:Mt}),route:bo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:r.jsx(LT,{size:Mt}),route:v_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:r.jsx(Yb,{size:Mt}),route:au,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:r.jsx(j2,{size:Mt}),route:RN,testId:"sidebar-tab-settings"}];function X6(t){return t===gi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(v_)?"knowledge":t.startsWith(au)?"findings":t.startsWith(yo)?"settings":"tasks"}function Q6(){const t=Pt(),s=yt(),i=_.useRef(null),o=X6(t.pathname),c=_.useCallback(d=>{s(d.route)},[s]),u=_.useCallback(d=>{var y,b;const p=(y=i.current)==null?void 0:y.querySelectorAll('[role="tab"]');if(!p)return;const h=Array.from(p).findIndex(k=>k===document.activeElement),g=h>=0?h:ri.findIndex(k=>k.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%ri.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+ri.length)%ri.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=ri.length-1;else return;s(ri[v].route),(b=p[v])==null||b.focus()},[o,s]);return r.jsx("nav",{className:Sr.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:ri.map(d=>{const p=d.view===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Sr.tab} ${p?Sr.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[r.jsx("span",{className:Sr.tabIcon,"aria-hidden":"true",children:d.icon}),r.jsx("span",{className:Sr.tabLabel,children:d.label})]},d.view)})})}const e4="_container_pi6ii_1",t4="_content_pi6ii_66",xb={container:e4,content:t4},n4=320,Q1=220,ex=600,tx="grackle-sidebar-width";function s4(){try{const t=localStorage.getItem(tx);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=Q1&&s<=ex)return s}}catch{}return n4}function a4(t){try{localStorage.setItem(tx,String(t))}catch{}}function i4({content:t}){const[s]=_.useState(s4),i=_.useRef(null);if(_.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const p=d.borderBoxSize[0];if(p){const h=Math.round(p.inlineSize);h>=Q1&&h<=ex&&a4(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),t!==void 0)return r.jsx("div",{className:xb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:r.jsx("div",{className:xb.content,children:t})})}const o4="_bar_tnfsh_1",r4="_btnPrimary_tnfsh_32",l4="_statusText_tnfsh_85",c4="_statusCompleted_tnfsh_90",u4="_statusFailed_tnfsh_94",d4="_statusBlocked_tnfsh_98",f4="_hintText_tnfsh_103",xt={bar:o4,btnPrimary:r4,statusText:l4,statusCompleted:c4,statusFailed:u4,statusBlocked:d4,hintText:f4};function p4({sessions:t,tasks:s,environments:i}){const o=yt(),c=Pt(),u=Nt("/sessions/:sessionId"),d=Nt("/tasks/:taskId"),p=Nt("/tasks/:taskId/stream"),h=Nt("/tasks/:taskId/findings"),g=Nt("/tasks/:taskId/edit"),v=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),y=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Nt("/sessions/new"),w=Nt("/environments/:environmentId/workspaces/:workspaceId"),j=Nt("/tasks/new"),N=Nt("/chat"),C=Nt("/"),E=Nt("/settings/*"),I=u==null?void 0:u.params.sessionId,R=(d==null?void 0:d.params.taskId)??(p==null?void 0:p.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(y==null?void 0:y.params.taskId)??(b==null?void 0:b.params.taskId)??(k==null?void 0:k.params.taskId),D=v??y??b??k,q=(D==null?void 0:D.params.environmentId)??(w==null?void 0:w.params.environmentId),$=c.pathname.startsWith("/environments")&&!w&&!D,Y=!!N,G=!!S,Q=!!w&&!v&&!y&&!b&&!k,ae=!!j;if(!!C&&!G&&!Q&&!ae||!!E||(!!g||!!k)||ae||$||G)return r.jsx(r.Fragment,{});if(Y)return i.find(Z=>Z.adapterType==="local"&&Z.status==="connected")?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Add a local environment to start chatting"})});if(Q)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Select a task or click + to create one"})});if(R){const B=s.find(re=>re.id===R);if(!B)return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})});const Z=new Map(s.map(re=>[re.id,re])),ne=B.dependsOn.some(re=>{const ue=Z.get(re);return ue!==void 0&&ue.status!=="complete"});if(B.status==="not_started"){const re=ne?B.dependsOn.map(ue=>Z.get(ue)).filter(ue=>ue&&ue.status!=="complete").map(ue=>ue.title):[];return r.jsx("div",{className:xt.bar,children:ne?r.jsxs("span",{className:xt.statusBlocked,children:["Blocked by: ",re.join(", ")]}):r.jsx("span",{className:xt.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const re=B.latestSessionId||void 0,ue=re?t.find(je=>je.id===re):void 0;return ue&&ue.status!=="stopped"?r.jsx(r.Fragment,{}):r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return r.jsxs("div",{className:xt.bar,children:[r.jsx("span",{className:`${xt.statusText} ${xt.statusCompleted}`,children:"Task completed"}),r.jsx("button",{onClick:()=>o(_i(B.workspaceId,void 0,q)),className:xt.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:`${xt.statusText} ${xt.statusFailed}`,children:"Task failed"})})}if(I){const B=t.find(re=>re.id===I),Z=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!Z)return r.jsx(r.Fragment,{});if(Z)return r.jsxs("div",{className:xt.bar,children:[r.jsxs("span",{className:`${xt.statusText} ${xt.hintText}`,children:["Session ",B.endReason||B.status]}),r.jsx("button",{onClick:()=>o(m_(B.environmentId)),className:xt.btnPrimary,children:"+ New Chat"})]})}return r.jsx("div",{className:xt.bar,children:r.jsx("span",{className:xt.hintText,children:"Loading..."})})}const m4="_nav_14i94_1",h4="_tab_14i94_24",g4="_tabActive_14i94_62",v4="_tabLabel_14i94_75",y4="_statusDot_14i94_81",b4="_pulse_14i94_87",_4="_addButton_14i94_99",x4="_empty_14i94_132",wa={nav:m4,tab:h4,tabActive:g4,tabLabel:v4,statusDot:y4,pulse:b4,addButton:_4,empty:x4},k4={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function S4({environments:t}){const s=yt(),i=_.useRef(null),o=Nt("/environments/:environmentId"),c=Nt("/environments/:environmentId/edit"),u=Nt("/environments/:environmentId/workspaces/:workspaceId"),d=Nt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(o==null?void 0:o.params.environmentId)??(c==null?void 0:c.params.environmentId)??(u==null?void 0:u.params.environmentId)??(d==null?void 0:d.params.environmentId),h=p==="new"?void 0:p,g=_.useCallback(b=>{s(hi(b))},[s]),v=_.useCallback(b=>{var N;const k=(N=i.current)==null?void 0:N.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),w=S>=0?S:t.findIndex(C=>C.id===h);let j=w;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),j=(w+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),j=(w-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),j=0;else if(b.key==="End")b.preventDefault(),j=k.length-1;else return;j<t.length&&s(hi(t[j].id)),k[j].focus()},[h,t,s]),y=h??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:wa.nav,"data-testid":"environment-nav",children:[r.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(b=>{const k=b.id===h,S=b.id===y,w=k4[b.status]||"var(--text-tertiary)",j=b.status==="connected";return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${wa.tab} ${k?wa.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"env-nav-item",children:[r.jsx("span",{className:`${wa.statusDot} ${j?wa.pulse:""}`,style:{color:w},"aria-hidden":"true",children:r.jsx(Ra,{size:Hp,fill:"currentColor"})}),r.jsx("span",{className:wa.tabLabel,title:b.displayName||b.id,children:b.displayName||b.id})]},b.id)})}),r.jsx("button",{type:"button",className:wa.addButton,onClick:()=>s(AN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&r.jsx("div",{className:wa.empty,children:"No environments yet."})]})}function Bm(t){const s=new Date(t),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),p=Math.floor(d/24);if(c<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}h ago`;if(p===1)return"yesterday";if(p<7)return`${p} days ago`;const h=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return h?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const kb={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function Yc(t){return kb[t]||kb.general}const T4="_nav_dlm8m_1",w4="_categoryPills_dlm8m_24",N4="_categoryPill_dlm8m_24",j4="_tab_dlm8m_42",C4="_tabActive_dlm8m_80",E4="_tabContent_dlm8m_93",A4="_tabLabel_dlm8m_100",D4="_tabMeta_dlm8m_106",R4="_categoryDot_dlm8m_111",M4="_empty_dlm8m_118",hs={nav:T4,categoryPills:w4,categoryPill:N4,tab:j4,tabActive:C4,tabContent:E4,tabLabel:A4,tabMeta:D4,categoryDot:R4,empty:M4};function I4({findings:t,workspaceId:s,environmentId:i}){const o=yt(),c=_.useRef(null),u=Nt("/findings/:findingId"),d=Nt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(u==null?void 0:u.params.findingId)??(d==null?void 0:d.params.findingId),h=_.useMemo(()=>{const b=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(b).sort()},[t]),g=_.useCallback(b=>{o(vp(b,s,i))},[o,s,i]),v=_.useCallback(b=>{var N;const k=(N=c.current)==null?void 0:N.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),w=S>=0?S:t.findIndex(C=>C.id===p);let j=w;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),j=(w+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),j=(w-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),j=0;else if(b.key==="End")b.preventDefault(),j=k.length-1;else return;j<t.length&&o(vp(t[j].id,s,i)),k[j].focus()},[p,t,o,s,i]),y=p??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:hs.nav,"data-testid":"findings-nav",children:[h.length>1&&r.jsx("div",{className:hs.categoryPills,"data-testid":"findings-nav-categories",children:h.map(b=>r.jsx("span",{className:hs.categoryPill,style:{color:Yc(b).text},children:b},b))}),r.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(b=>{const k=b.id===p,S=b.id===y;return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${hs.tab} ${k?hs.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"finding-nav-item",children:[r.jsx("span",{className:hs.categoryDot,style:{color:Yc(b.category).text},"aria-hidden":"true",children:r.jsx(Ra,{size:Hp,fill:"currentColor"})}),r.jsxs("span",{className:hs.tabContent,children:[r.jsx("span",{className:hs.tabLabel,title:b.title,children:b.title}),r.jsx("span",{className:hs.tabMeta,title:b.createdAt,children:Bm(b.createdAt)})]})]},b.id)})}),t.length===0&&r.jsx("div",{className:hs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function O4(t){if(t.length===0)return[];const s=[...t].sort((o,c)=>o[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let o=1;o<s.length;o++){const c=i[i.length-1],[u,d]=s[o];u<=c[1]+1?c[1]=Math.max(c[1],d):i.push([u,d])}return i}function nx({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return r.jsx(r.Fragment,{children:t});const o=O4(s),c=[];let u=0;for(const[d,p]of o)d>u&&c.push(r.jsx("span",{children:t.slice(u,d)},`p${u}`)),c.push(r.jsx("mark",{className:i,children:t.slice(d,p+1)},`m${d}`)),u=p+1;return u<t.length&&c.push(r.jsx("span",{children:t.slice(u)},`p${u}`)),r.jsx(r.Fragment,{children:c})}function B4(t){const s=new Map(t.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of s.values())o.parentTaskId&&s.has(o.parentTaskId)?s.get(o.parentTaskId).children.push(o):i.push(o);for(const o of s.values())o.children.sort((c,u)=>c.sortOrder-u.sortOrder);return i.sort((o,c)=>o.sortOrder-c.sortOrder)}function L4(t,s){const i=new Map;for(const u of t){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(p);h?h.push(u):i.set(p,[u])}const o=[],c=new Set;for(const u of I2){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Ma(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Ma(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}const z4="_container_z4i38_1",U4="_header_z4i38_5",$4="_headerActions_z4i38_17",P4="_searchInput_z4i38_23",V4="_searchHighlight_z4i38_56",H4="_groupToggle_z4i38_62",q4="_groupToggleActive_z4i38_89",G4="_addButton_z4i38_93",F4="_taskRow_z4i38_120",Z4="_selected_z4i38_140",K4="_expandArrow_z4i38_150",Y4="_expanded_z4i38_157",J4="_leafSpacer_z4i38_161",W4="_taskStatusIcon_z4i38_166",X4="_taskTitle_z4i38_170",Q4="_workspaceBadge_z4i38_177",eI="_childCountBadge_z4i38_195",tI="_dependencyBadge_z4i38_208",nI="_blockedBadge_z4i38_220",sI="_addChildButton_z4i38_225",aI="_emptyState_z4i38_268",iI="_statusGroupHeader_z4i38_275",oI="_statusGroupIcon_z4i38_294",rI="_statusGroupLabel_z4i38_298",lI="_statusGroupCount_z4i38_303",He={container:z4,header:U4,headerActions:$4,searchInput:P4,searchHighlight:V4,groupToggle:H4,groupToggleActive:q4,addButton:G4,taskRow:F4,selected:Z4,expandArrow:K4,expanded:Y4,leafSpacer:J4,taskStatusIcon:W4,taskTitle:X4,workspaceBadge:Q4,childCountBadge:eI,dependencyBadge:tI,blockedBadge:nI,addChildButton:sI,emptyState:aI,statusGroupHeader:iI,statusGroupIcon:oI,statusGroupLabel:rI,statusGroupCount:lI},cI=[{name:"title",weight:2},{name:"description",weight:1}],sx=16,uI=16,ax="grackle-task-group-by-status";function Sb(){try{return localStorage.getItem(ax)==="true"}catch{return!1}}function dI(t){try{localStorage.setItem(ax,String(t))}catch{}}function fI({group:t,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return r.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[r.jsxs("div",{className:He.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[r.jsx("span",{className:`${He.expandArrow} ${s?He.expanded:""}`,"aria-hidden":"true",children:r.jsx(Xs,{size:kt})}),r.jsx("span",{className:He.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),r.jsx("span",{className:He.statusGroupLabel,children:t.label}),r.jsx("span",{className:He.statusGroupCount,children:t.tasks.length})]}),r.jsx(_s,{children:s&&r.jsx(It.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 h=Ma(p.status),g=o===p.id,v=p.parentTaskId||!p.workspaceId?void 0:d.get(p.workspaceId);return r.jsxs("div",{onClick:()=>c(os(p.id)),className:`${He.taskRow} ${g?He.selected:""}`,style:{"--task-indent":`${sx}px`},"data-task-id":p.id,children:[r.jsx("span",{className:He.leafSpacer}),r.jsx("span",{className:He.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${Gr(p.status)}`,children:h.icon}),r.jsx("span",{className:He.taskTitle,title:p.title,children:r.jsx(nx,{text:p.title,indices:u.get(p.id),highlightClass:He.searchHighlight})}),v&&r.jsx("span",{className:He.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function ix({node:t,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h}){const g=Ma(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(N=>d.get(N)!=="complete"),y=i.has(t.id),b=t.children.length>0,k=c===t.id,S=sx+s*uI,j=s===0&&!t.parentTaskId&&t.workspaceId?h.get(t.workspaceId):void 0;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{onClick:()=>u(os(t.id)),className:`${He.taskRow} ${k?He.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[b&&r.jsx("span",{className:`${He.expandArrow} ${y?He.expanded:""}`,role:"button",tabIndex:0,"aria-label":y?"Collapse task":"Expand task",onClick:N=>{N.stopPropagation(),o(t.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),N.stopPropagation(),o(t.id))},children:r.jsx(Xs,{size:kt,"aria-hidden":"true"})}),!b&&r.jsx("span",{className:He.leafSpacer}),r.jsx("span",{className:He.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Gr(t.status)}`,children:g.icon}),r.jsx("span",{className:He.taskTitle,title:t.title,children:r.jsx(nx,{text:t.title,indices:p.get(t.id),highlightClass:He.searchHighlight})}),j&&r.jsx("span",{className:He.workspaceBadge,title:j,children:j}),b&&r.jsxs("span",{className:He.childCountBadge,children:[t.children.filter(N=>N.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&r.jsx("span",{className:`${He.dependencyBadge} ${v?He.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<ZS&&r.jsx("button",{onClick:N=>{N.stopPropagation(),u(_i(t.workspaceId,t.id))},title:"Add child task","aria-label":"Add child task",className:He.addChildButton,children:"+"})]}),r.jsx(_s,{children:b&&y&&r.jsx(It.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=>r.jsx(ix,{node:N,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h},N.id))})})]})}function pI({workspaces:t,tasks:s}){const i=yt(),[o,c]=_.useState(new Set),[u,d]=_.useState(new Set),[p,h]=_.useState(Sb),[g,v]=_.useState(Sb),[y,b]=_.useState(new Map),k=Nt("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,w=_.useMemo(()=>new Map(s.map(ie=>[ie.id,ie.status])),[s]),j=_.useMemo(()=>new Map(t.map(ie=>[ie.id,ie.name])),[t]),N=()=>{const ie=!p;dI(ie),h(ie),ie&&(v(!0),b(new Map))},C=ie=>{b(ee=>{const B=new Map(ee),Z=B.has(ie)?B.get(ie):g;return B.set(ie,!Z),B})},E=ie=>y.has(ie)?y.get(ie):g,I=ie=>{c(ee=>{const B=new Set(ee);return B.has(ie)?(B.delete(ie),d(Z=>new Set(Z).add(ie))):(B.add(ie),d(Z=>{const ne=new Set(Z);return ne.delete(ie),ne})),B})};_.useEffect(()=>{const ie=new Set(s.filter(ee=>ee.parentTaskId).map(ee=>ee.parentTaskId));ie.size>0&&c(ee=>{const B=new Set(ee);for(const Z of ie)u.has(Z)||B.add(Z);return B})},[s,u]);const[R,D]=_.useState(""),{directMatchTaskIds:q,treeMatchTaskIds:$,titleHighlights:Y}=_.useMemo(()=>{if(!R.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ie=FS(s,R,cI),ee=new Set(ie.map(re=>re.item.id)),B=new Map;for(const re of ie){const ue=re.matches.find(Ze=>Ze.key==="title");ue&&B.set(re.item.id,ue.indices)}const Z=new Set(ee),ne=new Map(s.map(re=>[re.id,re]));for(const re of[...ee]){let ue=ne.get(re);for(;ue!=null&&ue.parentTaskId;)Z.add(ue.parentTaskId),ue=ne.get(ue.parentTaskId)}return{directMatchTaskIds:ee,treeMatchTaskIds:Z,titleHighlights:B}},[R,s]),G=q!==null,Q=G?p?q:$:null,ae=Q?s.filter(ie=>Q.has(ie.id)):s,me=p?[]:B4(ae);return r.jsxs("div",{className:He.container,children:[r.jsxs("div",{className:He.header,children:[r.jsx("span",{children:"Tasks"}),r.jsxs("div",{className:He.headerActions,children:[r.jsx("button",{className:`${He.groupToggle} ${p?He.groupToggleActive:""}`,onClick:N,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,title:p?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:r.jsx(u2,{size:Gt})}),r.jsx("button",{className:He.addButton,onClick:()=>i(_i()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&r.jsx("input",{type:"text",value:R,onChange:ie=>D(ie.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:He.searchInput,"data-testid":"sidebar-search"}),p?L4(ae,w).map(ie=>r.jsx(fI,{group:ie,isExpanded:E(ie.status),onToggle:()=>C(ie.status),selectedTaskId:S,navigate:i,titleHighlights:Y,workspaceNames:j},ie.status)):me.map(ie=>r.jsx(ix,{node:ie,depth:0,expandedTasks:o,toggleTask:I,selectedTaskId:S,navigate:i,taskStatusById:w,titleHighlights:Y,workspaceNames:j},ie.id)),ae.length===0&&!G&&r.jsx("div",{className:He.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&G&&r.jsx("div",{className:He.emptyState,children:"No matching tasks"})]})}const mI="_toast_ed2dk_1",hI="_success_ed2dk_18",gI="_icon_ed2dk_22",vI="_error_ed2dk_25",yI="_warning_ed2dk_32",bI="_info_ed2dk_38",_I="_message_ed2dk_53",xI="_close_ed2dk_60",Tr={toast:mI,success:hI,icon:gI,error:vI,warning:yI,info:bI,message:_I,close:xI},kI={success:r.jsx(To,{size:Mt}),error:r.jsx(yi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function SI({toast:t,onDismiss:s}){return _.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),r.jsxs(It.div,{className:`${Tr.toast} ${Tr[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:[r.jsx("span",{className:Tr.icon,"aria-hidden":"true",children:kI[t.variant]}),r.jsx("span",{className:Tr.message,children:t.message}),r.jsx("button",{type:"button",className:Tr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:r.jsx(yi,{size:Gt,"aria-hidden":"true"})})]})}const TI="_container_qqse2_1",wI={container:TI};function NI({toasts:t,onDismiss:s}){return r.jsx("div",{className:wI.container,"data-testid":"toast-container",children:r.jsx(_s,{children:t.map(i=>r.jsx(SI,{toast:i,onDismiss:s},i.id))})})}const jI="_callout_e5awm_1",CI="_success_e5awm_11",EI="_icon_e5awm_15",AI="_error_e5awm_18",DI="_warning_e5awm_25",RI="_info_e5awm_32",MI="_content_e5awm_48",II="_close_e5awm_53",wr={callout:jI,success:CI,icon:EI,error:AI,warning:DI,info:RI,content:MI,close:II},OI={success:r.jsx(To,{size:Mt}),error:r.jsx(yi,{size:Mt}),warning:r.jsx(Vp,{size:Mt}),info:r.jsx(Pp,{size:Mt})};function BI({variant:t="info",children:s,dismissible:i=!1,className:o}){const[c,u]=_.useState(!1);return r.jsx(r.Fragment,{children:!c&&r.jsxs("div",{className:[wr.callout,wr[t],o].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[r.jsx("span",{className:wr.icon,"aria-hidden":"true",children:OI[t]}),r.jsx("span",{className:wr.content,children:s}),i&&r.jsx("button",{type:"button",className:wr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:r.jsx(yi,{size:Gt,"aria-hidden":"true"})})]})})}function LI({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return r.jsx(r.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return r.jsx("div",{"data-testid":"update-banner",children:r.jsxs(BI,{variant:"info",dismissible:!0,children:[r.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",r.jsx("code",{children:c})]})})}const zI="_container_de44x_1",UI="_emptyState_de44x_8",$I="_card_de44x_14",PI="_cardClickable_de44x_34",VI="_cardHeader_de44x_42",HI="_categoryBadge_de44x_54",qI="_findingTitle_de44x_62",GI="_findingDate_de44x_68",FI="_findingContent_de44x_80",ZI="_tags_de44x_86",KI="_tag_de44x_86",ns={container:zI,emptyState:UI,card:$I,cardClickable:PI,cardHeader:VI,categoryBadge:HI,findingTitle:qI,findingDate:GI,findingContent:FI,tags:ZI,tag:KI};function ox({findings:t,onFindingClick:s}){return t.length===0?r.jsx("div",{className:ns.emptyState,children:"No findings yet. Agents will post discoveries here."}):r.jsx("div",{className:ns.container,children:t.map((i,o)=>{const c=Yc(i.category),u=s?It.button:It.div;return r.jsxs(u,{type:s?"button":void 0,className:`${ns.card} ${s?ns.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:o*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[r.jsxs("div",{className:ns.cardHeader,children:[r.jsx("span",{className:ns.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),r.jsx("span",{className:ns.findingTitle,children:i.title}),r.jsx("span",{className:ns.findingDate,title:i.createdAt,children:Bm(i.createdAt)})]}),r.jsx("div",{className:ns.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&r.jsx("div",{className:ns.tags,children:i.tags.map(d=>r.jsx("span",{className:ns.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:d},d))})]},i.id)})})}const YI="_section_1ingb_14",JI="_sectionTitle_1ingb_26",WI="_sectionDescription_1ingb_35",XI="_tokenList_1ingb_48",QI="_tokenRow_1ingb_55",eO="_tokenBadge_1ingb_68",tO="_tokenName_1ingb_83",nO="_tokenTarget_1ingb_90",sO="_deleteButton_1ingb_99",aO="_addForm_1ingb_113",iO="_formRow_1ingb_119",oO="_input_1ingb_125",rO="_select_1ingb_155",lO="_addButton_1ingb_187",cO="_emptyStateInfo_1ingb_221",uO="_themeOptions_1ingb_229",dO="_themeOption_1ingb_229",fO="_themeOptionSelected_1ingb_254",pO="_themeOptionHeader_1ingb_259",mO="_themeOptionLabel_1ingb_266",hO="_themeOptionDesc_1ingb_273",gO="_variantToggle_1ingb_279",vO="_variantButton_1ingb_286",yO="_variantActive_1ingb_305",bO="_themeSwatches_1ingb_311",_O="_themeSwatch_1ingb_311",xO="_systemToggle_1ingb_325",kO="_systemToggleHint_1ingb_341",SO="_themeActive_1ingb_348",TO="_aboutGrid_1ingb_354",wO="_aboutItem_1ingb_360",NO="_aboutLabel_1ingb_373",jO="_aboutValue_1ingb_379",CO="_aboutDot_1ingb_387",EO="_aboutDotConnected_1ingb_394",AO="_aboutDotDisconnected_1ingb_398",pe={section:YI,sectionTitle:JI,sectionDescription:WI,tokenList:XI,tokenRow:QI,tokenBadge:eO,tokenName:tO,tokenTarget:nO,deleteButton:sO,addForm:aO,formRow:iO,input:oO,select:rO,addButton:lO,emptyStateInfo:cO,themeOptions:uO,themeOption:dO,themeOptionSelected:fO,themeOptionHeader:pO,themeOptionLabel:mO,themeOptionDesc:hO,variantToggle:gO,variantButton:vO,variantActive:yO,themeSwatches:bO,themeSwatch:_O,systemToggle:xO,systemToggleHint:kO,themeActive:SO,aboutGrid:TO,aboutItem:wO,aboutLabel:NO,aboutValue:jO,aboutDot:CO,aboutDotConnected:EO,aboutDotDisconnected:AO},DO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function RO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=_.useState(""),[d,p]=_.useState(""),[h,g]=_.useState("env_var"),[v,y]=_.useState(""),[b,k]=_.useState(null),S=N=>{if(N.preventDefault(),!c||!d)return;const C=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,d,h,C,h==="file"?v:""),o==null||o("Token saved successfully","success"),u(""),p(""),y("")},w=N=>{k(N)},j=()=>{b&&(i(b),o==null||o("Token deleted","info")),k(null)};return r.jsxs(r.Fragment,{children:[r.jsx(vi,{isOpen:b!==null,title:"Delete Token?",description:b?`"${b}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>k(null)}),r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Tokens"}),r.jsx("p",{className:pe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?r.jsx("div",{className:pe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):r.jsx("div",{className:pe.tokenList,children:t.map(N=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenBadge,children:N.tokenType}),r.jsx("span",{className:pe.tokenName,children:N.name}),r.jsx("span",{className:pe.tokenTarget,children:N.tokenType==="env_var"?N.envVar:N.filePath}),r.jsx("button",{className:pe.deleteButton,onClick:()=>w(N.name),title:`Delete ${N.name}`,"aria-label":`Delete ${N.name}`,children:r.jsx(yi,{size:Gt,"aria-hidden":"true"})})]},N.name))}),r.jsxs("form",{className:pe.addForm,onSubmit:S,children:[r.jsxs("div",{className:pe.formRow,children:[r.jsx("input",{className:pe.input,type:"text",placeholder:"Token name",value:c,onChange:N=>u(N.target.value)}),r.jsx("input",{className:pe.input,type:"password",placeholder:"Value",value:d,onChange:N=>p(N.target.value)})]}),r.jsxs("div",{className:pe.formRow,children:[r.jsx("select",{className:pe.select,value:h,onChange:N=>g(N.target.value),children:DO.map(N=>r.jsx("option",{value:N.value,children:N.label},N.value))}),r.jsx("input",{className:pe.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:N=>y(N.target.value)}),r.jsx("button",{className:pe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const du=[{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"]}],rx=new Set(du.map(t=>t.id)),Tb="grackle";function Bp(t){return du.find(s=>s.id===t)}function MO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Appearance"}),r.jsx("p",{className:pe.sectionDescription,children:"Choose how Grackle looks across the app."}),r.jsx("div",{className:pe.themeOptions,children:du.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?t===u.id||t===u.variantLightId||t===u.variantDarkId:t===u.id,h=d&&s===u.variantLightId;return r.jsxs("button",{type:"button",className:`${pe.themeOption} ${p?pe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[r.jsxs("span",{className:pe.themeOptionHeader,children:[r.jsxs("span",{children:[r.jsx("span",{className:pe.themeOptionLabel,children:u.label}),r.jsx("span",{className:pe.themeOptionDesc,children:u.description})]}),d&&r.jsxs("span",{className:pe.variantToggle,children:[r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&h?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&h,children:"☼"}),r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&!h?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!h,children:"☾"})]})]}),u.swatches&&r.jsx("span",{className:pe.themeSwatches,children:u.swatches.map((g,v)=>r.jsx("span",{className:pe.themeSwatch,style:{background:g}},v))})]},u.id)})}),r.jsxs("label",{className:pe.systemToggle,children:[r.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),r.jsx("span",{children:"Match system light/dark preference"})]}),r.jsx("p",{className:pe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),r.jsxs("p",{className:pe.themeActive,children:["Active theme: ",r.jsx("strong",{children:s})]})]})}function IO({connected:t,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return r.jsxs("section",{className:pe.section,"data-testid":"about-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"About"}),r.jsx("p",{className:pe.sectionDescription,children:"Connection status and application information."}),r.jsxs("div",{className:pe.aboutGrid,children:[r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Connection"}),r.jsxs("span",{className:pe.aboutValue,children:[r.jsx("span",{className:`${pe.aboutDot} ${t?pe.aboutDotConnected:pe.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Environments"}),r.jsxs("span",{className:pe.aboutValue,children:[o,"/",c," connected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Active Sessions"}),r.jsx("span",{className:pe.aboutValue,children:u})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Version"}),r.jsx("span",{className:pe.aboutValue,children:"0.89.3"})]})]})]})}const OO="_container_cddyd_1",BO="_header_cddyd_8",LO="_headerTitle_cddyd_35",zO="_badge_cddyd_44",UO="_headerActions_cddyd_54",$O="_body_cddyd_61",PO="_formContent_cddyd_73",VO="_section_cddyd_85",HO="_label_cddyd_91",qO="_titleInput_cddyd_98",GO="_descriptionTextarea_cddyd_131",FO="_parentContext_cddyd_167",ZO="_parentLabel_cddyd_175",KO="_parentName_cddyd_182",YO="_personaSelect_cddyd_186",JO="_depList_cddyd_220",WO="_depItem_cddyd_226",XO="_depItemSelected_cddyd_248",QO="_noDeps_cddyd_252",e5="_btnPrimary_cddyd_258",t5="_btnGhost_cddyd_289",Je={container:OO,header:BO,headerTitle:LO,badge:zO,headerActions:UO,body:$O,formContent:PO,section:VO,label:HO,titleInput:qO,descriptionTextarea:GO,parentContext:FO,parentLabel:ZO,parentName:KO,personaSelect:YO,depList:JO,depItem:WO,depItemSelected:XO,noDeps:QO,btnPrimary:e5,btnGhost:t5};function lx({mode:t,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:p,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:y}){const b=yt(),k=t==="edit",S=k&&s?u.find(de=>de.id===s):void 0,w=k?(S==null?void 0:S.workspaceId)??"":i??"",[j,N]=_.useState(w),C=w||j,E=d.find(de=>de.id===C),I=c??(E==null?void 0:E.environmentId),R=!k&&!i,D=k?(S==null?void 0:S.parentTaskId)??"":o??"",q=D?u.find(de=>de.id===D):void 0,[$,Y]=_.useState((S==null?void 0:S.title)??""),[G,Q]=_.useState((S==null?void 0:S.description)??""),[ae,me]=_.useState((S==null?void 0:S.dependsOn)??[]),[ie,ee]=_.useState((S==null?void 0:S.defaultPersonaId)??""),[B,Z]=_.useState((S==null?void 0:S.canDecompose)??!1),[ne,re]=_.useState(!1),ue=_.useRef(!1);_.useEffect(()=>{k&&S&&!ue.current&&(ue.current=!0,Y(S.title),Q(S.description),me(S.dependsOn),ee(S.defaultPersonaId),Z(S.canDecompose))},[k,S]);const Ze=u.filter(de=>de.workspaceId===C&&(!k||de.id!==s)&&de.id!==D),je=$.trim().length>0&&(!k||S!==void 0)&&C.length>0,Te=de=>{me(Oe=>Oe.includes(de)?Oe.filter(bt=>bt!==de):[...Oe,de])},Ie=()=>{!je||ne||k&&S===void 0||(k&&s?(g(s,$.trim(),G,ae,ie),y==null||y("Task updated","success"),v?v():b(os(s,void 0,C,I),{replace:!0})):(re(!0),h(C,$.trim(),G,ae.length>0?ae:void 0,D||void 0,ie,B,()=>{y==null||y("Task created","success"),b(i?mi(i,I):"/tasks",{replace:!0})},de=>{y==null||y(de,"error"),re(!1)})))},le=()=>{if(v){v();return}b(k&&s?os(s,void 0,C,I):i?mi(i,I):"/tasks")},ve=k?"edit task":D?"child task":"new task";return r.jsxs("div",{className:Je.container,children:[r.jsxs("div",{className:Je.header,children:[r.jsxs("div",{className:Je.headerTitle,children:[r.jsx("span",{className:Je.badge,children:ve}),q&&r.jsxs("span",{className:Je.parentContext,children:[r.jsx("span",{className:Je.parentLabel,children:"Child of"}),r.jsx("span",{className:Je.parentName,children:q.title})]})]}),r.jsxs("div",{className:Je.headerActions,children:[r.jsx("button",{onClick:Ie,disabled:!je||ne,className:Je.btnPrimary,"data-testid":"task-edit-save",children:ne?"Creating…":k?"Save Changes":"Create"}),r.jsx("button",{onClick:le,className:Je.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:Je.body,children:r.jsxs("div",{className:Je.formContent,children:[R&&r.jsxs("div",{className:Je.section,children:[r.jsx("label",{className:Je.label,htmlFor:"task-edit-workspace",children:"Workspace"}),r.jsxs("select",{id:"task-edit-workspace",value:j,onChange:de=>N(de.target.value),className:Je.personaSelect,"data-testid":"task-edit-workspace",children:[r.jsx("option",{value:"",children:"Select a workspace..."}),d.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsxs("div",{className:Je.section,children:[r.jsx("label",{className:Je.label,htmlFor:"task-edit-title",children:"Title"}),r.jsx("input",{id:"task-edit-title",type:"text",value:$,onChange:de=>Y(de.target.value),placeholder:"Task title...",autoFocus:!0,className:Je.titleInput,"data-testid":"task-edit-title",onKeyDown:de=>{de.key==="Enter"&&je&&Ie()}})]}),r.jsxs("div",{className:Je.section,children:[r.jsx("label",{className:Je.label,htmlFor:"task-edit-description",children:"Description"}),r.jsx("textarea",{id:"task-edit-description",value:G,onChange:de=>Q(de.target.value),placeholder:"Describe the task... (markdown supported)",className:Je.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),r.jsxs("div",{className:Je.section,children:[r.jsx("label",{className:Je.label,htmlFor:"task-edit-persona",children:"Default Persona"}),r.jsxs("select",{id:"task-edit-persona",value:ie,onChange:de=>ee(de.target.value),className:Je.personaSelect,"data-testid":"task-edit-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),p.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),!k&&r.jsx("div",{className:Je.section,children:r.jsxs("label",{className:Je.depItem,"data-testid":"task-edit-can-decompose",children:[r.jsx("input",{type:"checkbox",checked:B,onChange:de=>Z(de.target.checked)}),"Can spawn subtasks"]})}),r.jsxs("div",{className:Je.section,children:[r.jsx("div",{className:Je.label,children:"Dependencies"}),Ze.length===0?r.jsx("div",{className:Je.noDeps,children:"No other tasks in this workspace"}):r.jsx("div",{className:Je.depList,children:Ze.map(de=>{const Oe=ae.includes(de.id);return r.jsxs("label",{className:`${Je.depItem} ${Oe?Je.depItemSelected:""}`,"data-testid":`dep-option-${de.id}`,children:[r.jsx("input",{type:"checkbox",checked:Oe,onChange:()=>Te(de.id)}),de.title,r.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",de.status,")"]})]},de.id)})})]})]})})]})}const n5="_container_legrg_1",s5="_header_legrg_8",a5="_headerTitle_legrg_35",i5="_badge_legrg_44",o5="_headerActions_legrg_54",r5="_body_legrg_61",l5="_formContent_legrg_73",c5="_section_legrg_85",u5="_label_legrg_91",d5="_nameInput_legrg_98",f5="_fieldInput_legrg_131",p5="_adapterSelect_legrg_164",m5="_readOnlyValue_legrg_198",h5="_codespaceSection_legrg_204",g5="_codespaceActions_legrg_210",v5="_creatingHint_legrg_216",y5="_errorHint_legrg_222",b5="_btnPrimary_legrg_235",_5="_btnGhost_legrg_266",se={container:n5,header:s5,headerTitle:a5,badge:i5,headerActions:o5,body:r5,formContent:l5,section:c5,label:u5,nameInput:d5,fieldInput:f5,adapterSelect:p5,readOnlyValue:m5,codespaceSection:h5,codespaceActions:g5,creatingHint:v5,errorHint:y5,btnPrimary:b5,btnGhost:_5},Bc=1,Lc=65535;function np(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Bc&&s<=Lc}function sp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function x5({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=_.useState("pick"),[y,b]=_.useState(""),[k,S]=_.useState("");return g==="create"?r.jsxs("div",{className:se.codespaceSection,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repository"}),r.jsx("input",{type:"text",value:y,onChange:w=>b(w.target.value),placeholder:"owner/repo",className:se.fieldInput,"data-testid":"env-codespace-repo"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Machine Type"}),r.jsx("input",{type:"text",value:k,onChange:w=>S(w.target.value),placeholder:"Machine type (optional)...",className:se.fieldInput,"data-testid":"env-codespace-machine"})]}),r.jsxs("div",{className:se.codespaceActions,children:[r.jsx("button",{onClick:()=>{y.trim()&&(h(y.trim(),k.trim()||void 0),v("pick"),b(""),S(""))},disabled:!y.trim(),className:se.btnPrimary,children:"Create"}),r.jsx("button",{onClick:()=>{v("pick"),b(""),S("")},className:se.btnGhost,children:"Cancel"})]})]}):r.jsx("div",{className:se.codespaceSection,children:r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace"}),!d&&r.jsxs("select",{value:t,onChange:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!i.trim()&&o(w.target.value))},disabled:p,className:se.adapterSelect,"data-testid":"env-codespace-select",children:[r.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>r.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.name)),r.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&r.jsx("span",{className:se.creatingHint,children:"Creating codespace..."}),d&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:se.errorHint,children:d}),r.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"Or enter codespace name manually...",className:se.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&r.jsx("span",{className:se.errorHint,children:u})]})})}function cx({mode:t,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:y}){const b=yt(),k=t==="edit",S=k&&s?i.find(le=>le.id===s):void 0,[w,j]=_.useState(""),[N,C]=_.useState("local"),[E,I]=_.useState(""),[R,D]=_.useState(""),[q,$]=_.useState(""),[Y,G]=_.useState(""),[Q,ae]=_.useState(""),[me,ie]=_.useState(""),[ee,B]=_.useState(""),[Z,ne]=_.useState(null),re=_.useCallback(()=>{const le={};if(N==="local"){if(E.trim()&&(le.host=E.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.port=ve)}}else if(N==="ssh"){if(le.host=E.trim(),q.trim()&&(le.user=q.trim()),R.trim()){const ve=Number(R);Number.isInteger(ve)&&(le.sshPort=ve)}Y.trim()&&(le.identityFile=Y.trim())}else N==="docker"?(Q.trim()&&(le.image=Q.trim()),me.trim()&&(le.repo=me.trim())):N==="codespace"&&(le.codespaceName=ee.trim());return le},[N,E,R,q,Y,Q,me,ee]),ue=()=>!(!w.trim()||N==="ssh"&&!E.trim()||N==="codespace"&&!ee.trim()||(N==="local"||N==="ssh")&&!np(R)),Ze=()=>{ue()&&(o(w.trim(),N,re()),y==null||y("Environment added successfully","success"),b(bo,{replace:!0}))},je=()=>{b(s?hi(s):bo)},Te=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig),Oe=ve.trim();Oe?de[le]=Oe:delete de[le],c(s,{adapterConfig:de})},[S,s,c]),Ie=_.useCallback((le,ve)=>{if(!S||!s)return;const de=sp(S.adapterConfig);if(ve.trim()){const Oe=Number(ve);Number.isInteger(Oe)&&Oe>=Bc&&Oe<=Lc&&(de[le]=Oe)}else delete de[le];c(s,{adapterConfig:de})},[S,s,c]);if(k){if(!S)return r.jsxs("div",{className:se.container,children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsx("div",{className:se.formContent,children:r.jsx("span",{className:se.readOnlyValue,children:"Environment not found"})})})]});const le=sp(S.adapterConfig);return r.jsxs("div",{className:se.container,"data-testid":"env-edit-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Name"}),r.jsx(Xt,{value:S.displayName,onSave:ve=>{s&&c(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:Z,onActivate:ne,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Adapter Type"}),r.jsx("span",{className:se.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Port"}),r.jsx(Xt,{value:String(le.port??""),onSave:ve=>Ie("port",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ne,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"User"}),r.jsx(Xt,{value:String(le.user??""),onSave:ve=>Te("user",ve),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"SSH Port"}),r.jsx(Xt,{value:String(le.sshPort??""),onSave:ve=>Ie("sshPort",ve),validate:ve=>np(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:ne,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Identity File"}),r.jsx(Xt,{value:String(le.identityFile??""),onSave:ve=>Te("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:ne,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Image"}),r.jsx(Xt,{value:String(le.image??""),onSave:ve=>Te("image",ve),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repo"}),r.jsx(Xt,{value:String(le.repo??""),onSave:ve=>Te("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:ne,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace Name"}),r.jsx(Xt,{value:String(le.codespaceName??""),onSave:ve=>Te("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:ne,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return r.jsxs("div",{className:se.container,"data-testid":"env-create-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"new environment"})}),r.jsxs("div",{className:se.headerActions,children:[r.jsx("button",{onClick:Ze,disabled:!ue(),className:se.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),r.jsx("button",{onClick:je,className:se.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-name",children:"Name"}),r.jsx("input",{id:"env-create-name",type:"text",value:w,onChange:le=>j(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:se.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&ue()&&Ze()}})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),r.jsxs("select",{id:"env-create-adapter",value:N,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:se.adapterSelect,"data-testid":"env-create-adapter",children:[r.jsx("option",{value:"local",children:"local"}),r.jsx("option",{value:"ssh",children:"ssh"}),r.jsx("option",{value:"docker",children:"docker"}),r.jsx("option",{value:"codespace",children:"codespace"})]})]}),N==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:le=>I(le.target.value),placeholder:"Host (optional)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>D(le.target.value),placeholder:"Port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]})]}),N==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:le=>I(le.target.value),placeholder:"Host (required)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-user",children:"User"}),r.jsx("input",{id:"env-create-user",type:"text",value:q,onChange:le=>$(le.target.value),placeholder:"User (optional)...",className:se.fieldInput,"data-testid":"env-create-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"SSH Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Bc,max:Lc,value:R,onChange:le=>D(le.target.value),placeholder:"SSH port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-identity",children:"Identity File"}),r.jsx("input",{id:"env-create-identity",type:"text",value:Y,onChange:le=>G(le.target.value),placeholder:"Identity file (optional)...",className:se.fieldInput,"data-testid":"env-create-identity"})]})]}),N==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-image",children:"Image"}),r.jsx("input",{id:"env-create-image",type:"text",value:Q,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:se.fieldInput,"data-testid":"env-create-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-repo",children:"Repo"}),r.jsx("input",{id:"env-create-repo",type:"text",value:me,onChange:le=>ie(le.target.value),placeholder:"Repo (optional)...",className:se.fieldInput,"data-testid":"env-create-repo"})]})]}),N==="codespace"&&r.jsx(x5,{codespaceName:ee,onCodespaceNameChange:B,envName:w,onEnvNameChange:j,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const k5="_group_1iprv_1",S5="_groupTitle_1iprv_8",T5="_shortcutList_1iprv_17",w5="_shortcutRow_1iprv_23",N5="_keys_1iprv_36",j5="_kbd_1iprv_43",C5="_description_1iprv_60",li={group:k5,groupTitle:S5,shortcutList:T5,shortcutRow:w5,keys:N5,kbd:j5,description:C5},E5=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"},{keys:["3"],description:"Switch to Findings tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function A5(){return r.jsxs("section",{className:pe.section,"data-testid":"keyboard-shortcuts-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"Keyboard Shortcuts"}),r.jsx("p",{className:pe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),E5.map(t=>r.jsxs("div",{className:li.group,children:[r.jsx("h4",{className:li.groupTitle,children:t.title}),r.jsx("div",{className:li.shortcutList,children:t.shortcuts.map(s=>r.jsxs("div",{className:li.shortcutRow,children:[r.jsx("span",{className:li.keys,children:s.keys.map(i=>r.jsx("kbd",{className:li.kbd,children:i},i))}),r.jsx("span",{className:li.description,children:s.description})]},s.description))})]},t.title))]})}const D5="_workpadSection_y8nj9_1",R5="_workpadLabel_y8nj9_9",M5="_workpadStatus_y8nj9_17",I5="_workpadSummary_y8nj9_23",O5="_workpadExtra_y8nj9_29",Na={workpadSection:D5,workpadLabel:R5,workpadStatus:M5,workpadSummary:I5,workpadExtra:O5};function B5({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return r.jsxs("div",{className:Na.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Na.workpadLabel,children:"Workpad"}),r.jsx("div",{className:Na.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return r.jsxs("div",{className:Na.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:Na.workpadLabel,children:"Workpad"}),s.status&&r.jsx("div",{className:Na.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&r.jsx("div",{className:Na.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&r.jsx("div",{className:Na.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const L5=[{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 z5({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...t};o==="claude"?u.claude=c:u[o]=c,s(u)};return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Credential Providers"}),r.jsx("p",{className:pe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),r.jsx("div",{className:pe.tokenList,children:L5.map(o=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenName,children:o.label}),r.jsx("span",{className:pe.tokenTarget,children:o.description}),r.jsx("select",{className:pe.select,value:t[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>r.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const U5="_container_10efq_1",$5="_header_10efq_7",P5="_list_10efq_105",V5="_card_10efq_111",H5="_cardHeader_10efq_125",q5="_cardTitle_10efq_135",G5="_defaultBadge_10efq_141",F5="_cardActions_10efq_155",Z5="_description_10efq_160",K5="_meta_10efq_166",Y5="_empty_10efq_212",J5="_typeBadge_10efq_362",qn={container:U5,header:$5,list:P5,card:V5,cardHeader:H5,cardTitle:q5,defaultBadge:G5,cardActions:F5,description:Z5,meta:K5,empty:Y5,typeBadge:J5};function W5({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,p]=_.useState(null),h=d?t.find(v=>v.id===d):void 0,g=async v=>{await i(v),p(null)};return r.jsxs("div",{className:qn.container,children:[r.jsxs("div",{className:qn.header,children:[r.jsx("h2",{children:"Personas"}),r.jsx(Gs,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?r.jsx("p",{className:qn.empty,children:"No personas yet. Create one to get started."}):r.jsx("div",{className:qn.list,children:t.map(v=>{const y=s===v.id,b=v.type==="script";return r.jsxs("div",{className:qn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u(v.id))},children:[r.jsxs("div",{className:qn.cardHeader,children:[r.jsxs("span",{className:qn.cardTitle,children:[r.jsx("strong",{children:v.name}),r.jsx("span",{className:qn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:b?"Script":"Agent"}),y&&r.jsx("span",{className:qn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),r.jsxs("div",{className:qn.cardActions,onClick:k=>k.stopPropagation(),children:[!y&&r.jsx(Gs,{variant:"ghost",size:"sm",onClick:()=>{o(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),r.jsx(Gs,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),r.jsx(Gs,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&r.jsx("p",{className:qn.description,children:v.description}),r.jsxs("div",{className:qn.meta,children:[v.runtime&&r.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&r.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&r.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),r.jsx(vi,{isOpen:d!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{d&&g(d).catch(()=>{})},onCancel:()=>p(null)})]})}const X5="_container_uy08i_1",Q5="_header_uy08i_7",eB="_count_uy08i_13",tB="_presets_uy08i_18",nB="_presetButton_uy08i_24",sB="_filterInput_uy08i_41",aB="_groups_uy08i_53",iB="_group_uy08i_53",oB="_groupHeader_uy08i_68",rB="_groupName_uy08i_77",lB="_groupCount_uy08i_81",cB="_toolList_uy08i_87",uB="_toolItem_uy08i_95",dB="_toolName_uy08i_103",on={container:X5,header:Q5,count:eB,presets:tB,presetButton:nB,filterInput:sB,groups:aB,group:iB,groupHeader:oB,groupName:rB,groupCount:lB,toolList:cB,toolItem:uB,toolName:dB},fB=(()=>{const t=new Map;for(const s of qb){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),pB=[{name:"default",label:"Default",tools:Gb},{name:"worker",label:"Worker",tools:KS},{name:"orchestrator",label:"Orchestrator",tools:YS},{name:"admin",label:"Admin",tools:JS}];function wb({selectedTools:t,onChange:s,disabled:i}){const[o,c]=_.useState(""),u=_.useMemo(()=>new Set(t),[t]),d=_.useCallback(v=>{if(i)return;const y=new Set(u);y.has(v)?y.delete(v):y.add(v),s([...y].sort())},[u,s,i]),p=_.useCallback((v,y)=>{if(i)return;const b=new Set(u);for(const k of v)y?b.delete(k):b.add(k);s([...b].sort())},[u,s,i]),h=_.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return r.jsxs("div",{className:on.container,"data-testid":"mcp-tool-selector",children:[r.jsx("div",{className:on.header,children:r.jsx("span",{className:on.count,children:t.length===0?`Using default (${Gb.length} tools)`:`${t.length} of ${qb.size} tools selected`})}),r.jsxs("div",{className:on.presets,"data-testid":"mcp-tool-presets",children:[pB.map(v=>r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),r.jsx("input",{type:"text",className:on.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),r.jsx("div",{className:on.groups,children:fB.map(({group:v,tools:y})=>{const b=g?y.filter(S=>S.toLowerCase().includes(g)):y;if(b.length===0)return null;const k=b.every(S=>u.has(S));return r.jsxs("div",{className:on.group,"data-testid":`tool-group-${v}`,children:[r.jsxs("label",{className:on.groupHeader,children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(b,k),disabled:i,"data-testid":`group-toggle-${v}`}),r.jsx("span",{className:on.groupName,children:v}),r.jsxs("span",{className:on.groupCount,children:["(",b.filter(S=>u.has(S)).length,"/",b.length,")"]})]}),r.jsx("div",{className:on.toolList,children:b.map(S=>r.jsxs("label",{className:on.toolItem,children:[r.jsx("input",{type:"checkbox",checked:u.has(S),onChange:()=>d(S),disabled:i,"data-testid":`tool-${S}`}),r.jsx("span",{className:on.toolName,children:S})]},S))})]},v)})})]})}const mB="_nav_1bhou_1",hB="_tab_1bhou_24",gB="_tabIcon_1bhou_62",vB="_tabActive_1bhou_68",Sc={nav:mB,tab:hB,tabIcon:gB,tabActive:vB},qs=[{path:"credentials",label:"Credentials",icon:r.jsx(a2,{size:Mt})},{path:"personas",label:"Personas",icon:r.jsx(A2,{size:Mt})},{path:"appearance",label:"Appearance",icon:r.jsx(_2,{size:Mt})},{path:"shortcuts",label:"Shortcuts",icon:r.jsx(o2,{size:Mt})},{path:"about",label:"About",icon:r.jsx(Pp,{size:Mt})}];function yB(){var d;const t=Pt(),s=yt(),i=_.useRef(null),o=((d=qs.find(p=>{const h=`${yo}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??qs[0].path,c=_.useCallback(p=>{s(`${yo}/${p}`)},[s]),u=_.useCallback(p=>{var k,S;const h=(k=i.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(w=>w===document.activeElement),v=g>=0?g:qs.findIndex(w=>w.path===o);let y=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),y=(v+1)%qs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),y=(v-1+qs.length)%qs.length;else if(p.key==="Home")p.preventDefault(),y=0;else if(p.key==="End")p.preventDefault(),y=qs.length-1;else return;const b=qs[y].path;s(`${yo}/${b}`),(S=h[y])==null||S.focus()},[o,s]);return r.jsx("nav",{className:Sc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:qs.map(p=>{const h=p.path===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${Sc.tab} ${h?Sc.tabActive:""}`,onClick:()=>c(p.path),children:[r.jsx("span",{className:Sc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function bB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of t)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(qv.map(u=>[u,[]]));for(const u of t){const d=Gr(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(S=>s.get(S)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(S=>S.status==="complete").length;let y;if(d==="paused"&&i){const S=i.get(u.id);S==="idle"?y="Needs input":S==="completed"&&(y="Ready to complete")}const b={task:u,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:y},k=c.get(d);k?k.push(b):c.get("not_started").push(b)}for(const u of c.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return qv.map(u=>{const d=Ma(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const _B="_boardContainer_1c4y1_1",xB="_column_1c4y1_17",kB="_columnHeader_1c4y1_34",SB="_columnIcon_1c4y1_47",TB="_columnLabel_1c4y1_52",wB="_columnCount_1c4y1_57",NB="_cardList_1c4y1_67",jB="_emptyPlaceholder_1c4y1_76",CB="_card_1c4y1_67",EB="_cardHeader_1c4y1_107",AB="_cardStatusIcon_1c4y1_113",DB="_cardTitle_1c4y1_119",RB="_cardBadges_1c4y1_127",MB="_badge_1c4y1_134",IB="_blockedBadge_1c4y1_146",OB="_childBadge_1c4y1_151",BB="_depBadge_1c4y1_155",LB="_parentBadge_1c4y1_159",zB="_pausedSubBadge_1c4y1_166",UB="_personaBadge_1c4y1_170",$B="_envBadge_1c4y1_174",PB="_emptyCta_1c4y1_178",VB="_ctaButton_1c4y1_188",HB="_ctaDescription_1c4y1_204",nt={boardContainer:_B,column:xB,columnHeader:kB,columnIcon:SB,columnLabel:TB,columnCount:wB,cardList:NB,emptyPlaceholder:jB,card:CB,cardHeader:EB,cardStatusIcon:AB,cardTitle:DB,cardBadges:RB,badge:MB,blockedBadge:IB,childBadge:OB,depBadge:BB,parentBadge:LB,pausedSubBadge:zB,personaBadge:UB,envBadge:$B,emptyCta:PB,ctaButton:VB,ctaDescription:HB};function qB({workspaceId:t,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=yt(),p=_.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),h=_.useMemo(()=>new Map(i.map(b=>[b.id,b.status])),[i]),g=_.useMemo(()=>new Map(p.map(b=>[b.id,b])),[p]),v=_.useMemo(()=>{const b=new Map(o.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(u.map(C=>[C.id,C])),w=new Map,j=new Map,N=new Map;for(const C of p)if(C.latestSessionId){const E=b.get(C.latestSessionId);if(E){if(w.set(C.id,E.endReason||E.status),E.personaId){const I=k.get(E.personaId);I&&j.set(C.id,I.name)}if(E.environmentId){const I=S.get(E.environmentId);I&&N.set(C.id,I.displayName)}}}return{sessionStatusByTaskId:w,personaNameByTaskId:j,environmentNameByTaskId:N}},[p,o,c,u]),y=_.useMemo(()=>bB({tasks:p,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,h,v]);return p.length===0?r.jsxs("div",{className:nt.emptyCta,"data-testid":"board-empty-cta",children:[r.jsx("button",{className:nt.ctaButton,onClick:()=>d(_i(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:nt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):r.jsx("div",{className:nt.boardContainer,"data-testid":"board-container",children:y.map(b=>r.jsxs("section",{className:nt.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[r.jsxs("div",{className:nt.columnHeader,children:[r.jsx("span",{className:nt.columnIcon,style:{color:b.style.color},children:b.style.icon}),r.jsx("span",{className:nt.columnLabel,children:b.label}),r.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),r.jsx("div",{className:nt.cardList,children:b.tasks.length===0?r.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):r.jsx(_s,{mode:"popLayout",children:b.tasks.map(k=>r.jsx(It.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:r.jsx(GB,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>d(os(k.task.id,void 0,t,s))})},k.task.id))})})]},b.status))})}function GB({boardTask:t,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:p,doneChildCount:h,pausedSubBadge:g}=t,v=Ma(u.status),y=u.parentTaskId?s.get(u.parentTaskId):void 0;return r.jsxs("div",{className:nt.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c())},children:[r.jsxs("div",{className:nt.cardHeader,children:[r.jsx("span",{className:nt.cardStatusIcon,style:{color:v.color},children:v.icon}),r.jsx("span",{className:nt.cardTitle,children:u.title})]}),r.jsxs("div",{className:nt.cardBadges,children:[y&&r.jsx("span",{className:`${nt.badge} ${nt.parentBadge}`,title:y.title,children:y.title}),p>0&&r.jsxs("span",{className:`${nt.badge} ${nt.childBadge}`,children:[h,"/",p]}),d&&r.jsx("span",{className:`${nt.badge} ${nt.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&r.jsx("span",{className:`${nt.badge} ${nt.depBadge}`,children:"dep"}),g&&r.jsx("span",{className:`${nt.badge} ${nt.pausedSubBadge}`,children:g}),i&&r.jsx("span",{className:`${nt.badge} ${nt.personaBadge}`,children:i}),o&&r.jsx("span",{className:`${nt.badge} ${nt.envBadge}`,children:o})]})]})}const FB="_formContent_ymnez_1",ZB="_section_ymnez_13",KB="_label_ymnez_19",YB="_titleInput_ymnez_26",JB="_descriptionTextarea_ymnez_58",WB="_selectField_ymnez_94",XB="_checkboxRow_ymnez_128",QB="_checkboxLabel_ymnez_141",e8="_fieldError_ymnez_146",ht={formContent:FB,section:ZB,label:KB,titleInput:YB,descriptionTextarea:JB,selectField:WB,checkboxRow:XB,checkboxLabel:QB,fieldError:e8};function t8(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.environmentId)??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const n8=100;function s8({values:t,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const p=(h,g)=>{s({...t,[h]:g})};return r.jsxs("div",{className:ht.formContent,children:[r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-name",children:"Name"}),r.jsx("input",{id:"ws-name",className:ht.titleInput,type:"text",value:t.name,onChange:h=>p("name",h.target.value),placeholder:"Workspace name",maxLength:n8,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-description",children:"Description"}),r.jsx("textarea",{id:"ws-description",className:ht.descriptionTextarea,value:t.description,onChange:h=>p("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-repo",children:"Repository URL"}),r.jsx("input",{id:"ws-repo",className:ht.titleInput,type:"text",value:t.repoUrl,onChange:h=>p("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-environment",children:"Environment"}),r.jsxs("select",{id:"ws-environment",className:ht.selectField,value:t.environmentId,onChange:h=>p("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[r.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>r.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&r.jsx("span",{className:ht.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-persona",children:"Default Persona"}),r.jsxs("select",{id:"ws-persona",className:ht.selectField,value:t.defaultPersonaId,onChange:h=>p("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>r.jsx("option",{value:h.id,children:h.name},h.id))]})]}),r.jsx("div",{className:ht.section,children:r.jsxs("label",{className:ht.checkboxRow,children:[r.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:h=>p("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),r.jsx("span",{className:ht.checkboxLabel,children:"Enable worktree isolation"})]})}),r.jsxs("div",{className:ht.section,children:[r.jsx("label",{className:ht.label,htmlFor:"ws-workdir",children:"Working Directory"}),r.jsx("input",{id:"ws-workdir",className:ht.titleInput,type:"text",value:t.workingDirectory,onChange:h=>p("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const ux=_.createContext(void 0),a8=4e3;function i8({children:t}){const[s,i]=_.useState([]),o=_.useRef(0),c=_.useCallback(d=>{i(p=>p.filter(h=>h.id!==d))},[]),u=_.useCallback((d,p="info",h=a8)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:p,duration:h}])},[]);return r.jsx(ux.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:t})}function vn(){const t=_.useContext(ux);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Lp="grackle-theme",dx="grackle-prefer-system",fx="(prefers-color-scheme: dark)";let Er=[],zc;function ap(){zc=void 0;for(const t of Er)t()}function zp(){return typeof window>"u"?!1:window.matchMedia(fx).matches}function Or(){if(typeof localStorage>"u")return Tb;try{const t=localStorage.getItem(Lp);if(t!==null&&rx.has(t))return t}catch{}return Tb}function Jc(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(dx)==="true"}catch{return!1}}function Up(t){return du.find(s=>s.variantLightId===t||s.variantDarkId===t)}function px(t,s){const i=Bp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?zp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Up(t);if(o!=null&&o.variantLightId&&o.variantDarkId)return zp()?o.variantDarkId:o.variantLightId}return t}function uo(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=px(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&uo(Or(),Jc());function o8(){return zc===void 0&&(zc={themeId:Or(),systemDark:zp(),preferSystem:Jc()}),zc}function r8(t){return Er=[...Er,t],()=>{Er=Er.filter(s=>s!==t)}}function l8(){const t=_.useSyncExternalStore(r8,o8),{themeId:s,preferSystem:i}=t,o=px(s,i),c=_.useCallback(d=>{if(rx.has(d)){try{localStorage.setItem(Lp,d)}catch{}uo(d,Jc(),!0),ap()}},[]),u=_.useCallback(d=>{try{localStorage.setItem(dx,d?"true":"false")}catch{}if(d){const p=Or(),h=Bp(p);if(h!=null&&h.hidden){const g=Up(p);if(g)try{localStorage.setItem(Lp,g.id)}catch{}}}uo(Or(),d,!0),ap()},[]);return _.useEffect(()=>{uo(s,i)},[s,i]),_.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(fx),p=()=>{const h=Or(),g=Jc();if(g){const v=Bp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&uo(h,g),v!=null&&v.hidden){const y=Up(h);y!=null&&y.variantDarkId&&y.variantLightId&&uo(h,g)}}ap()};return d.addEventListener("change",p),()=>{d.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const mx=_.createContext(void 0);function c8({children:t}){const s=l8();return r.jsx(mx.Provider,{value:s,children:t})}function hx(){const t=_.useContext(mx);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const gx=_.createContext(void 0),vx=_.createContext(void 0);function u8({children:t}){const[s,i]=_.useState(void 0),o=_.useCallback(c=>{i(c)},[]);return r.jsx(vx.Provider,{value:o,children:r.jsx(gx.Provider,{value:s,children:t})})}function d8(){return _.useContext(gx)}function f8(){const t=_.useContext(vx);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Lm=_.createContext(void 0);function lt(){const t=_.useContext(Lm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function yx(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function bx(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function p8(t){return yx(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 m8=new Set(["off","subscription","api_key"]),Tc=new Set(["off","on"]);function h8(t){return yx(t)&&m8.has(t.claude)&&Tc.has(t.github)&&Tc.has(t.copilot)&&Tc.has(t.codex)&&Tc.has(t.goose)}function _x(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 xx(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 g8(t,s){const i=[];let o=t;const c=new Set;for(;o&&s.has(o)&&!c.has(o);){c.add(o);const u=s.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Ws={label:"Home",url:gi};function v8(t){return t?[Ws,{label:"Settings",url:yo},{label:t,url:void 0}]:[Ws,{label:"Settings",url:void 0}]}const zm={label:"Environments",url:bo};function y8(){return[Ws,{label:"Environments",url:void 0}]}function b8(){return[Ws,{label:"New Chat",url:void 0}]}function _8(t){return[Ws,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function x8(t,s,i,o){const c=i.find(d=>d.id===t),u=o.find(d=>d.id===s);return[Ws,zm,{label:(u==null?void 0:u.displayName)??"Environment",url:hi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function k8(t,s,i,o,c){const u=g8(t,c),d=c.get(t),p=d==null?void 0:d.workspaceId,h=p?i.find(k=>k.id===p):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(k=>k.id===g):void 0,y=[Ws];v&&g&&(y.push(zm),y.push({label:v.displayName,url:hi(g)})),h&&g&&y.push({label:h.name,url:mi(h.id,g)});for(let k=0;k<u.length-1;k++)y.push({label:u[k].title,url:os(u[k].id,void 0,p,g)});const b=u[u.length-1];return y.push({label:(b==null?void 0:b.title)??t,url:void 0}),y}const S8={label:"Findings",url:au};function T8(){return[Ws,{label:"Findings",url:void 0}]}function kx(t,s,i,o,c){const u=[Ws];if(s&&i){const d=o.find(h=>h.id===s),p=c.find(h=>h.id===i);u.push(zm),p&&u.push({label:p.displayName,url:hi(i)}),d&&u.push({label:d.name,url:mi(s,i)}),u.push({label:"Findings",url:zN(s,i)})}else u.push(S8);return u.push({label:t,url:void 0}),u}function Um(t){const s=[];for(const i of t){const o=s[s.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?s[s.length-1]={...o,content:o.content+i.content}:s.push(i)}return s}function wc(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function w8(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 i=t.item;if(i&&typeof i.id=="string")return i.id}function $m(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const y=s.get(v),b=y?wc(y):void 0;if(b)try{const k=JSON.parse(v.content);i.set(b,{tool:k.tool,args:k.args})}catch{}}const o=new Set,c=new Set,u=t.map((v,y)=>{if(v.eventType!=="tool_result")return v;const b=s.get(v),k=b?w8(b):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;o.add(k),c.add(y);let w;const j=v.content.trim();if(j.startsWith("{"))try{const N=JSON.parse(j);typeof N.detailedContent=="string"&&(w=N.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:w}}}),d=[];for(let v=0;v<u.length;v++){if(u[v].eventType!=="tool_use")continue;const y=s.get(u[v]),b=y?wc(y):void 0;b&&o.has(b)||d.push(v)}const p=[];for(let v=0;v<u.length;v++)u[v].eventType!=="tool_result"||c.has(v)||p.push(v);let h=0;for(const v of d){for(;h<p.length&&p[h]<v;)h++;if(h>=p.length)break;const y=p[h];if(y!==v+1)continue;const b=u[v],k=u[y];let S;try{const w=JSON.parse(b.content);S={tool:w.tool,args:w.args}}catch{}if(S){let w;const j=k.content.trim();if(j.startsWith("{"))try{const E=JSON.parse(j);typeof E.detailedContent=="string"&&(w=E.detailedContent)}catch{}u[y]={...k,toolUseCtx:{...S,detailedResult:w}},c.add(y);const N=s.get(b),C=N?wc(N):void 0;C?o.add(C):(o.add(`__seq_${v}`),s.set(b,{...N??{},__seqId:`__seq_${v}`})),h++}}const g=u.filter(v=>{if(v.eventType!=="tool_use")return!0;const y=s.get(v);if(!y)return!0;const b=wc(y);if(b&&o.has(b))return!1;const k=y.__seqId;return!(k&&o.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let y=!1;for(let b=v+1;b<g.length;b++)if(g[b].eventType!=="tool_use"){y=!0;break}y&&(g[v]={...g[v],settled:!0})}return g}function N8(t,s,i){const o=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Sx(s),u=s.filter(h=>$p(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||$p(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:p}}function Sx(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function $p(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function j8(t,s){var d;const i=new Map;for(const p of s)i.set(p.id,p);const o=Sx(t),c=[];for(const p of t){const h=p.workspaceId?((d=i.get(p.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:h}):$p(p,o)?c.push({task:p,reason:"blocked",workspaceName:h}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((p,h)=>(u[p.reason]??3)-(u[h.reason]??3)),c}function C8(t,s){const i=new Map;for(const o of s)i.set(o.id,o);return t.filter(o=>o.status==="running"||o.status==="idle"||o.status==="waiting").map(o=>{var c;return{session:o,environmentName:((c=i.get(o.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function E8(t,s,i){const o=new Map;for(const c of s){if(!c.workspaceId)continue;let u=o.get(c.workspaceId);u||(u={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},o.set(c.workspaceId,u)),u.totalTasks+=1,c.status==="complete"?u.completedTasks+=1:c.status==="working"?u.workingTasks+=1:c.status==="failed"&&(u.failedTasks+=1)}return t.map(c=>{const u=o.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:u.totalTasks,completedTasks:u.completedTasks,workingTasks:u.workingTasks,failedTasks:u.failedTasks}})}const gs=[{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
255
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
256
- const header = req.headers.authorization;
257
- if (!header?.startsWith("Bearer ")) {
258
- res.status(401).json({ error: "Missing token" });
259
- return;
260
- }
261
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
262
- req.user = decoded;
263
- next();
264
- }
265
- \`\`\``,tags:["auth","jwt","middleware","typescript"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:14Z",updatedAt:"2026-02-27T08:15:14Z",val:2},{id:"kn-audit-schema",label:"Audit Log Schema",kind:"knowledge",category:"snippet",content:`\`\`\`sql
266
- CREATE TABLE audit_log (
267
- id BIGSERIAL PRIMARY KEY,
268
- user_id UUID REFERENCES users(id),
269
- action TEXT NOT NULL,
270
- entity_type TEXT NOT NULL,
271
- entity_id TEXT NOT NULL,
272
- old_value JSONB,
273
- new_value JSONB,
274
- ip_address INET,
275
- created_at TIMESTAMPTZ DEFAULT now()
276
- );
277
- \`\`\``,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}],ja=[{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"}],A8=new Map(gs.map(t=>[t.id,t]));function ip(t){const s=A8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Nb={"kn-auth-flow":{node:ip("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:ip("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:ip("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"}]}},D8=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1}],R8=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costUsd:.41},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",inputTokens:42600,outputTokens:8100,costUsd:.22},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",inputTokens:31400,outputTokens:9800,costUsd:.18},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costUsd:.31},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",inputTokens:18900,outputTokens:4500,costUsd:.1},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costUsd:.38}],M8=[{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.
278
- Project: acme/alpha — Node.js + Express REST API
279
- 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";
280
- import type { Request, Response, NextFunction } from "express";
281
-
282
- export function requireAuth(req: Request, res: Response, next: NextFunction): void {
283
- if (!req.session?.userId) {
284
- res.status(401).json({ error: "Not authenticated" });
285
- return;
286
- }
287
- next();
288
- }`,raw:JSON.stringify({tool_use_id:"tu-prev-001"})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:10Z",content:"The current auth uses express-session with server-side session storage. Let me find all files that depend on this pattern."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:11Z",content:JSON.stringify({tool:"Grep",args:{pattern:"req\\.session",path:"src/"}}),raw:JSON.stringify({id:"tu-prev-002",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:12Z",content:`src/middleware/auth.ts:4: if (!req.session?.userId) {
289
- src/routes/login.ts:18: req.session.userId = user.id;
290
- src/routes/login.ts:19: req.session.role = user.role;
291
- src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_usd:.21})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
292
- import bcrypt from "bcrypt";
293
- import { db } from "../db.js";
294
-
295
- const router = Router();
296
-
297
- router.post("/login", async (req, res) => {
298
- const { email, password } = req.body;
299
- const user = await db.users.findByEmail(email);
300
- if (!user || !await bcrypt.compare(password, user.passwordHash)) {
301
- return res.status(401).json({ error: "Invalid credentials" });
302
- }
303
- req.session.userId = user.id;
304
- req.session.role = user.role;
305
- res.json({ ok: true });
306
- });
307
-
308
- export default router;`,raw:JSON.stringify({tool_use_id:"tu-prev-003"})},{sessionId:"sess-001-prev",eventType:"error",timestamp:"2026-02-26T15:12:00Z",content:"Context window exceeded before completing implementation"},{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T15:12:01Z",content:"interrupted"},{sessionId:"sess-001",eventType:"status",timestamp:"2026-02-27T08:15:01Z",content:"running"},{sessionId:"sess-001",eventType:"system",timestamp:"2026-02-27T08:15:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
309
- Project: acme/alpha — Node.js + Express REST API
310
- Task: Implement auth middleware using JWT tokens
311
-
312
- Note: A previous session attempted this task but was interrupted. Pick up where it left off.`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:04Z",content:"I'll pick up the JWT auth migration. The previous session identified 3 files that need updating. Let me verify the current state and start implementing."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:04.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"pending"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"pending"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:05Z",content:JSON.stringify({tool:"Grep",args:{pattern:"express-session|req\\.session",path:"src/",output_mode:"files_with_matches"}}),raw:JSON.stringify({id:"tu-001-01",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:06Z",content:`src/middleware/auth.ts
313
- src/routes/login.ts
314
- src/routes/protected.ts`,raw:JSON.stringify({tool_use_id:"tu-001-01"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:08Z",content:"Good, same 3 files. Let me install the JWT library first, then rewrite the middleware."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:09Z",content:JSON.stringify({tool:"Bash",args:{command:"npm install jsonwebtoken && npm install -D @types/jsonwebtoken"}}),raw:JSON.stringify({id:"tu-001-02",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:11Z",content:`added 12 packages in 3.2s
315
-
316
- added 1 package in 0.8s`,raw:JSON.stringify({tool_use_id:"tu-001-02"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:11.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"completed"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"in_progress"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:12Z",content:"Now I'll rewrite the auth middleware to use JWT verification instead of session checks."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:13Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/auth.ts",content:`import jwt from "jsonwebtoken";
317
- import type { Request, Response, NextFunction } from "express";
318
-
319
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
320
-
321
- export interface JwtPayload {
322
- userId: string;
323
- role: string;
324
- iat: number;
325
- exp: number;
326
- }
327
-
328
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
329
- const header = req.headers.authorization;
330
- if (!header?.startsWith("Bearer ")) {
331
- res.status(401).json({ error: "Missing or malformed token" });
332
- return;
333
- }
334
- try {
335
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
336
- req.user = decoded;
337
- next();
338
- } catch (err) {
339
- if (err instanceof jwt.TokenExpiredError) {
340
- res.status(401).json({ error: "Token expired" });
341
- } else {
342
- res.status(403).json({ error: "Invalid token" });
343
- }
344
- }
345
- }
346
- `}}),raw:JSON.stringify({id:"tu-001-03",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:14Z",content:"File written: src/middleware/auth.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-03"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:16Z",content:`Now I need to update the login route to issue JWT tokens instead of setting session data.
347
-
348
- The new login flow will:
349
- 1. Validate credentials (unchanged)
350
- 2. Generate a JWT with \`userId\` and \`role\` claims
351
- 3. Return the token in the response body
352
- 4. Include a refresh token for long-lived sessions`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:17Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/login.ts",content:`import { Router } from "express";
353
- import bcrypt from "bcrypt";
354
- import jwt from "jsonwebtoken";
355
- import crypto from "node:crypto";
356
- import { db } from "../db.js";
357
-
358
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
359
- const ACCESS_TOKEN_EXPIRY = "24h";
360
- const REFRESH_TOKEN_BYTES = 48;
361
-
362
- const router = Router();
363
-
364
- router.post("/login", async (req, res) => {
365
- const { email, password } = req.body;
366
- const user = await db.users.findByEmail(email);
367
- if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
368
- return res.status(401).json({ error: "Invalid credentials" });
369
- }
370
-
371
- const accessToken = jwt.sign(
372
- { userId: user.id, role: user.role },
373
- JWT_SECRET,
374
- { expiresIn: ACCESS_TOKEN_EXPIRY },
375
- );
376
-
377
- const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
378
- await db.refreshTokens.create({ userId: user.id, token: refreshToken });
379
-
380
- res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
381
- });
382
-
383
- export default router;
384
- `}}),raw:JSON.stringify({id:"tu-001-04",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:18Z",content:"File written: src/routes/login.ts (33 lines)",raw:JSON.stringify({tool_use_id:"tu-001-04"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:20Z",content:"Let me update the protected route to use the new `req.user` shape from the JWT payload."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:21Z",content:JSON.stringify({tool:"Edit",args:{file_path:"src/routes/protected.ts",old_string:"const userId = req.session.userId;",new_string:"const { userId } = req.user as JwtPayload;"}}),raw:JSON.stringify({id:"tu-001-05",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:22Z",content:"Updated src/routes/protected.ts",raw:JSON.stringify({tool_use_id:"tu-001-05"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:24Z",content:"Now let me run the existing tests to make sure nothing is broken, then I'll add new JWT-specific tests."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:25Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-06",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:30Z",content:` PASS src/routes/__tests__/login.test.ts
385
- PASS src/routes/__tests__/protected.test.ts
386
- FAIL src/middleware/__tests__/auth.test.ts
387
- x should reject missing session (12ms)
388
- x should allow valid session (8ms)
389
-
390
- 2 failed, 12 passed, 14 total
391
-
392
- Test Suites: 1 failed, 2 passed, 3 total`,raw:JSON.stringify({tool_use_id:"tu-001-06",is_error:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:32Z",content:`Two tests failed because they still test the old session-based auth. I need to rewrite those tests for JWT.
393
-
394
- Let me update the auth middleware tests:`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:33Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/__tests__/auth.test.ts",content:`import { describe, it, expect } from "vitest";
395
- import jwt from "jsonwebtoken";
396
- import { verifyToken } from "../auth.js";
397
- import { createMockReqRes } from "../../test-utils/mock-express.js";
398
-
399
- const SECRET = "test-secret";
400
- process.env.JWT_SECRET = SECRET;
401
-
402
- describe("verifyToken", () => {
403
- it("should reject requests without Authorization header", () => {
404
- const { req, res, next } = createMockReqRes();
405
- verifyToken(req, res, next);
406
- expect(res.status).toHaveBeenCalledWith(401);
407
- });
408
-
409
- it("should reject expired tokens", () => {
410
- const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
411
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
412
- verifyToken(req, res, next);
413
- expect(res.status).toHaveBeenCalledWith(401);
414
- });
415
-
416
- it("should accept valid tokens and attach user to request", () => {
417
- const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
418
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
419
- verifyToken(req, res, next);
420
- expect(next).toHaveBeenCalled();
421
- expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
422
- });
423
- });
424
- `}}),raw:JSON.stringify({id:"tu-001-07",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:34Z",content:"File written: src/middleware/__tests__/auth.test.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-07"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:35Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-08",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:40Z",content:` PASS src/routes/__tests__/login.test.ts
425
- PASS src/routes/__tests__/protected.test.ts
426
- PASS src/middleware/__tests__/auth.test.ts
427
-
428
- Test Suites: 3 passed, 3 total
429
- Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_usd:.22})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
430
-
431
- ### Changes made
432
-
433
- | File | Action |
434
- |------|--------|
435
- | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
436
- | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
437
- | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
438
- | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
439
-
440
- ### Key decisions
441
- - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
442
- - **Refresh tokens**: 48-byte random hex, stored in DB
443
- - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:30:01Z",content:"running"},{sessionId:"sess-002",eventType:"system",timestamp:"2026-02-27T07:30:02Z",content:`You are a QA engineer. Write comprehensive tests covering happy paths, edge cases, error scenarios, and security.
444
- Project: acme/alpha — Node.js + Express REST API
445
- Task: Write unit tests for the user registration endpoint`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:04Z",content:"I'll write thorough tests for `POST /api/register`. Let me first read the registration endpoint to understand its behavior."},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:05Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/register.ts"}}),raw:JSON.stringify({id:"tu-002-01",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:06Z",content:`import { Router } from "express";
446
- import bcrypt from "bcrypt";
447
- import { db } from "../db.js";
448
- import { validateEmail, validatePassword } from "../utils/validators.js";
449
-
450
- const SALT_ROUNDS = 12;
451
- const router = Router();
452
-
453
- router.post("/register", async (req, res) => {
454
- const { name, email, password } = req.body;
455
-
456
- if (!name || !email || !password) {
457
- return res.status(400).json({ error: "Missing required fields" });
458
- }
459
- if (!validateEmail(email)) {
460
- return res.status(400).json({ error: "Invalid email format" });
461
- }
462
- if (!validatePassword(password)) {
463
- return res.status(400).json({ error: "Password too weak" });
464
- }
465
-
466
- const existing = await db.users.findByEmail(email);
467
- if (existing) {
468
- return res.status(409).json({ error: "Email already registered" });
469
- }
470
-
471
- const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
472
- const user = await db.users.create({ name, email, passwordHash });
473
- res.status(201).json({ id: user.id, name: user.name, email: user.email });
474
- });
475
-
476
- export default router;`,raw:JSON.stringify({tool_use_id:"tu-002-01"})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:10Z",content:`Good. The endpoint validates input, checks for duplicates, hashes the password, and creates the user. I'll write tests covering:
477
-
478
- 1. **Happy path** - valid registration
479
- 2. **Missing fields** - each required field missing
480
- 3. **Invalid email** - malformed email format
481
- 4. **Weak password** - password validation failure
482
- 5. **Duplicate email** - conflict with existing user
483
- 6. **SQL injection** - malicious email input
484
- 7. **XSS payload** - HTML in the name field
485
- 8. **Response shape** - correct status codes and body structure`},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/__tests__/register.test.ts",content:"// [test content - 8 test cases as described above]"}}),raw:JSON.stringify({id:"tu-002-02",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:13Z",content:"File written: src/routes/__tests__/register.test.ts (142 lines)",raw:JSON.stringify({tool_use_id:"tu-002-02"})},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:31:00Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=register"}}),raw:JSON.stringify({id:"tu-002-03",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:31:30Z",content:` PASS src/routes/__tests__/register.test.ts
486
- POST /api/register
487
- ✓ should register a valid user (28ms)
488
- ✓ should reject missing name (4ms)
489
- ✓ should reject missing email (3ms)
490
- ✓ should reject missing password (3ms)
491
- ✓ should reject invalid email format (5ms)
492
- ✓ should reject weak password (4ms)
493
- ✓ should reject duplicate email (12ms)
494
- ✓ should sanitize HTML in name field (6ms)
495
-
496
- Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_usd:.18})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
497
- Project: acme/alpha — Node.js + Express + PostgreSQL
498
- Task: Add audit_log table and migrate schema`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:05Z",content:"I need to add an `audit_log` table for tracking all write operations. Let me review the current schema first."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"tu-003-01",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:07Z",content:`CREATE TABLE users (
499
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
500
- name TEXT NOT NULL,
501
- email TEXT UNIQUE NOT NULL,
502
- password_hash TEXT NOT NULL,
503
- role TEXT DEFAULT 'user',
504
- created_at TIMESTAMPTZ DEFAULT now(),
505
- updated_at TIMESTAMPTZ DEFAULT now()
506
- );
507
-
508
- CREATE TABLE sessions (
509
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
510
- user_id UUID REFERENCES users(id),
511
- expires_at TIMESTAMPTZ NOT NULL,
512
- created_at TIMESTAMPTZ DEFAULT now()
513
- );`,raw:JSON.stringify({tool_use_id:"tu-003-01"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:12Z",content:"I see the schema. I'll create a migration that:\n1. Adds a `last_login_at` column to `users`\n2. Adds an index on `sessions.expires_at` for efficient cleanup queries\n3. Creates the `audit_log` table\n\nLet me write the migration file:"},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:14Z",content:JSON.stringify({tool:"Write",args:{file_path:"migrations/002_audit_log.sql",content:`-- Migration: 002_audit_log
514
- -- Add audit logging and user activity tracking
515
-
516
- BEGIN;
517
-
518
- -- 1. Add last_login_at to users
519
- ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
520
-
521
- -- 2. Index for session cleanup queries
522
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
523
-
524
- -- 3. Audit log table
525
- CREATE TABLE audit_log (
526
- id BIGSERIAL PRIMARY KEY,
527
- user_id UUID REFERENCES users(id),
528
- action TEXT NOT NULL,
529
- entity_type TEXT NOT NULL,
530
- entity_id TEXT NOT NULL,
531
- old_value JSONB,
532
- new_value JSONB,
533
- ip_address INET,
534
- created_at TIMESTAMPTZ DEFAULT now()
535
- );
536
-
537
- CREATE INDEX idx_audit_log_user ON audit_log (user_id);
538
- CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
539
- CREATE INDEX idx_audit_log_created ON audit_log (created_at);
540
-
541
- COMMIT;
542
- `}}),raw:JSON.stringify({id:"tu-003-02",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:15Z",content:"File written: migrations/002_audit_log.sql (29 lines)",raw:JSON.stringify({tool_use_id:"tu-003-02"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:00Z",content:"Now I need to implement the audit middleware that logs write operations. This will intercept POST, PUT, PATCH, and DELETE requests."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:46:02Z",content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate -- --dry-run"}}),raw:JSON.stringify({id:"tu-003-03",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:46:10Z",content:`Dry run: would apply 002_audit_log.sql
543
- - ALTER TABLE users ADD COLUMN last_login_at
544
- - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
545
- - CREATE TABLE audit_log
546
- - 3 indexes on audit_log
547
-
548
- WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
549
- Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_usd:.31})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
550
- Project: acme/data-pipeline — ETL pipelines for analytics
551
- Task: Implement rate limiting for the public API using a token-bucket algorithm`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:05Z",content:"I'll implement rate limiting using a token-bucket algorithm. Let me first survey the existing API infrastructure to find the right integration point."},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:05.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"in_progress"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"pending"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:06Z",content:JSON.stringify({tool:"Glob",args:{pattern:"src/middleware/**/*.ts"}}),raw:JSON.stringify({id:"tu-004-01",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:07Z",content:`src/middleware/cors.ts
552
- src/middleware/error-handler.ts
553
- src/middleware/logger.ts
554
- src/middleware/request-id.ts`,raw:JSON.stringify({tool_use_id:"tu-004-01"})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:09Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"completed"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"in_progress"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:10Z",content:`Good middleware structure already in place. I'll add a \`rate-limiter.ts\` module that:
555
-
556
- - Uses an **in-memory token bucket** per client IP
557
- - Supports configurable rate (requests/second) and burst size
558
- - Returns \`429 Too Many Requests\` with \`Retry-After\` header
559
- - Has a Redis adapter option for multi-instance deployments
560
-
561
- Let me implement it:`},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/rate-limiter.ts",content:"// Token bucket rate limiter implementation"}}),raw:JSON.stringify({id:"tu-004-02",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:13Z",content:"File written: src/middleware/rate-limiter.ts (87 lines)",raw:JSON.stringify({tool_use_id:"tu-004-02"})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:18Z",content:"Now I need to wire the rate limiter into the Express middleware stack. It should go after the request-ID middleware but before route handlers."},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:00:01Z",content:"running"},{sessionId:"sess-005",eventType:"system",timestamp:"2026-02-27T06:00:02Z",content:`You are a database specialist. Focus on connection management, performance, and multi-tenant isolation.
562
- Project: acme/alpha — Node.js + Express + PostgreSQL
563
- Task: Refactor database connection pooling for multi-tenant isolation`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:05Z",content:"I'll refactor the DB layer to support per-tenant connection pools. This is needed because the current single-pool design means one slow tenant can exhaust connections for everyone."},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/db/pool.ts"}}),raw:JSON.stringify({id:"tu-005-01",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:07Z",content:`import pg from "pg";
564
-
565
- const pool = new pg.Pool({
566
- connectionString: process.env.DATABASE_URL,
567
- max: 20,
568
- idleTimeoutMillis: 30000,
569
- });
570
-
571
- export { pool };`,raw:JSON.stringify({tool_use_id:"tu-005-01"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:12Z",content:`The current pool is a single shared instance with \`max: 20\`. For multi-tenant isolation, I need:
572
-
573
- 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
574
- 2. **Configurable limits** per tenant (max connections, idle timeout)
575
- 3. **Health checks** with automatic pool eviction for unhealthy connections
576
- 4. **Graceful shutdown** that drains all pools`},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:14Z",content:JSON.stringify({tool:"Grep",args:{pattern:"import.*pool|from.*pool",path:"src/",output_mode:"content"}}),raw:JSON.stringify({id:"tu-005-02",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:15Z",content:`src/db/index.ts:1:import { pool } from "./pool.js";
577
- src/routes/users.ts:2:import { pool } from "../db/pool.js";
578
- src/routes/register.ts:3:import { pool } from "../db/pool.js";
579
- src/routes/admin.ts:4:import { pool } from "../db/pool.js";
580
- src/services/billing.ts:2:import { pool } from "../db/pool.js";
581
- src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stringify({tool_use_id:"tu-005-02"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:20Z",content:`Six files import the pool directly. I'll need to:
582
- 1. Create a new \`PoolManager\` abstraction
583
- 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
584
- 3. Add middleware to extract tenant ID from the request
585
-
586
- This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_usd:.38})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],I8=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",environmentId:"env-docker-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",environmentId:"env-local-01",status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],O8=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}})},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}})},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,defaultPersonaId:"",workpad:""},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,defaultPersonaId:"",workpad:""}],Nc=[{id:"find-001",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"architecture",title:"Auth middleware is tightly coupled to Express",content:"The current auth middleware directly references Express Request/Response types. Consider extracting a framework-agnostic token verification layer so we can reuse it in the WebSocket auth path.",tags:["auth","decoupling","middleware"],createdAt:"2026-02-27T08:16:00Z"},{id:"find-002",workspaceId:"proj-alpha",taskId:"task-003",sessionId:"sess-002",category:"api",title:"Missing pagination on GET /api/users",content:"The users endpoint returns all rows without limit/offset. For datasets over 10k rows this will cause timeouts. Recommend cursor-based pagination with a default page size of 50.",tags:["api","pagination","performance"],createdAt:"2026-02-27T07:31:00Z"},{id:"find-003",workspaceId:"proj-alpha",taskId:"task-005",sessionId:"sess-003",category:"bug",title:"Race condition in session cleanup",content:"When two requests hit /api/logout concurrently, the second call throws a 500 because the session row has already been deleted. Needs an idempotent DELETE or a conditional check.",tags:["bug","concurrency","sessions"],createdAt:"2026-02-26T22:50:00Z"},{id:"find-004",workspaceId:"proj-alpha",taskId:"task-004",sessionId:"",category:"decision",title:"Chose pg-pool over knex connection pool",content:"pg-pool gives us direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool anyway and adds overhead we don't need since we write raw SQL.",tags:["database","decision","postgres"],createdAt:"2026-02-23T11:30:00Z"},{id:"find-005",workspaceId:"proj-alpha",taskId:"",sessionId:"",category:"dependency",title:"jsonwebtoken has 3 high-severity CVEs",content:"The jsonwebtoken package (v8.x) has known vulnerabilities. Consider migrating to jose which is maintained, supports ESM, and covers the same JWS/JWE surface area with zero dependencies.",tags:["security","dependency","jwt"],createdAt:"2026-02-27T08:20:00Z"},{id:"find-006",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"pattern",title:"Consistent error response shape",content:"All error responses should follow the shape `{ error: string, code: string, details?: unknown }`. Currently some routes return `{ message: string }` and others return `{ error: string }`.",tags:["api","consistency","error-handling"],createdAt:"2026-02-27T08:17:00Z"},{id:"find-007",workspaceId:"proj-beta",taskId:"task-007",sessionId:"sess-004",category:"architecture",title:"Watermark storage should be pluggable",content:"The incremental load watermarks are currently stored in a local SQLite file. For production multi-worker scenarios, this needs to be backed by a shared store (Redis or Postgres).",tags:["architecture","pipeline","scalability"],createdAt:"2026-02-27T09:05:00Z"}],B8=[{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:""}],L8=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","finding_post","finding_list","knowledge_search","knowledge_create_node","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Posts findings for issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Post findings for anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["finding_post","finding_list","knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and posts a findings summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:`const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));
587
- for (const f of files) {
588
- const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
589
- if (eslintResult.exitCode !== 0) {
590
- env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
591
- }
592
- const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
593
- if (prettierResult.exitCode !== 0) {
594
- env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
595
- }
596
- }
597
- env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],z8={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Ee(t){return new Date(Date.now()+t).toISOString()}const jb=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Ee(1600),content:`src/routes/users.ts
598
- src/routes/auth.ts
599
- src/routes/billing.ts
600
- src/routes/admin.ts
601
- src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Ee(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
602
-
603
- \`\`\`typescript
604
- const router = Router();
605
- router.use(authenticate);
606
- router.use(validateBody);
607
-
608
- router.get("/", listUsers);
609
- router.post("/", createUser);
610
- router.get("/:id", getUser);
611
- router.put("/:id", updateUser);
612
- router.delete("/:id", deleteUser);
613
- \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Ee(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Ee(4e3),content:` PASS src/routes/__tests__/users.test.ts
614
- PASS src/routes/__tests__/auth.test.ts
615
- PASS src/routes/__tests__/billing.test.ts
616
-
617
- Test Suites: 3 passed, 3 total
618
- Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Ee(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:Ee(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Ee(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`CREATE TABLE users (
619
- id UUID PRIMARY KEY,
620
- name TEXT NOT NULL,
621
- email TEXT UNIQUE NOT NULL,
622
- created_at TIMESTAMPTZ DEFAULT now()
623
- );
624
-
625
- CREATE TABLE sessions (
626
- id UUID PRIMARY KEY,
627
- user_id UUID REFERENCES users(id),
628
- expires_at TIMESTAMPTZ NOT NULL
629
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:`I found the tables to modify:
630
- - **users**: add column \`last_login_at\`
631
- - **sessions**: add index on \`expires_at\`
632
- - **audit_log**: new table
633
-
634
- This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
635
-
636
- Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Ee(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Ee(1700),content:`Applying 002_add_last_login.sql... done
637
- Applying 003_sessions_index.sql... done
638
- Applying 004_audit_log.sql... done
639
-
640
- 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Ee(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Ee(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`import { StripeClient } from "./stripe-client.js";
641
- import type { Invoice, LineItem } from "../types/billing.js";
642
-
643
- export class BillingService {
644
- constructor(private stripe: StripeClient) {}
645
-
646
- async calculateMonthlyTotal(userId: string): Promise<number> {
647
- const invoices = await this.stripe.listInvoices(userId);
648
- return invoices.reduce((sum, inv) => sum + inv.total, 0);
649
- }
650
- }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Ee(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Ee(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Ee(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Ee(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Ee(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Ee(1800),content:`import jwt from "jsonwebtoken";
651
- import type { Request, Response, NextFunction } from "express";
652
-
653
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
654
-
655
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
656
- const header = req.headers.authorization;
657
- if (!header?.startsWith("Bearer ")) {
658
- res.status(401).json({ error: "Missing token" });
659
- return;
660
- }
661
- try {
662
- const decoded = jwt.verify(header.slice(7), JWT_SECRET);
663
- if (decoded.exp > Date.now() / 1000) {
664
- res.status(403).json({ error: "Token expired" });
665
- return;
666
- }
667
- req.user = decoded;
668
- next();
669
- } catch {
670
- res.status(403).json({ error: "Invalid token" });
671
- }
672
- }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Ee(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Ee(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Ee(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Ee(5800),content:`[exit 0] > jest --grep auth
673
-
674
- PASS src/auth.test.ts
675
- ✓ validates JWT token (12ms)
676
- ✓ rejects expired token (3ms)
677
- ✓ handles missing header (1ms)
678
-
679
- Tests: 3 passed, 3 total
680
- Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Ee(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Ee(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
681
- src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Ee(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],Cb=400;function U8({children:t}){const[s,i]=_.useState(D8),[o,c]=_.useState(R8),[u,d]=_.useState(M8),[p,h]=_.useState(void 0),[g,v]=_.useState(I8),[y,b]=_.useState(O8),[k,S]=_.useState(Nc),[w,j]=_.useState(void 0),N=!1,[C,E]=_.useState(B8),[I,R]=_.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[D,q]=_.useState(L8),[$]=_.useState(z8),[Y,G]=_.useState(""),[Q,ae]=_.useState(gs),[me,ie]=_.useState(ja),[ee,B]=_.useState(void 0),[Z,ne]=_.useState(void 0),[re,ue]=_.useState(""),Ze=_.useRef(void 0),je=_.useRef(0),Te=_.useRef(0),Ie=_.useRef(new Set),le=_.useRef(new Map),ve=_.useRef(y);ve.current=y;const de=_.useRef(new Map),Oe=_.useRef(new Map),bt=_.useCallback(P=>(je.current+=1,`mock-${P}-${String(je.current).padStart(3,"0")}`),[]),yn=_.useCallback(()=>{const P=jb[Te.current%jb.length];return Te.current+=1,P},[]),L=_.useCallback((P,te,oe)=>{const ce=setTimeout(()=>{var fe;Ie.current.delete(ce),oe&&((fe=le.current.get(oe))==null||fe.delete(ce)),P()},te);Ie.current.add(ce),oe&&(le.current.has(oe)||le.current.set(oe,new Set),le.current.get(oe).add(ce))},[]),Me=_.useCallback(P=>{const te=le.current.get(P);te&&(te.forEach(oe=>{clearTimeout(oe),Ie.current.delete(oe)}),le.current.delete(P))},[]),et=_.useCallback((P,te,oe)=>{c(ce=>ce.map(fe=>fe.id===P?{...fe,status:te,...oe!==void 0?{endReason:oe}:{}}:fe))},[]),tt=_.useCallback(P=>{d(te=>[...te,P])},[]),qe=_.useCallback((P,te,oe)=>{te.forEach((ce,fe)=>{L(()=>{const ze={sessionId:P,...ce.event,timestamp:new Date().toISOString()};if(tt(ze),ce.event.eventType==="status"){const ye=_x(ce.event.content),Ae=xx(ce.event.content);et(P,ye,Ae)}fe===te.length-1&&oe&&oe()},ce.delayMs,P)})},[L,tt,et]),ls=_.useCallback(async(P,te,oe,ce)=>{console.log("[MockGrackle] spawn",{environmentId:P,prompt:te,runtime:ce});const fe=bt("sess"),ze={id:fe,environmentId:P,runtime:ce||"claude-code",status:"running",prompt:te,startedAt:new Date().toISOString()};c(Ae=>[...Ae,ze]),h(fe);const ye=yn();if(console.log(`[MockGrackle] Playing scenario: ${ye.label}`),ye.pauseForInput){const Ae=ye.pauseAfterStep??ye.steps.length-1,Ge=ye.steps.slice(0,Ae+1),ct=Ge.length>0?Ge[Ge.length-1].delayMs:0;qe(fe,Ge),L(()=>{et(fe,"idle"),tt({sessionId:fe,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ct+Cb,fe),ye.resumeSteps&&de.current.set(fe,ye.resumeSteps)}else qe(fe,ye.steps)},[bt,yn,qe,L,et,tt]),Qs=_.useCallback(async P=>{console.log("[MockGrackle] kill",P),Me(P),de.current.delete(P),et(P,"stopped","killed"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),b(te=>te.map(oe=>oe.latestSessionId===P&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),Dn=_.useCallback(async P=>{console.log("[MockGrackle] stopGraceful",P),Me(P),de.current.delete(P),et(P,"stopped","terminated"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),b(te=>te.map(oe=>oe.latestSessionId===P&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),Kn=_.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),cs=_.useCallback(async P=>{console.log("[MockGrackle] loadSessionEvents",P)},[]),ea=_.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),Yn=_.useCallback(async(P,te,oe,ce,fe,ze,ye,Ae,Ge)=>{console.log("[MockGrackle] createWorkspace",{name:P,description:te});const ct={id:bt("proj"),name:P,description:te||"",repoUrl:oe||"",environmentId:ce||"",status:"active",workingDirectory:ye||"",useWorktrees:ze??!0,defaultPersonaId:fe||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Fe=>[...Fe,ct]),Ae&&Ae()},[bt]),Ne=_.useCallback(async P=>{console.log("[MockGrackle] archiveWorkspace",P),v(te=>te.map(oe=>oe.id===P?{...oe,status:"archived"}:oe))},[]),Ce=_.useCallback(async P=>{console.log("[MockGrackle] loadTasks",P)},[]),cn=_.useCallback(async(P,te,oe,ce,fe,ze,ye,Ae,Ge)=>{console.log("[MockGrackle] createTask",{workspaceId:P,title:te,parentTaskId:fe}),b(ct=>{const Ut=ct.filter(ft=>ft.workspaceId===P).reduce((ft,Vt)=>Math.max(ft,Vt.sortOrder),0),Ft=fe?ct.find(ft=>ft.id===fe):void 0;if(fe&&!Ft)return console.warn("[MockGrackle] Parent task not found:",fe),ct;if(Ft&&!Ft.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",fe),ct;const Et=Ft?Ft.depth+1:0,sn={id:bt("task"),workspaceId:P,title:te,description:oe||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ce||[],reviewNotes:void 0,sortOrder:Ut+1,createdAt:new Date().toISOString(),parentTaskId:fe||"",depth:Et,childTaskIds:[],canDecompose:ye??!fe,defaultPersonaId:ze||"",workpad:""};return[...ct,sn]}),Ae&&Ae()},[bt]),bn=_.useCallback(async(P,te,oe,ce)=>{var ct;console.log("[MockGrackle] startTask",{taskId:P});const fe=ve.current.find(Fe=>Fe.id===P),ze=(fe==null?void 0:fe.title)??"",ye=bt("sess"),Ae={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:ze||P,startedAt:new Date().toISOString()};c(Fe=>[...Fe,Ae]),b(Fe=>Fe.map(Ut=>Ut.id===P?{...Ut,status:"working",latestSessionId:ye,branch:`mock/${P.slice(0,8)}`}:Ut));const Ge=yn();if(console.log(`[MockGrackle] Playing task scenario: ${Ge.label}`),Ge.pauseForInput){const Fe=Ge.pauseAfterStep??Ge.steps.length-1,Ut=Ge.steps.slice(0,Fe+1),Ft=Ut.length>0?Ut[Ut.length-1].delayMs:0;if(qe(ye,Ut),L(()=>{et(ye,"idle"),tt({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Ft+Cb,ye),Ge.resumeSteps){const Et=[...Ge.resumeSteps];de.current.set(ye,Et);const sn=Et.reduce((ft,Vt)=>Math.max(ft,Vt.delayMs),0);Oe.current.set(ye,{taskId:P,delayAfterResume:sn+200})}}else{const Fe=Ge.steps.length>0?Ge.steps[Ge.steps.length-1].delayMs:0;qe(ye,Ge.steps);const Ut=(ct=Ge.steps[Ge.steps.length-1])==null?void 0:ct.event.content;L(()=>{Ut==="completed"?b(Ft=>Ft.map(Et=>Et.id===P&&Et.status==="working"?{...Et,status:"paused"}:Et)):Ut==="failed"&&b(Ft=>Ft.map(Et=>Et.id===P&&Et.status==="working"?{...Et,status:"failed"}:Et))},Fe+100,ye)}},[bt,yn,qe,L,et,tt]),ks=_.useCallback(async(P,te)=>{console.log("[MockGrackle] sendInput",{sessionId:P,text:te}),tt({sessionId:P,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${te}`}),et(P,"running"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const oe=de.current.get(P);if(oe)de.current.delete(P),qe(P,oe);else{const fe=[{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"}}];qe(P,fe)}const ce=Oe.current.get(P);ce&&(Oe.current.delete(P),L(()=>{b(fe=>fe.map(ze=>ze.id===ce.taskId&&ze.status==="working"?{...ze,status:"paused"}:ze))},ce.delayAfterResume,P))},[tt,et,qe,L]),us=_.useCallback(async P=>{console.log("[MockGrackle] completeTask",P),b(te=>te.map(oe=>oe.id===P?{...oe,status:"complete"}:oe))},[]),ki=_.useCallback(async P=>{console.log("[MockGrackle] resumeTask",P)},[]),za=_.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] updateTask",{taskId:P,title:te}),b(ze=>ze.map(ye=>ye.id===P?{...ye,title:te.trim()||ye.title,description:oe,dependsOn:ce,...fe!==void 0?{defaultPersonaId:fe}:{}}:ye))},[]),Si=_.useCallback(async P=>{console.log("[MockGrackle] deleteTask",P),b(te=>te.filter(oe=>oe.id!==P))},[]),Qr=_.useCallback(async P=>{console.log("[MockGrackle] loadFindings",P),S(Nc.filter(te=>te.workspaceId===P))},[]),ta=_.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),S([...Nc])},[]),Qt=_.useCallback(async P=>{console.log("[MockGrackle] loadFinding",P);const te=Nc.find(oe=>oe.id===P);j(te)},[]),Jn=_.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] postFinding",{workspaceId:P,title:te});const ze={id:bt("find"),workspaceId:P,taskId:"",sessionId:"",category:ce||"general",title:te,content:oe,tags:fe||[],createdAt:new Date().toISOString()};S(ye=>[...ye,ze])},[bt]),en=_.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),el=_.useCallback(async(P,te,oe)=>{console.log("[MockGrackle] addEnvironment",{displayName:P,adapterType:te,adapterConfig:oe})},[]),tl=_.useCallback(async(P,te)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:P,...te}),i(oe=>oe.map(ce=>ce.id!==P?ce:{...ce,...te.displayName!==void 0?{displayName:te.displayName}:{},...te.adapterConfig!==void 0?{adapterConfig:JSON.stringify(te.adapterConfig)}:{}}))},[]),nl=_.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Ua=_.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] setToken",{name:P,tokenType:oe}),E(ze=>[...ze.filter(Ae=>Ae.name!==P),{name:P,tokenType:oe,envVar:ce,filePath:fe,expiresAt:""}])},[]),$a=_.useCallback(async P=>{console.log("[MockGrackle] deleteToken",P),E(te=>te.filter(oe=>oe.name!==P))},[]),Pa=_.useCallback(async P=>{console.log("[MockGrackle] updateCredentialProviders",P),R(P)},[]);_.useEffect(()=>()=>{Ie.current.forEach(clearTimeout),Ie.current.clear()},[]);const Ss=_.useMemo(()=>({connected:!0,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:p,workspaces:g,tasks:y,findings:k,selectedFinding:w,findingLoading:N,tokens:C,credentialProviders:I,spawn:ls,sendInput:ks,kill:Qs,stopGraceful:Dn,refresh:Kn,loadSessionEvents:cs,clearEvents:ea,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Yn,archiveWorkspace:Ne,updateWorkspace:async(P,te)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:P,...te}),v(oe=>oe.map(ce=>ce.id!==P?ce:{...ce,...te.name!==void 0?{name:te.name}:{},...te.description!==void 0?{description:te.description}:{},...te.repoUrl!==void 0?{repoUrl:te.repoUrl}:{},...te.environmentId!==void 0?{environmentId:te.environmentId}:{},...te.workingDirectory!==void 0?{workingDirectory:te.workingDirectory}:{},...te.useWorktrees!==void 0?{useWorktrees:te.useWorktrees}:{},...te.defaultPersonaId!==void 0?{defaultPersonaId:te.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:Ce,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:cn,startTask:bn,stopTask:async P=>{console.log("[MockGrackle] stopTask",{taskId:P}),await us(P)},completeTask:us,resumeTask:ki,updateTask:za,deleteTask:Si,loadFindings:Qr,loadAllFindings:ta,loadFinding:Qt,postFinding:Jn,loadEnvironments:en,addEnvironment:el,updateEnvironment:tl,loadTokens:nl,setToken:Ua,deleteToken:$a,updateCredentialProviders:Pa,provisionStatus:{},provisionEnvironment:async(P,te)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:D,createPersona:async(P,te,oe,ce,fe,ze,ye,Ae,Ge)=>{console.log("[MockGrackle] createPersona",{name:P});const ct={id:`mock-persona-${Date.now()}`,name:P,description:te,systemPrompt:oe,toolConfig:"{}",runtime:ce??"claude-code",model:fe||"",maxTurns:ze||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Ae||"",allowedMcpTools:Ge||[]};return q(Fe=>[...Fe,ct]),ct},updatePersona:async(P,te,oe,ce,fe,ze,ye,Ae,Ge,ct)=>{console.log("[MockGrackle] updatePersona",{personaId:P,name:te});const Fe=D.find(Et=>Et.id===P);if(!Fe)throw new Error(`Persona not found: ${P}`);const Ut=new Date().toISOString(),Ft={...Fe,...te!==void 0?{name:te}:{},...oe!==void 0?{description:oe}:{},...ce!==void 0?{systemPrompt:ce}:{},...fe!==void 0?{runtime:fe}:{},...ze!==void 0?{model:ze}:{},...ye!==void 0?{maxTurns:ye}:{},...Ae!==void 0?{type:Ae}:{},...Ge!==void 0?{script:Ge}:{},...ct!==void 0?{allowedMcpTools:ct}:{},updatedAt:Ut};return q(Et=>Et.map(sn=>sn.id===P?Ft:sn)),Ft},deletePersona:async P=>{console.log("[MockGrackle] deletePersona",P),q(te=>te.filter(oe=>oe.id!==P))},taskSessions:$,loadTaskSessions:async P=>{console.log("[MockGrackle] loadTaskSessions",P)},appDefaultPersonaId:Y,setAppDefaultPersonaId:async P=>{console.log("[MockGrackle] setAppDefaultPersonaId",P),G(P)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costUsd:1.12,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costUsd:.48,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1}},loadUsage:async(P,te)=>{console.log(`[MockGrackle] loadUsage(${P}, ${te})`)},knowledge:{graphData:{nodes:Q,links:me},selectedNode:ee,loading:!1,selectedId:Z,searchQuery:re,search:async P=>{if(console.log("[MockGrackle] knowledge.search",P),!P.trim()){ue(P);return}ue(P);const te=Ze.current,oe=te?gs.filter(ye=>!ye.workspaceId||ye.workspaceId===te):gs,ce=P.toLowerCase(),fe=oe.filter(ye=>{var Ae,Ge,ct;return ye.label.toLowerCase().includes(ce)||((Ae=ye.content)==null?void 0:Ae.toLowerCase().includes(ce))||((Ge=ye.tags)==null?void 0:Ge.some(Fe=>Fe.toLowerCase().includes(ce)))||((ct=ye.category)==null?void 0:ct.toLowerCase().includes(ce))});ae(fe);const ze=new Set(fe.map(ye=>ye.id));ie(ja.filter(ye=>ze.has(ye.source)&&ze.has(ye.target))),ne(void 0),B(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ue("");const P=Ze.current,te=P?gs.filter(ce=>!ce.workspaceId||ce.workspaceId===P):gs;ae(te);const oe=new Set(te.map(ce=>ce.id));ie(ja.filter(ce=>oe.has(ce.source)&&oe.has(ce.target)))},selectNode:async P=>{console.log("[MockGrackle] knowledge.selectNode",P),ne(P);const te=P in Nb?Nb[P]:void 0;if(te)B(te);else{const oe=gs.find(ce=>ce.id===P);if(oe){const ce=ja.filter(fe=>fe.source===P||fe.target===P).map(fe=>({fromId:fe.source,toId:fe.target,type:fe.type}));B({node:oe,edges:ce})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ne(void 0),B(void 0)},expandNode:async P=>{console.log("[MockGrackle] knowledge.expandNode",P),ae(te=>{const oe=new Set(te.map(Ae=>Ae.id)),ce=ja.filter(Ae=>Ae.source===P||Ae.target===P),fe=new Set;for(const Ae of ce)oe.has(Ae.source)||fe.add(Ae.source),oe.has(Ae.target)||fe.add(Ae.target);if(fe.size===0)return te;const ze=gs.filter(Ae=>fe.has(Ae.id)),ye=new Set([...oe,...fe]);return ie(Ae=>{const Ge=new Set(Ae.map(Fe=>`${Fe.source}|${Fe.target}|${Fe.type}`)),ct=ja.filter(Fe=>ye.has(Fe.source)&&ye.has(Fe.target)&&!Ge.has(`${Fe.source}|${Fe.target}|${Fe.type}`));return ct.length>0?[...Ae,...ct]:Ae}),[...te,...ze]})},loadRecent:async P=>{if(console.log("[MockGrackle] knowledge.loadRecent",P),Ze.current=P,P){const te=gs.filter(ce=>!ce.workspaceId||ce.workspaceId===P);ae(te);const oe=new Set(te.map(ce=>ce.id));ie(ja.filter(ce=>oe.has(ce.source)&&oe.has(ce.target)))}else ae(gs),ie(ja);ue("")},handleEvent:()=>!1}}),[s,o,u,p,g,y,k,w,C,I,D,$,Y,Q,me,ee,Z,re,ls,ks,Qs,Dn,Kn,cs,ea,Yn,Ne,Ce,cn,bn,us,ki,za,Si,Qr,ta,Qt,Jn,en,el,tl,nl,Ua,$a,Pa]);return r.jsx(Lm.Provider,{value:Ss,children:t})}const $8=3e3;function P8(t){const[s,i]=_.useState(!1),o=_.useRef(t.onSessionEvent);o.current=t.onSessionEvent;const c=_.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const u=_.useRef(t.onConnect);u.current=t.onConnect;const d=_.useRef(t.onDisconnect);return d.current=t.onDisconnect,_.useEffect(()=>{let p=!1,h;async function g(){var v,y;if(!p){try{const b=xe.streamEvents({});i(!0),Promise.resolve((v=u.current)==null?void 0:v.call(u)).catch(()=>{});for await(const k of b){if(p)break;const S=k.event;if(S.case==="sessionEvent"){const w=S.value;o.current({sessionId:w.sessionId,type:w.type,timestamp:w.timestamp,content:w.content,raw:w.raw})}else if(S.case==="domainEvent"){const w=S.value;c.current({id:w.id,type:w.type,timestamp:w.timestamp,payloadJson:w.payloadJson})}}}catch(b){if(b instanceof Wc&&b.code===WS.Unauthenticated){window.location.href=ON;return}}p||(i(!1),(y=d.current)==null||y.call(d),h=setTimeout(()=>{g().catch(()=>{})},$8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function V8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Eb(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd}}function H8(t){return{sessionId:t.sessionId,eventType:Fb(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function q8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:XS(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Ab(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:QS(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad}}function op(t){return{id:t.id,workspaceId:t.workspaceId,taskId:t.taskId,sessionId:t.sessionId,category:t.category,title:t.title,content:t.content,tags:[...t.tags],createdAt:t.createdAt}}function G8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function F8(t){return{claude:eT(t.claude),github:hc(t.github),copilot:hc(t.copilot),codex:hc(t.codex),goose:hc(t.goose)}}function Z8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function rp(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 K8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}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 lp(t){return{source:t.fromId,target:t.toId,type:t.type}}const Db=5e3;function Y8(){const[t,s]=_.useState([]),[i,o]=_.useState({}),c=_.useCallback(async()=>{try{const b=await xe.listEnvironments({});s(b.environments.map(V8))}catch{}},[]),u=_.useCallback(b=>{switch(b.type){case"environment.added":return!0;case"environment.removed":{const k=b.payload.environmentId;return k&&(s(S=>S.filter(w=>w.id!==k)),o(S=>{const w={...S};return delete w[k],w})),!0}case"environment.changed":return c().catch(()=>{}),!0;case"environment.provision_progress":{const k=b.payload;if(typeof k.environmentId!="string"||typeof k.stage!="string"||typeof k.message!="string"||typeof k.progress!="number")return bx("environment.provision_progress","invalid payload"),!0;if(o(S=>({...S,[k.environmentId]:{stage:k.stage,message:k.message,progress:k.progress}})),k.stage==="ready"){const S=k.environmentId;setTimeout(()=>{o(w=>{const j={...w};return delete j[S],j})},Db)}return!0}default:return!1}},[c]),d=_.useCallback(b=>{var k;if(b.type==="environments"){const S=Array.isArray((k=b.payload)==null?void 0:k.environments)?b.payload.environments:[];return s(S),!0}return!1},[]),p=_.useCallback(async(b,k,S)=>{try{await xe.addEnvironment({displayName:b,adapterType:k,adapterConfig:JSON.stringify(S??{})})}catch{}},[]),h=_.useCallback(async(b,k)=>{try{await xe.updateEnvironment({id:b,displayName:k.displayName,adapterConfig:k.adapterConfig?JSON.stringify(k.adapterConfig):void 0})}catch{}},[]),g=_.useCallback(async(b,k)=>{try{const S=xe.provisionEnvironment({id:b,force:k??!1});for await(const w of S)o(j=>({...j,[b]:{stage:w.stage,message:w.message,progress:w.progress}})),w.stage==="ready"&&setTimeout(()=>{o(j=>{const N={...j};return delete N[b],N})},Db)}catch{o(S=>{const w={...S};return delete w[b],w})}},[]),v=_.useCallback(async b=>{try{await xe.stopEnvironment({id:b})}catch{}},[]),y=_.useCallback(async b=>{try{await xe.removeEnvironment({id:b})}catch{}},[]);return{environments:t,provisionStatus:i,loadEnvironments:c,addEnvironment:p,updateEnvironment:h,provisionEnvironment:g,stopEnvironment:v,removeEnvironment:y,handleEvent:u,handleLegacyMessage:d}}const cp=new Set(["pending","running","idle"]),J8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Rb=["pending","running","idle"];function W8(){const[t,s]=_.useState([]),[i,o]=_.useState([]),[c,u]=_.useState(0),[d,p]=_.useState(void 0),[h,g]=_.useState({}),v=_.useCallback(async()=>{try{const D=(await xe.listSessions({})).sessions.map(Eb);s(q=>{const $=new Map(q.map(Y=>[Y.id,Y]));return D.map(Y=>{const G=$.get(Y.id),Q=G==null?void 0:G.status;return!Q||Q===Y.status?Y:J8.has(Q)&&cp.has(Y.status)?{...Y,status:Q,...G.endReason!==void 0?{endReason:G.endReason}:{}}:cp.has(Q)&&cp.has(Y.status)&&Rb.indexOf(Q)>Rb.indexOf(Y.status)?{...Y,status:Q}:Y})})}catch{}},[]),y=_.useCallback(R=>{if(R.type!=="session_event")return!1;if(!p8(R.payload))return bx("session_event","payload is not a valid SessionEvent"),!0;const D=R.payload;let q=0;if(o($=>{const Y=[...$,D];return Y.length>co?(q=Y.length-co,Y.slice(-co)):Y}),q>0&&u($=>$+q),D.eventType==="usage")try{const $=JSON.parse(D.content),Y=Number($.input_tokens)||0,G=Number($.output_tokens)||0,Q=Number($.cost_usd)||0;(Y>0||G>0||Q>0)&&s(ae=>ae.map(me=>me.id===D.sessionId?{...me,inputTokens:(me.inputTokens??0)+Y,outputTokens:(me.outputTokens??0)+G,costUsd:(me.costUsd??0)+Q}:me))}catch{}if(D.eventType==="status"){const $=_x(D.content),Y=xx(D.content);s(G=>G.some(ae=>ae.id===D.sessionId)?G.map(ae=>ae.id===D.sessionId?{...ae,status:$,...Y!==void 0?{endReason:Y}:{}}:ae):[...G,{id:D.sessionId,environmentId:"",runtime:"",status:$,prompt:"",startedAt:D.timestamp,...Y!==void 0?{endReason:Y}:{}}])}return!0},[]),b=_.useCallback(R=>{y({type:"session_event",payload:R})},[y]),k=_.useCallback(R=>{var D,q,$,Y,G;switch(R.type){case"sessions":{const Q=Array.isArray((D=R.payload)==null?void 0:D.sessions)?R.payload.sessions:[];return s(Q),!0}case"spawned":{const Q=(q=R.payload)==null?void 0:q.sessionId;return typeof Q=="string"&&Q&&p(Q),v().catch(()=>{}),!0}case"session_events":{const Q=Array.isArray(($=R.payload)==null?void 0:$.events)?R.payload.events:[];return Q.length>0&&o(Q),!0}case"task_sessions":{const Q=(Y=R.payload)==null?void 0:Y.taskId;if(typeof Q=="string"&&Q){const ae=Array.isArray((G=R.payload)==null?void 0:G.sessions)?R.payload.sessions:[];g(me=>({...me,[Q]:ae}))}return!0}default:return!1}},[v]),S=_.useCallback(async(R,D,q,$)=>{try{const Y=await xe.spawnAgent({environmentId:R,prompt:D,personaId:q||"",workingDirectory:$||""});p(Y.id),await v()}catch{}},[v]),w=_.useCallback(async(R,D)=>{try{await xe.sendInput({sessionId:R,text:D})}catch{}},[]),j=_.useCallback(async R=>{try{await xe.killAgent({id:R,graceful:!1})}catch{}},[]),N=_.useCallback(async R=>{try{await xe.killAgent({id:R,graceful:!0})}catch{}},[]),C=_.useCallback(async R=>{try{const q=(await xe.getSessionEvents({id:R})).events.map(H8);if(q.length>0){let $=0;o(Y=>{const G=new Set;for(const me of Y)me.sessionId===R&&G.add(`${me.timestamp}|${me.eventType}`);const Q=q.filter(me=>!G.has(`${me.timestamp}|${me.eventType}`)),ae=[...Y,...Q].sort((me,ie)=>me.sessionId!==ie.sessionId?0:me.timestamp.localeCompare(ie.timestamp));return ae.length>co?($=ae.length-co,ae.slice(-co)):ae}),$>0&&u(Y=>Y+$)}}catch{}},[]),E=_.useCallback(()=>{o([]),u(0)},[]),I=_.useCallback(async R=>{try{const q=(await xe.getTaskSessions({id:R})).sessions.map(Eb);g($=>({...$,[R]:q}))}catch{}},[]);return{sessions:t,events:i,eventsDropped:c,lastSpawnedId:d,taskSessions:h,loadSessions:v,spawn:S,sendInput:w,kill:j,stopGraceful:N,loadSessionEvents:C,clearEvents:E,loadTaskSessions:I,handleMessage:y,handleSessionEvent:b,handleLegacyMessage:k}}function X8(){const[t,s]=_.useState([]),[i,o]=_.useState(!1),c=_.useCallback(async()=>{try{const v=await xe.listWorkspaces({});s(v.workspaces.map(q8))}catch{}},[]),u=_.useCallback(v=>{switch(v.type){case"workspace.created":return o(!1),c().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return c().catch(()=>{}),!0;default:return!1}},[c]),d=_.useCallback(()=>{o(!1)},[]),p=_.useCallback(async(v,y,b,k,S,w,j,N,C)=>{o(!0);try{await xe.createWorkspace({name:v,description:y||"",repoUrl:b||"",environmentId:k||"",defaultPersonaId:S||void 0,useWorktrees:w??!0,workingDirectory:j||void 0}),o(!1),N==null||N()}catch(E){o(!1);const I=E instanceof Wc?E.message:"Failed to create workspace";C==null||C(I)}},[]),h=_.useCallback(async v=>{try{await xe.archiveWorkspace({id:v})}catch{}},[]),g=_.useCallback(async(v,y)=>{try{await xe.updateWorkspace({id:v,...y})}catch{}},[]);return{workspaces:t,workspaceCreating:i,loadWorkspaces:c,createWorkspace:p,archiveWorkspace:h,updateWorkspace:g,handleEvent:u,onDisconnect:d}}function Q8(){const[t,s]=_.useState([]),[i,o]=_.useState(void 0),c=_.useRef({}),u=_.useCallback(async C=>{try{const I=(await xe.listTasks({workspaceId:C})).tasks.map(Ab);s(R=>[...R.filter(D=>D.workspaceId!==C),...I])}catch{}},[]),d=_.useCallback(async()=>{try{const E=(await xe.listTasks({})).tasks.map(Ab);s(I=>{const R=new Set(E.map(D=>D.id));return[...I.filter(D=>!R.has(D.id)),...E]})}catch{}},[]),p=_.useCallback((C,E)=>{const I=R=>{clearTimeout(c.current[R]),c.current[R]=setTimeout(()=>{delete c.current[R],u(R).catch(()=>{})},200)};C?I(C):E&&s(R=>{const D=R.find(q=>q.id===E);return D!=null&&D.workspaceId?I(D.workspaceId):d().catch(()=>{}),R})},[u,d]),h=_.useCallback(C=>{const E=C.payload;switch(C.type){case"task.created":{const I=typeof E.workspaceId=="string"?E.workspaceId:"";return I&&u(I).catch(()=>{}),!0}case"task.started":{const I=typeof E.taskId=="string"?E.taskId:"",R=typeof E.sessionId=="string"?E.sessionId:"",D=typeof E.workspaceId=="string"?E.workspaceId:"";return o(q=>I&&q===I?void 0:q),R&&I&&s(q=>q.map($=>$.id===I?{...$,latestSessionId:R}:$)),p(D,I),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const I=typeof E.workspaceId=="string"?E.workspaceId:"",R=typeof E.taskId=="string"?E.taskId:"";return p(I,R),!0}default:return!1}},[u,p]),g=_.useCallback(()=>{o(void 0)},[]),v=_.useCallback(C=>{var E,I;if(C.type==="tasks"){const R=Array.isArray((E=C.payload)==null?void 0:E.tasks)?C.payload.tasks:[],D=typeof((I=C.payload)==null?void 0:I.workspaceId)=="string"&&C.payload.workspaceId?C.payload.workspaceId:"";return s(D?q=>[...q.filter($=>$.workspaceId!==D),...R]:q=>{const $=new Set(R.map(Y=>Y.id));return[...q.filter(Y=>!$.has(Y.id)),...R]}),!0}return!1},[]),y=_.useCallback(async(C,E,I,R,D,q,$,Y,G)=>{try{await xe.createTask({workspaceId:C,title:E,description:I||"",dependsOn:R||[],parentTaskId:D||"",defaultPersonaId:q||void 0,canDecompose:$??void 0}),Y==null||Y()}catch(Q){const ae=Q instanceof Wc?Q.message:"Failed to create task";G==null||G(ae)}},[]),b=_.useCallback(async(C,E,I,R)=>{o(C);try{await xe.startTask({taskId:C,personaId:E||"",environmentId:I||"",notes:R||""})}catch{o(void 0)}},[]),k=_.useCallback(async C=>{try{await xe.stopTask({id:C})}catch{}},[]),S=_.useCallback(async C=>{try{await xe.completeTask({id:C})}catch{}},[]),w=_.useCallback(async C=>{try{await xe.resumeTask({id:C})}catch{}},[]),j=_.useCallback(async(C,E,I,R,D)=>{try{await xe.updateTask({id:C,title:E,description:I,dependsOn:R,...D!==void 0?{defaultPersonaId:D}:{}})}catch{}},[]),N=_.useCallback(async C=>{try{await xe.deleteTask({id:C})}catch{}},[]);return{tasks:t,taskStartingId:i,loadTasks:u,loadAllTasks:d,createTask:y,startTask:b,stopTask:k,completeTask:S,resumeTask:w,updateTask:j,deleteTask:N,handleEvent:h,onDisconnect:g,handleLegacyMessage:v}}function eL(){const[t,s]=_.useState([]),[i,o]=_.useState(void 0),[c,u]=_.useState(!1),d=_.useCallback(async y=>{try{const b=await xe.queryFindings({workspaceId:y});s(b.findings.map(op))}catch{}},[]),p=_.useCallback(async()=>{try{const y=await xe.queryFindings({workspaceId:""});s(y.findings.map(op))}catch{}},[]),h=_.useCallback(async y=>{o(void 0),u(!0);try{const b=await xe.getFinding({id:y});o(op(b))}catch{o(void 0)}finally{u(!1)}},[]),g=_.useCallback(y=>{if(y.type==="finding.posted"){const b=typeof y.payload.workspaceId=="string"?y.payload.workspaceId:"";return b&&d(b).catch(()=>{}),!0}return!1},[d]),v=_.useCallback(async(y,b,k,S,w)=>{try{await xe.postFinding({workspaceId:y,title:b,content:k,category:S??"general",tags:w??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,loadFindings:d,loadAllFindings:p,loadFinding:h,postFinding:v,handleEvent:g}}function tL(){const[t,s]=_.useState([]),i=_.useCallback(async()=>{try{const d=await xe.listTokens({});s(d.tokens.map(G8))}catch{}},[]),o=_.useCallback(d=>d.type==="token.changed"?(i().catch(()=>{}),!0):!1,[i]),c=_.useCallback(async(d,p,h,g,v)=>{try{await xe.setToken({name:d,value:p,type:h,envVar:g,filePath:v})}catch{}},[]),u=_.useCallback(async d=>{try{await xe.deleteToken({name:d})}catch{}},[]);return{tokens:t,loadTokens:i,setToken:c,deleteToken:u,handleEvent:o}}function nL(){const[t,s]=_.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),i=_.useCallback(async()=>{try{const u=await xe.getCredentialProviders({});s(F8(u))}catch{}},[]),o=_.useCallback(u=>u.type==="credential.providers_changed"?(h8(u.payload)&&s(u.payload),!0):!1,[]),c=_.useCallback(async u=>{const d=[{provider:"claude",value:u.claude},{provider:"github",value:u.github},{provider:"copilot",value:u.copilot},{provider:"codex",value:u.codex},{provider:"goose",value:u.goose}];await Promise.allSettled(d.map(({provider:p,value:h})=>xe.setCredentialProvider({provider:p,value:h})))},[]);return{credentialProviders:t,loadCredentials:i,updateCredentialProviders:c,handleEvent:o}}function sL(){const[t,s]=_.useState([]),[i,o]=_.useState(""),[c,u]=_.useState(""),[d,p]=_.useState(!1),h=_.useCallback(async()=>{try{const v=await xe.listCodespaces({});s(v.codespaces.map(Z8)),u(v.error)}catch{}},[]),g=_.useCallback(async(v,y)=>{p(!0),o("");try{await xe.createCodespace({repo:v,machine:y??""}),p(!1),await h()}catch(b){p(!1);const k=b instanceof Wc?b.message:"Failed to create codespace";o(k)}},[h]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function aL(){const[t,s]=_.useState([]),i=_.useCallback(async()=>{try{const p=await xe.listPersonas({});s(p.personas.map(rp))}catch{}},[]),o=_.useCallback(p=>{switch(p.type){case"persona.created":case"persona.updated":case"persona.deleted":return i().catch(()=>{}),!0;default:return!1}},[i]),c=_.useCallback(async(p,h,g,v,y,b,k,S,w)=>{const j=await xe.createPersona({name:p,description:h,systemPrompt:g,runtime:v||"",model:y||"",maxTurns:b||0,type:k||"agent",script:S||"",allowedMcpTools:w||[]}),N=rp(j);return s(C=>[...C.filter(E=>E.id!==N.id),N]),N},[]),u=_.useCallback(async(p,h,g,v,y,b,k,S,w,j)=>{const N={id:p};h!==void 0&&(N.name=h),g!==void 0&&(N.description=g),v!==void 0&&(N.systemPrompt=v),y!==void 0&&(N.runtime=y),b!==void 0&&(N.model=b),k!==void 0&&(N.maxTurns=k),S!==void 0&&(N.type=S),w!==void 0&&(N.script=w),j!==void 0&&(N.allowedMcpTools={tools:j});const C=await xe.updatePersona(N),E=rp(C);return s(I=>I.map(R=>R.id===E.id?E:R)),E},[]),d=_.useCallback(async p=>{await xe.deletePersona({id:p}),s(h=>h.filter(g=>g.id!==p))},[]);return{personas:t,loadPersonas:i,createPersona:c,updatePersona:u,deletePersona:d,handleEvent:o}}function iL(t){if(t)try{return JSON.parse(t)}catch{return}}function oL(){const[t,s]=_.useState(new Map),[i,o]=_.useState([]),[c,u]=_.useState(void 0),[d,p]=_.useState(void 0),[h,g]=_.useState(!1),[v,y]=_.useState(""),b=_.useRef(""),k=_.useCallback(async I=>{const R=I??"";b.current=R,y(""),g(!0);try{const D=await xe.listRecentKnowledgeNodes({limit:30,workspaceId:R}),q=new Map,$=[];for(const Y of D.nodes)q.set(Y.id,jc(Y));for(const Y of D.edges)$.push(lp(Y));for(const Y of $){const G=q.get(Y.source);G&&(G.val+=1);const Q=q.get(Y.target);Q&&(Q.val+=1)}s(q),o($)}catch{}finally{g(!1)}},[]),S=_.useCallback(async I=>{if(I.trim()){y(I),p(void 0),u(void 0),g(!0);try{const R=await xe.searchKnowledge({query:I,limit:20,workspaceId:b.current}),D=new Map,q=[];for(const $ of R.results){$.node&&D.set($.node.id,jc($.node,$.edges.length));for(const Y of $.edges)q.push(lp(Y))}s(D),o(q)}catch{}finally{g(!1)}}},[]),w=_.useCallback(()=>{k(b.current).catch(()=>{})},[k]),j=_.useCallback(async I=>{p(I);try{const R=await xe.getKnowledgeNode({id:I});if(!R.node){u(void 0);return}u({node:jc(R.node,R.edges.length),edges:R.edges.map(D=>({fromId:D.fromId,toId:D.toId,type:D.type,metadata:iL(D.metadataJson)}))})}catch{u(void 0)}},[]),N=_.useCallback(()=>{p(void 0),u(void 0)},[]),C=_.useCallback(async I=>{try{const R=await xe.expandKnowledgeNode({id:I,depth:1});s(D=>{const q=new Map(D);for(const $ of R.nodes)q.has($.id)||q.set($.id,jc($));return q}),o(D=>{const q=new Set(D.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of R.edges){const G=lp(Y),Q=`${G.source}:${G.target}:${G.type}`;q.has(Q)||$.push(G)}return[...D,...$]})}catch{}},[]),E=_.useCallback(I=>!1,[]);return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:S,clearSearch:w,selectNode:j,clearSelection:N,expandNode:C,loadRecent:k,handleEvent:E}}function rL(){const[t,s]=_.useState(""),[i,o]=_.useState(void 0),[c,u]=_.useState({}),d=Y8(),p=W8(),h=X8(),g=Q8(),v=eL(),y=tL(),b=nL(),k=sL(),S=aL(),w=oL(),{connected:j}=P8({onSessionEvent:G=>{p.handleSessionEvent({sessionId:G.sessionId,eventType:Fb(G.type),timestamp:G.timestamp,content:G.content,raw:G.raw||void 0})},onDomainEvent:G=>{try{const Q=JSON.parse(G.payloadJson);D({id:G.id,type:G.type,timestamp:G.timestamp,payload:Q})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",G.payloadJson)}},onConnect:q,onDisconnect:$}),N="default_persona_id",C="onboarding_completed",E=_.useCallback(async G=>{const Q=await xe.setSetting({key:N,value:G});s(Q.value)},[]),I=_.useCallback(async()=>{o(!0);try{await xe.setSetting({key:C,value:"true"})}catch{}},[]),R=_.useCallback(async(G,Q)=>{try{const ae=await xe.getUsage({scope:G,id:Q}),me=`${G}:${Q}`;u(ie=>({...ie,[me]:K8(ae)}))}catch{}},[]);function D(G){const Q=G.payload.key,ae=G.payload.value;if(G.type==="setting.changed"){Q===N&&s(ae??""),Q===C&&o(ae==="true");return}if(d.handleEvent(G)){(G.type==="environment.removed"||G.type==="environment.changed")&&p.loadSessions().catch(()=>{});return}if(!h.handleEvent(G)){if(g.handleEvent(G)){G.type==="task.started"&&p.loadSessions().catch(()=>{});return}v.handleEvent(G)||y.handleEvent(G)||b.handleEvent(G)||S.handleEvent(G)||w.handleEvent(G)}}async function q(){d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{}),b.loadCredentials().catch(()=>{}),S.loadPersonas().catch(()=>{}),g.loadAllTasks().catch(()=>{});try{const G=await xe.getSetting({key:N});s(G.value)}catch{}try{const G=await xe.getSetting({key:C});o(G.value==="true")}catch{}}function $(){h.onDisconnect(),g.onDisconnect()}const Y=_.useCallback(()=>{d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{})},[d.loadEnvironments,p.loadSessions,h.loadWorkspaces,y.loadTokens]);return{connected:j,environments:d.environments,sessions:p.sessions,events:p.events,eventsDropped:p.eventsDropped,lastSpawnedId:p.lastSpawnedId,workspaces:h.workspaces,tasks:g.tasks,findings:v.findings,selectedFinding:v.selectedFinding,findingLoading:v.findingLoading,tokens:y.tokens,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,refresh:Y,loadSessionEvents:p.loadSessionEvents,clearEvents:p.clearEvents,loadWorkspaces:h.loadWorkspaces,createWorkspace:h.createWorkspace,archiveWorkspace:h.archiveWorkspace,updateWorkspace:h.updateWorkspace,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask,loadFindings:v.loadFindings,loadAllFindings:v.loadAllFindings,loadFinding:v.loadFinding,postFinding:v.postFinding,loadEnvironments:d.loadEnvironments,addEnvironment:d.addEnvironment,updateEnvironment:d.updateEnvironment,loadTokens:y.loadTokens,setToken:y.setToken,deleteToken:y.deleteToken,credentialProviders:b.credentialProviders,updateCredentialProviders:b.updateCredentialProviders,provisionStatus:d.provisionStatus,provisionEnvironment:d.provisionEnvironment,stopEnvironment:d.stopEnvironment,removeEnvironment:d.removeEnvironment,codespaces:k.codespaces,codespaceError:k.codespaceError,codespaceListError:k.codespaceListError,codespaceCreating:k.codespaceCreating,listCodespaces:k.listCodespaces,createCodespace:k.createCodespace,workspaceCreating:h.workspaceCreating,taskStartingId:g.taskStartingId,personas:S.personas,createPersona:S.createPersona,updatePersona:S.updatePersona,deletePersona:S.deletePersona,taskSessions:p.taskSessions,loadTaskSessions:p.loadTaskSessions,appDefaultPersonaId:t,setAppDefaultPersonaId:E,onboardingCompleted:i,completeOnboarding:I,usageCache:c,loadUsage:R,knowledge:w}}function lL({children:t}){const s=rL();return r.jsx(Lm.Provider,{value:s,children:t})}function cL(t,s){const i=_.useRef(null);_.useEffect(()=>{const o=i.current;if(i.current=t,o===null)return;const c=new Map;for(const d of o)c.set(d.id,d);const u=new Set;for(const d of t){u.add(d.id);const p=c.get(d.id);if(p&&p.status!==d.status&&d.status!=="sleeping"){if(d.status==="connecting"){s("Provisioning environment…","info");continue}d.status==="connected"?s("Environment connected","success"):d.status==="error"?s("Environment provision failed","error"):d.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const d of o)u.has(d.id)||s("Environment removed","info")},[t,s])}const uL={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 dL(t){return uL[t]}function fL(t,s){if(t===void 0)return[];const i=[],o=new Map;for(const u of t)o.set(u.id,u);const c=new Set;for(const u of s){c.add(u.id);const d=o.get(u.id);if(!d||d.status===u.status)continue;const p=dL(u.status);p&&i.push(p)}for(const u of t)c.has(u.id)||i.push({message:"Task deleted",variant:"info"});return i}function pL(t,s){const i=_.useRef(void 0);_.useEffect(()=>{const o=i.current;i.current=t;const c=fL(o,t);for(const u of c)s(u.message,u.variant)},[t,s])}const mL="_dashboard_16pzm_1",hL="_kpiStrip_16pzm_11",gL="_kpiCard_16pzm_23",vL="_kpiValue_16pzm_68",yL="_kpiLabel_16pzm_76",bL="_bodyGrid_16pzm_84",_L="_section_16pzm_96",xL="_sectionHeader_16pzm_109",kL="_sectionIcon_16pzm_118",SL="_sectionTitle_16pzm_123",TL="_sectionCount_16pzm_131",wL="_sectionBody_16pzm_138",NL="_emptyHint_16pzm_143",jL="_sessionRow_16pzm_150",CL="_sessionPrompt_16pzm_177",EL="_sessionEnv_16pzm_186",AL="_sessionRuntime_16pzm_192",DL="_sessionStatus_16pzm_198",RL="_statusDot_16pzm_207",ML="_attentionRow_16pzm_233",IL="_attentionTitle_16pzm_259",OL="_attentionMeta_16pzm_267",BL="_reasonBadge_16pzm_274",LL="_bottomGrid_16pzm_301",zL="_envRow_16pzm_312",UL="_envName_16pzm_323",$L="_envStatusBadge_16pzm_333",PL="_workspaceRow_16pzm_369",VL="_workspaceTop_16pzm_395",HL="_workspaceName_16pzm_401",qL="_workspaceCounts_16pzm_407",GL="_progressBar_16pzm_415",FL="_progressFill_16pzm_422",_e={dashboard:mL,kpiStrip:hL,kpiCard:gL,kpiValue:vL,kpiLabel:yL,bodyGrid:bL,section:_L,sectionHeader:xL,sectionIcon:kL,sectionTitle:SL,sectionCount:TL,sectionBody:wL,emptyHint:NL,sessionRow:jL,sessionPrompt:CL,sessionEnv:EL,sessionRuntime:AL,sessionStatus:DL,statusDot:RL,attentionRow:ML,attentionTitle:IL,attentionMeta:OL,reasonBadge:BL,bottomGrid:LL,envRow:zL,envName:UL,envStatusBadge:$L,workspaceRow:PL,workspaceTop:VL,workspaceName:HL,workspaceCounts:qL,progressBar:GL,progressFill:FL},ZL={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Cc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function KL(t,s,i,o){const c=[`${t} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),o>0&&c.push(`${o} failed`),c.join(", ")}function Ec({value:t,label:s,accent:i,index:o,testId:c}){return r.jsxs(It.div,{className:_e.kpiCard,"data-accent":i,"data-testid":c,variants:ZL,initial:"hidden",animate:"visible",custom:o,children:[r.jsx("span",{className:_e.kpiValue,children:t}),r.jsx("span",{className:_e.kpiLabel,children:s})]})}function YL(){const{workspaces:t,tasks:s,sessions:i,environments:o,loadTasks:c}=lt(),u=yt(),d=_.useRef(new Set);_.useEffect(()=>{for(const y of t)d.current.has(y.id)||(d.current.add(y.id),c(y.id).catch(()=>{}))},[t,c]);const p=_.useMemo(()=>N8(i,s,o),[i,s,o]),h=_.useMemo(()=>C8(i,o),[i,o]),g=_.useMemo(()=>j8(s,t),[s,t]),v=_.useMemo(()=>E8(t,s),[t,s,o]);return r.jsxs("div",{className:_e.dashboard,"data-testid":"dashboard",children:[r.jsxs("div",{className:_e.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[r.jsx(Ec,{value:p.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),r.jsx(Ec,{value:p.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),r.jsx(Ec,{value:p.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),r.jsx(Ec,{value:p.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),r.jsxs("div",{className:_e.bodyGrid,children:[r.jsxs(It.div,{className:_e.section,variants:Cc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"●"}),r.jsx("span",{className:_e.sectionTitle,children:"Active Sessions"}),r.jsx("span",{className:_e.sectionCount,children:h.length})]}),r.jsx("div",{className:_e.sectionBody,children:h.length===0?r.jsx("div",{className:_e.emptyHint,children:"No active sessions"}):h.map(({session:y,environmentName:b})=>r.jsxs("button",{type:"button",className:_e.sessionRow,onClick:()=>u(Xp(y.id)),"data-testid":"session-row",children:[r.jsx("span",{className:_e.sessionPrompt,title:y.prompt,children:y.prompt||"—"}),r.jsx("span",{className:_e.sessionEnv,children:b}),r.jsx("span",{className:_e.sessionRuntime,children:y.runtime}),r.jsxs("span",{className:_e.sessionStatus,children:[r.jsx("span",{className:_e.statusDot,"data-status":y.status}),y.status]})]},y.id))})]}),r.jsxs(It.div,{className:_e.section,variants:Cc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"⚑"}),r.jsx("span",{className:_e.sectionTitle,children:"Needs Attention"}),r.jsx("span",{className:_e.sectionCount,children:g.length})]}),r.jsx("div",{className:_e.sectionBody,children:g.length===0?r.jsx("div",{className:_e.emptyHint,children:"All clear"}):g.map(({task:y,reason:b,workspaceName:k})=>r.jsxs("button",{type:"button",className:_e.attentionRow,onClick:()=>u(os(y.id)),"data-testid":"attention-row",children:[r.jsxs("div",{className:_e.attentionTitle,children:[r.jsx("span",{className:_e.reasonBadge,"data-reason":b,children:b}),y.title]}),r.jsx("div",{className:_e.attentionMeta,children:r.jsx("span",{children:k})})]},y.id))})]})]}),r.jsxs("div",{className:_e.bottomGrid,children:[r.jsxs(It.div,{className:_e.section,variants:Cc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"◈"}),r.jsx("span",{className:_e.sectionTitle,children:"Environment Health"}),r.jsx("span",{className:_e.sectionCount,children:o.length})]}),r.jsx("div",{className:_e.sectionBody,children:o.length===0?r.jsx("div",{className:_e.emptyHint,children:"No environments configured"}):o.map(y=>r.jsxs("div",{className:_e.envRow,"data-testid":"dashboard-env-row",children:[r.jsx("span",{className:_e.envName,children:y.displayName}),r.jsx("span",{className:_e.envStatusBadge,"data-status":y.status,children:y.status})]},y.id))})]}),r.jsxs(It.div,{className:_e.section,variants:Cc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"▦"}),r.jsx("span",{className:_e.sectionTitle,children:"Workspaces"}),r.jsx("span",{className:_e.sectionCount,children:t.length})]}),r.jsx("div",{className:_e.sectionBody,children:v.length===0?r.jsx("div",{className:_e.emptyHint,children:"No workspaces yet"}):v.map(({workspace:y,totalTasks:b,completedTasks:k,workingTasks:S,failedTasks:w})=>{const j=b>0?Math.round(k/b*100):0;return r.jsxs("button",{type:"button",className:_e.workspaceRow,onClick:()=>u(mi(y.id,y.environmentId)),"data-testid":"workspace-row",children:[r.jsxs("div",{className:_e.workspaceTop,children:[r.jsx("span",{className:_e.workspaceName,children:y.name}),r.jsxs("span",{className:_e.workspaceCounts,"aria-label":KL(k,b,S,w),children:[k,"/",b,S>0&&r.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",S]}),w>0&&r.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",w]})]})]}),b>0&&r.jsx("div",{className:_e.progressBar,children:r.jsx("div",{className:_e.progressFill,style:{width:`${j}%`}})})]},y.id)})})]})]})]})}const JL="_panelContainer_101ly_1",WL="_emptyState_101ly_8",XL="_fadeIn_101ly_1",QL="_workspaceSummary_101ly_17",ez="_workspaceSummaryTitle_101ly_28",tz="_workspaceSummarySubtitle_101ly_32",nz="_header_101ly_36",sz="_headerInfo_101ly_71",az="_killButton_101ly_77",iz="_headerTitle_101ly_106",oz="_headerActions_101ly_121",rz="_taskStatusBadge_101ly_128",lz="_taskBranch_101ly_137",cz="_taskBlockedBadge_101ly_143",uz="_btnPrimary_101ly_151",dz="_btnDanger_101ly_182",fz="_btnGhost_101ly_221",pz="_rejectInput_101ly_247",mz="_tabBar_101ly_277",hz="_tab_101ly_277",gz="_active_101ly_303",vz="_eventScroll_101ly_308",yz="_tabContent_101ly_314",bz="_noContext_101ly_319",_z="_overviewContent_101ly_325",xz="_overviewDashboard_101ly_334",kz="_overviewHero_101ly_340",Sz="_statusBadge_101ly_347",Tz="_statusPending_101ly_359",wz="_statusAssigned_101ly_364",Nz="_statusInProgress_101ly_369",jz="_statusReview_101ly_374",Cz="_statusDone_101ly_379",Ez="_statusFailed_101ly_384",Az="_statusWaitingInput_101ly_389",Dz="_overviewBranchPill_101ly_394",Rz="_branchLink_101ly_409",Mz="_overviewSection_101ly_420",Iz="_overviewLabel_101ly_426",Oz="_overviewValue_101ly_433",Bz="_overviewMuted_101ly_438",Lz="_overviewMarkdown_101ly_444",zz="_envRow_101ly_513",Uz="_envDot_101ly_519",$z="_envDotGreen_101ly_526",Pz="_envDotYellow_101ly_530",Vz="_envDotRed_101ly_534",Hz="_envDotGray_101ly_538",qz="_depList_101ly_542",Gz="_depItem_101ly_548",Fz="_depBlocked_101ly_555",Zz="_depDone_101ly_559",Kz="_timeline_101ly_563",Yz="_timelineRow_101ly_569",Jz="_timelineKey_101ly_576",Wz="_timelineValue_101ly_582",Xz="_timelineDelta_101ly_586",Qz="_reviewNotes_101ly_597",e7="_overviewDescription_101ly_608",t7="_waitingMessage_101ly_614",n7="_errorMessage_101ly_618",s7="_attemptSelector_101ly_622",a7="_attemptLabel_101ly_638",i7="_attemptButton_101ly_642",o7="_attemptActive_101ly_659",r7="_attemptStatus_101ly_665",l7="_emptyCta_101ly_671",c7="_ctaTitle_101ly_683",u7="_ctaDescription_101ly_689",d7="_ctaButton_101ly_696",f7="_ctaCreateForm_101ly_731",p7="_ctaCreateInput_101ly_737",m7="_ctaCreateOk_101ly_768",h7="_ctaLink_101ly_803",g7="_workspaceHeader_101ly_817",v7="_workspaceName_101ly_842",y7="_workspaceMeta_101ly_855",b7="_metaRow_101ly_863",_7="_metaLabel_101ly_876",x7="_metaValue_101ly_891",k7="_archiveButton_101ly_901",S7="_repoLink_101ly_931",T7="_metaToggle_101ly_941",w7="_metaToggleArrow_101ly_962",N7="_metaToggleArrowOpen_101ly_967",j7="_progressBarContainer_101ly_971",C7="_progressBar_101ly_971",E7="_progressFill_101ly_987",A7="_progressLabel_101ly_994",D7="_metaTimestamps_101ly_1001",R7="_metaTimestamp_101ly_1001",U={panelContainer:JL,emptyState:WL,fadeIn:XL,workspaceSummary:QL,workspaceSummaryTitle:ez,workspaceSummarySubtitle:tz,header:nz,headerInfo:sz,killButton:az,headerTitle:iz,headerActions:oz,taskStatusBadge:rz,taskBranch:lz,taskBlockedBadge:cz,btnPrimary:uz,btnDanger:dz,btnGhost:fz,rejectInput:pz,tabBar:mz,tab:hz,active:gz,eventScroll:vz,tabContent:yz,noContext:bz,overviewContent:_z,overviewDashboard:xz,overviewHero:kz,statusBadge:Sz,statusPending:Tz,statusAssigned:wz,statusInProgress:Nz,statusReview:jz,statusDone:Cz,statusFailed:Ez,statusWaitingInput:Az,overviewBranchPill:Dz,branchLink:Rz,overviewSection:Mz,overviewLabel:Iz,overviewValue:Oz,overviewMuted:Bz,overviewMarkdown:Lz,envRow:zz,envDot:Uz,envDotGreen:$z,envDotYellow:Pz,envDotRed:Vz,envDotGray:Hz,depList:qz,depItem:Gz,depBlocked:Fz,depDone:Zz,timeline:Kz,timelineRow:Yz,timelineKey:Jz,timelineValue:Wz,timelineDelta:Xz,reviewNotes:Qz,overviewDescription:e7,waitingMessage:t7,errorMessage:n7,attemptSelector:s7,attemptLabel:a7,attemptButton:i7,attemptActive:o7,attemptStatus:r7,emptyCta:l7,ctaTitle:c7,ctaDescription:u7,ctaButton:d7,ctaCreateForm:f7,ctaCreateInput:p7,ctaCreateOk:m7,ctaLink:h7,workspaceHeader:g7,workspaceName:v7,workspaceMeta:y7,metaRow:b7,metaLabel:_7,metaValue:x7,archiveButton:k7,repoLink:S7,metaToggle:T7,metaToggleArrow:w7,metaToggleArrowOpen:N7,progressBarContainer:j7,progressBar:C7,progressFill:E7,progressLabel:A7,metaTimestamps:D7,metaTimestamp:R7};function M7(){return r.jsx("div",{className:U.emptyState,children:"Select a task or click + to create one"})}function I7(){return r.jsx("div",{className:U.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function O7(){const{workspaces:t,environments:s}=lt(),i=yt(),o=s.length>0;return t.length>0?r.jsx(YL,{}):r.jsxs("div",{className:U.emptyCta,"data-testid":"welcome-cta",children:[r.jsx("div",{className:U.ctaTitle,children:"Welcome to Grackle"}),r.jsx("div",{className:U.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),r.jsx("button",{className:U.ctaButton,onClick:()=>i(g_),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&r.jsx("div",{className:U.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const B7="_panelContainer_19poq_1",L7="_chatHeader_19poq_8",z7="_chatHeaderInfo_19poq_37",U7="_emptyState_19poq_43",$7="_emptyTitle_19poq_55",P7="_emptyDescription_19poq_61",V7="_emptyHint_19poq_67",fi={panelContainer:B7,chatHeader:L7,chatHeaderInfo:z7,emptyState:U7,emptyTitle:$7,emptyDescription:P7,emptyHint:V7};function H7({hasLocalEnvironment:t}){return r.jsxs("div",{className:fi.emptyState,"data-testid":"chat-empty-state",children:[r.jsx("div",{className:fi.emptyTitle,children:"Welcome to Grackle"}),r.jsx("div",{className:fi.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&&r.jsx("div",{className:fi.emptyHint,children:"Go to Settings → Environments to add one."})]})}function q7(){const{tasks:t,sessions:s,events:i,eventsDropped:o,environments:c,loadTaskSessions:u,loadSessionEvents:d,kill:p,stopGraceful:h,taskSessions:g,sendInput:v,spawn:y,startTask:b,personas:k,provisionEnvironment:S}=lt(),{showToast:w}=vn(),j=_.useRef(void 0),[N,C]=_.useState(),E=t.find(G=>G.id===br),I=E!=null&&E.latestSessionId?s.find(G=>G.id===E.latestSessionId)??(g[br]??[]).find(G=>G.id===E.latestSessionId):void 0;_.useEffect(()=>{u(br).catch(()=>{})},[u]),_.useEffect(()=>{E!=null&&E.latestSessionId&&u(br).catch(()=>{})},[E==null?void 0:E.latestSessionId,u]),_.useEffect(()=>{I&&I.id!==j.current&&(j.current=I.id,d(I.id).catch(()=>{}))},[I==null?void 0:I.id,d]);const R=_.useMemo(()=>{if(!I)return[];const G=i.filter(Q=>Q.sessionId===I.id);return $m(Um(G))},[i,I==null?void 0:I.id]),D=c.find(G=>G.adapterType==="local"&&G.status==="connected"),q=I!==void 0&&I.status!=="stopped"&&I.status!=="suspended",$=(I==null?void 0:I.status)==="idle";_.useEffect(()=>{N&&I&&$&&(v(I.id,N).catch(()=>{}),C(void 0))},[N,$,I==null?void 0:I.id,v]);const Y=_.useCallback((G,Q,ae,me)=>{me&&C(me),b(G,Q,ae).catch(()=>{})},[b]);return r.jsxs("div",{className:fi.panelContainer,"data-testid":"chat-page",children:[q&&r.jsxs("div",{className:fi.chatHeader,children:[r.jsxs("span",{className:fi.chatHeaderInfo,children:["Session: ",I.id.slice(0,8)," | ",I.runtime," | ",I.status]}),r.jsx(y_,{label:"Stop",onClick:()=>{h(I.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{h(I.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{p(I.id).catch(()=>{})}}]})]}),r.jsx(Im,{events:R,eventsDropped:o,emptyState:r.jsx(H7,{hasLocalEnvironment:!!D})}),D&&q&&r.jsx(Lr,{mode:"send",sessionId:I.id,environmentId:I.environmentId,personas:k,environments:c,onSendInput:(G,Q)=>{v(G,Q).catch(()=>{})},onSpawn:(G,Q,ae)=>{y(G,Q,ae).catch(()=>{})},onStartTask:(G,Q,ae)=>{b(G,Q,ae).catch(()=>{})},onProvisionEnvironment:G=>{S(G).catch(()=>{})},onShowToast:w}),D&&!q&&r.jsx(Lr,{mode:"start",taskId:br,environmentId:D.id,personas:k,environments:c,onSendInput:(G,Q)=>{v(G,Q).catch(()=>{})},onSpawn:(G,Q,ae)=>{y(G,Q,ae).catch(()=>{})},onStartTask:Y,onProvisionEnvironment:G=>{S(G).catch(()=>{})},onShowToast:w})]})}function G7(){const t=b8(),[s]=Wp(),i=s.get("env")??"",{sendInput:o,spawn:c,startTask:u,personas:d,environments:p,provisionEnvironment:h}=lt(),{showToast:g}=vn();return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:U.emptyState,children:"Enter a prompt below to start a new session"}),r.jsx(Lr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:p,onSendInput:(v,y)=>{o(v,y).catch(()=>{})},onSpawn:(v,y,b)=>{c(v,y,b).catch(()=>{})},onStartTask:(v,y,b)=>{u(v,y,b).catch(()=>{})},onProvisionEnvironment:v=>{h(v).catch(()=>{})},onShowToast:g})]})}function F7({sessionId:t,session:s,isActive:i,onStop:o,onKill:c}){return r.jsxs("div",{className:U.header,children:[r.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.costUsd?` | ${b_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${_o(s.costUsd??0)}`:""]}),r.jsxs("span",{className:U.headerInfo,children:[s&&r.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&r.jsx(y_,{label:"Stop",onClick:o,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:o},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function Z7({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),i=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return r.jsx("div",{className:s?U.errorMessage:U.waitingMessage,children:i})}function K7(){const{sessionId:t}=rs(),{events:s,eventsDropped:i,sessions:o,kill:c,stopGraceful:u,loadSessionEvents:d,sendInput:p,spawn:h,startTask:g,personas:v,environments:y,provisionEnvironment:b}=lt(),{showToast:k}=vn(),S=_.useRef(void 0),w=_8(t),j=o.find(E=>E.id===t)??void 0,N=_.useMemo(()=>{const E=t?s.filter(I=>I.sessionId===t):[];return $m(Um(E))},[s,t]);if(_.useEffect(()=>{t&&t!==S.current&&(S.current=t,d(t).catch(()=>{}))},[t,d]),!t)return r.jsx("div",{className:U.emptyState,children:"No session selected"});const C=(j==null?void 0:j.status)==="running"||(j==null?void 0:j.status)==="idle";return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:w}),r.jsx(F7,{sessionId:t,session:j,isActive:C,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{c(t).catch(()=>{})}}),r.jsx(Im,{events:N,eventsDropped:i,emptyState:r.jsx(Z7,{session:j})}),C&&r.jsx(Lr,{mode:"send",sessionId:t,environmentId:j.environmentId,personas:v,environments:y,onSendInput:(E,I)=>{p(E,I).catch(()=>{})},onSpawn:(E,I,R)=>{h(E,I,R).catch(()=>{})},onStartTask:(E,I,R)=>{g(E,I,R).catch(()=>{})},onProvisionEnvironment:E=>{b(E).catch(()=>{})},onShowToast:k})]})}function Y7(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Ks(t,s){const i=_.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:p=!0}=t;_.useEffect(()=>{if(!p)return;const h=g=>{if(d&&Y7(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(u&&!g.shiftKey||g.key===o&&i.current())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[o,c,u,d,p])}function Mb(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const o=Date.now()-s.getTime();if(o<0)return"just now";const c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const up=100;function J7(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function W7(){const{workspaceId:t,environmentId:s}=rs(),i=yt(),{tasks:o,environments:c,workspaces:u,personas:d,sessions:p,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:y}=lt(),{resolvedThemeId:b}=hx(),[k,S]=_.useState("tasks"),[w,j]=_.useState(!1),[N,C]=_.useState(null),[E,I]=_.useState(!1),R=_.useRef(void 0),D=u.find(ee=>ee.id===t),q=s??(D==null?void 0:D.environmentId)??"",$=x8(t,q,u,c);Ks({key:"1"},()=>S("graph")),Ks({key:"2"},()=>S("board")),Ks({key:"3"},()=>S("tasks")),_.useEffect(()=>{const ee=R.current;R.current=t,!(ee===void 0||ee===t)&&N!==null&&C(null)},[t,N]);const Y=p.reduce((ee,B)=>ee+(B.costUsd??0),0);_.useEffect(()=>{t&&y("workspace",t).catch(()=>{})},[t,y,Y]);const G=t?v[`workspace:${t}`]:void 0,Q=o.filter(ee=>ee.workspaceId===t),ae=Q.filter(ee=>ee.status==="complete").length,me=Q.length,ie=me>0?Math.round(ae/me*100):0;return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:$}),r.jsxs("div",{className:U.workspaceHeader,children:[r.jsx("span",{className:U.workspaceName,"data-testid":"workspace-name",children:r.jsx(Xt,{value:(D==null?void 0:D.name)||"",onSave:ee=>{D&&g(D.id,{name:ee}).catch(()=>{})},validate:ee=>{const B=ee.trim();if(!B)return"Name is required";if(B.length>up)return`Max ${up} characters`},maxLength:up,fieldId:"name",activeFieldId:N,onActivate:C,ariaLabel:"Workspace name",renderDisplay:ee=>ee||t||void 0,"data-testid":"edit-name"})}),r.jsx("button",{className:U.archiveButton,onClick:()=>j(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),r.jsxs("button",{className:U.metaToggle,onClick:()=>I(!E),"aria-expanded":!E,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[r.jsx("span",{className:`${U.metaToggleArrow} ${E?"":U.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!E&&r.jsxs("div",{className:U.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Description"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Op,{value:(D==null?void 0:D.description)||"",onSave:ee=>{D&&g(D.id,{description:ee}).catch(()=>{})},fieldId:"description",activeFieldId:N,onActivate:C,renderDisplay:ee=>ee?r.jsx("span",{className:U.overviewMarkdown,children:r.jsx(Xc,{remarkPlugins:[Qc],children:ee})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Repository"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Xt,{value:(D==null?void 0:D.repoUrl)||"",onSave:ee=>{D&&g(D.id,{repoUrl:ee}).catch(()=>{})},validate:ee=>{const B=ee.trim();if(B&&!/^https?:\/\/.+/.test(B))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:N,onActivate:C,renderDisplay:ee=>{const B=J7(ee);return B?r.jsx("a",{className:U.repoLink,href:B,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:ee}):ee?r.jsx("span",{children:ee}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Environment"}),r.jsx("div",{className:U.metaValue,children:r.jsx(S6,{value:(D==null?void 0:D.environmentId)||"",onSave:ee=>{D&&ee&&g(D.id,{environmentId:ee}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:N,onActivate:C,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Persona"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Kc,{value:(D==null?void 0:D.defaultPersonaId)||"",onSave:ee=>{D&&g(D.id,{defaultPersonaId:ee}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...d.map(ee=>({value:ee.id,label:ee.name}))],fieldId:"defaultPersonaId",activeFieldId:N,onActivate:C,renderDisplay:ee=>{const B=d.find(Z=>Z.id===ee);if(B)return r.jsx("span",{children:B.name})},placeholder:(D==null?void 0:D.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Worktrees"}),r.jsx("div",{className:U.metaValue,children:r.jsx(h6,{checked:(D==null?void 0:D.useWorktrees)??!0,onChange:ee=>{D&&g(D.id,{useWorktrees:ee}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Working Dir"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Xt,{value:(D==null?void 0:D.workingDirectory)||"",onSave:ee=>{D&&g(D.id,{workingDirectory:ee}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:N,onActivate:C,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),D&&r.jsxs("div",{className:U.metaTimestamps,children:[r.jsxs("span",{className:U.metaTimestamp,children:["Created ",Mb(D.createdAt)]}),D.updatedAt&&D.updatedAt!==D.createdAt&&r.jsxs("span",{className:U.metaTimestamp,children:["· Updated ",Mb(D.updatedAt)]})]})]}),me>0&&r.jsxs("div",{className:U.progressBarContainer,"data-testid":"progress-bar",children:[r.jsx("div",{className:U.progressBar,children:r.jsx("div",{className:U.progressFill,style:{width:`${ie}%`}})}),r.jsxs("span",{className:U.progressLabel,children:[ae,"/",me]})]}),G&&G.costUsd>0&&r.jsx("div",{className:U.progressBarContainer,children:r.jsxs("span",{className:U.progressLabel,children:["Usage: ",_o(G.costUsd)," (",G.sessionCount," session",G.sessionCount!==1?"s":"",")"]})}),r.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Workspace view",children:[r.jsx("button",{role:"tab","aria-selected":k==="graph",className:`${U.tab} ${k==="graph"?U.active:""}`,onClick:()=>S("graph"),children:"Graph"}),r.jsx("button",{role:"tab","aria-selected":k==="board",className:`${U.tab} ${k==="board"?U.active:""}`,onClick:()=>S("board"),"data-testid":"board-tab",children:"Board"}),r.jsx("button",{role:"tab","aria-selected":k==="tasks",className:`${U.tab} ${k==="tasks"?U.active:""}`,onClick:()=>S("tasks"),children:"Tasks"})]}),k==="tasks"&&me>0&&r.jsxs("div",{className:U.workspaceSummary,children:[r.jsx("span",{className:U.workspaceSummaryTitle,children:`${ae}/${me} tasks complete`}),r.jsx("span",{className:U.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),k==="tasks"&&me===0&&r.jsxs("div",{className:U.emptyCta,children:[r.jsx("button",{className:U.ctaButton,onClick:()=>i(_i(t,void 0,q)),children:"Create Task"}),r.jsx("div",{className:U.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),k==="board"&&r.jsx(qB,{workspaceId:t,environmentId:q,tasks:o,sessions:p,personas:d,environments:c}),k==="graph"&&r.jsx(PN,{workspaceId:t,environmentId:q,tasks:o,resolvedThemeId:b}),r.jsx(vi,{isOpen:w,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{D&&(h(D.id).catch(()=>{}),i("/",{replace:!0})),j(!1)},onCancel:()=>j(!1)})]})}const X7="_container_3pgew_1",Q7="_header_3pgew_8",eU="_headerTitle_3pgew_35",tU="_headerActions_3pgew_44",nU="_body_3pgew_51",sU="_btnPrimary_3pgew_63",aU="_btnGhost_3pgew_94",iU="_error_3pgew_116",Ca={container:X7,header:Q7,headerTitle:eU,headerActions:tU,body:nU,btnPrimary:sU,btnGhost:aU,error:iU};function oU(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 rU=[{label:"Home",url:gi},{label:"New Workspace",url:void 0}];function lU(){const[t]=Wp(),s=t.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=lt(),{showToast:d}=vn(),p=yt(),[h,g]=_.useState(()=>{var j;return t8(void 0,s||((j=i[0])==null?void 0:j.id))}),[v,y]=_.useState(),[b,k]=_.useState();_.useEffect(()=>{s||h.environmentId||i.length===0||g(j=>{var N;return j.environmentId?j:{...j,environmentId:((N=i[0])==null?void 0:N.id)??""}})},[i,s,h.environmentId]);const S=()=>{const j=oU(h);if(j){y(j),k(void 0);return}y(void 0),k(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{d("Workspace created","success"),p(gi,{replace:!0})},N=>{k(N)}).catch(()=>{})},w=()=>{p(s?hi(s):gi,{replace:!0})};return r.jsxs("div",{className:Ca.container,children:[r.jsxs("div",{className:Ca.header,children:[r.jsx("div",{className:Ca.headerTitle,children:r.jsx(xs,{segments:rU})}),r.jsxs("div",{className:Ca.headerActions,children:[r.jsx("button",{className:Ca.btnGhost,onClick:w,disabled:u,"data-testid":"workspace-create-cancel",children:"Cancel"}),r.jsx("button",{className:Ca.btnPrimary,onClick:S,disabled:u||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:u?r.jsx(Y1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),r.jsxs("div",{className:Ca.body,children:[r.jsx(s8,{values:h,onChange:j=>{g(j),y(void 0),k(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),b&&r.jsx("div",{className:Ca.error,"data-testid":"workspace-create-submit-error",children:b})]})]})}function Ib(){const{workspaceId:t,environmentId:s}=rs(),[i]=Wp(),o=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:u,workspaces:d,personas:p,createTask:h,updateTask:g}=lt(),{showToast:v}=vn();return r.jsx(lx,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:p,onCreateTask:(y,b,k,S,w,j,N,C,E)=>{h(y,b,k,S,w,j,N,C,E).catch(()=>{})},onUpdateTask:(y,b,k,S,w)=>{g(y,b,k,S,w).catch(()=>{})},onShowToast:v})}function Ac(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 dp(t,s){if(!t||!s)return;const i=new Date(s).getTime()-new Date(t).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(o===0)return`${c}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${c}s`:`${u}h ${d}m`}function Ob(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?U.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?U.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?U.envDotRed:U.envDotGray}function cU({status:t}){const s=Ma(t),i=M2(t);return r.jsx("span",{className:`${U.statusBadge} ${U[i]??U.statusPending}`,children:s.label})}function uU({task:t,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:p}=lt(),h=c.reduce((E,I)=>E+(I.costUsd??0),0);_.useEffect(()=>{d("task",t.id).catch(()=>{}),t.childTaskIds.length>0&&d("task_tree",t.id).catch(()=>{})},[t.id,t.childTaskIds.length,d,h]);const g=`task:${t.id}`,v=g in p?p[g]:void 0,y=`task_tree:${t.id}`,b=t.childTaskIds.length>0&&y in p?p[y]:void 0,k=c.length>0?c[c.length-1]:void 0,S=(k==null?void 0:k.environmentId)??"",w=S?i.find(E=>E.id===S):void 0,j=o.find(E=>E.id===t.workspaceId),N=i.find(E=>E.id===u),C=t.branch&&(j!=null&&j.repoUrl)?`${j.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return r.jsxs("div",{className:U.overviewDashboard,children:[r.jsxs("div",{className:U.overviewHero,children:[r.jsx(cU,{status:t.status}),t.branch&&r.jsx("span",{className:U.overviewBranchPill,children:C?r.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:U.branchLink,children:["🔗"," ",t.branch]}):r.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Description"}),r.jsx("div",{className:U.overviewMarkdown,children:r.jsx(Xc,{remarkPlugins:[Qc],children:t.description})})]}),t.workpad&&r.jsx(B5,{workpad:t.workpad}),r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Environment"}),S&&w?r.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${U.envDot} ${Ob(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),r.jsx("span",{className:U.overviewValue,children:w.displayName})]}):N?r.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${U.envDot} ${Ob(N.status)}`,title:N.status,"aria-label":`Status: ${N.status}`,role:"img"}),r.jsx("span",{className:U.overviewValue,children:N.displayName}),r.jsx("span",{className:U.overviewMuted,children:"(workspace default)"})]}):r.jsx("div",{className:U.overviewMuted,children:"Set in workspace settings"})]}),r.jsxs("div",{className:U.overviewSection,"data-testid":"task-overview-dependencies",children:[r.jsx("div",{className:U.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?r.jsx("div",{className:U.overviewMuted,children:"None"}):r.jsx("div",{className:U.depList,children:t.dependsOn.map(E=>{const I=s.get(E),R=(I==null?void 0:I.status)==="complete";return r.jsxs("div",{className:`${U.depItem} ${R?U.depDone:U.depBlocked}`,children:[r.jsx("span",{children:R?"✓":"○"}),r.jsx("span",{children:(I==null?void 0:I.title)??E})]},E)})})]}),r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Timeline"}),r.jsxs("div",{className:U.timeline,children:[t.createdAt&&r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Created"}),r.jsx("span",{className:U.timelineValue,children:Ac(t.createdAt)})]}),t.assignedAt&&(()=>{const E=dp(t.createdAt,t.assignedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Assigned"}),r.jsx("span",{className:U.timelineValue,children:Ac(t.assignedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=dp(t.assignedAt??t.createdAt,t.startedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Started"}),r.jsx("span",{className:U.timelineValue,children:Ac(t.startedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=dp(t.startedAt,t.completedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Completed"}),r.jsx("span",{className:U.timelineValue,children:Ac(t.completedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&r.jsx("div",{className:U.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Usage"}),r.jsxs("div",{className:U.timeline,children:[r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Cost"}),r.jsx("span",{className:U.timelineValue,children:_o(v.costUsd)}),r.jsxs("span",{className:U.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),b&&b.costUsd>v.costUsd&&r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Total (incl. subtasks)"}),r.jsx("span",{className:U.timelineValue,children:_o(b.costUsd)}),r.jsxs("span",{className:U.timelineDelta,children:[b.sessionCount," session",b.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Review Notes"}),r.jsx("div",{className:U.reviewNotes,children:t.reviewNotes})]})]})}function dU({task:t,sessionId:s,isBlocked:i,onStart:o,onResume:c,onStop:u,onPause:d,onDelete:p,onEdit:h}){if(t.status==="not_started")return i?r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]}):r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{"data-testid":"task-header-start",onClick:o,className:U.btnPrimary,children:"Start"}),r.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]});if(t.status==="working")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:u,className:U.btnDanger,children:"Stop"}),r.jsx("button",{onClick:d,disabled:!s,className:U.btnGhost,children:"Pause"})]});if(t.status==="paused")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:u,className:U.btnPrimary,children:"Stop"}),r.jsx("button",{onClick:c,className:U.btnGhost,children:"Resume"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]});if(t.status==="complete")return r.jsx("div",{className:U.headerActions,children:r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})});if(t.status==="failed")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:o,className:U.btnPrimary,children:"Retry"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]})}function fU({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return r.jsxs("div",{className:U.attemptSelector,"data-testid":"attempt-selector",children:[r.jsx("span",{className:U.attemptLabel,children:"Attempts:"}),t.map((o,c)=>{const u=o.id===s,d=o.status==="stopped"&&o.endReason==="completed"?"✓":o.status==="stopped"?"✗":o.status==="running"||o.status==="idle"?"●":"";return r.jsxs("button",{className:`${U.attemptButton} ${u?U.attemptActive:""}`,onClick:()=>i(o.id),title:`Attempt #${c+1} — ${o.status}`,"aria-label":`Attempt #${c+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${c+1}`,children:["#",c+1,d&&r.jsx("span",{className:U.attemptStatus,children:d})]},o.id)})]})}function Ea(){const{taskId:t,workspaceId:s,environmentId:i}=rs(),o=Pt(),c=yt(),{showToast:u}=vn(),{events:d,eventsDropped:p,tasks:h,sessions:g,environments:v,findings:y,loadSessionEvents:b,loadFindings:k,kill:S,startTask:w,stopTask:j,resumeTask:N,deleteTask:C,createTask:E,updateTask:I,workspaces:R,taskSessions:D,loadTaskSessions:q,sendInput:$,spawn:Y,personas:G,provisionEnvironment:Q}=lt(),ae=_.useRef(void 0),me=_.useRef(void 0),ie=_.useRef(void 0),ee=_.useRef(void 0),B=_.useRef(void 0),Z=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",ne=o.pathname.endsWith("/edit"),[re,ue]=_.useState(Z),[Ze,je]=_.useState(!1),[Te,Ie]=_.useState(void 0),[le,ve]=_.useState(""),[de,Oe]=_.useState(ne),bt=_.useRef(Z),yn=_.useRef(ne),L=h.find(Ne=>Ne.id===t),Me=(L==null?void 0:L.workspaceId)||void 0,et=R.find(Ne=>Ne.id===Me);_.useEffect(()=>{Z!==bt.current&&(bt.current=Z,Z!==re&&ue(Z))},[Z,re]),_.useEffect(()=>{ne!==yn.current&&(yn.current=ne,ne!==de&&Oe(ne))},[ne,de]),_.useEffect(()=>{if(le===""){if(et!=null&&et.environmentId)ve(et.environmentId);else if(v.length>0){const Ne=v.find(Ce=>Ce.status==="connected");ve((Ne==null?void 0:Ne.id)??v[0].id)}}},[le,et==null?void 0:et.environmentId,v]);const tt=L?D[L.id]??[]:[];let qe;Te&&tt.some(Ne=>Ne.id===Te)?qe=Te:qe=(L==null?void 0:L.latestSessionId)||void 0;const ls=()=>{je(!0)},Qs=()=>{if(!L)return;C(L.id).catch(()=>{}),je(!1);const Ne=i??(et==null?void 0:et.environmentId);c(L.workspaceId&&Ne?mi(L.workspaceId,Ne):"/",{replace:!0})};_.useEffect(()=>{(L==null?void 0:L.id)!==me.current&&(me.current=L==null?void 0:L.id,Ie(void 0),ve(""),Oe(ne))},[L==null?void 0:L.id,ne]),_.useEffect(()=>{if(!(L!=null&&L.id))return;const Ne=L.id!==ee.current,Ce=L.latestSessionId!==B.current;(Ne||Ce)&&(ee.current=L.id,B.current=L.latestSessionId,q(L.id).catch(()=>{}))},[L==null?void 0:L.id,L==null?void 0:L.latestSessionId,q]),_.useEffect(()=>{if((L==null?void 0:L.status)!==ie.current){const Ne=ie.current===void 0;ie.current=L==null?void 0:L.status;const Ce=(L==null?void 0:L.status)==="not_started"?"overview":(L==null?void 0:L.status)==="working"||(L==null?void 0:L.status)==="paused"?"stream":(L==null?void 0:L.status)==="complete"?"findings":void 0;Ce&&Ce!==re&&!(Ne&&Z!=="overview")&&ue(Ce)}},[L==null?void 0:L.status,re,Z]);const Dn=_.useMemo(()=>new Map(h.map(Ne=>[Ne.id,Ne])),[h]),Kn=_.useMemo(()=>{const Ne=qe?d.filter(Ce=>Ce.sessionId===qe):[];return $m(Um(Ne))},[d,qe]),cs=L?L.dependsOn.some(Ne=>{const Ce=Dn.get(Ne);return Ce!==void 0&&Ce.status!=="complete"}):!1,ea=_.useMemo(()=>k8(t,i,R,v,Dn),[t,i,R,v,Dn]);_.useEffect(()=>{qe&&qe!==ae.current&&(ae.current=qe,b(qe).catch(()=>{}))},[qe,b]),_.useEffect(()=>{re==="findings"&&Me&&k(Me).catch(()=>{})},[re,Me,k]);const Yn=Ne=>{ue(Ne),c(os(t,Ne==="overview"?void 0:Ne,s,i))};return Ks({key:"1"},()=>Yn("overview")),Ks({key:"2"},()=>Yn("stream")),Ks({key:"3"},()=>Yn("findings")),r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:ea}),r.jsxs("div",{className:U.header,children:[r.jsxs("span",{className:U.headerTitle,children:[r.jsx("span",{"data-testid":"task-title",children:(L==null?void 0:L.title)||t}),L&&r.jsx("span",{className:U.taskStatusBadge,"data-testid":"task-status",children:L.status}),(L==null?void 0:L.branch)&&r.jsx("span",{className:U.taskBranch,children:L.branch}),cs&&r.jsx("span",{className:U.taskBlockedBadge,children:"blocked"})]}),L&&r.jsx(dU,{task:L,sessionId:qe,isBlocked:cs,onStart:()=>{w(L.id,void 0,le).catch(()=>{})},onResume:()=>{N(L.id).catch(()=>{})},onStop:()=>{j(L.id).catch(()=>{})},onPause:()=>{qe&&S(qe).catch(()=>{})},onDelete:ls,onEdit:()=>Oe(!0)})]}),r.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Task view",children:[r.jsx("button",{role:"tab","aria-selected":re==="overview",className:`${U.tab} ${re==="overview"?U.active:""}`,onClick:()=>Yn("overview"),children:"Overview"}),r.jsx("button",{role:"tab","aria-selected":re==="stream",className:`${U.tab} ${re==="stream"?U.active:""}`,onClick:()=>Yn("stream"),children:"Stream"}),r.jsx("button",{role:"tab","aria-selected":re==="findings",className:`${U.tab} ${re==="findings"?U.active:""}`,onClick:()=>Yn("findings"),children:"Findings"})]}),r.jsxs(_s,{mode:"wait",children:[re==="overview"&&r.jsx(It.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.overviewContent,"data-testid":"task-overview",children:de&&L?r.jsx(lx,{mode:"edit",taskId:L.id,workspaceId:Me,environmentId:i,tasks:h,workspaces:R,personas:G,onCreateTask:(Ne,Ce,cn,bn,ks,us,ki,za,Si)=>{E(Ne,Ce,cn,bn,ks,us,ki,za,Si).catch(()=>{})},onUpdateTask:(Ne,Ce,cn,bn,ks)=>{I(Ne,Ce,cn,bn,ks).catch(()=>{})},onEditDone:()=>{ne?c(os(L.id,void 0,s,i),{replace:!0}):Oe(!1)},onShowToast:u}):L?r.jsx(uU,{task:L,tasksById:Dn,environments:v,workspaces:R,taskSessions:tt,selectedEnvId:le}):r.jsx("div",{className:U.waitingMessage,children:"No additional details"})},"overview"),re==="stream"&&r.jsxs(It.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:[r.jsx(fU,{taskSessions:tt,selectedSessionId:qe,onSelect:Ne=>Ie(Ne)}),r.jsx(Im,{events:Kn,eventsDropped:p,emptyState:!qe&&L?cs?r.jsx("div",{className:U.emptyCta,"data-testid":"stream-blocked-message",children:r.jsx("div",{className:U.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):r.jsxs("div",{className:U.emptyCta,children:[r.jsx("button",{"data-testid":"stream-start-cta",className:U.ctaButton,onClick:()=>{w(L.id,void 0,le).catch(()=>{})},children:"Start Task"}),r.jsx("div",{className:U.ctaDescription,children:"Click to begin agent execution"})]}):qe&&Kn.length===0?r.jsx("div",{className:U.waitingMessage,children:"Waiting for events..."}):void 0})]},"stream"),re==="findings"&&r.jsx(It.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.tabContent,children:Me?r.jsx(ox,{findings:y.filter(Ne=>Ne.workspaceId===Me)}):r.jsx("div",{className:U.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!L||L.status!=="working"&&L.status!=="paused")return;const Ne=qe?g.find(Ce=>Ce.id===qe):void 0;if(!(!Ne||Ne.status==="stopped"))return r.jsx(Lr,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:G,environments:v,onSendInput:(Ce,cn)=>{$(Ce,cn).catch(()=>{})},onSpawn:(Ce,cn,bn)=>{Y(Ce,cn,bn).catch(()=>{})},onStartTask:(Ce,cn,bn)=>{w(Ce,cn,bn).catch(()=>{})},onProvisionEnvironment:Ce=>{Q(Ce).catch(()=>{})},onShowToast:u})})(),L&&r.jsx(vi,{isOpen:Ze,title:"Delete Task?",description:`"${L.title}" will be permanently removed.`,onConfirm:Qs,onCancel:()=>je(!1)})]})}function pU(){const{environments:t,addEnvironment:s,updateEnvironment:i,listCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,createCodespace:h}=lt(),{showToast:g}=vn();return r.jsx(cx,{mode:"new",environments:t,onAddEnvironment:(v,y,b)=>{s(v,y,b).catch(()=>{})},onUpdateEnvironment:(v,y)=>{i(v,y).catch(()=>{})},onListCodespaces:()=>{o().catch(()=>{})},codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:(v,y)=>{h(v,y).catch(()=>{})},onShowToast:g})}function mU(){const{environmentId:t}=rs(),{environments:s,addEnvironment:i,updateEnvironment:o,listCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:p,codespaceCreating:h,createCodespace:g}=lt(),{showToast:v}=vn();return r.jsx(cx,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(y,b,k)=>{i(y,b,k).catch(()=>{})},onUpdateEnvironment:(y,b)=>{o(y,b).catch(()=>{})},onListCodespaces:()=>{c().catch(()=>{})},codespaces:u,codespaceError:d,codespaceListError:p,codespaceCreating:h,onCreateCodespace:(y,b)=>{g(y,b).catch(()=>{})},onShowToast:v})}const hU="_layout_11u79_1",gU="_content_11u79_8",vU="_tabPanel_11u79_14",Br={layout:hU,content:gU,tabPanel:vU};function yU(){const t=y8();return r.jsxs("div",{className:Br.layout,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:Br.content,children:r.jsx(Ba,{})})]})}const bU="_container_13sb6_1",_U="_envHeader_13sb6_6",xU="_envTitleRow_13sb6_10",kU="_statusDot_13sb6_16",SU="_envName_13sb6_21",TU="_statusBadge_13sb6_27",wU="_envMeta_13sb6_33",NU="_metaTag_13sb6_39",jU="_actions_13sb6_51",CU="_provisionMessage_13sb6_59",EU="_errorMessage_13sb6_64",AU="_section_13sb6_69",DU="_sectionHeader_13sb6_73",RU="_cardList_13sb6_121",MU="_card_13sb6_121",IU="_cardHeader_13sb6_138",OU="_cardName_13sb6_144",BU="_cardActions_13sb6_149",LU="_cardDescription_13sb6_154",zU="_cardMeta_13sb6_160",UU="_repoLink_13sb6_166",$U="_empty_13sb6_174",PU="_btnPrimary_13sb6_180",VU="_btnOutline_13sb6_214",HU="_btnSmall_13sb6_241",qU="_btnDanger_13sb6_267",Ve={container:bU,envHeader:_U,envTitleRow:xU,statusDot:kU,envName:SU,statusBadge:TU,envMeta:wU,metaTag:NU,actions:jU,provisionMessage:CU,errorMessage:EU,section:AU,sectionHeader:DU,cardList:RU,card:MU,cardHeader:IU,cardName:OU,cardActions:BU,cardDescription:LU,cardMeta:zU,repoLink:UU,empty:$U,btnPrimary:PU,btnOutline:VU,btnSmall:HU,btnDanger:qU},GU={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function FU(){const{environmentId:t}=rs(),s=yt(),{environments:i,workspaces:o,sessions:c,provisionStatus:u,provisionEnvironment:d,stopEnvironment:p,removeEnvironment:h,archiveWorkspace:g}=lt(),[v,y]=_.useState(!1),[b,k]=_.useState(!1),[S,w]=_.useState(void 0),j=i.find(ae=>ae.id===t);if(!t||!j)return r.jsx(is,{to:bo,replace:!0});const N=o.filter(ae=>ae.environmentId===j.id),C=c.filter(ae=>ae.environmentId===j.id),E=C.reduce((ae,me)=>ae+(me.costUsd??0),0),I=GU[j.status]||"var(--text-tertiary)",R=j.status==="connected",D=j.status==="connecting",q=j.status==="disconnected"||j.status==="error"||j.status==="sleeping",$=j.id in u?u[j.id]:void 0,Y=()=>{h(j.id).catch(()=>{}),y(!1),s(bo,{replace:!0})},G=()=>{k(!1),d(j.id,!0).catch(()=>{})},Q=ae=>{g(ae).catch(()=>{}),w(void 0)};return r.jsxs("div",{className:Ve.container,children:[r.jsx(vi,{isOpen:v,title:"Delete Environment?",description:`"${j.displayName||j.id}" will be permanently removed along with all its data.`,onConfirm:Y,onCancel:()=>y(!1)}),r.jsx(vi,{isOpen:b,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:G,onCancel:()=>k(!1)}),r.jsxs("div",{className:Ve.envHeader,children:[r.jsxs("div",{className:Ve.envTitleRow,children:[r.jsx("span",{className:Ve.statusDot,style:{color:I},children:"●"}),r.jsx("h2",{className:Ve.envName,children:j.displayName||j.id}),r.jsx("span",{className:Ve.statusBadge,style:{color:I},children:j.status})]}),r.jsxs("div",{className:Ve.envMeta,children:[r.jsxs("span",{className:Ve.metaTag,children:["Adapter: ",j.adapterType]}),C.length>0&&r.jsxs("span",{className:Ve.metaTag,children:[C.length," session",C.length!==1?"s":""]}),E>0&&r.jsxs("span",{className:Ve.metaTag,children:["Cost: ",_o(E)]})]})]}),r.jsxs("div",{className:Ve.actions,children:[R&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:Ve.btnPrimary,onClick:()=>s(m_(j.id)),children:"New Chat"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>{p(j.id).catch(()=>{})},children:"Stop"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>k(!0),disabled:$!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),q&&r.jsx("button",{className:Ve.btnPrimary,onClick:()=>{d(j.id).catch(()=>{})},children:j.status==="error"?"Retry":j.status==="sleeping"?"Wake":"Connect"}),D&&$!==void 0&&r.jsx("span",{className:Ve.provisionMessage,children:$.message}),j.status==="error"&&($==null?void 0:$.stage)==="error"&&r.jsx("span",{className:Ve.errorMessage,children:$.message}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>s(DN(j.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),r.jsx("button",{className:Ve.btnDanger,onClick:()=>y(!0),children:"Delete"})]}),r.jsxs("div",{className:Ve.section,children:[r.jsxs("div",{className:Ve.sectionHeader,children:[r.jsx("h3",{children:"Workspaces"}),r.jsx("button",{className:Ve.btnPrimary,onClick:()=>s(`${g_}?environment=${encodeURIComponent(j.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),N.length===0&&r.jsx("p",{className:Ve.empty,children:"No workspaces yet. Create one to get started."}),r.jsx("div",{className:Ve.cardList,children:N.map(ae=>r.jsx(ZU,{workspace:ae,confirmArchiveId:S,onOpen:()=>s(mi(ae.id,j.id)),onArchive:()=>w(ae.id),onConfirmArchive:()=>Q(ae.id),onCancelArchive:()=>w(void 0)},ae.id))})]})]})}function ZU({workspace:t,confirmArchiveId:s,onOpen:i,onArchive:o,onConfirmArchive:c,onCancelArchive:u}){const d=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return r.jsxs("div",{className:Ve.card,"data-testid":"workspace-card",children:[r.jsxs("div",{className:Ve.cardHeader,children:[r.jsx("strong",{className:Ve.cardName,children:t.name}),r.jsxs("div",{className:Ve.cardActions,children:[r.jsx("button",{className:Ve.btnSmall,onClick:i,children:"Open"}),d?r.jsxs(r.Fragment,{children:[r.jsx("button",{className:Ve.btnDanger,onClick:c,children:"Confirm"}),r.jsx("button",{className:Ve.btnSmall,onClick:u,children:"Cancel"})]}):r.jsx("button",{className:Ve.btnSmall,onClick:o,children:"Archive"})]})]}),t.description&&r.jsx("p",{className:Ve.cardDescription,children:t.description}),t.repoUrl&&r.jsx("div",{className:Ve.cardMeta,children:p?r.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Ve.repoLink,children:t.repoUrl}):r.jsx("span",{children:t.repoUrl})})]})}const KU={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function YU(){const s=Pt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=KU[s],o=v8(i);return r.jsxs("div",{className:Br.layout,children:[r.jsx(xs,{segments:o}),r.jsx("div",{className:Br.content,children:r.jsx("div",{className:Br.tabPanel,children:r.jsx(Ba,{})},s)})]})}function JU(){const{tokens:t,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=lt(),{showToast:u}=vn();return r.jsxs(r.Fragment,{children:[r.jsx(z5,{credentialProviders:o,onUpdateCredentialProviders:d=>{c(d).catch(()=>{})}}),r.jsx(RO,{tokens:t,onSetToken:(d,p,h,g,v)=>{s(d,p,h,g,v).catch(()=>{})},onDeleteToken:d=>{i(d).catch(()=>{})},onShowToast:u})]})}function WU(){const{personas:t,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=lt(),{showToast:c}=vn(),u=yt();return r.jsx(W5,{personas:t,appDefaultPersonaId:i,onDeletePersona:async d=>{try{await s(d)}catch(p){throw console.error("Failed to delete persona",{personaId:d,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async d=>{try{await o(d)}catch(p){console.error("Failed to set app default persona ID",{personaId:d,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>u(MN),onNavigateToPersona:d=>u(h_(d))})}const XU="_container_1ooin_1",QU="_form_1ooin_7",e9="_formActions_1ooin_75",t9="_editableSection_1ooin_82",n9="_defaultBadge_1ooin_93",s9="_typeToggle_1ooin_107",a9="_scriptEditor_1ooin_121",i9="_optional_1ooin_128",ss={container:XU,form:QU,formActions:e9,editableSection:t9,defaultBadge:n9,typeToggle:s9,scriptEditor:a9,optional:i9},Bb=[{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)"}],Lb=[{value:"genaiscript",label:"genaiscript"}],o9="0";function zb(){const{personaId:t}=rs(),s=yt(),{showToast:i}=vn(),{personas:o,createPersona:c,updatePersona:u,deletePersona:d,appDefaultPersonaId:p,setAppDefaultPersonaId:h}=lt(),g=t===void 0,v=g?void 0:o.find(b=>b.id===t);if(!g&&o.length>0&&!v)return r.jsx(is,{to:Cf,replace:!0});const y=[{label:"Settings",url:yo},{label:"Personas",url:Cf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return r.jsxs("div",{className:ss.container,children:[r.jsx(xs,{segments:y}),r.jsx(r9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(Cf)},showToast:i})]})}function r9({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:p,showToast:h}){const g=yt(),[v,y]=_.useState((t==null?void 0:t.name)??""),[b,k]=_.useState((t==null?void 0:t.description)??""),[S,w]=_.useState((t==null?void 0:t.systemPrompt)??""),[j,N]=_.useState((t==null?void 0:t.runtime)??"claude-code"),[C,E]=_.useState((t==null?void 0:t.model)??"sonnet"),[I,R]=_.useState((t==null?void 0:t.maxTurns)??0),[D,q]=_.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[$,Y]=_.useState((t==null?void 0:t.script)??""),[G,Q]=_.useState((t==null?void 0:t.allowedMcpTools)??[]),[ae,me]=_.useState(!1),[ie,ee]=_.useState(null),[B,Z]=_.useState(!!s);_.useEffect(()=>{if(!s&&t&&!B){Z(!0),y(t.name),k(t.description),w(t.systemPrompt);const L=t.type==="script"?"script":"agent";N(L==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),R(t.maxTurns),q(L),Y(t.script||""),Q(t.allowedMcpTools)}},[s,t,B]);const ne=L=>{q(L),L==="script"?N("genaiscript"):j==="genaiscript"&&N("claude-code")},re=!s&&t===void 0,ue=v.trim().length>0&&!re&&S.trim().length>0&&(D==="script"?$.trim().length>0:!!j&&!!C),Ze=s&&ue,je=!s&&i===(t==null?void 0:t.id),Te=!s&&t&&!je&&D==="agent"&&!!j&&!!C,Ie=(L,Me)=>{if(!L.trim())return`${Me} is required`},le=L=>{if(L.preventDefault(),!(re||!ue)){if(t){c(t.id,v,b,S,j,C,I,D,$).then(()=>{h("Persona updated","success"),p()},()=>{h("Failed to save persona","error")});return}o(v,b,S,j,C,I,D,$,G).then(Me=>{h("Persona created","success"),g(h_(Me.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},ve=()=>{t&&u(t.id).then(()=>{h("Persona deleted","success"),p()},()=>{h("Failed to delete persona","error")})},de=async(L,Me,et,tt)=>L().then(()=>{Me(),h(et,"success")},()=>{h(tt,"error")}),Oe=(L,Me)=>{if(!t)return;const et=L==="type"?String(Me):D,tt=L==="runtime"?String(Me):L==="type"?String(Me)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,qe=L==="model"?String(Me):C,ls=L==="maxTurns"?Number(Me):I,Qs=L==="systemPrompt"?String(Me):S,Dn=L==="script"?String(Me):$;de(()=>c(t.id,L==="name"?String(Me):v,L==="description"?String(Me):b,Qs,tt,qe,ls,et,Dn),()=>{if(L==="type"){const Kn=String(Me)==="script"?"script":"agent";q(Kn),N(tt)}L==="runtime"&&N(String(Me)),L==="name"&&y(String(Me)),L==="description"&&k(String(Me)),L==="systemPrompt"&&w(String(Me)),L==="model"&&E(String(Me)),L==="maxTurns"&&R(Number(Me)),L==="script"&&Y(String(Me))},"Persona updated","Failed to update persona").catch(()=>{})},bt=L=>{le(L)},yn=()=>{t&&d(t.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return r.jsxs(r.Fragment,{children:[re?r.jsxs("div",{className:ss.form,children:[r.jsx("h3",{children:"Edit Persona"}),r.jsx("p",{children:"Loading persona..."})]}):s?r.jsxs("form",{onSubmit:bt,className:ss.form,children:[r.jsx("h3",{children:"Create Persona"}),r.jsxs("div",{className:ss.typeToggle,"data-testid":"persona-type-toggle",children:[r.jsxs("label",{children:[r.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:D==="agent",onChange:()=>ne("agent")}),"Agent"]}),r.jsxs("label",{children:[r.jsx("input",{type:"radio",name:"personaType",value:"script",checked:D==="script",onChange:()=>ne("script")}),"Script"]})]}),r.jsxs("label",{children:["Name",r.jsx("input",{type:"text",value:v,onChange:L=>y(L.target.value),placeholder:D==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),r.jsxs("label",{children:["Description",r.jsx("input",{type:"text",value:b,onChange:L=>k(L.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Runtime",r.jsx("select",{value:j,onChange:L=>N(L.target.value),"data-testid":"persona-runtime-select",children:(D==="script"?Lb:Bb).map(L=>r.jsx("option",{value:L.value,children:L.label},L.value))})]}),D==="agent"&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{children:["Model",r.jsx("input",{type:"text",value:C,onChange:L=>E(L.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["Max Turns",r.jsx("input",{type:"number",value:I,onChange:L=>R(parseInt(L.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx("textarea",{value:S,onChange:L=>w(L.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),D==="script"&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{children:["Model ",r.jsx("span",{className:ss.optional,children:"(optional)"}),r.jsx("input",{type:"text",value:C,onChange:L=>E(L.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["System Prompt",r.jsx("textarea",{value:S,onChange:L=>w(L.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),r.jsxs("label",{children:["Script",r.jsx("textarea",{value:$,onChange:L=>Y(L.target.value),placeholder:`script({ model: "openai:gpt-4o" });
682
-
683
- const grackle = await host.mcpServer({
684
- id: "grackle",
685
- url: env.vars.GRACKLE_MCP_URL,
686
- });
687
-
688
- $\`Summarize the current tasks.\`;`,rows:20,className:ss.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),D==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(wb,{selectedTools:G,onChange:Q})]}),r.jsxs("div",{className:ss.formActions,children:[r.jsx(Gs,{type:"submit",variant:"primary",size:"md",disabled:!Ze,"data-testid":"persona-detail-save",children:"Create"}),r.jsx(Gs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?r.jsxs("div",{className:ss.form,children:[r.jsx("h3",{children:"Edit Persona"}),r.jsxs("div",{className:ss.formActions,children:[r.jsx(Gs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Te&&r.jsx(Gs,{type:"button",variant:"ghost",size:"md",onClick:yn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),je&&r.jsx("span",{className:ss.defaultBadge,children:"App Default"}),r.jsx(Gs,{type:"button",variant:"danger",size:"md",onClick:()=>me(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),r.jsxs("div",{className:ss.editableSection,children:[r.jsxs("label",{children:["Name",r.jsx(Xt,{value:v,onSave:L=>{Oe("name",L)},validate:L=>Ie(L,"Name"),fieldId:"persona-name",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),r.jsxs("label",{children:["Description",r.jsx(Xt,{value:b,onSave:L=>{Oe("description",L)},fieldId:"persona-description",activeFieldId:ie,onActivate:ee,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Type",r.jsx(Kc,{value:D,onSave:L=>{Oe("type",L)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),r.jsxs("label",{children:["Runtime",r.jsx(Kc,{value:j,onSave:L=>{Oe("runtime",L)},options:D==="script"?Lb:Bb,fieldId:"persona-runtime",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),r.jsxs("label",{children:["Model",D==="script"?" (optional)":"",r.jsx(Xt,{value:C,onSave:L=>{Oe("model",L)},validate:D==="agent"?L=>Ie(L,"Model"):void 0,fieldId:"persona-model",activeFieldId:ie,onActivate:ee,placeholder:D==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["Max Turns",r.jsx(Xt,{value:String(I),onSave:L=>{Oe("maxTurns",parseInt(L,10)||0)},validate:L=>/^\d+$/.test(L.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:ie,onActivate:ee,placeholder:o9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx(Op,{value:S,onSave:L=>{Oe("systemPrompt",L)},validate:L=>Ie(L,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:ie,onActivate:ee,placeholder:D==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),D==="script"&&r.jsxs("label",{children:["Script",r.jsx(Op,{value:$,onSave:L=>{Oe("script",L)},validate:L=>Ie(L,"Script"),fieldId:"persona-script",activeFieldId:ie,onActivate:ee,placeholder:`script({ model: "openai:gpt-4o" });
689
-
690
- const grackle = await host.mcpServer({
691
- id: "grackle",
692
- url: env.vars.GRACKLE_MCP_URL,
693
- });
694
-
695
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),D==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(wb,{selectedTools:G,onChange:L=>{Q(L),de(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,L),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Te&&!je&&r.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,r.jsx(vi,{isOpen:ae,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ve,onCancel:()=>me(!1)})]})}function l9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=hx();return r.jsx(MO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function c9(){const[t,s]=_.useState(void 0);return _.useEffect(()=>{let i=!1;return(async()=>{try{const c=await xe.getVersionStatus({});i||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{i=!0}},[]),t}function u9(){const{connected:t,environments:s,sessions:i}=lt(),o=c9();return r.jsxs(r.Fragment,{children:[o&&r.jsx(LI,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),r.jsx(IO,{connected:t,environments:s,sessions:i})]})}function d9(){return r.jsx(A5,{})}const Ub=_i();function f9(){const t=yt();return Ks({key:"?"},()=>{t(IN)}),Ks({key:"n"},()=>{t(Ub)}),Ks({key:"N"},()=>{t(Ub)}),r.jsx(r.Fragment,{})}function Xr(t){const s=f8();_.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function p9(){const{workspaces:t,tasks:s}=lt(),i=_.useMemo(()=>r.jsx(pI,{workspaces:t,tasks:s}),[t,s]);return Xr(i),r.jsx(Ba,{})}function m9(){const{environments:t}=lt(),s=_.useMemo(()=>r.jsx(S4,{environments:t}),[t]);return Xr(s),r.jsx(Ba,{})}function h9(){const t=_.useMemo(()=>r.jsx(yB,{}),[]);return Xr(t),r.jsx(Ba,{})}function g9(){const{findings:t,loadFindings:s,loadAllFindings:i}=lt(),{workspaceId:o,environmentId:c}=rs();_.useEffect(()=>{o?s(o).catch(()=>{}):i().catch(()=>{})},[o,s,i]);const u=_.useMemo(()=>r.jsx(I4,{findings:t,workspaceId:o,environmentId:c}),[t,o,c]);return Xr(u),r.jsx(Ba,{})}function v9(){const{knowledge:t,workspaces:s}=lt(),i=_.useCallback(p=>{t.search(p).catch(()=>{})},[t]),o=_.useCallback(()=>{t.clearSearch()},[t]),c=_.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),u=_.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),d=_.useMemo(()=>r.jsx(B6,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[t,s,i,o,c,u]);return Xr(d),r.jsx(Ba,{})}const y9="_container_ce571_1",b9="_title_ce571_6",$b={container:y9,title:b9};function Pb(){const{environmentId:t,workspaceId:s}=rs(),{findings:i,loadFindings:o,workspaces:c,environments:u}=lt(),d=yt();_.useEffect(()=>{s&&o(s).catch(()=>{})},[s,o]);const p=_.useCallback(g=>{d(vp(g,s,t))},[d,s,t]),h=s&&t?kx("Findings",s,t,c,u).slice(0,-1):T8();return r.jsxs("div",{className:$b.container,"data-testid":"findings-list-page",children:[r.jsx(xs,{segments:h}),r.jsx("h1",{className:$b.title,children:"Findings"}),r.jsx(ox,{findings:i,onFindingClick:p})]})}const _9="_container_1wwpb_1",x9="_notFound_1wwpb_6",k9="_header_1wwpb_12",S9="_categoryBadge_1wwpb_19",T9="_title_1wwpb_28",w9="_content_1wwpb_35",N9="_tags_1wwpb_77",j9="_tag_1wwpb_77",C9="_meta_1wwpb_92",E9="_metaTimestamp_1wwpb_100",A9="_metaLink_1wwpb_105",rn={container:_9,notFound:x9,header:k9,categoryBadge:S9,title:T9,content:w9,tags:N9,tag:j9,meta:C9,metaTimestamp:E9,metaLink:A9};function Vb(){const{findingId:t,environmentId:s,workspaceId:i}=rs(),{selectedFinding:o,findingLoading:c,loadFinding:u,workspaces:d,environments:p}=lt(),h=yt();if(_.useEffect(()=>{t&&u(t).catch(()=>{})},[t,u]),c)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Loading..."})});if(!o)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Finding not found."})});const g=kx(o.title,i,s,d,p),v=Yc(o.category);return r.jsxs("div",{className:rn.container,"data-testid":"finding-detail-page",children:[r.jsx(xs,{segments:g}),r.jsxs("div",{className:rn.header,children:[r.jsx("span",{className:rn.categoryBadge,style:{background:v.bg,color:v.text},children:o.category}),r.jsx("h1",{className:rn.title,children:o.title})]}),o.content&&r.jsx("div",{className:rn.content,children:r.jsx(Xc,{remarkPlugins:[Qc],children:o.content})}),o.tags.length>0&&r.jsx("div",{className:rn.tags,children:o.tags.map(y=>r.jsx("span",{className:rn.tag,children:y},y))}),r.jsxs("div",{className:rn.meta,children:[r.jsx("span",{className:rn.metaTimestamp,title:o.createdAt,children:Bm(o.createdAt)}),o.taskId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(os(o.taskId))},children:"View Task"}),o.sessionId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(Xp(o.sessionId))},children:"View Session"})]})]})}const D9="_wizard_1260s_1",R9="_container_1260s_10",M9="_stepContent_1260s_19",I9="_logoArea_1260s_28",O9="_logoImage_1260s_32",B9="_heading_1260s_41",L9="_tagline_1260s_49",z9="_subtitle_1260s_56",U9="_featureList_1260s_64",$9="_runtimeGrid_1260s_89",P9="_runtimeCard_1260s_101",V9="_runtimeName_1260s_133",H9="_runtimeDescription_1260s_139",q9="_buttonRow_1260s_144",G9="_primaryButton_1260s_151",F9="_ghostButton_1260s_185",Z9="_dots_1260s_213",K9="_dot_1260s_213",dt={wizard:D9,container:R9,stepContent:M9,logoArea:I9,logoImage:O9,heading:B9,tagline:L9,subtitle:z9,featureList:U9,runtimeGrid:$9,runtimeCard:P9,runtimeName:V9,runtimeDescription:H9,buttonRow:q9,primaryButton:G9,ghostButton:F9,dots:Z9,dot:K9};function Y9({onNext:t}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-welcome",children:[r.jsx("div",{className:dt.logoArea,children:r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:dt.logoImage})}),r.jsx("h1",{className:dt.heading,children:"Welcome to Grackle"}),r.jsx("p",{className:dt.tagline,children:"Multi-agent orchestration for software teams"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function J9({onNext:t,onBack:s}){return r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-about",children:[r.jsx("h2",{className:dt.heading,children:"What is Grackle?"}),r.jsxs("ul",{className:dt.featureList,children:[r.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),r.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),r.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),r.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),r.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:s,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const W9=[{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 X9({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=_.useState(t||"claude-code");return _.useEffect(()=>{t&&u(t)},[t]),r.jsxs("div",{className:dt.stepContent,"data-testid":"setup-runtime",children:[r.jsx("h2",{className:dt.heading,children:"Choose Your Runtime"}),r.jsx("p",{className:dt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),r.jsx("div",{className:dt.runtimeGrid,children:W9.map(d=>r.jsxs("button",{type:"button",className:dt.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[r.jsx("span",{className:dt.runtimeName,children:d.name}),r.jsx("span",{className:dt.runtimeDescription,children:d.description})]},d.id))}),r.jsxs("div",{className:dt.buttonRow,children:[r.jsx("button",{type:"button",className:dt.ghostButton,onClick:i,children:"Back"}),r.jsx("button",{type:"button",className:dt.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const Q9=3,Hb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function e$(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=lt(),{showToast:c}=vn(),u=yt(),[d,p]=_.useState(0),[h,g]=_.useState(!1),v=t.find(b=>b.id==="claude-code"),y=_.useCallback(b=>{g(!0);const k=[];if(v&&b!==v.runtime){const w=Hb[b]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,b,w))}const S=t.find(w=>w.id===Iv);if(S&&b!==S.runtime){const w=Hb[b]??"sonnet";k.push(s(Iv,void 0,void 0,void 0,b,w))}Promise.all(k).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,u,c]);return o===!0?r.jsx(is,{to:"/",replace:!0}):r.jsx("div",{className:dt.wizard,"data-testid":"setup-wizard",children:r.jsxs("div",{className:dt.container,children:[r.jsx(_s,{mode:"wait",children:r.jsxs(It.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&r.jsx(Y9,{onNext:()=>p(1)}),d===1&&r.jsx(J9,{onNext:()=>p(2),onBack:()=>p(0)}),d===2&&r.jsx(X9,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:y,onBack:()=>p(1),finishDisabled:!v||h})]},d)}),r.jsx("div",{className:dt.dots,children:Array.from({length:Q9},(b,k)=>r.jsx("span",{className:dt.dot,"data-active":k===d},k))})]})})}const t$="_root_zndgp_1",n$="_body_zndgp_7",s$="_main_zndgp_19",a$="_sidebarWrapper_zndgp_26",i$="_overlay_zndgp_51",Ar={root:t$,body:n$,main:s$,sidebarWrapper:a$,overlay:i$},o$=_.lazy(()=>fT(()=>import("./KnowledgePage-P3bqvNAI.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),Tx=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function r$(){const{connected:t,environments:s,sessions:i,tasks:o}=lt(),{toasts:c,dismissToast:u}=vn(),d=Pt(),p=d8(),h=p!==void 0,[g,v]=_.useState(!1),y=_.useCallback(()=>v(b=>!b),[]);return _.useEffect(()=>{v(!1)},[d.pathname]),_.useEffect(()=>{if(!g)return;const b=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[g]),r.jsxs(r.Fragment,{children:[r.jsx(F6,{connected:t,environments:s,sessions:i,onToggleSidebar:h?y:void 0,sidebarOpen:g}),r.jsx(Q6,{}),r.jsxs("div",{className:Ar.body,children:[h&&r.jsx("div",{className:Ar.sidebarWrapper,"data-sidebar-open":g,children:r.jsx(i4,{content:p})}),h&&g&&r.jsx("div",{className:Ar.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),r.jsxs("div",{className:Ar.main,children:[r.jsx(Ba,{}),r.jsx(p4,{sessions:i,tasks:o,environments:s})]})]}),r.jsx(NI,{toasts:c,onDismiss:u}),r.jsx(f9,{})]})}function l$(){const{lastSpawnedId:t,environments:s,tasks:i,connected:o,onboardingCompleted:c}=lt(),{showToast:u}=vn();cL(s,u),pL(i,u);const d=yt(),p=Pt();return _.useEffect(()=>{t&&!p.pathname.includes("/tasks/")&&d(Xp(t),{replace:!0})},[t,d,p.pathname]),o&&c===!1?r.jsx(is,{to:"/setup",replace:!0}):r.jsx(u8,{children:r.jsxs("div",{className:Ar.root,children:[Tx&&r.jsx(cj,{}),r.jsx(r$,{})]})})}function fp(){const{workspaceId:t}=rs(),{workspaces:s}=lt(),i=Pt(),o=s.find(h=>h.id===t);if(!(o!=null&&o.environmentId))return s.length===0?void 0:r.jsx(is,{to:"/environments",replace:!0});const c=encodeURIComponent(t),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",p=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return r.jsx(is,{to:p,replace:!0})}function c$(){return r.jsxs(Yw,{children:[r.jsx(Se,{path:"setup",element:r.jsx(e$,{})}),r.jsxs(Se,{element:r.jsx(l$,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(O7,{})}),r.jsx(Se,{path:"chat",element:r.jsx(q7,{})}),r.jsx(Se,{path:"sessions/new",element:r.jsx(G7,{})}),r.jsx(Se,{path:"sessions/:sessionId",element:r.jsx(K7,{})}),r.jsx(Se,{element:r.jsx(v9,{}),children:r.jsx(Se,{path:"knowledge",element:r.jsx(_.Suspense,{fallback:r.jsx(J1,{}),children:r.jsx(o$,{})})})}),r.jsxs(Se,{element:r.jsx(p9,{}),children:[r.jsx(Se,{path:"tasks",element:r.jsx(M7,{})}),r.jsx(Se,{path:"tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"tasks/:taskId",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"tasks/:taskId/edit",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"tasks/:taskId/stream",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"tasks/:taskId/findings",element:r.jsx(Ea,{})})]}),r.jsxs(Se,{element:r.jsx(g9,{}),children:[r.jsx(Se,{path:"findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"findings/:findingId",element:r.jsx(Vb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:r.jsx(Pb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:r.jsx(Vb,{})})]}),r.jsxs(Se,{element:r.jsx(m9,{}),children:[r.jsx(Se,{path:"workspaces",element:r.jsx(is,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"workspaces/new",element:r.jsx(lU,{})}),r.jsx(Se,{path:"workspaces/:workspaceId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId",element:r.jsx(fp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:r.jsx(fp,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId",element:r.jsx(W7,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:r.jsx(Ib,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:r.jsx(Ea,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:r.jsx(Ea,{})}),r.jsxs(Se,{path:"environments",element:r.jsx(yU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(I7,{})}),r.jsx(Se,{path:"new",element:r.jsx(pU,{})}),r.jsx(Se,{path:":environmentId",element:r.jsx(FU,{})}),r.jsx(Se,{path:":environmentId/edit",element:r.jsx(mU,{})})]})]}),r.jsx(Se,{element:r.jsx(h9,{}),children:r.jsxs(Se,{path:"settings",element:r.jsx(YU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(is,{to:"credentials",replace:!0})}),r.jsx(Se,{path:"environments",element:r.jsx(is,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"credentials",element:r.jsx(JU,{})}),r.jsx(Se,{path:"tokens",element:r.jsx(is,{to:"../credentials",replace:!0})}),r.jsx(Se,{path:"personas",element:r.jsx(WU,{})}),r.jsx(Se,{path:"personas/new",element:r.jsx(zb,{})}),r.jsx(Se,{path:"personas/:personaId",element:r.jsx(zb,{})}),r.jsx(Se,{path:"appearance",element:r.jsx(l9,{})}),r.jsx(Se,{path:"shortcuts",element:r.jsx(d9,{})}),r.jsx(Se,{path:"about",element:r.jsx(u9,{})})]})}),r.jsx(Se,{path:"*",element:r.jsx(is,{to:"/",replace:!0})})]})]})}const u$=1e4;function d$(){const{onboardingCompleted:t}=lt(),[s,i]=_.useState(!1);_.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),u$);return()=>clearTimeout(c)},[t]);const o=t===void 0&&!s;return r.jsx(_s,{mode:"wait",children:o?r.jsx(It.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:r.jsx(J1,{})},"splash"):r.jsx(It.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:r.jsx(_N,{basename:"/".replace(/\/$/,""),children:r.jsx(c$,{})})},"app")})}function f$(){const t=Tx?U8:lL;return r.jsx(c8,{children:r.jsx(i8,{children:r.jsx(t,{children:r.jsx(d$,{})})})})}cT.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(f$,{})}));export{xs as B,v_ as K,lt as a,vp as f,Xp as s,os as t,yt as u};