tide-commander 1.40.4 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BossLogsModal-CehuxNwV.js → BossLogsModal-gE17BBT9.js} +1 -1
- package/dist/assets/{BossSpawnModal-Cohl0WaH.js → BossSpawnModal-SPvzti1i.js} +1 -1
- package/dist/assets/{ControlsModal-CAVkg9mM.js → ControlsModal-A489_yUU.js} +1 -1
- package/dist/assets/{DockerLogsModal-BXv9Hzg-.js → DockerLogsModal-Bexhv2Eo.js} +1 -1
- package/dist/assets/{EmbeddedEditor-CTlTVKdD.js → EmbeddedEditor-BdrKX9Ef.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-B1zQWbRR.js → GmailOAuthSetup-BRDLCsnz.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-CmayoZ-D.js → GoogleOAuthSetup-8tWGRN1a.js} +1 -1
- package/dist/assets/{IframeModal-DlS7y7PK.js → IframeModal-AIthNZLG.js} +1 -1
- package/dist/assets/{IntegrationsPanel-BPKoNwZm.js → IntegrationsPanel-D4rlShHL.js} +2 -2
- package/dist/assets/{LogViewerModal-Bx9IDiFM.js → LogViewerModal-CWASeq5k.js} +1 -1
- package/dist/assets/{MonitoringModal-DzqEa0fQ.js → MonitoringModal-GCxQ22tf.js} +1 -1
- package/dist/assets/{PM2LogsModal-DZXPRV5-.js → PM2LogsModal-BFJ1_6O0.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-BajWqtWn.js → RestoreArchivedAreaModal-BtuMbJVE.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-LqaLezB-.js → SaveSnapshotModal-BUn9mntc.js} +1 -1
- package/dist/assets/{Scene2DCanvas-DWDmyh_y.js → Scene2DCanvas-CToncCYk.js} +1 -1
- package/dist/assets/{SceneManager-BgkqWsDb.js → SceneManager-BivL9Mu6.js} +1 -1
- package/dist/assets/{SkillsPanel-CO-Zt0Tq.js → SkillsPanel-IE07LIWC.js} +1 -1
- package/dist/assets/{SnapshotManager-D4Uzw6Tp.js → SnapshotManager-Cs7fZ_aA.js} +1 -1
- package/dist/assets/{SpawnModal-BdCgTKpM.js → SpawnModal-DbfTe3y2.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-BoaofULj.js → SubordinateAssignmentModal-DdANoM7g.js} +1 -1
- package/dist/assets/{SupervisorPanel-D8Cp77my.js → SupervisorPanel-CE7sMgHN.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-CFf3Tud5.js → TriggerManagerPanel-Cyb1Sf8s.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-EtzhBZWw.js → WorkflowEditorPanel-BM9nnUIT.js} +1 -1
- package/dist/assets/{index-CDAtstMx.js → index-B_0CIcus.js} +1 -1
- package/dist/assets/{index-BKRKKMPQ.js → index-CvetF6vL.js} +3 -3
- package/dist/assets/{index-DBpmD8r7.js → index-DESPWRkl.js} +2 -2
- package/dist/assets/{index-2YWd58Wh.js → index-DahUmubU.js} +1 -1
- package/dist/assets/{index-BgTRovwT.js → index-DlFukYeW.js} +1 -1
- package/dist/assets/{index-BiJ_hIit.js → index-Ez0uF12M.js} +1 -1
- package/dist/assets/{index-DByGRjfY.js → index-bXLSkGdM.js} +1 -1
- package/dist/assets/{index-VO6fNr63.js → index-dnQQyjiL.js} +1 -1
- package/dist/assets/main-BL6u5aPD.js +153 -0
- package/dist/assets/main-CVYa_fKP.css +1 -0
- package/dist/assets/{web-1BwWjkKM.js → web-CwCZTch8.js} +1 -1
- package/dist/assets/{web-BXQj42md.js → web-DGZ9VJ1o.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/main-BFSqr5mR.css +0 -1
- package/dist/assets/main-BSyGZK2z.js +0 -152
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browser-ponyfill-DZOWXZ4K.js","assets/vendor-react--Eh9ivFN.js","assets/index-DESPWRkl.js","assets/modulepreload-polyfill-B5Qt9EMX.js","assets/vendor-three-Chj50gSY.js","assets/web-CwCZTch8.js","assets/SceneManager-BivL9Mu6.js","assets/prism-cpp-CK2Ly5dS.js","assets/prism-java-CK6tws4L.js","assets/prism-csharp-ByDDDiWW.js","assets/prism-ruby-CQBUuZIF.js","assets/prism-php-Dt9698bA.js","assets/prism-scss-CeN16CFC.js","assets/prism-perl-UZfqnD51.js","assets/prism-haskell-Ce8aBmia.js","assets/prism-elixir-df27OMMQ.js","assets/xterm-6GBZ9nXN.css","assets/SpawnModal-DbfTe3y2.js","assets/BossSpawnModal-SPvzti1i.js","assets/SubordinateAssignmentModal-DdANoM7g.js","assets/index-dnQQyjiL.js","assets/index-Bykeknjl.css","assets/index-Ez0uF12M.js","assets/index-DlFukYeW.js","assets/index-CvetF6vL.js","assets/SupervisorPanel-CE7sMgHN.js","assets/index-B_0CIcus.js","assets/ControlsModal-A489_yUU.js","assets/SkillsPanel-IE07LIWC.js","assets/SnapshotManager-Cs7fZ_aA.js","assets/RestoreArchivedAreaModal-BtuMbJVE.js","assets/IntegrationsPanel-D4rlShHL.js","assets/MonitoringModal-GCxQ22tf.js","assets/WorkflowEditorPanel-BM9nnUIT.js","assets/TriggerManagerPanel-Cyb1Sf8s.js","assets/index-DahUmubU.js","assets/index-CprCD9du.css","assets/PM2LogsModal-BFJ1_6O0.js","assets/LogViewerModal-CWASeq5k.js","assets/DockerLogsModal-Bexhv2Eo.js","assets/BossLogsModal-gE17BBT9.js","assets/Scene2DCanvas-CToncCYk.js","assets/Scene2DCanvas-DwXbvB-b.css","assets/index-bXLSkGdM.js","assets/index-BZyCMBzi.css","assets/IframeModal-AIthNZLG.js","assets/IframeModal-DJkCGwT6.css","assets/SaveSnapshotModal-BUn9mntc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var EE=Object.defineProperty;var ME=(t,e,n)=>e in t?EE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Je=(t,e,n)=>ME(t,typeof e!="symbol"?e+"":e,n);import"./modulepreload-polyfill-B5Qt9EMX.js";import{r as qb,g as Tu,a as RA,c as E0}from"./vendor-react--Eh9ivFN.js";import{T as DE,a as Zg,b as OA,L as LA,c as tu,F as Rf,M as nr,V as PA,C as Lr,d as tr,S as Er,e as RE,P as OE,D as eb,f as Of,g as eo,I as LE,Q as IA,h as PE,O as BA,i as IE,j as BE,B as nu,k as FE,l as FA,N as zE,m as $E,n as HE,o as tb,p as zA,R as nb,q as UE,r as WE,s as qE,t as wf,u as VE,v as Vb,w as $A,x as fl,y as GE,z as HA,A as YE,E as cl,G as KE,H as QE,J as XE,K as JE,U as Pm,W as UA,X as ZE,Y as eM,Z as tM,_ as nM,$ as sM,a0 as aM,a1 as WA,a2 as rM,a3 as M0,a4 as D0,a5 as R0,a6 as O0,a7 as sb,a8 as iM,a9 as oM,aa as lM,ab as cM,ac as uM,ad as dM,ae as fM,af as pM,ag as hM,ah as mM,ai as gM,aj as bM}from"./vendor-three-Chj50gSY.js";function xM(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in t)){const r=Object.getOwnPropertyDescriptor(s,a);r&&Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Im={exports:{}},_c={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.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 L0;function yM(){if(L0)return _c;L0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,a,r){var i=null;if(r!==void 0&&(i=""+r),a.key!==void 0&&(i=""+a.key),"key"in a){r={};for(var c in a)c!=="key"&&(r[c]=a[c])}else r=a;return a=r.ref,{$$typeof:t,type:s,key:i,ref:a!==void 0?a:null,props:r}}return _c.Fragment=e,_c.jsx=n,_c.jsxs=n,_c}var P0;function vM(){return P0||(P0=1,Im.exports=yM()),Im.exports}var o=vM(),b=qb();const je=Tu(b),qA=xM({__proto__:null,default:je},[b]);var Bm={exports:{}},Ec={},Fm={exports:{}},zm={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* scheduler.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var I0;function wM(){return I0||(I0=1,(function(t){function e(z,W){var V=z.length;z.push(W);e:for(;0<V;){var Y=V-1>>>1,P=z[Y];if(0<a(P,W))z[Y]=W,z[V]=P,V=Y;else break e}}function n(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var W=z[0],V=z.pop();if(V!==W){z[0]=V;e:for(var Y=0,P=z.length,K=P>>>1;Y<K;){var Q=2*(Y+1)-1,q=z[Q],be=Q+1,ue=z[be];if(0>a(q,V))be<P&&0>a(ue,q)?(z[Y]=ue,z[be]=V,Y=be):(z[Y]=q,z[Q]=V,Y=Q);else if(be<P&&0>a(ue,V))z[Y]=ue,z[be]=V,Y=be;else break e}}return W}function a(z,W){var V=z.sortIndex-W.sortIndex;return V!==0?V:z.id-W.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;t.unstable_now=function(){return r.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var d=[],f=[],h=1,m=null,x=3,y=!1,v=!1,S=!1,A=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function E(z){for(var W=n(f);W!==null;){if(W.callback===null)s(f);else if(W.startTime<=z)s(f),W.sortIndex=W.expirationTime,e(d,W);else break;W=n(f)}}function D(z){if(S=!1,E(z),!v)if(n(d)!==null)v=!0,_||(_=!0,F());else{var W=n(f);W!==null&&L(D,W.startTime-z)}}var _=!1,B=-1,O=5,T=-1;function M(){return A?!0:!(t.unstable_now()-T<O)}function R(){if(A=!1,_){var z=t.unstable_now();T=z;var W=!0;try{e:{v=!1,S&&(S=!1,N(B),B=-1),y=!0;var V=x;try{t:{for(E(z),m=n(d);m!==null&&!(m.expirationTime>z&&M());){var Y=m.callback;if(typeof Y=="function"){m.callback=null,x=m.priorityLevel;var P=Y(m.expirationTime<=z);if(z=t.unstable_now(),typeof P=="function"){m.callback=P,E(z),W=!0;break t}m===n(d)&&s(d),E(z)}else s(d);m=n(d)}if(m!==null)W=!0;else{var K=n(f);K!==null&&L(D,K.startTime-z),W=!1}}break e}finally{m=null,x=V,y=!1}W=void 0}}finally{W?F():_=!1}}}var F;if(typeof j=="function")F=function(){j(R)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,U=$.port2;$.port1.onmessage=R,F=function(){U.postMessage(null)}}else F=function(){k(R,0)};function L(z,W){B=k(function(){z(t.unstable_now())},W)}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(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<z?Math.floor(1e3/z):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_next=function(z){switch(x){case 1:case 2:case 3:var W=3;break;default:W=x}var V=x;x=W;try{return z()}finally{x=V}},t.unstable_requestPaint=function(){A=!0},t.unstable_runWithPriority=function(z,W){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var V=x;x=z;try{return W()}finally{x=V}},t.unstable_scheduleCallback=function(z,W,V){var Y=t.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?Y+V:Y):V=Y,z){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=V+P,z={id:h++,callback:W,priorityLevel:z,startTime:V,expirationTime:P,sortIndex:-1},V>Y?(z.sortIndex=V,e(f,z),n(d)===null&&z===n(f)&&(S?(N(B),B=-1):S=!0,L(D,V-Y))):(z.sortIndex=P,e(d,z),v||y||(v=!0,_||(_=!0,F()))),z},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(z){var W=x;return function(){var V=x;x=W;try{return z.apply(this,arguments)}finally{x=V}}}})(zm)),zm}var B0;function kM(){return B0||(B0=1,Fm.exports=wM()),Fm.exports}/**
|
|
19
|
+
* @license React
|
|
20
|
+
* react-dom-client.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var F0;function SM(){if(F0)return Ec;F0=1;var t=kM(),e=qb(),n=RA();function s(l){var u="https://react.dev/errors/"+l;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+l+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function r(l){var u=l,p=l;if(l.alternate)for(;u.return;)u=u.return;else{l=u;do u=l,(u.flags&4098)!==0&&(p=u.return),l=u.return;while(l)}return u.tag===3?p:null}function i(l){if(l.tag===13){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function c(l){if(l.tag===31){var u=l.memoizedState;if(u===null&&(l=l.alternate,l!==null&&(u=l.memoizedState)),u!==null)return u.dehydrated}return null}function d(l){if(r(l)!==l)throw Error(s(188))}function f(l){var u=l.alternate;if(!u){if(u=r(l),u===null)throw Error(s(188));return u!==l?null:l}for(var p=l,g=u;;){var w=p.return;if(w===null)break;var C=w.alternate;if(C===null){if(g=w.return,g!==null){p=g;continue}break}if(w.child===C.child){for(C=w.child;C;){if(C===p)return d(w),l;if(C===g)return d(w),u;C=C.sibling}throw Error(s(188))}if(p.return!==g.return)p=w,g=C;else{for(var I=!1,G=w.child;G;){if(G===p){I=!0,p=w,g=C;break}if(G===g){I=!0,g=w,p=C;break}G=G.sibling}if(!I){for(G=C.child;G;){if(G===p){I=!0,p=C,g=w;break}if(G===g){I=!0,g=C,p=w;break}G=G.sibling}if(!I)throw Error(s(189))}}if(p.alternate!==g)throw Error(s(190))}if(p.tag!==3)throw Error(s(188));return p.stateNode.current===p?l:u}function h(l){var u=l.tag;if(u===5||u===26||u===27||u===6)return l;for(l=l.child;l!==null;){if(u=h(l),u!==null)return u;l=l.sibling}return null}var m=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),j=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),T=Symbol.for("react.activity"),M=Symbol.for("react.memo_cache_sentinel"),R=Symbol.iterator;function F(l){return l===null||typeof l!="object"?null:(l=R&&l[R]||l["@@iterator"],typeof l=="function"?l:null)}var $=Symbol.for("react.client.reference");function U(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===$?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case S:return"Fragment";case k:return"Profiler";case A:return"StrictMode";case D:return"Suspense";case _:return"SuspenseList";case T:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case v:return"Portal";case j:return l.displayName||"Context";case N:return(l._context.displayName||"Context")+".Consumer";case E:var u=l.render;return l=l.displayName,l||(l=u.displayName||u.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case B:return u=l.displayName||null,u!==null?u:U(l.type)||"Memo";case O:u=l._payload,l=l._init;try{return U(l(u))}catch{}}return null}var L=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},Y=[],P=-1;function K(l){return{current:l}}function Q(l){0>P||(l.current=Y[P],Y[P]=null,P--)}function q(l,u){P++,Y[P]=l.current,l.current=u}var be=K(null),ue=K(null),Z=K(null),de=K(null);function Ce(l,u){switch(q(Z,u),q(ue,l),q(be,null),u.nodeType){case 9:case 11:l=(l=u.documentElement)&&(l=l.namespaceURI)?Zw(l):0;break;default:if(l=u.tagName,u=u.namespaceURI)u=Zw(u),l=e0(u,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}Q(be),q(be,l)}function xe(){Q(be),Q(ue),Q(Z)}function Ne(l){l.memoizedState!==null&&q(de,l);var u=be.current,p=e0(u,l.type);u!==p&&(q(ue,l),q(be,p))}function qe(l){ue.current===l&&(Q(be),Q(ue)),de.current===l&&(Q(de),Ac._currentValue=V)}var Ge,X;function se(l){if(Ge===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);Ge=u&&u[1]||"",X=-1<p.stack.indexOf(`
|
|
27
|
+
at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
28
|
+
`+Ge+l+X}var Ee=!1;function Ve(l,u){if(!l||Ee)return"";Ee=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(u){var Xe=function(){throw Error()};if(Object.defineProperty(Xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Xe,[])}catch(He){var Pe=He}Reflect.construct(l,[],Xe)}else{try{Xe.call()}catch(He){Pe=He}l.call(Xe.prototype)}}else{try{throw Error()}catch(He){Pe=He}(Xe=l())&&typeof Xe.catch=="function"&&Xe.catch(function(){})}}catch(He){if(He&&Pe&&typeof He.stack=="string")return[He.stack,Pe.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var w=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");w&&w.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=g.DetermineComponentFrameRoot(),I=C[0],G=C[1];if(I&&G){var re=I.split(`
|
|
29
|
+
`),De=G.split(`
|
|
30
|
+
`);for(w=g=0;g<re.length&&!re[g].includes("DetermineComponentFrameRoot");)g++;for(;w<De.length&&!De[w].includes("DetermineComponentFrameRoot");)w++;if(g===re.length||w===De.length)for(g=re.length-1,w=De.length-1;1<=g&&0<=w&&re[g]!==De[w];)w--;for(;1<=g&&0<=w;g--,w--)if(re[g]!==De[w]){if(g!==1||w!==1)do if(g--,w--,0>w||re[g]!==De[w]){var Ye=`
|
|
31
|
+
`+re[g].replace(" at new "," at ");return l.displayName&&Ye.includes("<anonymous>")&&(Ye=Ye.replace("<anonymous>",l.displayName)),Ye}while(1<=g&&0<=w);break}}}finally{Ee=!1,Error.prepareStackTrace=p}return(p=l?l.displayName||l.name:"")?se(p):""}function at(l,u){switch(l.tag){case 26:case 27:case 5:return se(l.type);case 16:return se("Lazy");case 13:return l.child!==u&&u!==null?se("Suspense Fallback"):se("Suspense");case 19:return se("SuspenseList");case 0:case 15:return Ve(l.type,!1);case 11:return Ve(l.type.render,!1);case 1:return Ve(l.type,!0);case 31:return se("Activity");default:return""}}function we(l){try{var u="",p=null;do u+=at(l,p),p=l,l=l.return;while(l);return u}catch(g){return`
|
|
32
|
+
Error generating stack: `+g.message+`
|
|
33
|
+
`+g.stack}}var $e=Object.prototype.hasOwnProperty,ie=t.unstable_scheduleCallback,fe=t.unstable_cancelCallback,Ue=t.unstable_shouldYield,it=t.unstable_requestPaint,ot=t.unstable_now,ce=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,ae=t.unstable_UserBlockingPriority,Se=t.unstable_NormalPriority,ee=t.unstable_LowPriority,ge=t.unstable_IdlePriority,Re=t.log,Fe=t.unstable_setDisableYieldValue,oe=null,Le=null;function te(l){if(typeof Re=="function"&&Fe(l),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(oe,l)}catch{}}var pe=Math.clz32?Math.clz32:Ke,ke=Math.log,Be=Math.LN2;function Ke(l){return l>>>=0,l===0?32:31-(ke(l)/Be|0)|0}var ze=256,Ze=262144,lt=4194304;function et(l){var u=l&42;if(u!==0)return u;switch(l&-l){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 l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function ct(l,u,p){var g=l.pendingLanes;if(g===0)return 0;var w=0,C=l.suspendedLanes,I=l.pingedLanes;l=l.warmLanes;var G=g&134217727;return G!==0?(g=G&~C,g!==0?w=et(g):(I&=G,I!==0?w=et(I):p||(p=G&~l,p!==0&&(w=et(p))))):(G=g&~C,G!==0?w=et(G):I!==0?w=et(I):p||(p=g&~l,p!==0&&(w=et(p)))),w===0?0:u!==0&&u!==w&&(u&C)===0&&(C=w&-w,p=u&-u,C>=p||C===32&&(p&4194048)!==0)?u:w}function st(l,u){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&u)===0}function bt(l,u){switch(l){case 1:case 2:case 4:case 8:case 64:return u+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 u+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 Tt(){var l=lt;return lt<<=1,(lt&62914560)===0&&(lt=4194304),l}function he(l){for(var u=[],p=0;31>p;p++)u.push(l);return u}function _e(l,u){l.pendingLanes|=u,u!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function We(l,u,p,g,w,C){var I=l.pendingLanes;l.pendingLanes=p,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=p,l.entangledLanes&=p,l.errorRecoveryDisabledLanes&=p,l.shellSuspendCounter=0;var G=l.entanglements,re=l.expirationTimes,De=l.hiddenUpdates;for(p=I&~p;0<p;){var Ye=31-pe(p),Xe=1<<Ye;G[Ye]=0,re[Ye]=-1;var Pe=De[Ye];if(Pe!==null)for(De[Ye]=null,Ye=0;Ye<Pe.length;Ye++){var He=Pe[Ye];He!==null&&(He.lane&=-536870913)}p&=~Xe}g!==0&&nt(l,g,0),C!==0&&w===0&&l.tag!==0&&(l.suspendedLanes|=C&~(I&~u))}function nt(l,u,p){l.pendingLanes|=u,l.suspendedLanes&=~u;var g=31-pe(u);l.entangledLanes|=u,l.entanglements[g]=l.entanglements[g]|1073741824|p&261930}function _t(l,u){var p=l.entangledLanes|=u;for(l=l.entanglements;p;){var g=31-pe(p),w=1<<g;w&u|l[g]&u&&(l[g]|=u),p&=~w}}function Bt(l,u){var p=u&-u;return p=(p&42)!==0?1:Ct(p),(p&(l.suspendedLanes|u))!==0?0:p}function Ct(l){switch(l){case 2:l=1;break;case 8:l=4;break;case 32:l=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:l=128;break;case 268435456:l=134217728;break;default:l=0}return l}function $t(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function Vt(){var l=W.p;return l!==0?l:(l=window.event,l===void 0?32:S0(l.type))}function gt(l,u){var p=W.p;try{return W.p=l,u()}finally{W.p=p}}var ut=Math.random().toString(36).slice(2),ft="__reactFiber$"+ut,Ft="__reactProps$"+ut,cn="__reactContainer$"+ut,Dn="__reactEvents$"+ut,ss="__reactListeners$"+ut,zs="__reactHandles$"+ut,Ia="__reactResources$"+ut,$s="__reactMarker$"+ut;function ra(l){delete l[ft],delete l[Ft],delete l[Dn],delete l[ss],delete l[zs]}function ms(l){var u=l[ft];if(u)return u;for(var p=l.parentNode;p;){if(u=p[cn]||p[ft]){if(p=u.alternate,u.child!==null||p!==null&&p.child!==null)for(l=o0(l);l!==null;){if(p=l[ft])return p;l=o0(l)}return u}l=p,p=l.parentNode}return null}function Et(l){if(l=l[ft]||l[cn]){var u=l.tag;if(u===5||u===6||u===13||u===31||u===26||u===27||u===3)return l}return null}function Zn(l){var u=l.tag;if(u===5||u===26||u===27||u===6)return l.stateNode;throw Error(s(33))}function Vn(l){var u=l[Ia];return u||(u=l[Ia]={hoistableStyles:new Map,hoistableScripts:new Map}),u}function kn(l){l[$s]=!0}var $r=new Set,Hr={};function gs(l,u){ia(l,u),ia(l+"Capture",u)}function ia(l,u){for(Hr[l]=u,l=0;l<u.length;l++)$r.add(u[l])}var Pl=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]*$"),Ur={},bo={};function Hs(l){return $e.call(bo,l)?!0:$e.call(Ur,l)?!1:Pl.test(l)?bo[l]=!0:(Ur[l]=!0,!1)}function ja(l,u,p){if(Hs(u))if(p===null)l.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":l.removeAttribute(u);return;case"boolean":var g=u.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){l.removeAttribute(u);return}}l.setAttribute(u,""+p)}}function oa(l,u,p){if(p===null)l.removeAttribute(u);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(u);return}l.setAttribute(u,""+p)}}function os(l,u,p,g){if(g===null)l.removeAttribute(p);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":l.removeAttribute(p);return}l.setAttributeNS(u,p,""+g)}}function as(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function xo(l){var u=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function me(l,u,p){var g=Object.getOwnPropertyDescriptor(l.constructor.prototype,u);if(!l.hasOwnProperty(u)&&typeof g<"u"&&typeof g.get=="function"&&typeof g.set=="function"){var w=g.get,C=g.set;return Object.defineProperty(l,u,{configurable:!0,get:function(){return w.call(this)},set:function(I){p=""+I,C.call(this,I)}}),Object.defineProperty(l,u,{enumerable:g.enumerable}),{getValue:function(){return p},setValue:function(I){p=""+I},stopTracking:function(){l._valueTracker=null,delete l[u]}}}}function tt(l){if(!l._valueTracker){var u=xo(l)?"checked":"value";l._valueTracker=me(l,u,""+l[u])}}function At(l){if(!l)return!1;var u=l._valueTracker;if(!u)return!0;var p=u.getValue(),g="";return l&&(g=xo(l)?l.checked?"true":"false":l.value),l=g,l!==p?(u.setValue(l),!0):!1}function en(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}var Pn=/[\n"\\]/g;function zt(l){return l.replace(Pn,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function jt(l,u,p,g,w,C,I,G){l.name="",I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?l.type=I:l.removeAttribute("type"),u!=null?I==="number"?(u===0&&l.value===""||l.value!=u)&&(l.value=""+as(u)):l.value!==""+as(u)&&(l.value=""+as(u)):I!=="submit"&&I!=="reset"||l.removeAttribute("value"),u!=null?ws(l,I,as(u)):p!=null?ws(l,I,as(p)):g!=null&&l.removeAttribute("value"),w==null&&C!=null&&(l.defaultChecked=!!C),w!=null&&(l.checked=w&&typeof w!="function"&&typeof w!="symbol"),G!=null&&typeof G!="function"&&typeof G!="symbol"&&typeof G!="boolean"?l.name=""+as(G):l.removeAttribute("name")}function jn(l,u,p,g,w,C,I,G){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(l.type=C),u!=null||p!=null){if(!(C!=="submit"&&C!=="reset"||u!=null)){tt(l);return}p=p!=null?""+as(p):"",u=u!=null?""+as(u):p,G||u===l.value||(l.value=u),l.defaultValue=u}g=g??w,g=typeof g!="function"&&typeof g!="symbol"&&!!g,l.checked=G?l.checked:!!g,l.defaultChecked=!!g,I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(l.name=I),tt(l)}function ws(l,u,p){u==="number"&&en(l.ownerDocument)===l||l.defaultValue===""+p||(l.defaultValue=""+p)}function On(l,u,p,g){if(l=l.options,u){u={};for(var w=0;w<p.length;w++)u["$"+p[w]]=!0;for(p=0;p<l.length;p++)w=u.hasOwnProperty("$"+l[p].value),l[p].selected!==w&&(l[p].selected=w),w&&g&&(l[p].defaultSelected=!0)}else{for(p=""+as(p),u=null,w=0;w<l.length;w++){if(l[w].value===p){l[w].selected=!0,g&&(l[w].defaultSelected=!0);return}u!==null||l[w].disabled||(u=l[w])}u!==null&&(u.selected=!0)}}function ks(l,u,p){if(u!=null&&(u=""+as(u),u!==l.value&&(l.value=u),p==null)){l.defaultValue!==u&&(l.defaultValue=u);return}l.defaultValue=p!=null?""+as(p):""}function Ba(l,u,p,g){if(u==null){if(g!=null){if(p!=null)throw Error(s(92));if(L(g)){if(1<g.length)throw Error(s(93));g=g[0]}p=g}p==null&&(p=""),u=p}p=as(u),l.defaultValue=p,g=l.textContent,g===p&&g!==""&&g!==null&&(l.value=g),tt(l)}function la(l,u){if(u){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=u;return}}l.textContent=u}var Bp=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 Fu(l,u,p){var g=u.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?g?l.setProperty(u,""):u==="float"?l.cssFloat="":l[u]="":g?l.setProperty(u,p):typeof p!="number"||p===0||Bp.has(u)?u==="float"?l.cssFloat=p:l[u]=(""+p).trim():l[u]=p+"px"}function Il(l,u,p){if(u!=null&&typeof u!="object")throw Error(s(62));if(l=l.style,p!=null){for(var g in p)!p.hasOwnProperty(g)||u!=null&&u.hasOwnProperty(g)||(g.indexOf("--")===0?l.setProperty(g,""):g==="float"?l.cssFloat="":l[g]="");for(var w in u)g=u[w],u.hasOwnProperty(w)&&p[w]!==g&&Fu(l,w,g)}else for(var C in u)u.hasOwnProperty(C)&&Fu(l,C,u[C])}function yo(l){if(l.indexOf("-")===-1)return!1;switch(l){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 Ti=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"]]),Bl=/^[\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 vo(l){return Bl.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}function Na(){}var Fl=null;function zl(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var cr=null,ur=null;function $l(l){var u=Et(l);if(u&&(l=u.stateNode)){var p=l[Ft]||null;e:switch(l=u.stateNode,u.type){case"input":if(jt(l,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),u=p.name,p.type==="radio"&&u!=null){for(p=l;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+zt(""+u)+'"][type="radio"]'),u=0;u<p.length;u++){var g=p[u];if(g!==l&&g.form===l.form){var w=g[Ft]||null;if(!w)throw Error(s(90));jt(g,w.value,w.defaultValue,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name)}}for(u=0;u<p.length;u++)g=p[u],g.form===l.form&&At(g)}break e;case"textarea":ks(l,p.value,p.defaultValue);break e;case"select":u=p.value,u!=null&&On(l,!!p.multiple,u,!1)}}}var wo=!1;function Hl(l,u,p){if(wo)return l(u,p);wo=!0;try{var g=l(u);return g}finally{if(wo=!1,(cr!==null||ur!==null)&&(Cd(),cr&&(u=cr,l=ur,ur=cr=null,$l(u),l)))for(u=0;u<l.length;u++)$l(l[u])}}function Wr(l,u){var p=l.stateNode;if(p===null)return null;var g=p[Ft]||null;if(g===null)return null;p=g[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(l=l.type,g=!(l==="button"||l==="input"||l==="select"||l==="textarea")),l=!g;break e;default:l=!1}if(l)return null;if(p&&typeof p!="function")throw Error(s(231,u,typeof p));return p}var ca=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ko=!1;if(ca)try{var qr={};Object.defineProperty(qr,"passive",{get:function(){ko=!0}}),window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{ko=!1}var Ta=null,So=null,_i=null;function Ul(){if(_i)return _i;var l,u=So,p=u.length,g,w="value"in Ta?Ta.value:Ta.textContent,C=w.length;for(l=0;l<p&&u[l]===w[l];l++);var I=p-l;for(g=1;g<=I&&u[p-g]===w[C-g];g++);return _i=w.slice(l,1<g?1-g:void 0)}function ne(l){var u=l.keyCode;return"charCode"in l?(l=l.charCode,l===0&&u===13&&(l=13)):l=u,l===10&&(l=13),32<=l||l===13?l:0}function Te(){return!0}function ye(){return!1}function Ie(l){function u(p,g,w,C,I){this._reactName=p,this._targetInst=w,this.type=g,this.nativeEvent=C,this.target=I,this.currentTarget=null;for(var G in l)l.hasOwnProperty(G)&&(p=l[G],this[G]=p?p(C):C[G]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?Te:ye,this.isPropagationStopped=ye,this}return m(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Te)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Te)},persist:function(){},isPersistent:Te}),u}var mt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mt=Ie(mt),fn=m({},mt,{view:0,detail:0}),rn=Ie(fn),$n,ls,Ss,Wl=m({},fn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$p,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Ss&&(Ss&&l.type==="mousemove"?($n=l.screenX-Ss.screenX,ls=l.screenY-Ss.screenY):ls=$n=0,Ss=l),$n)},movementY:function(l){return"movementY"in l?l.movementY:ls}}),zu=Ie(Wl),$u=m({},Wl,{dataTransfer:0}),Hu=Ie($u),ql=m({},fn,{relatedTarget:0}),Co=Ie(ql),Fp=m({},mt,{animationName:0,elapsedTime:0,pseudoElement:0}),zp=Ie(Fp),OT=m({},mt,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}}),LT=Ie(OT),PT=m({},mt,{data:0}),sy=Ie(PT),IT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BT={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"},FT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zT(l){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(l):(l=FT[l])?!!u[l]:!1}function $p(){return zT}var $T=m({},fn,{key:function(l){if(l.key){var u=IT[l.key]||l.key;if(u!=="Unidentified")return u}return l.type==="keypress"?(l=ne(l),l===13?"Enter":String.fromCharCode(l)):l.type==="keydown"||l.type==="keyup"?BT[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$p,charCode:function(l){return l.type==="keypress"?ne(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?ne(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}}),HT=Ie($T),UT=m({},Wl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ay=Ie(UT),WT=m({},fn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$p}),qT=Ie(WT),VT=m({},mt,{propertyName:0,elapsedTime:0,pseudoElement:0}),GT=Ie(VT),YT=m({},Wl,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0}),KT=Ie(YT),QT=m({},mt,{newState:0,oldState:0}),XT=Ie(QT),JT=[9,13,27,32],Hp=ca&&"CompositionEvent"in window,Vl=null;ca&&"documentMode"in document&&(Vl=document.documentMode);var ZT=ca&&"TextEvent"in window&&!Vl,ry=ca&&(!Hp||Vl&&8<Vl&&11>=Vl),iy=" ",oy=!1;function ly(l,u){switch(l){case"keyup":return JT.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Ao=!1;function e_(l,u){switch(l){case"compositionend":return cy(u);case"keypress":return u.which!==32?null:(oy=!0,iy);case"textInput":return l=u.data,l===iy&&oy?null:l;default:return null}}function t_(l,u){if(Ao)return l==="compositionend"||!Hp&&ly(l,u)?(l=Ul(),_i=So=Ta=null,Ao=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return ry&&u.locale!=="ko"?null:u.data;default:return null}}var n_={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 uy(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u==="input"?!!n_[l.type]:u==="textarea"}function dy(l,u,p,g){cr?ur?ur.push(g):ur=[g]:cr=g,u=Md(u,"onChange"),0<u.length&&(p=new Mt("onChange","change",null,p,g),l.push({event:p,listeners:u}))}var Gl=null,Yl=null;function s_(l){Gw(l,0)}function Uu(l){var u=Zn(l);if(At(u))return l}function fy(l,u){if(l==="change")return u}var py=!1;if(ca){var Up;if(ca){var Wp="oninput"in document;if(!Wp){var hy=document.createElement("div");hy.setAttribute("oninput","return;"),Wp=typeof hy.oninput=="function"}Up=Wp}else Up=!1;py=Up&&(!document.documentMode||9<document.documentMode)}function my(){Gl&&(Gl.detachEvent("onpropertychange",gy),Yl=Gl=null)}function gy(l){if(l.propertyName==="value"&&Uu(Yl)){var u=[];dy(u,Yl,l,zl(l)),Hl(s_,u)}}function a_(l,u,p){l==="focusin"?(my(),Gl=u,Yl=p,Gl.attachEvent("onpropertychange",gy)):l==="focusout"&&my()}function r_(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Uu(Yl)}function i_(l,u){if(l==="click")return Uu(u)}function o_(l,u){if(l==="input"||l==="change")return Uu(u)}function l_(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var Us=typeof Object.is=="function"?Object.is:l_;function Kl(l,u){if(Us(l,u))return!0;if(typeof l!="object"||l===null||typeof u!="object"||u===null)return!1;var p=Object.keys(l),g=Object.keys(u);if(p.length!==g.length)return!1;for(g=0;g<p.length;g++){var w=p[g];if(!$e.call(u,w)||!Us(l[w],u[w]))return!1}return!0}function by(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function xy(l,u){var p=by(l);l=0;for(var g;p;){if(p.nodeType===3){if(g=l+p.textContent.length,l<=u&&g>=u)return{node:p,offset:u-l};l=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=by(p)}}function yy(l,u){return l&&u?l===u?!0:l&&l.nodeType===3?!1:u&&u.nodeType===3?yy(l,u.parentNode):"contains"in l?l.contains(u):l.compareDocumentPosition?!!(l.compareDocumentPosition(u)&16):!1:!1}function vy(l){l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window;for(var u=en(l.document);u instanceof l.HTMLIFrameElement;){try{var p=typeof u.contentWindow.location.href=="string"}catch{p=!1}if(p)l=u.contentWindow;else break;u=en(l.document)}return u}function qp(l){var u=l&&l.nodeName&&l.nodeName.toLowerCase();return u&&(u==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||u==="textarea"||l.contentEditable==="true")}var c_=ca&&"documentMode"in document&&11>=document.documentMode,jo=null,Vp=null,Ql=null,Gp=!1;function wy(l,u,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Gp||jo==null||jo!==en(g)||(g=jo,"selectionStart"in g&&qp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ql&&Kl(Ql,g)||(Ql=g,g=Md(Vp,"onSelect"),0<g.length&&(u=new Mt("onSelect","select",null,u,p),l.push({event:u,listeners:g}),u.target=jo)))}function Ei(l,u){var p={};return p[l.toLowerCase()]=u.toLowerCase(),p["Webkit"+l]="webkit"+u,p["Moz"+l]="moz"+u,p}var No={animationend:Ei("Animation","AnimationEnd"),animationiteration:Ei("Animation","AnimationIteration"),animationstart:Ei("Animation","AnimationStart"),transitionrun:Ei("Transition","TransitionRun"),transitionstart:Ei("Transition","TransitionStart"),transitioncancel:Ei("Transition","TransitionCancel"),transitionend:Ei("Transition","TransitionEnd")},Yp={},ky={};ca&&(ky=document.createElement("div").style,"AnimationEvent"in window||(delete No.animationend.animation,delete No.animationiteration.animation,delete No.animationstart.animation),"TransitionEvent"in window||delete No.transitionend.transition);function Mi(l){if(Yp[l])return Yp[l];if(!No[l])return l;var u=No[l],p;for(p in u)if(u.hasOwnProperty(p)&&p in ky)return Yp[l]=u[p];return l}var Sy=Mi("animationend"),Cy=Mi("animationiteration"),Ay=Mi("animationstart"),u_=Mi("transitionrun"),d_=Mi("transitionstart"),f_=Mi("transitioncancel"),jy=Mi("transitionend"),Ny=new Map,Kp="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(" ");Kp.push("scrollEnd");function _a(l,u){Ny.set(l,u),gs(u,[l])}var Wu=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var u=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(u))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",l);return}console.error(l)},ua=[],To=0,Qp=0;function qu(){for(var l=To,u=Qp=To=0;u<l;){var p=ua[u];ua[u++]=null;var g=ua[u];ua[u++]=null;var w=ua[u];ua[u++]=null;var C=ua[u];if(ua[u++]=null,g!==null&&w!==null){var I=g.pending;I===null?w.next=w:(w.next=I.next,I.next=w),g.pending=w}C!==0&&Ty(p,w,C)}}function Vu(l,u,p,g){ua[To++]=l,ua[To++]=u,ua[To++]=p,ua[To++]=g,Qp|=g,l.lanes|=g,l=l.alternate,l!==null&&(l.lanes|=g)}function Xp(l,u,p,g){return Vu(l,u,p,g),Gu(l)}function Di(l,u){return Vu(l,null,null,u),Gu(l)}function Ty(l,u,p){l.lanes|=p;var g=l.alternate;g!==null&&(g.lanes|=p);for(var w=!1,C=l.return;C!==null;)C.childLanes|=p,g=C.alternate,g!==null&&(g.childLanes|=p),C.tag===22&&(l=C.stateNode,l===null||l._visibility&1||(w=!0)),l=C,C=C.return;return l.tag===3?(C=l.stateNode,w&&u!==null&&(w=31-pe(p),l=C.hiddenUpdates,g=l[w],g===null?l[w]=[u]:g.push(u),u.lane=p|536870912),C):null}function Gu(l){if(50<xc)throw xc=0,im=null,Error(s(185));for(var u=l.return;u!==null;)l=u,u=l.return;return l.tag===3?l.stateNode:null}var _o={};function p_(l,u,p,g){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ws(l,u,p,g){return new p_(l,u,p,g)}function Jp(l){return l=l.prototype,!(!l||!l.isReactComponent)}function dr(l,u){var p=l.alternate;return p===null?(p=Ws(l.tag,u,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=u,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&65011712,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,u=l.dependencies,p.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p.refCleanup=l.refCleanup,p}function _y(l,u){l.flags&=65011714;var p=l.alternate;return p===null?(l.childLanes=0,l.lanes=u,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=p.childLanes,l.lanes=p.lanes,l.child=p.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=p.memoizedProps,l.memoizedState=p.memoizedState,l.updateQueue=p.updateQueue,l.type=p.type,u=p.dependencies,l.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),l}function Yu(l,u,p,g,w,C){var I=0;if(g=l,typeof l=="function")Jp(l)&&(I=1);else if(typeof l=="string")I=xE(l,p,be.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case T:return l=Ws(31,p,u,w),l.elementType=T,l.lanes=C,l;case S:return Ri(p.children,w,C,u);case A:I=8,w|=24;break;case k:return l=Ws(12,p,u,w|2),l.elementType=k,l.lanes=C,l;case D:return l=Ws(13,p,u,w),l.elementType=D,l.lanes=C,l;case _:return l=Ws(19,p,u,w),l.elementType=_,l.lanes=C,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case j:I=10;break e;case N:I=9;break e;case E:I=11;break e;case B:I=14;break e;case O:I=16,g=null;break e}I=29,p=Error(s(130,l===null?"null":typeof l,"")),g=null}return u=Ws(I,p,u,w),u.elementType=l,u.type=g,u.lanes=C,u}function Ri(l,u,p,g){return l=Ws(7,l,g,u),l.lanes=p,l}function Zp(l,u,p){return l=Ws(6,l,null,u),l.lanes=p,l}function Ey(l){var u=Ws(18,null,null,0);return u.stateNode=l,u}function eh(l,u,p){return u=Ws(4,l.children!==null?l.children:[],l.key,u),u.lanes=p,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}var My=new WeakMap;function da(l,u){if(typeof l=="object"&&l!==null){var p=My.get(l);return p!==void 0?p:(u={value:l,source:u,stack:we(u)},My.set(l,u),u)}return{value:l,source:u,stack:we(u)}}var Eo=[],Mo=0,Ku=null,Xl=0,fa=[],pa=0,Vr=null,Fa=1,za="";function fr(l,u){Eo[Mo++]=Xl,Eo[Mo++]=Ku,Ku=l,Xl=u}function Dy(l,u,p){fa[pa++]=Fa,fa[pa++]=za,fa[pa++]=Vr,Vr=l;var g=Fa;l=za;var w=32-pe(g)-1;g&=~(1<<w),p+=1;var C=32-pe(u)+w;if(30<C){var I=w-w%5;C=(g&(1<<I)-1).toString(32),g>>=I,w-=I,Fa=1<<32-pe(u)+w|p<<w|g,za=C+l}else Fa=1<<C|p<<w|g,za=l}function th(l){l.return!==null&&(fr(l,1),Dy(l,1,0))}function nh(l){for(;l===Ku;)Ku=Eo[--Mo],Eo[Mo]=null,Xl=Eo[--Mo],Eo[Mo]=null;for(;l===Vr;)Vr=fa[--pa],fa[pa]=null,za=fa[--pa],fa[pa]=null,Fa=fa[--pa],fa[pa]=null}function Ry(l,u){fa[pa++]=Fa,fa[pa++]=za,fa[pa++]=Vr,Fa=u.id,za=u.overflow,Vr=l}var cs=null,_n=null,an=!1,Gr=null,ha=!1,sh=Error(s(519));function Yr(l){var u=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(da(u,l)),sh}function Oy(l){var u=l.stateNode,p=l.type,g=l.memoizedProps;switch(u[ft]=l,u[Ft]=g,p){case"dialog":Kt("cancel",u),Kt("close",u);break;case"iframe":case"object":case"embed":Kt("load",u);break;case"video":case"audio":for(p=0;p<vc.length;p++)Kt(vc[p],u);break;case"source":Kt("error",u);break;case"img":case"image":case"link":Kt("error",u),Kt("load",u);break;case"details":Kt("toggle",u);break;case"input":Kt("invalid",u),jn(u,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":Kt("invalid",u);break;case"textarea":Kt("invalid",u),Ba(u,g.value,g.defaultValue,g.children)}p=g.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||u.textContent===""+p||g.suppressHydrationWarning===!0||Xw(u.textContent,p)?(g.popover!=null&&(Kt("beforetoggle",u),Kt("toggle",u)),g.onScroll!=null&&Kt("scroll",u),g.onScrollEnd!=null&&Kt("scrollend",u),g.onClick!=null&&(u.onclick=Na),u=!0):u=!1,u||Yr(l,!0)}function Ly(l){for(cs=l.return;cs;)switch(cs.tag){case 5:case 31:case 13:ha=!1;return;case 27:case 3:ha=!0;return;default:cs=cs.return}}function Do(l){if(l!==cs)return!1;if(!an)return Ly(l),an=!0,!1;var u=l.tag,p;if((p=u!==3&&u!==27)&&((p=u===5)&&(p=l.type,p=!(p!=="form"&&p!=="button")||wm(l.type,l.memoizedProps)),p=!p),p&&_n&&Yr(l),Ly(l),u===13){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));_n=i0(l)}else if(u===31){if(l=l.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(317));_n=i0(l)}else u===27?(u=_n,li(l.type)?(l=jm,jm=null,_n=l):_n=u):_n=cs?ga(l.stateNode.nextSibling):null;return!0}function Oi(){_n=cs=null,an=!1}function ah(){var l=Gr;return l!==null&&(Ds===null?Ds=l:Ds.push.apply(Ds,l),Gr=null),l}function Jl(l){Gr===null?Gr=[l]:Gr.push(l)}var rh=K(null),Li=null,pr=null;function Kr(l,u,p){q(rh,u._currentValue),u._currentValue=p}function hr(l){l._currentValue=rh.current,Q(rh)}function ih(l,u,p){for(;l!==null;){var g=l.alternate;if((l.childLanes&u)!==u?(l.childLanes|=u,g!==null&&(g.childLanes|=u)):g!==null&&(g.childLanes&u)!==u&&(g.childLanes|=u),l===p)break;l=l.return}}function oh(l,u,p,g){var w=l.child;for(w!==null&&(w.return=l);w!==null;){var C=w.dependencies;if(C!==null){var I=w.child;C=C.firstContext;e:for(;C!==null;){var G=C;C=w;for(var re=0;re<u.length;re++)if(G.context===u[re]){C.lanes|=p,G=C.alternate,G!==null&&(G.lanes|=p),ih(C.return,p,l),g||(I=null);break e}C=G.next}}else if(w.tag===18){if(I=w.return,I===null)throw Error(s(341));I.lanes|=p,C=I.alternate,C!==null&&(C.lanes|=p),ih(I,p,l),I=null}else I=w.child;if(I!==null)I.return=w;else for(I=w;I!==null;){if(I===l){I=null;break}if(w=I.sibling,w!==null){w.return=I.return,I=w;break}I=I.return}w=I}}function Ro(l,u,p,g){l=null;for(var w=u,C=!1;w!==null;){if(!C){if((w.flags&524288)!==0)C=!0;else if((w.flags&262144)!==0)break}if(w.tag===10){var I=w.alternate;if(I===null)throw Error(s(387));if(I=I.memoizedProps,I!==null){var G=w.type;Us(w.pendingProps.value,I.value)||(l!==null?l.push(G):l=[G])}}else if(w===de.current){if(I=w.alternate,I===null)throw Error(s(387));I.memoizedState.memoizedState!==w.memoizedState.memoizedState&&(l!==null?l.push(Ac):l=[Ac])}w=w.return}l!==null&&oh(u,l,p,g),u.flags|=262144}function Qu(l){for(l=l.firstContext;l!==null;){if(!Us(l.context._currentValue,l.memoizedValue))return!0;l=l.next}return!1}function Pi(l){Li=l,pr=null,l=l.dependencies,l!==null&&(l.firstContext=null)}function us(l){return Py(Li,l)}function Xu(l,u){return Li===null&&Pi(l),Py(l,u)}function Py(l,u){var p=u._currentValue;if(u={context:u,memoizedValue:p,next:null},pr===null){if(l===null)throw Error(s(308));pr=u,l.dependencies={lanes:0,firstContext:u},l.flags|=524288}else pr=pr.next=u;return p}var h_=typeof AbortController<"u"?AbortController:function(){var l=[],u=this.signal={aborted:!1,addEventListener:function(p,g){l.push(g)}};this.abort=function(){u.aborted=!0,l.forEach(function(p){return p()})}},m_=t.unstable_scheduleCallback,g_=t.unstable_NormalPriority,Gn={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lh(){return{controller:new h_,data:new Map,refCount:0}}function Zl(l){l.refCount--,l.refCount===0&&m_(g_,function(){l.controller.abort()})}var ec=null,ch=0,Oo=0,Lo=null;function b_(l,u){if(ec===null){var p=ec=[];ch=0,Oo=fm(),Lo={status:"pending",value:void 0,then:function(g){p.push(g)}}}return ch++,u.then(Iy,Iy),u}function Iy(){if(--ch===0&&ec!==null){Lo!==null&&(Lo.status="fulfilled");var l=ec;ec=null,Oo=0,Lo=null;for(var u=0;u<l.length;u++)(0,l[u])()}}function x_(l,u){var p=[],g={status:"pending",value:null,reason:null,then:function(w){p.push(w)}};return l.then(function(){g.status="fulfilled",g.value=u;for(var w=0;w<p.length;w++)(0,p[w])(u)},function(w){for(g.status="rejected",g.reason=w,w=0;w<p.length;w++)(0,p[w])(void 0)}),g}var By=z.S;z.S=function(l,u){ww=ot(),typeof u=="object"&&u!==null&&typeof u.then=="function"&&b_(l,u),By!==null&&By(l,u)};var Ii=K(null);function uh(){var l=Ii.current;return l!==null?l:Sn.pooledCache}function Ju(l,u){u===null?q(Ii,Ii.current):q(Ii,u.pool)}function Fy(){var l=uh();return l===null?null:{parent:Gn._currentValue,pool:l}}var Po=Error(s(460)),dh=Error(s(474)),Zu=Error(s(542)),ed={then:function(){}};function zy(l){return l=l.status,l==="fulfilled"||l==="rejected"}function $y(l,u,p){switch(p=l[p],p===void 0?l.push(u):p!==u&&(u.then(Na,Na),u=p),u.status){case"fulfilled":return u.value;case"rejected":throw l=u.reason,Uy(l),l;default:if(typeof u.status=="string")u.then(Na,Na);else{if(l=Sn,l!==null&&100<l.shellSuspendCounter)throw Error(s(482));l=u,l.status="pending",l.then(function(g){if(u.status==="pending"){var w=u;w.status="fulfilled",w.value=g}},function(g){if(u.status==="pending"){var w=u;w.status="rejected",w.reason=g}})}switch(u.status){case"fulfilled":return u.value;case"rejected":throw l=u.reason,Uy(l),l}throw Fi=u,Po}}function Bi(l){try{var u=l._init;return u(l._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Fi=p,Po):p}}var Fi=null;function Hy(){if(Fi===null)throw Error(s(459));var l=Fi;return Fi=null,l}function Uy(l){if(l===Po||l===Zu)throw Error(s(483))}var Io=null,tc=0;function td(l){var u=tc;return tc+=1,Io===null&&(Io=[]),$y(Io,l,u)}function nc(l,u){u=u.props.ref,l.ref=u!==void 0?u:null}function nd(l,u){throw u.$$typeof===x?Error(s(525)):(l=Object.prototype.toString.call(u),Error(s(31,l==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":l)))}function Wy(l){function u(Ae,le){if(l){var Me=Ae.deletions;Me===null?(Ae.deletions=[le],Ae.flags|=16):Me.push(le)}}function p(Ae,le){if(!l)return null;for(;le!==null;)u(Ae,le),le=le.sibling;return null}function g(Ae){for(var le=new Map;Ae!==null;)Ae.key!==null?le.set(Ae.key,Ae):le.set(Ae.index,Ae),Ae=Ae.sibling;return le}function w(Ae,le){return Ae=dr(Ae,le),Ae.index=0,Ae.sibling=null,Ae}function C(Ae,le,Me){return Ae.index=Me,l?(Me=Ae.alternate,Me!==null?(Me=Me.index,Me<le?(Ae.flags|=67108866,le):Me):(Ae.flags|=67108866,le)):(Ae.flags|=1048576,le)}function I(Ae){return l&&Ae.alternate===null&&(Ae.flags|=67108866),Ae}function G(Ae,le,Me,Qe){return le===null||le.tag!==6?(le=Zp(Me,Ae.mode,Qe),le.return=Ae,le):(le=w(le,Me),le.return=Ae,le)}function re(Ae,le,Me,Qe){var Nt=Me.type;return Nt===S?Ye(Ae,le,Me.props.children,Qe,Me.key):le!==null&&(le.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===O&&Bi(Nt)===le.type)?(le=w(le,Me.props),nc(le,Me),le.return=Ae,le):(le=Yu(Me.type,Me.key,Me.props,null,Ae.mode,Qe),nc(le,Me),le.return=Ae,le)}function De(Ae,le,Me,Qe){return le===null||le.tag!==4||le.stateNode.containerInfo!==Me.containerInfo||le.stateNode.implementation!==Me.implementation?(le=eh(Me,Ae.mode,Qe),le.return=Ae,le):(le=w(le,Me.children||[]),le.return=Ae,le)}function Ye(Ae,le,Me,Qe,Nt){return le===null||le.tag!==7?(le=Ri(Me,Ae.mode,Qe,Nt),le.return=Ae,le):(le=w(le,Me),le.return=Ae,le)}function Xe(Ae,le,Me){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return le=Zp(""+le,Ae.mode,Me),le.return=Ae,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return Me=Yu(le.type,le.key,le.props,null,Ae.mode,Me),nc(Me,le),Me.return=Ae,Me;case v:return le=eh(le,Ae.mode,Me),le.return=Ae,le;case O:return le=Bi(le),Xe(Ae,le,Me)}if(L(le)||F(le))return le=Ri(le,Ae.mode,Me,null),le.return=Ae,le;if(typeof le.then=="function")return Xe(Ae,td(le),Me);if(le.$$typeof===j)return Xe(Ae,Xu(Ae,le),Me);nd(Ae,le)}return null}function Pe(Ae,le,Me,Qe){var Nt=le!==null?le.key:null;if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return Nt!==null?null:G(Ae,le,""+Me,Qe);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case y:return Me.key===Nt?re(Ae,le,Me,Qe):null;case v:return Me.key===Nt?De(Ae,le,Me,Qe):null;case O:return Me=Bi(Me),Pe(Ae,le,Me,Qe)}if(L(Me)||F(Me))return Nt!==null?null:Ye(Ae,le,Me,Qe,null);if(typeof Me.then=="function")return Pe(Ae,le,td(Me),Qe);if(Me.$$typeof===j)return Pe(Ae,le,Xu(Ae,Me),Qe);nd(Ae,Me)}return null}function He(Ae,le,Me,Qe,Nt){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number"||typeof Qe=="bigint")return Ae=Ae.get(Me)||null,G(le,Ae,""+Qe,Nt);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case y:return Ae=Ae.get(Qe.key===null?Me:Qe.key)||null,re(le,Ae,Qe,Nt);case v:return Ae=Ae.get(Qe.key===null?Me:Qe.key)||null,De(le,Ae,Qe,Nt);case O:return Qe=Bi(Qe),He(Ae,le,Me,Qe,Nt)}if(L(Qe)||F(Qe))return Ae=Ae.get(Me)||null,Ye(le,Ae,Qe,Nt,null);if(typeof Qe.then=="function")return He(Ae,le,Me,td(Qe),Nt);if(Qe.$$typeof===j)return He(Ae,le,Me,Xu(le,Qe),Nt);nd(le,Qe)}return null}function yt(Ae,le,Me,Qe){for(var Nt=null,un=null,kt=le,Ut=le=0,nn=null;kt!==null&&Ut<Me.length;Ut++){kt.index>Ut?(nn=kt,kt=null):nn=kt.sibling;var dn=Pe(Ae,kt,Me[Ut],Qe);if(dn===null){kt===null&&(kt=nn);break}l&&kt&&dn.alternate===null&&u(Ae,kt),le=C(dn,le,Ut),un===null?Nt=dn:un.sibling=dn,un=dn,kt=nn}if(Ut===Me.length)return p(Ae,kt),an&&fr(Ae,Ut),Nt;if(kt===null){for(;Ut<Me.length;Ut++)kt=Xe(Ae,Me[Ut],Qe),kt!==null&&(le=C(kt,le,Ut),un===null?Nt=kt:un.sibling=kt,un=kt);return an&&fr(Ae,Ut),Nt}for(kt=g(kt);Ut<Me.length;Ut++)nn=He(kt,Ae,Ut,Me[Ut],Qe),nn!==null&&(l&&nn.alternate!==null&&kt.delete(nn.key===null?Ut:nn.key),le=C(nn,le,Ut),un===null?Nt=nn:un.sibling=nn,un=nn);return l&&kt.forEach(function(pi){return u(Ae,pi)}),an&&fr(Ae,Ut),Nt}function Rt(Ae,le,Me,Qe){if(Me==null)throw Error(s(151));for(var Nt=null,un=null,kt=le,Ut=le=0,nn=null,dn=Me.next();kt!==null&&!dn.done;Ut++,dn=Me.next()){kt.index>Ut?(nn=kt,kt=null):nn=kt.sibling;var pi=Pe(Ae,kt,dn.value,Qe);if(pi===null){kt===null&&(kt=nn);break}l&&kt&&pi.alternate===null&&u(Ae,kt),le=C(pi,le,Ut),un===null?Nt=pi:un.sibling=pi,un=pi,kt=nn}if(dn.done)return p(Ae,kt),an&&fr(Ae,Ut),Nt;if(kt===null){for(;!dn.done;Ut++,dn=Me.next())dn=Xe(Ae,dn.value,Qe),dn!==null&&(le=C(dn,le,Ut),un===null?Nt=dn:un.sibling=dn,un=dn);return an&&fr(Ae,Ut),Nt}for(kt=g(kt);!dn.done;Ut++,dn=Me.next())dn=He(kt,Ae,Ut,dn.value,Qe),dn!==null&&(l&&dn.alternate!==null&&kt.delete(dn.key===null?Ut:dn.key),le=C(dn,le,Ut),un===null?Nt=dn:un.sibling=dn,un=dn);return l&&kt.forEach(function(_E){return u(Ae,_E)}),an&&fr(Ae,Ut),Nt}function wn(Ae,le,Me,Qe){if(typeof Me=="object"&&Me!==null&&Me.type===S&&Me.key===null&&(Me=Me.props.children),typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case y:e:{for(var Nt=Me.key;le!==null;){if(le.key===Nt){if(Nt=Me.type,Nt===S){if(le.tag===7){p(Ae,le.sibling),Qe=w(le,Me.props.children),Qe.return=Ae,Ae=Qe;break e}}else if(le.elementType===Nt||typeof Nt=="object"&&Nt!==null&&Nt.$$typeof===O&&Bi(Nt)===le.type){p(Ae,le.sibling),Qe=w(le,Me.props),nc(Qe,Me),Qe.return=Ae,Ae=Qe;break e}p(Ae,le);break}else u(Ae,le);le=le.sibling}Me.type===S?(Qe=Ri(Me.props.children,Ae.mode,Qe,Me.key),Qe.return=Ae,Ae=Qe):(Qe=Yu(Me.type,Me.key,Me.props,null,Ae.mode,Qe),nc(Qe,Me),Qe.return=Ae,Ae=Qe)}return I(Ae);case v:e:{for(Nt=Me.key;le!==null;){if(le.key===Nt)if(le.tag===4&&le.stateNode.containerInfo===Me.containerInfo&&le.stateNode.implementation===Me.implementation){p(Ae,le.sibling),Qe=w(le,Me.children||[]),Qe.return=Ae,Ae=Qe;break e}else{p(Ae,le);break}else u(Ae,le);le=le.sibling}Qe=eh(Me,Ae.mode,Qe),Qe.return=Ae,Ae=Qe}return I(Ae);case O:return Me=Bi(Me),wn(Ae,le,Me,Qe)}if(L(Me))return yt(Ae,le,Me,Qe);if(F(Me)){if(Nt=F(Me),typeof Nt!="function")throw Error(s(150));return Me=Nt.call(Me),Rt(Ae,le,Me,Qe)}if(typeof Me.then=="function")return wn(Ae,le,td(Me),Qe);if(Me.$$typeof===j)return wn(Ae,le,Xu(Ae,Me),Qe);nd(Ae,Me)}return typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint"?(Me=""+Me,le!==null&&le.tag===6?(p(Ae,le.sibling),Qe=w(le,Me),Qe.return=Ae,Ae=Qe):(p(Ae,le),Qe=Zp(Me,Ae.mode,Qe),Qe.return=Ae,Ae=Qe),I(Ae)):p(Ae,le)}return function(Ae,le,Me,Qe){try{tc=0;var Nt=wn(Ae,le,Me,Qe);return Io=null,Nt}catch(kt){if(kt===Po||kt===Zu)throw kt;var un=Ws(29,kt,null,Ae.mode);return un.lanes=Qe,un.return=Ae,un}finally{}}}var zi=Wy(!0),qy=Wy(!1),Qr=!1;function fh(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ph(l,u){l=l.updateQueue,u.updateQueue===l&&(u.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Xr(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Jr(l,u,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(pn&2)!==0){var w=g.pending;return w===null?u.next=u:(u.next=w.next,w.next=u),g.pending=u,u=Gu(l),Ty(l,null,p),u}return Vu(l,g,u,p),Gu(l)}function sc(l,u,p){if(u=u.updateQueue,u!==null&&(u=u.shared,(p&4194048)!==0)){var g=u.lanes;g&=l.pendingLanes,p|=g,u.lanes=p,_t(l,p)}}function hh(l,u){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var w=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var I={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};C===null?w=C=I:C=C.next=I,p=p.next}while(p!==null);C===null?w=C=u:C=C.next=u}else w=C=u;p={baseState:g.baseState,firstBaseUpdate:w,lastBaseUpdate:C,shared:g.shared,callbacks:g.callbacks},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=u}var mh=!1;function ac(){if(mh){var l=Lo;if(l!==null)throw l}}function rc(l,u,p,g){mh=!1;var w=l.updateQueue;Qr=!1;var C=w.firstBaseUpdate,I=w.lastBaseUpdate,G=w.shared.pending;if(G!==null){w.shared.pending=null;var re=G,De=re.next;re.next=null,I===null?C=De:I.next=De,I=re;var Ye=l.alternate;Ye!==null&&(Ye=Ye.updateQueue,G=Ye.lastBaseUpdate,G!==I&&(G===null?Ye.firstBaseUpdate=De:G.next=De,Ye.lastBaseUpdate=re))}if(C!==null){var Xe=w.baseState;I=0,Ye=De=re=null,G=C;do{var Pe=G.lane&-536870913,He=Pe!==G.lane;if(He?(tn&Pe)===Pe:(g&Pe)===Pe){Pe!==0&&Pe===Oo&&(mh=!0),Ye!==null&&(Ye=Ye.next={lane:0,tag:G.tag,payload:G.payload,callback:null,next:null});e:{var yt=l,Rt=G;Pe=u;var wn=p;switch(Rt.tag){case 1:if(yt=Rt.payload,typeof yt=="function"){Xe=yt.call(wn,Xe,Pe);break e}Xe=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=Rt.payload,Pe=typeof yt=="function"?yt.call(wn,Xe,Pe):yt,Pe==null)break e;Xe=m({},Xe,Pe);break e;case 2:Qr=!0}}Pe=G.callback,Pe!==null&&(l.flags|=64,He&&(l.flags|=8192),He=w.callbacks,He===null?w.callbacks=[Pe]:He.push(Pe))}else He={lane:Pe,tag:G.tag,payload:G.payload,callback:G.callback,next:null},Ye===null?(De=Ye=He,re=Xe):Ye=Ye.next=He,I|=Pe;if(G=G.next,G===null){if(G=w.shared.pending,G===null)break;He=G,G=He.next,He.next=null,w.lastBaseUpdate=He,w.shared.pending=null}}while(!0);Ye===null&&(re=Xe),w.baseState=re,w.firstBaseUpdate=De,w.lastBaseUpdate=Ye,C===null&&(w.shared.lanes=0),si|=I,l.lanes=I,l.memoizedState=Xe}}function Vy(l,u){if(typeof l!="function")throw Error(s(191,l));l.call(u)}function Gy(l,u){var p=l.callbacks;if(p!==null)for(l.callbacks=null,l=0;l<p.length;l++)Vy(p[l],u)}var Bo=K(null),sd=K(0);function Yy(l,u){l=Sr,q(sd,l),q(Bo,u),Sr=l|u.baseLanes}function gh(){q(sd,Sr),q(Bo,Bo.current)}function bh(){Sr=sd.current,Q(Bo),Q(sd)}var qs=K(null),ma=null;function Zr(l){var u=l.alternate;q(Hn,Hn.current&1),q(qs,l),ma===null&&(u===null||Bo.current!==null||u.memoizedState!==null)&&(ma=l)}function xh(l){q(Hn,Hn.current),q(qs,l),ma===null&&(ma=l)}function Ky(l){l.tag===22?(q(Hn,Hn.current),q(qs,l),ma===null&&(ma=l)):ei()}function ei(){q(Hn,Hn.current),q(qs,qs.current)}function Vs(l){Q(qs),ma===l&&(ma=null),Q(Hn)}var Hn=K(0);function ad(l){for(var u=l;u!==null;){if(u.tag===13){var p=u.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Cm(p)||Am(p)))return u}else if(u.tag===19&&(u.memoizedProps.revealOrder==="forwards"||u.memoizedProps.revealOrder==="backwards"||u.memoizedProps.revealOrder==="unstable_legacy-backwards"||u.memoizedProps.revealOrder==="together")){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var mr=0,Ht=null,yn=null,Yn=null,rd=!1,Fo=!1,$i=!1,id=0,ic=0,zo=null,y_=0;function In(){throw Error(s(321))}function yh(l,u){if(u===null)return!1;for(var p=0;p<u.length&&p<l.length;p++)if(!Us(l[p],u[p]))return!1;return!0}function vh(l,u,p,g,w,C){return mr=C,Ht=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,z.H=l===null||l.memoizedState===null?Dv:Lh,$i=!1,C=p(g,w),$i=!1,Fo&&(C=Xy(u,p,g,w)),Qy(l),C}function Qy(l){z.H=cc;var u=yn!==null&&yn.next!==null;if(mr=0,Yn=yn=Ht=null,rd=!1,ic=0,zo=null,u)throw Error(s(300));l===null||Kn||(l=l.dependencies,l!==null&&Qu(l)&&(Kn=!0))}function Xy(l,u,p,g){Ht=l;var w=0;do{if(Fo&&(zo=null),ic=0,Fo=!1,25<=w)throw Error(s(301));if(w+=1,Yn=yn=null,l.updateQueue!=null){var C=l.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}z.H=Rv,C=u(p,g)}while(Fo);return C}function v_(){var l=z.H,u=l.useState()[0];return u=typeof u.then=="function"?oc(u):u,l=l.useState()[0],(yn!==null?yn.memoizedState:null)!==l&&(Ht.flags|=1024),u}function wh(){var l=id!==0;return id=0,l}function kh(l,u,p){u.updateQueue=l.updateQueue,u.flags&=-2053,l.lanes&=~p}function Sh(l){if(rd){for(l=l.memoizedState;l!==null;){var u=l.queue;u!==null&&(u.pending=null),l=l.next}rd=!1}mr=0,Yn=yn=Ht=null,Fo=!1,ic=id=0,zo=null}function Cs(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yn===null?Ht.memoizedState=Yn=l:Yn=Yn.next=l,Yn}function Un(){if(yn===null){var l=Ht.alternate;l=l!==null?l.memoizedState:null}else l=yn.next;var u=Yn===null?Ht.memoizedState:Yn.next;if(u!==null)Yn=u,yn=l;else{if(l===null)throw Ht.alternate===null?Error(s(467)):Error(s(310));yn=l,l={memoizedState:yn.memoizedState,baseState:yn.baseState,baseQueue:yn.baseQueue,queue:yn.queue,next:null},Yn===null?Ht.memoizedState=Yn=l:Yn=Yn.next=l}return Yn}function od(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function oc(l){var u=ic;return ic+=1,zo===null&&(zo=[]),l=$y(zo,l,u),u=Ht,(Yn===null?u.memoizedState:Yn.next)===null&&(u=u.alternate,z.H=u===null||u.memoizedState===null?Dv:Lh),l}function ld(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return oc(l);if(l.$$typeof===j)return us(l)}throw Error(s(438,String(l)))}function Ch(l){var u=null,p=Ht.updateQueue;if(p!==null&&(u=p.memoCache),u==null){var g=Ht.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(u={data:g.data.map(function(w){return w.slice()}),index:0})))}if(u==null&&(u={data:[],index:0}),p===null&&(p=od(),Ht.updateQueue=p),p.memoCache=u,p=u.data[u.index],p===void 0)for(p=u.data[u.index]=Array(l),g=0;g<l;g++)p[g]=M;return u.index++,p}function gr(l,u){return typeof u=="function"?u(l):u}function cd(l){var u=Un();return Ah(u,yn,l)}function Ah(l,u,p){var g=l.queue;if(g===null)throw Error(s(311));g.lastRenderedReducer=p;var w=l.baseQueue,C=g.pending;if(C!==null){if(w!==null){var I=w.next;w.next=C.next,C.next=I}u.baseQueue=w=C,g.pending=null}if(C=l.baseState,w===null)l.memoizedState=C;else{u=w.next;var G=I=null,re=null,De=u,Ye=!1;do{var Xe=De.lane&-536870913;if(Xe!==De.lane?(tn&Xe)===Xe:(mr&Xe)===Xe){var Pe=De.revertLane;if(Pe===0)re!==null&&(re=re.next={lane:0,revertLane:0,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),Xe===Oo&&(Ye=!0);else if((mr&Pe)===Pe){De=De.next,Pe===Oo&&(Ye=!0);continue}else Xe={lane:0,revertLane:De.revertLane,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},re===null?(G=re=Xe,I=C):re=re.next=Xe,Ht.lanes|=Pe,si|=Pe;Xe=De.action,$i&&p(C,Xe),C=De.hasEagerState?De.eagerState:p(C,Xe)}else Pe={lane:Xe,revertLane:De.revertLane,gesture:De.gesture,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},re===null?(G=re=Pe,I=C):re=re.next=Pe,Ht.lanes|=Xe,si|=Xe;De=De.next}while(De!==null&&De!==u);if(re===null?I=C:re.next=G,!Us(C,l.memoizedState)&&(Kn=!0,Ye&&(p=Lo,p!==null)))throw p;l.memoizedState=C,l.baseState=I,l.baseQueue=re,g.lastRenderedState=C}return w===null&&(g.lanes=0),[l.memoizedState,g.dispatch]}function jh(l){var u=Un(),p=u.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=l;var g=p.dispatch,w=p.pending,C=u.memoizedState;if(w!==null){p.pending=null;var I=w=w.next;do C=l(C,I.action),I=I.next;while(I!==w);Us(C,u.memoizedState)||(Kn=!0),u.memoizedState=C,u.baseQueue===null&&(u.baseState=C),p.lastRenderedState=C}return[C,g]}function Jy(l,u,p){var g=Ht,w=Un(),C=an;if(C){if(p===void 0)throw Error(s(407));p=p()}else p=u();var I=!Us((yn||w).memoizedState,p);if(I&&(w.memoizedState=p,Kn=!0),w=w.queue,_h(tv.bind(null,g,w,l),[l]),w.getSnapshot!==u||I||Yn!==null&&Yn.memoizedState.tag&1){if(g.flags|=2048,$o(9,{destroy:void 0},ev.bind(null,g,w,p,u),null),Sn===null)throw Error(s(349));C||(mr&127)!==0||Zy(g,u,p)}return p}function Zy(l,u,p){l.flags|=16384,l={getSnapshot:u,value:p},u=Ht.updateQueue,u===null?(u=od(),Ht.updateQueue=u,u.stores=[l]):(p=u.stores,p===null?u.stores=[l]:p.push(l))}function ev(l,u,p,g){u.value=p,u.getSnapshot=g,nv(u)&&sv(l)}function tv(l,u,p){return p(function(){nv(u)&&sv(l)})}function nv(l){var u=l.getSnapshot;l=l.value;try{var p=u();return!Us(l,p)}catch{return!0}}function sv(l){var u=Di(l,2);u!==null&&Rs(u,l,2)}function Nh(l){var u=Cs();if(typeof l=="function"){var p=l;if(l=p(),$i){te(!0);try{p()}finally{te(!1)}}}return u.memoizedState=u.baseState=l,u.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:l},u}function av(l,u,p,g){return l.baseState=p,Ah(l,yn,typeof g=="function"?g:gr)}function w_(l,u,p,g,w){if(fd(l))throw Error(s(485));if(l=u.action,l!==null){var C={payload:w,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(I){C.listeners.push(I)}};z.T!==null?p(!0):C.isTransition=!1,g(C),p=u.pending,p===null?(C.next=u.pending=C,rv(u,C)):(C.next=p.next,u.pending=p.next=C)}}function rv(l,u){var p=u.action,g=u.payload,w=l.state;if(u.isTransition){var C=z.T,I={};z.T=I;try{var G=p(w,g),re=z.S;re!==null&&re(I,G),iv(l,u,G)}catch(De){Th(l,u,De)}finally{C!==null&&I.types!==null&&(C.types=I.types),z.T=C}}else try{C=p(w,g),iv(l,u,C)}catch(De){Th(l,u,De)}}function iv(l,u,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(g){ov(l,u,g)},function(g){return Th(l,u,g)}):ov(l,u,p)}function ov(l,u,p){u.status="fulfilled",u.value=p,lv(u),l.state=p,u=l.pending,u!==null&&(p=u.next,p===u?l.pending=null:(p=p.next,u.next=p,rv(l,p)))}function Th(l,u,p){var g=l.pending;if(l.pending=null,g!==null){g=g.next;do u.status="rejected",u.reason=p,lv(u),u=u.next;while(u!==g)}l.action=null}function lv(l){l=l.listeners;for(var u=0;u<l.length;u++)(0,l[u])()}function cv(l,u){return u}function uv(l,u){if(an){var p=Sn.formState;if(p!==null){e:{var g=Ht;if(an){if(_n){t:{for(var w=_n,C=ha;w.nodeType!==8;){if(!C){w=null;break t}if(w=ga(w.nextSibling),w===null){w=null;break t}}C=w.data,w=C==="F!"||C==="F"?w:null}if(w){_n=ga(w.nextSibling),g=w.data==="F!";break e}}Yr(g)}g=!1}g&&(u=p[0])}}return p=Cs(),p.memoizedState=p.baseState=u,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cv,lastRenderedState:u},p.queue=g,p=_v.bind(null,Ht,g),g.dispatch=p,g=Nh(!1),C=Oh.bind(null,Ht,!1,g.queue),g=Cs(),w={state:u,dispatch:null,action:l,pending:null},g.queue=w,p=w_.bind(null,Ht,w,C,p),w.dispatch=p,g.memoizedState=l,[u,p,!1]}function dv(l){var u=Un();return fv(u,yn,l)}function fv(l,u,p){if(u=Ah(l,u,cv)[0],l=cd(gr)[0],typeof u=="object"&&u!==null&&typeof u.then=="function")try{var g=oc(u)}catch(I){throw I===Po?Zu:I}else g=u;u=Un();var w=u.queue,C=w.dispatch;return p!==u.memoizedState&&(Ht.flags|=2048,$o(9,{destroy:void 0},k_.bind(null,w,p),null)),[g,C,l]}function k_(l,u){l.action=u}function pv(l){var u=Un(),p=yn;if(p!==null)return fv(u,p,l);Un(),u=u.memoizedState,p=Un();var g=p.queue.dispatch;return p.memoizedState=l,[u,g,!1]}function $o(l,u,p,g){return l={tag:l,create:p,deps:g,inst:u,next:null},u=Ht.updateQueue,u===null&&(u=od(),Ht.updateQueue=u),p=u.lastEffect,p===null?u.lastEffect=l.next=l:(g=p.next,p.next=l,l.next=g,u.lastEffect=l),l}function hv(){return Un().memoizedState}function ud(l,u,p,g){var w=Cs();Ht.flags|=l,w.memoizedState=$o(1|u,{destroy:void 0},p,g===void 0?null:g)}function dd(l,u,p,g){var w=Un();g=g===void 0?null:g;var C=w.memoizedState.inst;yn!==null&&g!==null&&yh(g,yn.memoizedState.deps)?w.memoizedState=$o(u,C,p,g):(Ht.flags|=l,w.memoizedState=$o(1|u,C,p,g))}function mv(l,u){ud(8390656,8,l,u)}function _h(l,u){dd(2048,8,l,u)}function S_(l){Ht.flags|=4;var u=Ht.updateQueue;if(u===null)u=od(),Ht.updateQueue=u,u.events=[l];else{var p=u.events;p===null?u.events=[l]:p.push(l)}}function gv(l){var u=Un().memoizedState;return S_({ref:u,nextImpl:l}),function(){if((pn&2)!==0)throw Error(s(440));return u.impl.apply(void 0,arguments)}}function bv(l,u){return dd(4,2,l,u)}function xv(l,u){return dd(4,4,l,u)}function yv(l,u){if(typeof u=="function"){l=l();var p=u(l);return function(){typeof p=="function"?p():u(null)}}if(u!=null)return l=l(),u.current=l,function(){u.current=null}}function vv(l,u,p){p=p!=null?p.concat([l]):null,dd(4,4,yv.bind(null,u,l),p)}function Eh(){}function wv(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;return u!==null&&yh(u,g[1])?g[0]:(p.memoizedState=[l,u],l)}function kv(l,u){var p=Un();u=u===void 0?null:u;var g=p.memoizedState;if(u!==null&&yh(u,g[1]))return g[0];if(g=l(),$i){te(!0);try{l()}finally{te(!1)}}return p.memoizedState=[g,u],g}function Mh(l,u,p){return p===void 0||(mr&1073741824)!==0&&(tn&261930)===0?l.memoizedState=u:(l.memoizedState=p,l=Sw(),Ht.lanes|=l,si|=l,p)}function Sv(l,u,p,g){return Us(p,u)?p:Bo.current!==null?(l=Mh(l,p,g),Us(l,u)||(Kn=!0),l):(mr&42)===0||(mr&1073741824)!==0&&(tn&261930)===0?(Kn=!0,l.memoizedState=p):(l=Sw(),Ht.lanes|=l,si|=l,u)}function Cv(l,u,p,g,w){var C=W.p;W.p=C!==0&&8>C?C:8;var I=z.T,G={};z.T=G,Oh(l,!1,u,p);try{var re=w(),De=z.S;if(De!==null&&De(G,re),re!==null&&typeof re=="object"&&typeof re.then=="function"){var Ye=x_(re,g);lc(l,u,Ye,Ks(l))}else lc(l,u,g,Ks(l))}catch(Xe){lc(l,u,{then:function(){},status:"rejected",reason:Xe},Ks())}finally{W.p=C,I!==null&&G.types!==null&&(I.types=G.types),z.T=I}}function C_(){}function Dh(l,u,p,g){if(l.tag!==5)throw Error(s(476));var w=Av(l).queue;Cv(l,w,u,V,p===null?C_:function(){return jv(l),p(g)})}function Av(l){var u=l.memoizedState;if(u!==null)return u;u={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:V},next:null};var p={};return u.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gr,lastRenderedState:p},next:null},l.memoizedState=u,l=l.alternate,l!==null&&(l.memoizedState=u),u}function jv(l){var u=Av(l);u.next===null&&(u=l.alternate.memoizedState),lc(l,u.next.queue,{},Ks())}function Rh(){return us(Ac)}function Nv(){return Un().memoizedState}function Tv(){return Un().memoizedState}function A_(l){for(var u=l.return;u!==null;){switch(u.tag){case 24:case 3:var p=Ks();l=Xr(p);var g=Jr(u,l,p);g!==null&&(Rs(g,u,p),sc(g,u,p)),u={cache:lh()},l.payload=u;return}u=u.return}}function j_(l,u,p){var g=Ks();p={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},fd(l)?Ev(u,p):(p=Xp(l,u,p,g),p!==null&&(Rs(p,l,g),Mv(p,u,g)))}function _v(l,u,p){var g=Ks();lc(l,u,p,g)}function lc(l,u,p,g){var w={lane:g,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(fd(l))Ev(u,w);else{var C=l.alternate;if(l.lanes===0&&(C===null||C.lanes===0)&&(C=u.lastRenderedReducer,C!==null))try{var I=u.lastRenderedState,G=C(I,p);if(w.hasEagerState=!0,w.eagerState=G,Us(G,I))return Vu(l,u,w,0),Sn===null&&qu(),!1}catch{}finally{}if(p=Xp(l,u,w,g),p!==null)return Rs(p,l,g),Mv(p,u,g),!0}return!1}function Oh(l,u,p,g){if(g={lane:2,revertLane:fm(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},fd(l)){if(u)throw Error(s(479))}else u=Xp(l,p,g,2),u!==null&&Rs(u,l,2)}function fd(l){var u=l.alternate;return l===Ht||u!==null&&u===Ht}function Ev(l,u){Fo=rd=!0;var p=l.pending;p===null?u.next=u:(u.next=p.next,p.next=u),l.pending=u}function Mv(l,u,p){if((p&4194048)!==0){var g=u.lanes;g&=l.pendingLanes,p|=g,u.lanes=p,_t(l,p)}}var cc={readContext:us,use:ld,useCallback:In,useContext:In,useEffect:In,useImperativeHandle:In,useLayoutEffect:In,useInsertionEffect:In,useMemo:In,useReducer:In,useRef:In,useState:In,useDebugValue:In,useDeferredValue:In,useTransition:In,useSyncExternalStore:In,useId:In,useHostTransitionStatus:In,useFormState:In,useActionState:In,useOptimistic:In,useMemoCache:In,useCacheRefresh:In};cc.useEffectEvent=In;var Dv={readContext:us,use:ld,useCallback:function(l,u){return Cs().memoizedState=[l,u===void 0?null:u],l},useContext:us,useEffect:mv,useImperativeHandle:function(l,u,p){p=p!=null?p.concat([l]):null,ud(4194308,4,yv.bind(null,u,l),p)},useLayoutEffect:function(l,u){return ud(4194308,4,l,u)},useInsertionEffect:function(l,u){ud(4,2,l,u)},useMemo:function(l,u){var p=Cs();u=u===void 0?null:u;var g=l();if($i){te(!0);try{l()}finally{te(!1)}}return p.memoizedState=[g,u],g},useReducer:function(l,u,p){var g=Cs();if(p!==void 0){var w=p(u);if($i){te(!0);try{p(u)}finally{te(!1)}}}else w=u;return g.memoizedState=g.baseState=w,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:w},g.queue=l,l=l.dispatch=j_.bind(null,Ht,l),[g.memoizedState,l]},useRef:function(l){var u=Cs();return l={current:l},u.memoizedState=l},useState:function(l){l=Nh(l);var u=l.queue,p=_v.bind(null,Ht,u);return u.dispatch=p,[l.memoizedState,p]},useDebugValue:Eh,useDeferredValue:function(l,u){var p=Cs();return Mh(p,l,u)},useTransition:function(){var l=Nh(!1);return l=Cv.bind(null,Ht,l.queue,!0,!1),Cs().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,u,p){var g=Ht,w=Cs();if(an){if(p===void 0)throw Error(s(407));p=p()}else{if(p=u(),Sn===null)throw Error(s(349));(tn&127)!==0||Zy(g,u,p)}w.memoizedState=p;var C={value:p,getSnapshot:u};return w.queue=C,mv(tv.bind(null,g,C,l),[l]),g.flags|=2048,$o(9,{destroy:void 0},ev.bind(null,g,C,p,u),null),p},useId:function(){var l=Cs(),u=Sn.identifierPrefix;if(an){var p=za,g=Fa;p=(g&~(1<<32-pe(g)-1)).toString(32)+p,u="_"+u+"R_"+p,p=id++,0<p&&(u+="H"+p.toString(32)),u+="_"}else p=y_++,u="_"+u+"r_"+p.toString(32)+"_";return l.memoizedState=u},useHostTransitionStatus:Rh,useFormState:uv,useActionState:uv,useOptimistic:function(l){var u=Cs();u.memoizedState=u.baseState=l;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return u.queue=p,u=Oh.bind(null,Ht,!0,p),p.dispatch=u,[l,u]},useMemoCache:Ch,useCacheRefresh:function(){return Cs().memoizedState=A_.bind(null,Ht)},useEffectEvent:function(l){var u=Cs(),p={impl:l};return u.memoizedState=p,function(){if((pn&2)!==0)throw Error(s(440));return p.impl.apply(void 0,arguments)}}},Lh={readContext:us,use:ld,useCallback:wv,useContext:us,useEffect:_h,useImperativeHandle:vv,useInsertionEffect:bv,useLayoutEffect:xv,useMemo:kv,useReducer:cd,useRef:hv,useState:function(){return cd(gr)},useDebugValue:Eh,useDeferredValue:function(l,u){var p=Un();return Sv(p,yn.memoizedState,l,u)},useTransition:function(){var l=cd(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:oc(l),u]},useSyncExternalStore:Jy,useId:Nv,useHostTransitionStatus:Rh,useFormState:dv,useActionState:dv,useOptimistic:function(l,u){var p=Un();return av(p,yn,l,u)},useMemoCache:Ch,useCacheRefresh:Tv};Lh.useEffectEvent=gv;var Rv={readContext:us,use:ld,useCallback:wv,useContext:us,useEffect:_h,useImperativeHandle:vv,useInsertionEffect:bv,useLayoutEffect:xv,useMemo:kv,useReducer:jh,useRef:hv,useState:function(){return jh(gr)},useDebugValue:Eh,useDeferredValue:function(l,u){var p=Un();return yn===null?Mh(p,l,u):Sv(p,yn.memoizedState,l,u)},useTransition:function(){var l=jh(gr)[0],u=Un().memoizedState;return[typeof l=="boolean"?l:oc(l),u]},useSyncExternalStore:Jy,useId:Nv,useHostTransitionStatus:Rh,useFormState:pv,useActionState:pv,useOptimistic:function(l,u){var p=Un();return yn!==null?av(p,yn,l,u):(p.baseState=l,[l,p.queue.dispatch])},useMemoCache:Ch,useCacheRefresh:Tv};Rv.useEffectEvent=gv;function Ph(l,u,p,g){u=l.memoizedState,p=p(g,u),p=p==null?u:m({},u,p),l.memoizedState=p,l.lanes===0&&(l.updateQueue.baseState=p)}var Ih={enqueueSetState:function(l,u,p){l=l._reactInternals;var g=Ks(),w=Xr(g);w.payload=u,p!=null&&(w.callback=p),u=Jr(l,w,g),u!==null&&(Rs(u,l,g),sc(u,l,g))},enqueueReplaceState:function(l,u,p){l=l._reactInternals;var g=Ks(),w=Xr(g);w.tag=1,w.payload=u,p!=null&&(w.callback=p),u=Jr(l,w,g),u!==null&&(Rs(u,l,g),sc(u,l,g))},enqueueForceUpdate:function(l,u){l=l._reactInternals;var p=Ks(),g=Xr(p);g.tag=2,u!=null&&(g.callback=u),u=Jr(l,g,p),u!==null&&(Rs(u,l,p),sc(u,l,p))}};function Ov(l,u,p,g,w,C,I){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(g,C,I):u.prototype&&u.prototype.isPureReactComponent?!Kl(p,g)||!Kl(w,C):!0}function Lv(l,u,p,g){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(p,g),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(p,g),u.state!==l&&Ih.enqueueReplaceState(u,u.state,null)}function Hi(l,u){var p=u;if("ref"in u){p={};for(var g in u)g!=="ref"&&(p[g]=u[g])}if(l=l.defaultProps){p===u&&(p=m({},p));for(var w in l)p[w]===void 0&&(p[w]=l[w])}return p}function Pv(l){Wu(l)}function Iv(l){console.error(l)}function Bv(l){Wu(l)}function pd(l,u){try{var p=l.onUncaughtError;p(u.value,{componentStack:u.stack})}catch(g){setTimeout(function(){throw g})}}function Fv(l,u,p){try{var g=l.onCaughtError;g(p.value,{componentStack:p.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(w){setTimeout(function(){throw w})}}function Bh(l,u,p){return p=Xr(p),p.tag=3,p.payload={element:null},p.callback=function(){pd(l,u)},p}function zv(l){return l=Xr(l),l.tag=3,l}function $v(l,u,p,g){var w=p.type.getDerivedStateFromError;if(typeof w=="function"){var C=g.value;l.payload=function(){return w(C)},l.callback=function(){Fv(u,p,g)}}var I=p.stateNode;I!==null&&typeof I.componentDidCatch=="function"&&(l.callback=function(){Fv(u,p,g),typeof w!="function"&&(ai===null?ai=new Set([this]):ai.add(this));var G=g.stack;this.componentDidCatch(g.value,{componentStack:G!==null?G:""})})}function N_(l,u,p,g,w){if(p.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(u=p.alternate,u!==null&&Ro(u,p,w,!0),p=qs.current,p!==null){switch(p.tag){case 31:case 13:return ma===null?Ad():p.alternate===null&&Bn===0&&(Bn=3),p.flags&=-257,p.flags|=65536,p.lanes=w,g===ed?p.flags|=16384:(u=p.updateQueue,u===null?p.updateQueue=new Set([g]):u.add(g),cm(l,g,w)),!1;case 22:return p.flags|=65536,g===ed?p.flags|=16384:(u=p.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([g])},p.updateQueue=u):(p=u.retryQueue,p===null?u.retryQueue=new Set([g]):p.add(g)),cm(l,g,w)),!1}throw Error(s(435,p.tag))}return cm(l,g,w),Ad(),!1}if(an)return u=qs.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=w,g!==sh&&(l=Error(s(422),{cause:g}),Jl(da(l,p)))):(g!==sh&&(u=Error(s(423),{cause:g}),Jl(da(u,p))),l=l.current.alternate,l.flags|=65536,w&=-w,l.lanes|=w,g=da(g,p),w=Bh(l.stateNode,g,w),hh(l,w),Bn!==4&&(Bn=2)),!1;var C=Error(s(520),{cause:g});if(C=da(C,p),bc===null?bc=[C]:bc.push(C),Bn!==4&&(Bn=2),u===null)return!0;g=da(g,p),p=u;do{switch(p.tag){case 3:return p.flags|=65536,l=w&-w,p.lanes|=l,l=Bh(p.stateNode,g,l),hh(p,l),!1;case 1:if(u=p.type,C=p.stateNode,(p.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(ai===null||!ai.has(C))))return p.flags|=65536,w&=-w,p.lanes|=w,w=zv(w),$v(w,l,p,g),hh(p,w),!1}p=p.return}while(p!==null);return!1}var Fh=Error(s(461)),Kn=!1;function ds(l,u,p,g){u.child=l===null?qy(u,null,p,g):zi(u,l.child,p,g)}function Hv(l,u,p,g,w){p=p.render;var C=u.ref;if("ref"in g){var I={};for(var G in g)G!=="ref"&&(I[G]=g[G])}else I=g;return Pi(u),g=vh(l,u,p,I,C,w),G=wh(),l!==null&&!Kn?(kh(l,u,w),br(l,u,w)):(an&&G&&th(u),u.flags|=1,ds(l,u,g,w),u.child)}function Uv(l,u,p,g,w){if(l===null){var C=p.type;return typeof C=="function"&&!Jp(C)&&C.defaultProps===void 0&&p.compare===null?(u.tag=15,u.type=C,Wv(l,u,C,g,w)):(l=Yu(p.type,null,g,u,u.mode,w),l.ref=u.ref,l.return=u,u.child=l)}if(C=l.child,!Gh(l,w)){var I=C.memoizedProps;if(p=p.compare,p=p!==null?p:Kl,p(I,g)&&l.ref===u.ref)return br(l,u,w)}return u.flags|=1,l=dr(C,g),l.ref=u.ref,l.return=u,u.child=l}function Wv(l,u,p,g,w){if(l!==null){var C=l.memoizedProps;if(Kl(C,g)&&l.ref===u.ref)if(Kn=!1,u.pendingProps=g=C,Gh(l,w))(l.flags&131072)!==0&&(Kn=!0);else return u.lanes=l.lanes,br(l,u,w)}return zh(l,u,p,g,w)}function qv(l,u,p,g){var w=g.children,C=l!==null?l.memoizedState:null;if(l===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((u.flags&128)!==0){if(C=C!==null?C.baseLanes|p:p,l!==null){for(g=u.child=l.child,w=0;g!==null;)w=w|g.lanes|g.childLanes,g=g.sibling;g=w&~C}else g=0,u.child=null;return Vv(l,u,C,p,g)}if((p&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},l!==null&&Ju(u,C!==null?C.cachePool:null),C!==null?Yy(u,C):gh(),Ky(u);else return g=u.lanes=536870912,Vv(l,u,C!==null?C.baseLanes|p:p,p,g)}else C!==null?(Ju(u,C.cachePool),Yy(u,C),ei(),u.memoizedState=null):(l!==null&&Ju(u,null),gh(),ei());return ds(l,u,w,p),u.child}function uc(l,u){return l!==null&&l.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function Vv(l,u,p,g,w){var C=uh();return C=C===null?null:{parent:Gn._currentValue,pool:C},u.memoizedState={baseLanes:p,cachePool:C},l!==null&&Ju(u,null),gh(),Ky(u),l!==null&&Ro(l,u,g,!0),u.childLanes=w,null}function hd(l,u){return u=gd({mode:u.mode,children:u.children},l.mode),u.ref=l.ref,l.child=u,u.return=l,u}function Gv(l,u,p){return zi(u,l.child,null,p),l=hd(u,u.pendingProps),l.flags|=2,Vs(u),u.memoizedState=null,l}function T_(l,u,p){var g=u.pendingProps,w=(u.flags&128)!==0;if(u.flags&=-129,l===null){if(an){if(g.mode==="hidden")return l=hd(u,g),u.lanes=536870912,uc(null,l);if(xh(u),(l=_n)?(l=r0(l,ha),l=l!==null&&l.data==="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Vr!==null?{id:Fa,overflow:za}:null,retryLane:536870912,hydrationErrors:null},p=Ey(l),p.return=u,u.child=p,cs=u,_n=null)):l=null,l===null)throw Yr(u);return u.lanes=536870912,null}return hd(u,g)}var C=l.memoizedState;if(C!==null){var I=C.dehydrated;if(xh(u),w)if(u.flags&256)u.flags&=-257,u=Gv(l,u,p);else if(u.memoizedState!==null)u.child=l.child,u.flags|=128,u=null;else throw Error(s(558));else if(Kn||Ro(l,u,p,!1),w=(p&l.childLanes)!==0,Kn||w){if(g=Sn,g!==null&&(I=Bt(g,p),I!==0&&I!==C.retryLane))throw C.retryLane=I,Di(l,I),Rs(g,l,I),Fh;Ad(),u=Gv(l,u,p)}else l=C.treeContext,_n=ga(I.nextSibling),cs=u,an=!0,Gr=null,ha=!1,l!==null&&Ry(u,l),u=hd(u,g),u.flags|=4096;return u}return l=dr(l.child,{mode:g.mode,children:g.children}),l.ref=u.ref,u.child=l,l.return=u,l}function md(l,u){var p=u.ref;if(p===null)l!==null&&l.ref!==null&&(u.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(s(284));(l===null||l.ref!==p)&&(u.flags|=4194816)}}function zh(l,u,p,g,w){return Pi(u),p=vh(l,u,p,g,void 0,w),g=wh(),l!==null&&!Kn?(kh(l,u,w),br(l,u,w)):(an&&g&&th(u),u.flags|=1,ds(l,u,p,w),u.child)}function Yv(l,u,p,g,w,C){return Pi(u),u.updateQueue=null,p=Xy(u,g,p,w),Qy(l),g=wh(),l!==null&&!Kn?(kh(l,u,C),br(l,u,C)):(an&&g&&th(u),u.flags|=1,ds(l,u,p,C),u.child)}function Kv(l,u,p,g,w){if(Pi(u),u.stateNode===null){var C=_o,I=p.contextType;typeof I=="object"&&I!==null&&(C=us(I)),C=new p(g,C),u.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=Ih,u.stateNode=C,C._reactInternals=u,C=u.stateNode,C.props=g,C.state=u.memoizedState,C.refs={},fh(u),I=p.contextType,C.context=typeof I=="object"&&I!==null?us(I):_o,C.state=u.memoizedState,I=p.getDerivedStateFromProps,typeof I=="function"&&(Ph(u,p,I,g),C.state=u.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(I=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),I!==C.state&&Ih.enqueueReplaceState(C,C.state,null),rc(u,g,C,w),ac(),C.state=u.memoizedState),typeof C.componentDidMount=="function"&&(u.flags|=4194308),g=!0}else if(l===null){C=u.stateNode;var G=u.memoizedProps,re=Hi(p,G);C.props=re;var De=C.context,Ye=p.contextType;I=_o,typeof Ye=="object"&&Ye!==null&&(I=us(Ye));var Xe=p.getDerivedStateFromProps;Ye=typeof Xe=="function"||typeof C.getSnapshotBeforeUpdate=="function",G=u.pendingProps!==G,Ye||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(G||De!==I)&&Lv(u,C,g,I),Qr=!1;var Pe=u.memoizedState;C.state=Pe,rc(u,g,C,w),ac(),De=u.memoizedState,G||Pe!==De||Qr?(typeof Xe=="function"&&(Ph(u,p,Xe,g),De=u.memoizedState),(re=Qr||Ov(u,p,re,g,Pe,De,I))?(Ye||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(u.flags|=4194308)):(typeof C.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=g,u.memoizedState=De),C.props=g,C.state=De,C.context=I,g=re):(typeof C.componentDidMount=="function"&&(u.flags|=4194308),g=!1)}else{C=u.stateNode,ph(l,u),I=u.memoizedProps,Ye=Hi(p,I),C.props=Ye,Xe=u.pendingProps,Pe=C.context,De=p.contextType,re=_o,typeof De=="object"&&De!==null&&(re=us(De)),G=p.getDerivedStateFromProps,(De=typeof G=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(I!==Xe||Pe!==re)&&Lv(u,C,g,re),Qr=!1,Pe=u.memoizedState,C.state=Pe,rc(u,g,C,w),ac();var He=u.memoizedState;I!==Xe||Pe!==He||Qr||l!==null&&l.dependencies!==null&&Qu(l.dependencies)?(typeof G=="function"&&(Ph(u,p,G,g),He=u.memoizedState),(Ye=Qr||Ov(u,p,Ye,g,Pe,He,re)||l!==null&&l.dependencies!==null&&Qu(l.dependencies))?(De||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(g,He,re),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(g,He,re)),typeof C.componentDidUpdate=="function"&&(u.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof C.componentDidUpdate!="function"||I===l.memoizedProps&&Pe===l.memoizedState||(u.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===l.memoizedProps&&Pe===l.memoizedState||(u.flags|=1024),u.memoizedProps=g,u.memoizedState=He),C.props=g,C.state=He,C.context=re,g=Ye):(typeof C.componentDidUpdate!="function"||I===l.memoizedProps&&Pe===l.memoizedState||(u.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===l.memoizedProps&&Pe===l.memoizedState||(u.flags|=1024),g=!1)}return C=g,md(l,u),g=(u.flags&128)!==0,C||g?(C=u.stateNode,p=g&&typeof p.getDerivedStateFromError!="function"?null:C.render(),u.flags|=1,l!==null&&g?(u.child=zi(u,l.child,null,w),u.child=zi(u,null,p,w)):ds(l,u,p,w),u.memoizedState=C.state,l=u.child):l=br(l,u,w),l}function Qv(l,u,p,g){return Oi(),u.flags|=256,ds(l,u,p,g),u.child}var $h={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hh(l){return{baseLanes:l,cachePool:Fy()}}function Uh(l,u,p){return l=l!==null?l.childLanes&~p:0,u&&(l|=Ys),l}function Xv(l,u,p){var g=u.pendingProps,w=!1,C=(u.flags&128)!==0,I;if((I=C)||(I=l!==null&&l.memoizedState===null?!1:(Hn.current&2)!==0),I&&(w=!0,u.flags&=-129),I=(u.flags&32)!==0,u.flags&=-33,l===null){if(an){if(w?Zr(u):ei(),(l=_n)?(l=r0(l,ha),l=l!==null&&l.data!=="&"?l:null,l!==null&&(u.memoizedState={dehydrated:l,treeContext:Vr!==null?{id:Fa,overflow:za}:null,retryLane:536870912,hydrationErrors:null},p=Ey(l),p.return=u,u.child=p,cs=u,_n=null)):l=null,l===null)throw Yr(u);return Am(l)?u.lanes=32:u.lanes=536870912,null}var G=g.children;return g=g.fallback,w?(ei(),w=u.mode,G=gd({mode:"hidden",children:G},w),g=Ri(g,w,p,null),G.return=u,g.return=u,G.sibling=g,u.child=G,g=u.child,g.memoizedState=Hh(p),g.childLanes=Uh(l,I,p),u.memoizedState=$h,uc(null,g)):(Zr(u),Wh(u,G))}var re=l.memoizedState;if(re!==null&&(G=re.dehydrated,G!==null)){if(C)u.flags&256?(Zr(u),u.flags&=-257,u=qh(l,u,p)):u.memoizedState!==null?(ei(),u.child=l.child,u.flags|=128,u=null):(ei(),G=g.fallback,w=u.mode,g=gd({mode:"visible",children:g.children},w),G=Ri(G,w,p,null),G.flags|=2,g.return=u,G.return=u,g.sibling=G,u.child=g,zi(u,l.child,null,p),g=u.child,g.memoizedState=Hh(p),g.childLanes=Uh(l,I,p),u.memoizedState=$h,u=uc(null,g));else if(Zr(u),Am(G)){if(I=G.nextSibling&&G.nextSibling.dataset,I)var De=I.dgst;I=De,g=Error(s(419)),g.stack="",g.digest=I,Jl({value:g,source:null,stack:null}),u=qh(l,u,p)}else if(Kn||Ro(l,u,p,!1),I=(p&l.childLanes)!==0,Kn||I){if(I=Sn,I!==null&&(g=Bt(I,p),g!==0&&g!==re.retryLane))throw re.retryLane=g,Di(l,g),Rs(I,l,g),Fh;Cm(G)||Ad(),u=qh(l,u,p)}else Cm(G)?(u.flags|=192,u.child=l.child,u=null):(l=re.treeContext,_n=ga(G.nextSibling),cs=u,an=!0,Gr=null,ha=!1,l!==null&&Ry(u,l),u=Wh(u,g.children),u.flags|=4096);return u}return w?(ei(),G=g.fallback,w=u.mode,re=l.child,De=re.sibling,g=dr(re,{mode:"hidden",children:g.children}),g.subtreeFlags=re.subtreeFlags&65011712,De!==null?G=dr(De,G):(G=Ri(G,w,p,null),G.flags|=2),G.return=u,g.return=u,g.sibling=G,u.child=g,uc(null,g),g=u.child,G=l.child.memoizedState,G===null?G=Hh(p):(w=G.cachePool,w!==null?(re=Gn._currentValue,w=w.parent!==re?{parent:re,pool:re}:w):w=Fy(),G={baseLanes:G.baseLanes|p,cachePool:w}),g.memoizedState=G,g.childLanes=Uh(l,I,p),u.memoizedState=$h,uc(l.child,g)):(Zr(u),p=l.child,l=p.sibling,p=dr(p,{mode:"visible",children:g.children}),p.return=u,p.sibling=null,l!==null&&(I=u.deletions,I===null?(u.deletions=[l],u.flags|=16):I.push(l)),u.child=p,u.memoizedState=null,p)}function Wh(l,u){return u=gd({mode:"visible",children:u},l.mode),u.return=l,l.child=u}function gd(l,u){return l=Ws(22,l,null,u),l.lanes=0,l}function qh(l,u,p){return zi(u,l.child,null,p),l=Wh(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function Jv(l,u,p){l.lanes|=u;var g=l.alternate;g!==null&&(g.lanes|=u),ih(l.return,u,p)}function Vh(l,u,p,g,w,C){var I=l.memoizedState;I===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:g,tail:p,tailMode:w,treeForkCount:C}:(I.isBackwards=u,I.rendering=null,I.renderingStartTime=0,I.last=g,I.tail=p,I.tailMode=w,I.treeForkCount=C)}function Zv(l,u,p){var g=u.pendingProps,w=g.revealOrder,C=g.tail;g=g.children;var I=Hn.current,G=(I&2)!==0;if(G?(I=I&1|2,u.flags|=128):I&=1,q(Hn,I),ds(l,u,g,p),g=an?Xl:0,!G&&l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Jv(l,p,u);else if(l.tag===19)Jv(l,p,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(w){case"forwards":for(p=u.child,w=null;p!==null;)l=p.alternate,l!==null&&ad(l)===null&&(w=p),p=p.sibling;p=w,p===null?(w=u.child,u.child=null):(w=p.sibling,p.sibling=null),Vh(u,!1,w,p,C,g);break;case"backwards":case"unstable_legacy-backwards":for(p=null,w=u.child,u.child=null;w!==null;){if(l=w.alternate,l!==null&&ad(l)===null){u.child=w;break}l=w.sibling,w.sibling=p,p=w,w=l}Vh(u,!0,p,null,C,g);break;case"together":Vh(u,!1,null,null,void 0,g);break;default:u.memoizedState=null}return u.child}function br(l,u,p){if(l!==null&&(u.dependencies=l.dependencies),si|=u.lanes,(p&u.childLanes)===0)if(l!==null){if(Ro(l,u,p,!1),(p&u.childLanes)===0)return null}else return null;if(l!==null&&u.child!==l.child)throw Error(s(153));if(u.child!==null){for(l=u.child,p=dr(l,l.pendingProps),u.child=p,p.return=u;l.sibling!==null;)l=l.sibling,p=p.sibling=dr(l,l.pendingProps),p.return=u;p.sibling=null}return u.child}function Gh(l,u){return(l.lanes&u)!==0?!0:(l=l.dependencies,!!(l!==null&&Qu(l)))}function __(l,u,p){switch(u.tag){case 3:Ce(u,u.stateNode.containerInfo),Kr(u,Gn,l.memoizedState.cache),Oi();break;case 27:case 5:Ne(u);break;case 4:Ce(u,u.stateNode.containerInfo);break;case 10:Kr(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,xh(u),null;break;case 13:var g=u.memoizedState;if(g!==null)return g.dehydrated!==null?(Zr(u),u.flags|=128,null):(p&u.child.childLanes)!==0?Xv(l,u,p):(Zr(u),l=br(l,u,p),l!==null?l.sibling:null);Zr(u);break;case 19:var w=(l.flags&128)!==0;if(g=(p&u.childLanes)!==0,g||(Ro(l,u,p,!1),g=(p&u.childLanes)!==0),w){if(g)return Zv(l,u,p);u.flags|=128}if(w=u.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),q(Hn,Hn.current),g)break;return null;case 22:return u.lanes=0,qv(l,u,p,u.pendingProps);case 24:Kr(u,Gn,l.memoizedState.cache)}return br(l,u,p)}function ew(l,u,p){if(l!==null)if(l.memoizedProps!==u.pendingProps)Kn=!0;else{if(!Gh(l,p)&&(u.flags&128)===0)return Kn=!1,__(l,u,p);Kn=(l.flags&131072)!==0}else Kn=!1,an&&(u.flags&1048576)!==0&&Dy(u,Xl,u.index);switch(u.lanes=0,u.tag){case 16:e:{var g=u.pendingProps;if(l=Bi(u.elementType),u.type=l,typeof l=="function")Jp(l)?(g=Hi(l,g),u.tag=1,u=Kv(null,u,l,g,p)):(u.tag=0,u=zh(null,u,l,g,p));else{if(l!=null){var w=l.$$typeof;if(w===E){u.tag=11,u=Hv(null,u,l,g,p);break e}else if(w===B){u.tag=14,u=Uv(null,u,l,g,p);break e}}throw u=U(l)||l,Error(s(306,u,""))}}return u;case 0:return zh(l,u,u.type,u.pendingProps,p);case 1:return g=u.type,w=Hi(g,u.pendingProps),Kv(l,u,g,w,p);case 3:e:{if(Ce(u,u.stateNode.containerInfo),l===null)throw Error(s(387));g=u.pendingProps;var C=u.memoizedState;w=C.element,ph(l,u),rc(u,g,null,p);var I=u.memoizedState;if(g=I.cache,Kr(u,Gn,g),g!==C.cache&&oh(u,[Gn],p,!0),ac(),g=I.element,C.isDehydrated)if(C={element:g,isDehydrated:!1,cache:I.cache},u.updateQueue.baseState=C,u.memoizedState=C,u.flags&256){u=Qv(l,u,g,p);break e}else if(g!==w){w=da(Error(s(424)),u),Jl(w),u=Qv(l,u,g,p);break e}else{switch(l=u.stateNode.containerInfo,l.nodeType){case 9:l=l.body;break;default:l=l.nodeName==="HTML"?l.ownerDocument.body:l}for(_n=ga(l.firstChild),cs=u,an=!0,Gr=null,ha=!0,p=qy(u,null,g,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Oi(),g===w){u=br(l,u,p);break e}ds(l,u,g,p)}u=u.child}return u;case 26:return md(l,u),l===null?(p=d0(u.type,null,u.pendingProps,null))?u.memoizedState=p:an||(p=u.type,l=u.pendingProps,g=Dd(Z.current).createElement(p),g[ft]=u,g[Ft]=l,fs(g,p,l),kn(g),u.stateNode=g):u.memoizedState=d0(u.type,l.memoizedProps,u.pendingProps,l.memoizedState),null;case 27:return Ne(u),l===null&&an&&(g=u.stateNode=l0(u.type,u.pendingProps,Z.current),cs=u,ha=!0,w=_n,li(u.type)?(jm=w,_n=ga(g.firstChild)):_n=w),ds(l,u,u.pendingProps.children,p),md(l,u),l===null&&(u.flags|=4194304),u.child;case 5:return l===null&&an&&((w=g=_n)&&(g=rE(g,u.type,u.pendingProps,ha),g!==null?(u.stateNode=g,cs=u,_n=ga(g.firstChild),ha=!1,w=!0):w=!1),w||Yr(u)),Ne(u),w=u.type,C=u.pendingProps,I=l!==null?l.memoizedProps:null,g=C.children,wm(w,C)?g=null:I!==null&&wm(w,I)&&(u.flags|=32),u.memoizedState!==null&&(w=vh(l,u,v_,null,null,p),Ac._currentValue=w),md(l,u),ds(l,u,g,p),u.child;case 6:return l===null&&an&&((l=p=_n)&&(p=iE(p,u.pendingProps,ha),p!==null?(u.stateNode=p,cs=u,_n=null,l=!0):l=!1),l||Yr(u)),null;case 13:return Xv(l,u,p);case 4:return Ce(u,u.stateNode.containerInfo),g=u.pendingProps,l===null?u.child=zi(u,null,g,p):ds(l,u,g,p),u.child;case 11:return Hv(l,u,u.type,u.pendingProps,p);case 7:return ds(l,u,u.pendingProps,p),u.child;case 8:return ds(l,u,u.pendingProps.children,p),u.child;case 12:return ds(l,u,u.pendingProps.children,p),u.child;case 10:return g=u.pendingProps,Kr(u,u.type,g.value),ds(l,u,g.children,p),u.child;case 9:return w=u.type._context,g=u.pendingProps.children,Pi(u),w=us(w),g=g(w),u.flags|=1,ds(l,u,g,p),u.child;case 14:return Uv(l,u,u.type,u.pendingProps,p);case 15:return Wv(l,u,u.type,u.pendingProps,p);case 19:return Zv(l,u,p);case 31:return T_(l,u,p);case 22:return qv(l,u,p,u.pendingProps);case 24:return Pi(u),g=us(Gn),l===null?(w=uh(),w===null&&(w=Sn,C=lh(),w.pooledCache=C,C.refCount++,C!==null&&(w.pooledCacheLanes|=p),w=C),u.memoizedState={parent:g,cache:w},fh(u),Kr(u,Gn,w)):((l.lanes&p)!==0&&(ph(l,u),rc(u,null,null,p),ac()),w=l.memoizedState,C=u.memoizedState,w.parent!==g?(w={parent:g,cache:g},u.memoizedState=w,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=w),Kr(u,Gn,g)):(g=C.cache,Kr(u,Gn,g),g!==w.cache&&oh(u,[Gn],p,!0))),ds(l,u,u.pendingProps.children,p),u.child;case 29:throw u.pendingProps}throw Error(s(156,u.tag))}function xr(l){l.flags|=4}function Yh(l,u,p,g,w){if((u=(l.mode&32)!==0)&&(u=!1),u){if(l.flags|=16777216,(w&335544128)===w)if(l.stateNode.complete)l.flags|=8192;else if(Nw())l.flags|=8192;else throw Fi=ed,dh}else l.flags&=-16777217}function tw(l,u){if(u.type!=="stylesheet"||(u.state.loading&4)!==0)l.flags&=-16777217;else if(l.flags|=16777216,!g0(u))if(Nw())l.flags|=8192;else throw Fi=ed,dh}function bd(l,u){u!==null&&(l.flags|=4),l.flags&16384&&(u=l.tag!==22?Tt():536870912,l.lanes|=u,qo|=u)}function dc(l,u){if(!an)switch(l.tailMode){case"hidden":u=l.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var g=null;p!==null;)p.alternate!==null&&(g=p),p=p.sibling;g===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:g.sibling=null}}function En(l){var u=l.alternate!==null&&l.alternate.child===l.child,p=0,g=0;if(u)for(var w=l.child;w!==null;)p|=w.lanes|w.childLanes,g|=w.subtreeFlags&65011712,g|=w.flags&65011712,w.return=l,w=w.sibling;else for(w=l.child;w!==null;)p|=w.lanes|w.childLanes,g|=w.subtreeFlags,g|=w.flags,w.return=l,w=w.sibling;return l.subtreeFlags|=g,l.childLanes=p,u}function E_(l,u,p){var g=u.pendingProps;switch(nh(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return En(u),null;case 1:return En(u),null;case 3:return p=u.stateNode,g=null,l!==null&&(g=l.memoizedState.cache),u.memoizedState.cache!==g&&(u.flags|=2048),hr(Gn),xe(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(l===null||l.child===null)&&(Do(u)?xr(u):l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,ah())),En(u),null;case 26:var w=u.type,C=u.memoizedState;return l===null?(xr(u),C!==null?(En(u),tw(u,C)):(En(u),Yh(u,w,null,g,p))):C?C!==l.memoizedState?(xr(u),En(u),tw(u,C)):(En(u),u.flags&=-16777217):(l=l.memoizedProps,l!==g&&xr(u),En(u),Yh(u,w,l,g,p)),null;case 27:if(qe(u),p=Z.current,w=u.type,l!==null&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(!g){if(u.stateNode===null)throw Error(s(166));return En(u),null}l=be.current,Do(u)?Oy(u):(l=l0(w,g,p),u.stateNode=l,xr(u))}return En(u),null;case 5:if(qe(u),w=u.type,l!==null&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(!g){if(u.stateNode===null)throw Error(s(166));return En(u),null}if(C=be.current,Do(u))Oy(u);else{var I=Dd(Z.current);switch(C){case 1:C=I.createElementNS("http://www.w3.org/2000/svg",w);break;case 2:C=I.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;default:switch(w){case"svg":C=I.createElementNS("http://www.w3.org/2000/svg",w);break;case"math":C=I.createElementNS("http://www.w3.org/1998/Math/MathML",w);break;case"script":C=I.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof g.is=="string"?I.createElement("select",{is:g.is}):I.createElement("select"),g.multiple?C.multiple=!0:g.size&&(C.size=g.size);break;default:C=typeof g.is=="string"?I.createElement(w,{is:g.is}):I.createElement(w)}}C[ft]=u,C[Ft]=g;e:for(I=u.child;I!==null;){if(I.tag===5||I.tag===6)C.appendChild(I.stateNode);else if(I.tag!==4&&I.tag!==27&&I.child!==null){I.child.return=I,I=I.child;continue}if(I===u)break e;for(;I.sibling===null;){if(I.return===null||I.return===u)break e;I=I.return}I.sibling.return=I.return,I=I.sibling}u.stateNode=C;e:switch(fs(C,w,g),w){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&xr(u)}}return En(u),Yh(u,u.type,l===null?null:l.memoizedProps,u.pendingProps,p),null;case 6:if(l&&u.stateNode!=null)l.memoizedProps!==g&&xr(u);else{if(typeof g!="string"&&u.stateNode===null)throw Error(s(166));if(l=Z.current,Do(u)){if(l=u.stateNode,p=u.memoizedProps,g=null,w=cs,w!==null)switch(w.tag){case 27:case 5:g=w.memoizedProps}l[ft]=u,l=!!(l.nodeValue===p||g!==null&&g.suppressHydrationWarning===!0||Xw(l.nodeValue,p)),l||Yr(u,!0)}else l=Dd(l).createTextNode(g),l[ft]=u,u.stateNode=l}return En(u),null;case 31:if(p=u.memoizedState,l===null||l.memoizedState!==null){if(g=Do(u),p!==null){if(l===null){if(!g)throw Error(s(318));if(l=u.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(s(557));l[ft]=u}else Oi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;En(u),l=!1}else p=ah(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=p),l=!0;if(!l)return u.flags&256?(Vs(u),u):(Vs(u),null);if((u.flags&128)!==0)throw Error(s(558))}return En(u),null;case 13:if(g=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(w=Do(u),g!==null&&g.dehydrated!==null){if(l===null){if(!w)throw Error(s(318));if(w=u.memoizedState,w=w!==null?w.dehydrated:null,!w)throw Error(s(317));w[ft]=u}else Oi(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;En(u),w=!1}else w=ah(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=w),w=!0;if(!w)return u.flags&256?(Vs(u),u):(Vs(u),null)}return Vs(u),(u.flags&128)!==0?(u.lanes=p,u):(p=g!==null,l=l!==null&&l.memoizedState!==null,p&&(g=u.child,w=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(w=g.alternate.memoizedState.cachePool.pool),C=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(C=g.memoizedState.cachePool.pool),C!==w&&(g.flags|=2048)),p!==l&&p&&(u.child.flags|=8192),bd(u,u.updateQueue),En(u),null);case 4:return xe(),l===null&&gm(u.stateNode.containerInfo),En(u),null;case 10:return hr(u.type),En(u),null;case 19:if(Q(Hn),g=u.memoizedState,g===null)return En(u),null;if(w=(u.flags&128)!==0,C=g.rendering,C===null)if(w)dc(g,!1);else{if(Bn!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(C=ad(l),C!==null){for(u.flags|=128,dc(g,!1),l=C.updateQueue,u.updateQueue=l,bd(u,l),u.subtreeFlags=0,l=p,p=u.child;p!==null;)_y(p,l),p=p.sibling;return q(Hn,Hn.current&1|2),an&&fr(u,g.treeForkCount),u.child}l=l.sibling}g.tail!==null&&ot()>kd&&(u.flags|=128,w=!0,dc(g,!1),u.lanes=4194304)}else{if(!w)if(l=ad(C),l!==null){if(u.flags|=128,w=!0,l=l.updateQueue,u.updateQueue=l,bd(u,l),dc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!C.alternate&&!an)return En(u),null}else 2*ot()-g.renderingStartTime>kd&&p!==536870912&&(u.flags|=128,w=!0,dc(g,!1),u.lanes=4194304);g.isBackwards?(C.sibling=u.child,u.child=C):(l=g.last,l!==null?l.sibling=C:u.child=C,g.last=C)}return g.tail!==null?(l=g.tail,g.rendering=l,g.tail=l.sibling,g.renderingStartTime=ot(),l.sibling=null,p=Hn.current,q(Hn,w?p&1|2:p&1),an&&fr(u,g.treeForkCount),l):(En(u),null);case 22:case 23:return Vs(u),bh(),g=u.memoizedState!==null,l!==null?l.memoizedState!==null!==g&&(u.flags|=8192):g&&(u.flags|=8192),g?(p&536870912)!==0&&(u.flags&128)===0&&(En(u),u.subtreeFlags&6&&(u.flags|=8192)):En(u),p=u.updateQueue,p!==null&&bd(u,p.retryQueue),p=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==p&&(u.flags|=2048),l!==null&&Q(Ii),null;case 24:return p=null,l!==null&&(p=l.memoizedState.cache),u.memoizedState.cache!==p&&(u.flags|=2048),hr(Gn),En(u),null;case 25:return null;case 30:return null}throw Error(s(156,u.tag))}function M_(l,u){switch(nh(u),u.tag){case 1:return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return hr(Gn),xe(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 26:case 27:case 5:return qe(u),null;case 31:if(u.memoizedState!==null){if(Vs(u),u.alternate===null)throw Error(s(340));Oi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 13:if(Vs(u),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(s(340));Oi()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return Q(Hn),null;case 4:return xe(),null;case 10:return hr(u.type),null;case 22:case 23:return Vs(u),bh(),l!==null&&Q(Ii),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 24:return hr(Gn),null;case 25:return null;default:return null}}function nw(l,u){switch(nh(u),u.tag){case 3:hr(Gn),xe();break;case 26:case 27:case 5:qe(u);break;case 4:xe();break;case 31:u.memoizedState!==null&&Vs(u);break;case 13:Vs(u);break;case 19:Q(Hn);break;case 10:hr(u.type);break;case 22:case 23:Vs(u),bh(),l!==null&&Q(Ii);break;case 24:hr(Gn)}}function fc(l,u){try{var p=u.updateQueue,g=p!==null?p.lastEffect:null;if(g!==null){var w=g.next;p=w;do{if((p.tag&l)===l){g=void 0;var C=p.create,I=p.inst;g=C(),I.destroy=g}p=p.next}while(p!==w)}}catch(G){gn(u,u.return,G)}}function ti(l,u,p){try{var g=u.updateQueue,w=g!==null?g.lastEffect:null;if(w!==null){var C=w.next;g=C;do{if((g.tag&l)===l){var I=g.inst,G=I.destroy;if(G!==void 0){I.destroy=void 0,w=u;var re=p,De=G;try{De()}catch(Ye){gn(w,re,Ye)}}}g=g.next}while(g!==C)}}catch(Ye){gn(u,u.return,Ye)}}function sw(l){var u=l.updateQueue;if(u!==null){var p=l.stateNode;try{Gy(u,p)}catch(g){gn(l,l.return,g)}}}function aw(l,u,p){p.props=Hi(l.type,l.memoizedProps),p.state=l.memoizedState;try{p.componentWillUnmount()}catch(g){gn(l,u,g)}}function pc(l,u){try{var p=l.ref;if(p!==null){switch(l.tag){case 26:case 27:case 5:var g=l.stateNode;break;case 30:g=l.stateNode;break;default:g=l.stateNode}typeof p=="function"?l.refCleanup=p(g):p.current=g}}catch(w){gn(l,u,w)}}function $a(l,u){var p=l.ref,g=l.refCleanup;if(p!==null)if(typeof g=="function")try{g()}catch(w){gn(l,u,w)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(w){gn(l,u,w)}else p.current=null}function rw(l){var u=l.type,p=l.memoizedProps,g=l.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":p.autoFocus&&g.focus();break e;case"img":p.src?g.src=p.src:p.srcSet&&(g.srcset=p.srcSet)}}catch(w){gn(l,l.return,w)}}function Kh(l,u,p){try{var g=l.stateNode;Z_(g,l.type,p,u),g[Ft]=u}catch(w){gn(l,l.return,w)}}function iw(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27&&li(l.type)||l.tag===4}function Qh(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||iw(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.tag===27&&li(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function Xh(l,u,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,u?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(l,u):(u=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,u.appendChild(l),p=p._reactRootContainer,p!=null||u.onclick!==null||(u.onclick=Na));else if(g!==4&&(g===27&&li(l.type)&&(p=l.stateNode,u=null),l=l.child,l!==null))for(Xh(l,u,p),l=l.sibling;l!==null;)Xh(l,u,p),l=l.sibling}function xd(l,u,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,u?p.insertBefore(l,u):p.appendChild(l);else if(g!==4&&(g===27&&li(l.type)&&(p=l.stateNode),l=l.child,l!==null))for(xd(l,u,p),l=l.sibling;l!==null;)xd(l,u,p),l=l.sibling}function ow(l){var u=l.stateNode,p=l.memoizedProps;try{for(var g=l.type,w=u.attributes;w.length;)u.removeAttributeNode(w[0]);fs(u,g,p),u[ft]=l,u[Ft]=p}catch(C){gn(l,l.return,C)}}var yr=!1,Qn=!1,Jh=!1,lw=typeof WeakSet=="function"?WeakSet:Set,rs=null;function D_(l,u){if(l=l.containerInfo,ym=Fd,l=vy(l),qp(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var w=g.anchorOffset,C=g.focusNode;g=g.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var I=0,G=-1,re=-1,De=0,Ye=0,Xe=l,Pe=null;t:for(;;){for(var He;Xe!==p||w!==0&&Xe.nodeType!==3||(G=I+w),Xe!==C||g!==0&&Xe.nodeType!==3||(re=I+g),Xe.nodeType===3&&(I+=Xe.nodeValue.length),(He=Xe.firstChild)!==null;)Pe=Xe,Xe=He;for(;;){if(Xe===l)break t;if(Pe===p&&++De===w&&(G=I),Pe===C&&++Ye===g&&(re=I),(He=Xe.nextSibling)!==null)break;Xe=Pe,Pe=Xe.parentNode}Xe=He}p=G===-1||re===-1?null:{start:G,end:re}}else p=null}p=p||{start:0,end:0}}else p=null;for(vm={focusedElem:l,selectionRange:p},Fd=!1,rs=u;rs!==null;)if(u=rs,l=u.child,(u.subtreeFlags&1028)!==0&&l!==null)l.return=u,rs=l;else for(;rs!==null;){switch(u=rs,C=u.alternate,l=u.flags,u.tag){case 0:if((l&4)!==0&&(l=u.updateQueue,l=l!==null?l.events:null,l!==null))for(p=0;p<l.length;p++)w=l[p],w.ref.impl=w.nextImpl;break;case 11:case 15:break;case 1:if((l&1024)!==0&&C!==null){l=void 0,p=u,w=C.memoizedProps,C=C.memoizedState,g=p.stateNode;try{var yt=Hi(p.type,w);l=g.getSnapshotBeforeUpdate(yt,C),g.__reactInternalSnapshotBeforeUpdate=l}catch(Rt){gn(p,p.return,Rt)}}break;case 3:if((l&1024)!==0){if(l=u.stateNode.containerInfo,p=l.nodeType,p===9)Sm(l);else if(p===1)switch(l.nodeName){case"HEAD":case"HTML":case"BODY":Sm(l);break;default:l.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((l&1024)!==0)throw Error(s(163))}if(l=u.sibling,l!==null){l.return=u.return,rs=l;break}rs=u.return}}function cw(l,u,p){var g=p.flags;switch(p.tag){case 0:case 11:case 15:wr(l,p),g&4&&fc(5,p);break;case 1:if(wr(l,p),g&4)if(l=p.stateNode,u===null)try{l.componentDidMount()}catch(I){gn(p,p.return,I)}else{var w=Hi(p.type,u.memoizedProps);u=u.memoizedState;try{l.componentDidUpdate(w,u,l.__reactInternalSnapshotBeforeUpdate)}catch(I){gn(p,p.return,I)}}g&64&&sw(p),g&512&&pc(p,p.return);break;case 3:if(wr(l,p),g&64&&(l=p.updateQueue,l!==null)){if(u=null,p.child!==null)switch(p.child.tag){case 27:case 5:u=p.child.stateNode;break;case 1:u=p.child.stateNode}try{Gy(l,u)}catch(I){gn(p,p.return,I)}}break;case 27:u===null&&g&4&&ow(p);case 26:case 5:wr(l,p),u===null&&g&4&&rw(p),g&512&&pc(p,p.return);break;case 12:wr(l,p);break;case 31:wr(l,p),g&4&&fw(l,p);break;case 13:wr(l,p),g&4&&pw(l,p),g&64&&(l=p.memoizedState,l!==null&&(l=l.dehydrated,l!==null&&(p=$_.bind(null,p),oE(l,p))));break;case 22:if(g=p.memoizedState!==null||yr,!g){u=u!==null&&u.memoizedState!==null||Qn,w=yr;var C=Qn;yr=g,(Qn=u)&&!C?kr(l,p,(p.subtreeFlags&8772)!==0):wr(l,p),yr=w,Qn=C}break;case 30:break;default:wr(l,p)}}function uw(l){var u=l.alternate;u!==null&&(l.alternate=null,uw(u)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(u=l.stateNode,u!==null&&ra(u)),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var Rn=null,_s=!1;function vr(l,u,p){for(p=p.child;p!==null;)dw(l,u,p),p=p.sibling}function dw(l,u,p){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(oe,p)}catch{}switch(p.tag){case 26:Qn||$a(p,u),vr(l,u,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Qn||$a(p,u);var g=Rn,w=_s;li(p.type)&&(Rn=p.stateNode,_s=!1),vr(l,u,p),kc(p.stateNode),Rn=g,_s=w;break;case 5:Qn||$a(p,u);case 6:if(g=Rn,w=_s,Rn=null,vr(l,u,p),Rn=g,_s=w,Rn!==null)if(_s)try{(Rn.nodeType===9?Rn.body:Rn.nodeName==="HTML"?Rn.ownerDocument.body:Rn).removeChild(p.stateNode)}catch(C){gn(p,u,C)}else try{Rn.removeChild(p.stateNode)}catch(C){gn(p,u,C)}break;case 18:Rn!==null&&(_s?(l=Rn,s0(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,p.stateNode),Zo(l)):s0(Rn,p.stateNode));break;case 4:g=Rn,w=_s,Rn=p.stateNode.containerInfo,_s=!0,vr(l,u,p),Rn=g,_s=w;break;case 0:case 11:case 14:case 15:ti(2,p,u),Qn||ti(4,p,u),vr(l,u,p);break;case 1:Qn||($a(p,u),g=p.stateNode,typeof g.componentWillUnmount=="function"&&aw(p,u,g)),vr(l,u,p);break;case 21:vr(l,u,p);break;case 22:Qn=(g=Qn)||p.memoizedState!==null,vr(l,u,p),Qn=g;break;default:vr(l,u,p)}}function fw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null))){l=l.dehydrated;try{Zo(l)}catch(p){gn(u,u.return,p)}}}function pw(l,u){if(u.memoizedState===null&&(l=u.alternate,l!==null&&(l=l.memoizedState,l!==null&&(l=l.dehydrated,l!==null))))try{Zo(l)}catch(p){gn(u,u.return,p)}}function R_(l){switch(l.tag){case 31:case 13:case 19:var u=l.stateNode;return u===null&&(u=l.stateNode=new lw),u;case 22:return l=l.stateNode,u=l._retryCache,u===null&&(u=l._retryCache=new lw),u;default:throw Error(s(435,l.tag))}}function yd(l,u){var p=R_(l);u.forEach(function(g){if(!p.has(g)){p.add(g);var w=H_.bind(null,l,g);g.then(w,w)}})}function Es(l,u){var p=u.deletions;if(p!==null)for(var g=0;g<p.length;g++){var w=p[g],C=l,I=u,G=I;e:for(;G!==null;){switch(G.tag){case 27:if(li(G.type)){Rn=G.stateNode,_s=!1;break e}break;case 5:Rn=G.stateNode,_s=!1;break e;case 3:case 4:Rn=G.stateNode.containerInfo,_s=!0;break e}G=G.return}if(Rn===null)throw Error(s(160));dw(C,I,w),Rn=null,_s=!1,C=w.alternate,C!==null&&(C.return=null),w.return=null}if(u.subtreeFlags&13886)for(u=u.child;u!==null;)hw(u,l),u=u.sibling}var Ea=null;function hw(l,u){var p=l.alternate,g=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:Es(u,l),Ms(l),g&4&&(ti(3,l,l.return),fc(3,l),ti(5,l,l.return));break;case 1:Es(u,l),Ms(l),g&512&&(Qn||p===null||$a(p,p.return)),g&64&&yr&&(l=l.updateQueue,l!==null&&(g=l.callbacks,g!==null&&(p=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=p===null?g:p.concat(g))));break;case 26:var w=Ea;if(Es(u,l),Ms(l),g&512&&(Qn||p===null||$a(p,p.return)),g&4){var C=p!==null?p.memoizedState:null;if(g=l.memoizedState,p===null)if(g===null)if(l.stateNode===null){e:{g=l.type,p=l.memoizedProps,w=w.ownerDocument||w;t:switch(g){case"title":C=w.getElementsByTagName("title")[0],(!C||C[$s]||C[ft]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=w.createElement(g),w.head.insertBefore(C,w.querySelector("head > title"))),fs(C,g,p),C[ft]=l,kn(C),g=C;break e;case"link":var I=h0("link","href",w).get(g+(p.href||""));if(I){for(var G=0;G<I.length;G++)if(C=I[G],C.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&C.getAttribute("rel")===(p.rel==null?null:p.rel)&&C.getAttribute("title")===(p.title==null?null:p.title)&&C.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){I.splice(G,1);break t}}C=w.createElement(g),fs(C,g,p),w.head.appendChild(C);break;case"meta":if(I=h0("meta","content",w).get(g+(p.content||""))){for(G=0;G<I.length;G++)if(C=I[G],C.getAttribute("content")===(p.content==null?null:""+p.content)&&C.getAttribute("name")===(p.name==null?null:p.name)&&C.getAttribute("property")===(p.property==null?null:p.property)&&C.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&C.getAttribute("charset")===(p.charSet==null?null:p.charSet)){I.splice(G,1);break t}}C=w.createElement(g),fs(C,g,p),w.head.appendChild(C);break;default:throw Error(s(468,g))}C[ft]=l,kn(C),g=C}l.stateNode=g}else m0(w,l.type,l.stateNode);else l.stateNode=p0(w,g,l.memoizedProps);else C!==g?(C===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):C.count--,g===null?m0(w,l.type,l.stateNode):p0(w,g,l.memoizedProps)):g===null&&l.stateNode!==null&&Kh(l,l.memoizedProps,p.memoizedProps)}break;case 27:Es(u,l),Ms(l),g&512&&(Qn||p===null||$a(p,p.return)),p!==null&&g&4&&Kh(l,l.memoizedProps,p.memoizedProps);break;case 5:if(Es(u,l),Ms(l),g&512&&(Qn||p===null||$a(p,p.return)),l.flags&32){w=l.stateNode;try{la(w,"")}catch(yt){gn(l,l.return,yt)}}g&4&&l.stateNode!=null&&(w=l.memoizedProps,Kh(l,w,p!==null?p.memoizedProps:w)),g&1024&&(Jh=!0);break;case 6:if(Es(u,l),Ms(l),g&4){if(l.stateNode===null)throw Error(s(162));g=l.memoizedProps,p=l.stateNode;try{p.nodeValue=g}catch(yt){gn(l,l.return,yt)}}break;case 3:if(Ld=null,w=Ea,Ea=Rd(u.containerInfo),Es(u,l),Ea=w,Ms(l),g&4&&p!==null&&p.memoizedState.isDehydrated)try{Zo(u.containerInfo)}catch(yt){gn(l,l.return,yt)}Jh&&(Jh=!1,mw(l));break;case 4:g=Ea,Ea=Rd(l.stateNode.containerInfo),Es(u,l),Ms(l),Ea=g;break;case 12:Es(u,l),Ms(l);break;case 31:Es(u,l),Ms(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 13:Es(u,l),Ms(l),l.child.flags&8192&&l.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(wd=ot()),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 22:w=l.memoizedState!==null;var re=p!==null&&p.memoizedState!==null,De=yr,Ye=Qn;if(yr=De||w,Qn=Ye||re,Es(u,l),Qn=Ye,yr=De,Ms(l),g&8192)e:for(u=l.stateNode,u._visibility=w?u._visibility&-2:u._visibility|1,w&&(p===null||re||yr||Qn||Ui(l)),p=null,u=l;;){if(u.tag===5||u.tag===26){if(p===null){re=p=u;try{if(C=re.stateNode,w)I=C.style,typeof I.setProperty=="function"?I.setProperty("display","none","important"):I.display="none";else{G=re.stateNode;var Xe=re.memoizedProps.style,Pe=Xe!=null&&Xe.hasOwnProperty("display")?Xe.display:null;G.style.display=Pe==null||typeof Pe=="boolean"?"":(""+Pe).trim()}}catch(yt){gn(re,re.return,yt)}}}else if(u.tag===6){if(p===null){re=u;try{re.stateNode.nodeValue=w?"":re.memoizedProps}catch(yt){gn(re,re.return,yt)}}}else if(u.tag===18){if(p===null){re=u;try{var He=re.stateNode;w?a0(He,!0):a0(re.stateNode,!1)}catch(yt){gn(re,re.return,yt)}}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===l)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===l)break e;for(;u.sibling===null;){if(u.return===null||u.return===l)break e;p===u&&(p=null),u=u.return}p===u&&(p=null),u.sibling.return=u.return,u=u.sibling}g&4&&(g=l.updateQueue,g!==null&&(p=g.retryQueue,p!==null&&(g.retryQueue=null,yd(l,p))));break;case 19:Es(u,l),Ms(l),g&4&&(g=l.updateQueue,g!==null&&(l.updateQueue=null,yd(l,g)));break;case 30:break;case 21:break;default:Es(u,l),Ms(l)}}function Ms(l){var u=l.flags;if(u&2){try{for(var p,g=l.return;g!==null;){if(iw(g)){p=g;break}g=g.return}if(p==null)throw Error(s(160));switch(p.tag){case 27:var w=p.stateNode,C=Qh(l);xd(l,C,w);break;case 5:var I=p.stateNode;p.flags&32&&(la(I,""),p.flags&=-33);var G=Qh(l);xd(l,G,I);break;case 3:case 4:var re=p.stateNode.containerInfo,De=Qh(l);Xh(l,De,re);break;default:throw Error(s(161))}}catch(Ye){gn(l,l.return,Ye)}l.flags&=-3}u&4096&&(l.flags&=-4097)}function mw(l){if(l.subtreeFlags&1024)for(l=l.child;l!==null;){var u=l;mw(u),u.tag===5&&u.flags&1024&&u.stateNode.reset(),l=l.sibling}}function wr(l,u){if(u.subtreeFlags&8772)for(u=u.child;u!==null;)cw(l,u.alternate,u),u=u.sibling}function Ui(l){for(l=l.child;l!==null;){var u=l;switch(u.tag){case 0:case 11:case 14:case 15:ti(4,u,u.return),Ui(u);break;case 1:$a(u,u.return);var p=u.stateNode;typeof p.componentWillUnmount=="function"&&aw(u,u.return,p),Ui(u);break;case 27:kc(u.stateNode);case 26:case 5:$a(u,u.return),Ui(u);break;case 22:u.memoizedState===null&&Ui(u);break;case 30:Ui(u);break;default:Ui(u)}l=l.sibling}}function kr(l,u,p){for(p=p&&(u.subtreeFlags&8772)!==0,u=u.child;u!==null;){var g=u.alternate,w=l,C=u,I=C.flags;switch(C.tag){case 0:case 11:case 15:kr(w,C,p),fc(4,C);break;case 1:if(kr(w,C,p),g=C,w=g.stateNode,typeof w.componentDidMount=="function")try{w.componentDidMount()}catch(De){gn(g,g.return,De)}if(g=C,w=g.updateQueue,w!==null){var G=g.stateNode;try{var re=w.shared.hiddenCallbacks;if(re!==null)for(w.shared.hiddenCallbacks=null,w=0;w<re.length;w++)Vy(re[w],G)}catch(De){gn(g,g.return,De)}}p&&I&64&&sw(C),pc(C,C.return);break;case 27:ow(C);case 26:case 5:kr(w,C,p),p&&g===null&&I&4&&rw(C),pc(C,C.return);break;case 12:kr(w,C,p);break;case 31:kr(w,C,p),p&&I&4&&fw(w,C);break;case 13:kr(w,C,p),p&&I&4&&pw(w,C);break;case 22:C.memoizedState===null&&kr(w,C,p),pc(C,C.return);break;case 30:break;default:kr(w,C,p)}u=u.sibling}}function Zh(l,u){var p=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),l=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(l=u.memoizedState.cachePool.pool),l!==p&&(l!=null&&l.refCount++,p!=null&&Zl(p))}function em(l,u){l=null,u.alternate!==null&&(l=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==l&&(u.refCount++,l!=null&&Zl(l))}function Ma(l,u,p,g){if(u.subtreeFlags&10256)for(u=u.child;u!==null;)gw(l,u,p,g),u=u.sibling}function gw(l,u,p,g){var w=u.flags;switch(u.tag){case 0:case 11:case 15:Ma(l,u,p,g),w&2048&&fc(9,u);break;case 1:Ma(l,u,p,g);break;case 3:Ma(l,u,p,g),w&2048&&(l=null,u.alternate!==null&&(l=u.alternate.memoizedState.cache),u=u.memoizedState.cache,u!==l&&(u.refCount++,l!=null&&Zl(l)));break;case 12:if(w&2048){Ma(l,u,p,g),l=u.stateNode;try{var C=u.memoizedProps,I=C.id,G=C.onPostCommit;typeof G=="function"&&G(I,u.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(re){gn(u,u.return,re)}}else Ma(l,u,p,g);break;case 31:Ma(l,u,p,g);break;case 13:Ma(l,u,p,g);break;case 23:break;case 22:C=u.stateNode,I=u.alternate,u.memoizedState!==null?C._visibility&2?Ma(l,u,p,g):hc(l,u):C._visibility&2?Ma(l,u,p,g):(C._visibility|=2,Ho(l,u,p,g,(u.subtreeFlags&10256)!==0||!1)),w&2048&&Zh(I,u);break;case 24:Ma(l,u,p,g),w&2048&&em(u.alternate,u);break;default:Ma(l,u,p,g)}}function Ho(l,u,p,g,w){for(w=w&&((u.subtreeFlags&10256)!==0||!1),u=u.child;u!==null;){var C=l,I=u,G=p,re=g,De=I.flags;switch(I.tag){case 0:case 11:case 15:Ho(C,I,G,re,w),fc(8,I);break;case 23:break;case 22:var Ye=I.stateNode;I.memoizedState!==null?Ye._visibility&2?Ho(C,I,G,re,w):hc(C,I):(Ye._visibility|=2,Ho(C,I,G,re,w)),w&&De&2048&&Zh(I.alternate,I);break;case 24:Ho(C,I,G,re,w),w&&De&2048&&em(I.alternate,I);break;default:Ho(C,I,G,re,w)}u=u.sibling}}function hc(l,u){if(u.subtreeFlags&10256)for(u=u.child;u!==null;){var p=l,g=u,w=g.flags;switch(g.tag){case 22:hc(p,g),w&2048&&Zh(g.alternate,g);break;case 24:hc(p,g),w&2048&&em(g.alternate,g);break;default:hc(p,g)}u=u.sibling}}var mc=8192;function Uo(l,u,p){if(l.subtreeFlags&mc)for(l=l.child;l!==null;)bw(l,u,p),l=l.sibling}function bw(l,u,p){switch(l.tag){case 26:Uo(l,u,p),l.flags&mc&&l.memoizedState!==null&&yE(p,Ea,l.memoizedState,l.memoizedProps);break;case 5:Uo(l,u,p);break;case 3:case 4:var g=Ea;Ea=Rd(l.stateNode.containerInfo),Uo(l,u,p),Ea=g;break;case 22:l.memoizedState===null&&(g=l.alternate,g!==null&&g.memoizedState!==null?(g=mc,mc=16777216,Uo(l,u,p),mc=g):Uo(l,u,p));break;default:Uo(l,u,p)}}function xw(l){var u=l.alternate;if(u!==null&&(l=u.child,l!==null)){u.child=null;do u=l.sibling,l.sibling=null,l=u;while(l!==null)}}function gc(l){var u=l.deletions;if((l.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var g=u[p];rs=g,vw(g,l)}xw(l)}if(l.subtreeFlags&10256)for(l=l.child;l!==null;)yw(l),l=l.sibling}function yw(l){switch(l.tag){case 0:case 11:case 15:gc(l),l.flags&2048&&ti(9,l,l.return);break;case 3:gc(l);break;case 12:gc(l);break;case 22:var u=l.stateNode;l.memoizedState!==null&&u._visibility&2&&(l.return===null||l.return.tag!==13)?(u._visibility&=-3,vd(l)):gc(l);break;default:gc(l)}}function vd(l){var u=l.deletions;if((l.flags&16)!==0){if(u!==null)for(var p=0;p<u.length;p++){var g=u[p];rs=g,vw(g,l)}xw(l)}for(l=l.child;l!==null;){switch(u=l,u.tag){case 0:case 11:case 15:ti(8,u,u.return),vd(u);break;case 22:p=u.stateNode,p._visibility&2&&(p._visibility&=-3,vd(u));break;default:vd(u)}l=l.sibling}}function vw(l,u){for(;rs!==null;){var p=rs;switch(p.tag){case 0:case 11:case 15:ti(8,p,u);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var g=p.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:Zl(p.memoizedState.cache)}if(g=p.child,g!==null)g.return=p,rs=g;else e:for(p=l;rs!==null;){g=rs;var w=g.sibling,C=g.return;if(uw(g),g===p){rs=null;break e}if(w!==null){w.return=C,rs=w;break e}rs=C}}}var O_={getCacheForType:function(l){var u=us(Gn),p=u.data.get(l);return p===void 0&&(p=l(),u.data.set(l,p)),p},cacheSignal:function(){return us(Gn).controller.signal}},L_=typeof WeakMap=="function"?WeakMap:Map,pn=0,Sn=null,Yt=null,tn=0,mn=0,Gs=null,ni=!1,Wo=!1,tm=!1,Sr=0,Bn=0,si=0,Wi=0,nm=0,Ys=0,qo=0,bc=null,Ds=null,sm=!1,wd=0,ww=0,kd=1/0,Sd=null,ai=null,es=0,ri=null,Vo=null,Cr=0,am=0,rm=null,kw=null,xc=0,im=null;function Ks(){return(pn&2)!==0&&tn!==0?tn&-tn:z.T!==null?fm():Vt()}function Sw(){if(Ys===0)if((tn&536870912)===0||an){var l=Ze;Ze<<=1,(Ze&3932160)===0&&(Ze=262144),Ys=l}else Ys=536870912;return l=qs.current,l!==null&&(l.flags|=32),Ys}function Rs(l,u,p){(l===Sn&&(mn===2||mn===9)||l.cancelPendingCommit!==null)&&(Go(l,0),ii(l,tn,Ys,!1)),_e(l,p),((pn&2)===0||l!==Sn)&&(l===Sn&&((pn&2)===0&&(Wi|=p),Bn===4&&ii(l,tn,Ys,!1)),Ha(l))}function Cw(l,u,p){if((pn&6)!==0)throw Error(s(327));var g=!p&&(u&127)===0&&(u&l.expiredLanes)===0||st(l,u),w=g?B_(l,u):lm(l,u,!0),C=g;do{if(w===0){Wo&&!g&&ii(l,u,0,!1);break}else{if(p=l.current.alternate,C&&!P_(p)){w=lm(l,u,!1),C=!1;continue}if(w===2){if(C=u,l.errorRecoveryDisabledLanes&C)var I=0;else I=l.pendingLanes&-536870913,I=I!==0?I:I&536870912?536870912:0;if(I!==0){u=I;e:{var G=l;w=bc;var re=G.current.memoizedState.isDehydrated;if(re&&(Go(G,I).flags|=256),I=lm(G,I,!1),I!==2){if(tm&&!re){G.errorRecoveryDisabledLanes|=C,Wi|=C,w=4;break e}C=Ds,Ds=w,C!==null&&(Ds===null?Ds=C:Ds.push.apply(Ds,C))}w=I}if(C=!1,w!==2)continue}}if(w===1){Go(l,0),ii(l,u,0,!0);break}e:{switch(g=l,C=w,C){case 0:case 1:throw Error(s(345));case 4:if((u&4194048)!==u)break;case 6:ii(g,u,Ys,!ni);break e;case 2:Ds=null;break;case 3:case 5:break;default:throw Error(s(329))}if((u&62914560)===u&&(w=wd+300-ot(),10<w)){if(ii(g,u,Ys,!ni),ct(g,0,!0)!==0)break e;Cr=u,g.timeoutHandle=t0(Aw.bind(null,g,p,Ds,Sd,sm,u,Ys,Wi,qo,ni,C,"Throttled",-0,0),w);break e}Aw(g,p,Ds,Sd,sm,u,Ys,Wi,qo,ni,C,null,-0,0)}}break}while(!0);Ha(l)}function Aw(l,u,p,g,w,C,I,G,re,De,Ye,Xe,Pe,He){if(l.timeoutHandle=-1,Xe=u.subtreeFlags,Xe&8192||(Xe&16785408)===16785408){Xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Na},bw(u,C,Xe);var yt=(C&62914560)===C?wd-ot():(C&4194048)===C?ww-ot():0;if(yt=vE(Xe,yt),yt!==null){Cr=C,l.cancelPendingCommit=yt(Rw.bind(null,l,u,C,p,g,w,I,G,re,Ye,Xe,null,Pe,He)),ii(l,C,I,!De);return}}Rw(l,u,C,p,g,w,I,G,re)}function P_(l){for(var u=l;;){var p=u.tag;if((p===0||p===11||p===15)&&u.flags&16384&&(p=u.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var g=0;g<p.length;g++){var w=p[g],C=w.getSnapshot;w=w.value;try{if(!Us(C(),w))return!1}catch{return!1}}if(p=u.child,u.subtreeFlags&16384&&p!==null)p.return=u,u=p;else{if(u===l)break;for(;u.sibling===null;){if(u.return===null||u.return===l)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function ii(l,u,p,g){u&=~nm,u&=~Wi,l.suspendedLanes|=u,l.pingedLanes&=~u,g&&(l.warmLanes|=u),g=l.expirationTimes;for(var w=u;0<w;){var C=31-pe(w),I=1<<C;g[C]=-1,w&=~I}p!==0&&nt(l,p,u)}function Cd(){return(pn&6)===0?(yc(0),!1):!0}function om(){if(Yt!==null){if(mn===0)var l=Yt.return;else l=Yt,pr=Li=null,Sh(l),Io=null,tc=0,l=Yt;for(;l!==null;)nw(l.alternate,l),l=l.return;Yt=null}}function Go(l,u){var p=l.timeoutHandle;p!==-1&&(l.timeoutHandle=-1,nE(p)),p=l.cancelPendingCommit,p!==null&&(l.cancelPendingCommit=null,p()),Cr=0,om(),Sn=l,Yt=p=dr(l.current,null),tn=u,mn=0,Gs=null,ni=!1,Wo=st(l,u),tm=!1,qo=Ys=nm=Wi=si=Bn=0,Ds=bc=null,sm=!1,(u&8)!==0&&(u|=u&32);var g=l.entangledLanes;if(g!==0)for(l=l.entanglements,g&=u;0<g;){var w=31-pe(g),C=1<<w;u|=l[w],g&=~C}return Sr=u,qu(),p}function jw(l,u){Ht=null,z.H=cc,u===Po||u===Zu?(u=Hy(),mn=3):u===dh?(u=Hy(),mn=4):mn=u===Fh?8:u!==null&&typeof u=="object"&&typeof u.then=="function"?6:1,Gs=u,Yt===null&&(Bn=1,pd(l,da(u,l.current)))}function Nw(){var l=qs.current;return l===null?!0:(tn&4194048)===tn?ma===null:(tn&62914560)===tn||(tn&536870912)!==0?l===ma:!1}function Tw(){var l=z.H;return z.H=cc,l===null?cc:l}function _w(){var l=z.A;return z.A=O_,l}function Ad(){Bn=4,ni||(tn&4194048)!==tn&&qs.current!==null||(Wo=!0),(si&134217727)===0&&(Wi&134217727)===0||Sn===null||ii(Sn,tn,Ys,!1)}function lm(l,u,p){var g=pn;pn|=2;var w=Tw(),C=_w();(Sn!==l||tn!==u)&&(Sd=null,Go(l,u)),u=!1;var I=Bn;e:do try{if(mn!==0&&Yt!==null){var G=Yt,re=Gs;switch(mn){case 8:om(),I=6;break e;case 3:case 2:case 9:case 6:qs.current===null&&(u=!0);var De=mn;if(mn=0,Gs=null,Yo(l,G,re,De),p&&Wo){I=0;break e}break;default:De=mn,mn=0,Gs=null,Yo(l,G,re,De)}}I_(),I=Bn;break}catch(Ye){jw(l,Ye)}while(!0);return u&&l.shellSuspendCounter++,pr=Li=null,pn=g,z.H=w,z.A=C,Yt===null&&(Sn=null,tn=0,qu()),I}function I_(){for(;Yt!==null;)Ew(Yt)}function B_(l,u){var p=pn;pn|=2;var g=Tw(),w=_w();Sn!==l||tn!==u?(Sd=null,kd=ot()+500,Go(l,u)):Wo=st(l,u);e:do try{if(mn!==0&&Yt!==null){u=Yt;var C=Gs;t:switch(mn){case 1:mn=0,Gs=null,Yo(l,u,C,1);break;case 2:case 9:if(zy(C)){mn=0,Gs=null,Mw(u);break}u=function(){mn!==2&&mn!==9||Sn!==l||(mn=7),Ha(l)},C.then(u,u);break e;case 3:mn=7;break e;case 4:mn=5;break e;case 7:zy(C)?(mn=0,Gs=null,Mw(u)):(mn=0,Gs=null,Yo(l,u,C,7));break;case 5:var I=null;switch(Yt.tag){case 26:I=Yt.memoizedState;case 5:case 27:var G=Yt;if(I?g0(I):G.stateNode.complete){mn=0,Gs=null;var re=G.sibling;if(re!==null)Yt=re;else{var De=G.return;De!==null?(Yt=De,jd(De)):Yt=null}break t}}mn=0,Gs=null,Yo(l,u,C,5);break;case 6:mn=0,Gs=null,Yo(l,u,C,6);break;case 8:om(),Bn=6;break e;default:throw Error(s(462))}}F_();break}catch(Ye){jw(l,Ye)}while(!0);return pr=Li=null,z.H=g,z.A=w,pn=p,Yt!==null?0:(Sn=null,tn=0,qu(),Bn)}function F_(){for(;Yt!==null&&!Ue();)Ew(Yt)}function Ew(l){var u=ew(l.alternate,l,Sr);l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Mw(l){var u=l,p=u.alternate;switch(u.tag){case 15:case 0:u=Yv(p,u,u.pendingProps,u.type,void 0,tn);break;case 11:u=Yv(p,u,u.pendingProps,u.type.render,u.ref,tn);break;case 5:Sh(u);default:nw(p,u),u=Yt=_y(u,Sr),u=ew(p,u,Sr)}l.memoizedProps=l.pendingProps,u===null?jd(l):Yt=u}function Yo(l,u,p,g){pr=Li=null,Sh(u),Io=null,tc=0;var w=u.return;try{if(N_(l,w,u,p,tn)){Bn=1,pd(l,da(p,l.current)),Yt=null;return}}catch(C){if(w!==null)throw Yt=w,C;Bn=1,pd(l,da(p,l.current)),Yt=null;return}u.flags&32768?(an||g===1?l=!0:Wo||(tn&536870912)!==0?l=!1:(ni=l=!0,(g===2||g===9||g===3||g===6)&&(g=qs.current,g!==null&&g.tag===13&&(g.flags|=16384))),Dw(u,l)):jd(u)}function jd(l){var u=l;do{if((u.flags&32768)!==0){Dw(u,ni);return}l=u.return;var p=E_(u.alternate,u,Sr);if(p!==null){Yt=p;return}if(u=u.sibling,u!==null){Yt=u;return}Yt=u=l}while(u!==null);Bn===0&&(Bn=5)}function Dw(l,u){do{var p=M_(l.alternate,l);if(p!==null){p.flags&=32767,Yt=p;return}if(p=l.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!u&&(l=l.sibling,l!==null)){Yt=l;return}Yt=l=p}while(l!==null);Bn=6,Yt=null}function Rw(l,u,p,g,w,C,I,G,re){l.cancelPendingCommit=null;do Nd();while(es!==0);if((pn&6)!==0)throw Error(s(327));if(u!==null){if(u===l.current)throw Error(s(177));if(C=u.lanes|u.childLanes,C|=Qp,We(l,p,C,I,G,re),l===Sn&&(Yt=Sn=null,tn=0),Vo=u,ri=l,Cr=p,am=C,rm=w,kw=g,(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?(l.callbackNode=null,l.callbackPriority=0,U_(Se,function(){return Bw(),null})):(l.callbackNode=null,l.callbackPriority=0),g=(u.flags&13878)!==0,(u.subtreeFlags&13878)!==0||g){g=z.T,z.T=null,w=W.p,W.p=2,I=pn,pn|=4;try{D_(l,u,p)}finally{pn=I,W.p=w,z.T=g}}es=1,Ow(),Lw(),Pw()}}function Ow(){if(es===1){es=0;var l=ri,u=Vo,p=(u.flags&13878)!==0;if((u.subtreeFlags&13878)!==0||p){p=z.T,z.T=null;var g=W.p;W.p=2;var w=pn;pn|=4;try{hw(u,l);var C=vm,I=vy(l.containerInfo),G=C.focusedElem,re=C.selectionRange;if(I!==G&&G&&G.ownerDocument&&yy(G.ownerDocument.documentElement,G)){if(re!==null&&qp(G)){var De=re.start,Ye=re.end;if(Ye===void 0&&(Ye=De),"selectionStart"in G)G.selectionStart=De,G.selectionEnd=Math.min(Ye,G.value.length);else{var Xe=G.ownerDocument||document,Pe=Xe&&Xe.defaultView||window;if(Pe.getSelection){var He=Pe.getSelection(),yt=G.textContent.length,Rt=Math.min(re.start,yt),wn=re.end===void 0?Rt:Math.min(re.end,yt);!He.extend&&Rt>wn&&(I=wn,wn=Rt,Rt=I);var Ae=xy(G,Rt),le=xy(G,wn);if(Ae&&le&&(He.rangeCount!==1||He.anchorNode!==Ae.node||He.anchorOffset!==Ae.offset||He.focusNode!==le.node||He.focusOffset!==le.offset)){var Me=Xe.createRange();Me.setStart(Ae.node,Ae.offset),He.removeAllRanges(),Rt>wn?(He.addRange(Me),He.extend(le.node,le.offset)):(Me.setEnd(le.node,le.offset),He.addRange(Me))}}}}for(Xe=[],He=G;He=He.parentNode;)He.nodeType===1&&Xe.push({element:He,left:He.scrollLeft,top:He.scrollTop});for(typeof G.focus=="function"&&G.focus(),G=0;G<Xe.length;G++){var Qe=Xe[G];Qe.element.scrollLeft=Qe.left,Qe.element.scrollTop=Qe.top}}Fd=!!ym,vm=ym=null}finally{pn=w,W.p=g,z.T=p}}l.current=u,es=2}}function Lw(){if(es===2){es=0;var l=ri,u=Vo,p=(u.flags&8772)!==0;if((u.subtreeFlags&8772)!==0||p){p=z.T,z.T=null;var g=W.p;W.p=2;var w=pn;pn|=4;try{cw(l,u.alternate,u)}finally{pn=w,W.p=g,z.T=p}}es=3}}function Pw(){if(es===4||es===3){es=0,it();var l=ri,u=Vo,p=Cr,g=kw;(u.subtreeFlags&10256)!==0||(u.flags&10256)!==0?es=5:(es=0,Vo=ri=null,Iw(l,l.pendingLanes));var w=l.pendingLanes;if(w===0&&(ai=null),$t(p),u=u.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(oe,u,void 0,(u.current.flags&128)===128)}catch{}if(g!==null){u=z.T,w=W.p,W.p=2,z.T=null;try{for(var C=l.onRecoverableError,I=0;I<g.length;I++){var G=g[I];C(G.value,{componentStack:G.stack})}}finally{z.T=u,W.p=w}}(Cr&3)!==0&&Nd(),Ha(l),w=l.pendingLanes,(p&261930)!==0&&(w&42)!==0?l===im?xc++:(xc=0,im=l):xc=0,yc(0)}}function Iw(l,u){(l.pooledCacheLanes&=u)===0&&(u=l.pooledCache,u!=null&&(l.pooledCache=null,Zl(u)))}function Nd(){return Ow(),Lw(),Pw(),Bw()}function Bw(){if(es!==5)return!1;var l=ri,u=am;am=0;var p=$t(Cr),g=z.T,w=W.p;try{W.p=32>p?32:p,z.T=null,p=rm,rm=null;var C=ri,I=Cr;if(es=0,Vo=ri=null,Cr=0,(pn&6)!==0)throw Error(s(331));var G=pn;if(pn|=4,yw(C.current),gw(C,C.current,I,p),pn=G,yc(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(oe,C)}catch{}return!0}finally{W.p=w,z.T=g,Iw(l,u)}}function Fw(l,u,p){u=da(p,u),u=Bh(l.stateNode,u,2),l=Jr(l,u,2),l!==null&&(_e(l,2),Ha(l))}function gn(l,u,p){if(l.tag===3)Fw(l,l,p);else for(;u!==null;){if(u.tag===3){Fw(u,l,p);break}else if(u.tag===1){var g=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ai===null||!ai.has(g))){l=da(p,l),p=zv(2),g=Jr(u,p,2),g!==null&&($v(p,g,u,l),_e(g,2),Ha(g));break}}u=u.return}}function cm(l,u,p){var g=l.pingCache;if(g===null){g=l.pingCache=new L_;var w=new Set;g.set(u,w)}else w=g.get(u),w===void 0&&(w=new Set,g.set(u,w));w.has(p)||(tm=!0,w.add(p),l=z_.bind(null,l,u,p),u.then(l,l))}function z_(l,u,p){var g=l.pingCache;g!==null&&g.delete(u),l.pingedLanes|=l.suspendedLanes&p,l.warmLanes&=~p,Sn===l&&(tn&p)===p&&(Bn===4||Bn===3&&(tn&62914560)===tn&&300>ot()-wd?(pn&2)===0&&Go(l,0):nm|=p,qo===tn&&(qo=0)),Ha(l)}function zw(l,u){u===0&&(u=Tt()),l=Di(l,u),l!==null&&(_e(l,u),Ha(l))}function $_(l){var u=l.memoizedState,p=0;u!==null&&(p=u.retryLane),zw(l,p)}function H_(l,u){var p=0;switch(l.tag){case 31:case 13:var g=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:g=l.stateNode;break;case 22:g=l.stateNode._retryCache;break;default:throw Error(s(314))}g!==null&&g.delete(u),zw(l,p)}function U_(l,u){return ie(l,u)}var Td=null,Ko=null,um=!1,_d=!1,dm=!1,oi=0;function Ha(l){l!==Ko&&l.next===null&&(Ko===null?Td=Ko=l:Ko=Ko.next=l),_d=!0,um||(um=!0,q_())}function yc(l,u){if(!dm&&_d){dm=!0;do for(var p=!1,g=Td;g!==null;){if(l!==0){var w=g.pendingLanes;if(w===0)var C=0;else{var I=g.suspendedLanes,G=g.pingedLanes;C=(1<<31-pe(42|l)+1)-1,C&=w&~(I&~G),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(p=!0,Ww(g,C))}else C=tn,C=ct(g,g===Sn?C:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(C&3)===0||st(g,C)||(p=!0,Ww(g,C));g=g.next}while(p);dm=!1}}function W_(){$w()}function $w(){_d=um=!1;var l=0;oi!==0&&tE()&&(l=oi);for(var u=ot(),p=null,g=Td;g!==null;){var w=g.next,C=Hw(g,u);C===0?(g.next=null,p===null?Td=w:p.next=w,w===null&&(Ko=p)):(p=g,(l!==0||(C&3)!==0)&&(_d=!0)),g=w}es!==0&&es!==5||yc(l),oi!==0&&(oi=0)}function Hw(l,u){for(var p=l.suspendedLanes,g=l.pingedLanes,w=l.expirationTimes,C=l.pendingLanes&-62914561;0<C;){var I=31-pe(C),G=1<<I,re=w[I];re===-1?((G&p)===0||(G&g)!==0)&&(w[I]=bt(G,u)):re<=u&&(l.expiredLanes|=G),C&=~G}if(u=Sn,p=tn,p=ct(l,l===u?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),g=l.callbackNode,p===0||l===u&&(mn===2||mn===9)||l.cancelPendingCommit!==null)return g!==null&&g!==null&&fe(g),l.callbackNode=null,l.callbackPriority=0;if((p&3)===0||st(l,p)){if(u=p&-p,u===l.callbackPriority)return u;switch(g!==null&&fe(g),$t(p)){case 2:case 8:p=ae;break;case 32:p=Se;break;case 268435456:p=ge;break;default:p=Se}return g=Uw.bind(null,l),p=ie(p,g),l.callbackPriority=u,l.callbackNode=p,u}return g!==null&&g!==null&&fe(g),l.callbackPriority=2,l.callbackNode=null,2}function Uw(l,u){if(es!==0&&es!==5)return l.callbackNode=null,l.callbackPriority=0,null;var p=l.callbackNode;if(Nd()&&l.callbackNode!==p)return null;var g=tn;return g=ct(l,l===Sn?g:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),g===0?null:(Cw(l,g,u),Hw(l,ot()),l.callbackNode!=null&&l.callbackNode===p?Uw.bind(null,l):null)}function Ww(l,u){if(Nd())return null;Cw(l,u,!0)}function q_(){sE(function(){(pn&6)!==0?ie(J,W_):$w()})}function fm(){if(oi===0){var l=Oo;l===0&&(l=ze,ze<<=1,(ze&261888)===0&&(ze=256)),oi=l}return oi}function qw(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:vo(""+l)}function Vw(l,u){var p=u.ownerDocument.createElement("input");return p.name=u.name,p.value=u.value,l.id&&p.setAttribute("form",l.id),u.parentNode.insertBefore(p,u),l=new FormData(l),p.parentNode.removeChild(p),l}function V_(l,u,p,g,w){if(u==="submit"&&p&&p.stateNode===w){var C=qw((w[Ft]||null).action),I=g.submitter;I&&(u=(u=I[Ft]||null)?qw(u.formAction):I.getAttribute("formAction"),u!==null&&(C=u,I=null));var G=new Mt("action","action",null,g,w);l.push({event:G,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(oi!==0){var re=I?Vw(w,I):new FormData(w);Dh(p,{pending:!0,data:re,method:w.method,action:C},null,re)}}else typeof C=="function"&&(G.preventDefault(),re=I?Vw(w,I):new FormData(w),Dh(p,{pending:!0,data:re,method:w.method,action:C},C,re))},currentTarget:w}]})}}for(var pm=0;pm<Kp.length;pm++){var hm=Kp[pm],G_=hm.toLowerCase(),Y_=hm[0].toUpperCase()+hm.slice(1);_a(G_,"on"+Y_)}_a(Sy,"onAnimationEnd"),_a(Cy,"onAnimationIteration"),_a(Ay,"onAnimationStart"),_a("dblclick","onDoubleClick"),_a("focusin","onFocus"),_a("focusout","onBlur"),_a(u_,"onTransitionRun"),_a(d_,"onTransitionStart"),_a(f_,"onTransitionCancel"),_a(jy,"onTransitionEnd"),ia("onMouseEnter",["mouseout","mouseover"]),ia("onMouseLeave",["mouseout","mouseover"]),ia("onPointerEnter",["pointerout","pointerover"]),ia("onPointerLeave",["pointerout","pointerover"]),gs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),gs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),gs("onBeforeInput",["compositionend","keypress","textInput","paste"]),gs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),gs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),gs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vc="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(" "),K_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(vc));function Gw(l,u){u=(u&4)!==0;for(var p=0;p<l.length;p++){var g=l[p],w=g.event;g=g.listeners;e:{var C=void 0;if(u)for(var I=g.length-1;0<=I;I--){var G=g[I],re=G.instance,De=G.currentTarget;if(G=G.listener,re!==C&&w.isPropagationStopped())break e;C=G,w.currentTarget=De;try{C(w)}catch(Ye){Wu(Ye)}w.currentTarget=null,C=re}else for(I=0;I<g.length;I++){if(G=g[I],re=G.instance,De=G.currentTarget,G=G.listener,re!==C&&w.isPropagationStopped())break e;C=G,w.currentTarget=De;try{C(w)}catch(Ye){Wu(Ye)}w.currentTarget=null,C=re}}}}function Kt(l,u){var p=u[Dn];p===void 0&&(p=u[Dn]=new Set);var g=l+"__bubble";p.has(g)||(Yw(u,l,2,!1),p.add(g))}function mm(l,u,p){var g=0;u&&(g|=4),Yw(p,l,g,u)}var Ed="_reactListening"+Math.random().toString(36).slice(2);function gm(l){if(!l[Ed]){l[Ed]=!0,$r.forEach(function(p){p!=="selectionchange"&&(K_.has(p)||mm(p,!1,l),mm(p,!0,l))});var u=l.nodeType===9?l:l.ownerDocument;u===null||u[Ed]||(u[Ed]=!0,mm("selectionchange",!1,u))}}function Yw(l,u,p,g){switch(S0(u)){case 2:var w=SE;break;case 8:w=CE;break;default:w=Mm}p=w.bind(null,u,p,l),w=void 0,!ko||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(w=!0),g?w!==void 0?l.addEventListener(u,p,{capture:!0,passive:w}):l.addEventListener(u,p,!0):w!==void 0?l.addEventListener(u,p,{passive:w}):l.addEventListener(u,p,!1)}function bm(l,u,p,g,w){var C=g;if((u&1)===0&&(u&2)===0&&g!==null)e:for(;;){if(g===null)return;var I=g.tag;if(I===3||I===4){var G=g.stateNode.containerInfo;if(G===w)break;if(I===4)for(I=g.return;I!==null;){var re=I.tag;if((re===3||re===4)&&I.stateNode.containerInfo===w)return;I=I.return}for(;G!==null;){if(I=ms(G),I===null)return;if(re=I.tag,re===5||re===6||re===26||re===27){g=C=I;continue e}G=G.parentNode}}g=g.return}Hl(function(){var De=C,Ye=zl(p),Xe=[];e:{var Pe=Ny.get(l);if(Pe!==void 0){var He=Mt,yt=l;switch(l){case"keypress":if(ne(p)===0)break e;case"keydown":case"keyup":He=HT;break;case"focusin":yt="focus",He=Co;break;case"focusout":yt="blur",He=Co;break;case"beforeblur":case"afterblur":He=Co;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":He=zu;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":He=Hu;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":He=qT;break;case Sy:case Cy:case Ay:He=zp;break;case jy:He=GT;break;case"scroll":case"scrollend":He=rn;break;case"wheel":He=KT;break;case"copy":case"cut":case"paste":He=LT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":He=ay;break;case"toggle":case"beforetoggle":He=XT}var Rt=(u&4)!==0,wn=!Rt&&(l==="scroll"||l==="scrollend"),Ae=Rt?Pe!==null?Pe+"Capture":null:Pe;Rt=[];for(var le=De,Me;le!==null;){var Qe=le;if(Me=Qe.stateNode,Qe=Qe.tag,Qe!==5&&Qe!==26&&Qe!==27||Me===null||Ae===null||(Qe=Wr(le,Ae),Qe!=null&&Rt.push(wc(le,Qe,Me))),wn)break;le=le.return}0<Rt.length&&(Pe=new He(Pe,yt,null,p,Ye),Xe.push({event:Pe,listeners:Rt}))}}if((u&7)===0){e:{if(Pe=l==="mouseover"||l==="pointerover",He=l==="mouseout"||l==="pointerout",Pe&&p!==Fl&&(yt=p.relatedTarget||p.fromElement)&&(ms(yt)||yt[cn]))break e;if((He||Pe)&&(Pe=Ye.window===Ye?Ye:(Pe=Ye.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,He?(yt=p.relatedTarget||p.toElement,He=De,yt=yt?ms(yt):null,yt!==null&&(wn=r(yt),Rt=yt.tag,yt!==wn||Rt!==5&&Rt!==27&&Rt!==6)&&(yt=null)):(He=null,yt=De),He!==yt)){if(Rt=zu,Qe="onMouseLeave",Ae="onMouseEnter",le="mouse",(l==="pointerout"||l==="pointerover")&&(Rt=ay,Qe="onPointerLeave",Ae="onPointerEnter",le="pointer"),wn=He==null?Pe:Zn(He),Me=yt==null?Pe:Zn(yt),Pe=new Rt(Qe,le+"leave",He,p,Ye),Pe.target=wn,Pe.relatedTarget=Me,Qe=null,ms(Ye)===De&&(Rt=new Rt(Ae,le+"enter",yt,p,Ye),Rt.target=Me,Rt.relatedTarget=wn,Qe=Rt),wn=Qe,He&&yt)t:{for(Rt=Q_,Ae=He,le=yt,Me=0,Qe=Ae;Qe;Qe=Rt(Qe))Me++;Qe=0;for(var Nt=le;Nt;Nt=Rt(Nt))Qe++;for(;0<Me-Qe;)Ae=Rt(Ae),Me--;for(;0<Qe-Me;)le=Rt(le),Qe--;for(;Me--;){if(Ae===le||le!==null&&Ae===le.alternate){Rt=Ae;break t}Ae=Rt(Ae),le=Rt(le)}Rt=null}else Rt=null;He!==null&&Kw(Xe,Pe,He,Rt,!1),yt!==null&&wn!==null&&Kw(Xe,wn,yt,Rt,!0)}}e:{if(Pe=De?Zn(De):window,He=Pe.nodeName&&Pe.nodeName.toLowerCase(),He==="select"||He==="input"&&Pe.type==="file")var un=fy;else if(uy(Pe))if(py)un=o_;else{un=r_;var kt=a_}else He=Pe.nodeName,!He||He.toLowerCase()!=="input"||Pe.type!=="checkbox"&&Pe.type!=="radio"?De&&yo(De.elementType)&&(un=fy):un=i_;if(un&&(un=un(l,De))){dy(Xe,un,p,Ye);break e}kt&&kt(l,Pe,De),l==="focusout"&&De&&Pe.type==="number"&&De.memoizedProps.value!=null&&ws(Pe,"number",Pe.value)}switch(kt=De?Zn(De):window,l){case"focusin":(uy(kt)||kt.contentEditable==="true")&&(jo=kt,Vp=De,Ql=null);break;case"focusout":Ql=Vp=jo=null;break;case"mousedown":Gp=!0;break;case"contextmenu":case"mouseup":case"dragend":Gp=!1,wy(Xe,p,Ye);break;case"selectionchange":if(c_)break;case"keydown":case"keyup":wy(Xe,p,Ye)}var Ut;if(Hp)e:{switch(l){case"compositionstart":var nn="onCompositionStart";break e;case"compositionend":nn="onCompositionEnd";break e;case"compositionupdate":nn="onCompositionUpdate";break e}nn=void 0}else Ao?ly(l,p)&&(nn="onCompositionEnd"):l==="keydown"&&p.keyCode===229&&(nn="onCompositionStart");nn&&(ry&&p.locale!=="ko"&&(Ao||nn!=="onCompositionStart"?nn==="onCompositionEnd"&&Ao&&(Ut=Ul()):(Ta=Ye,So="value"in Ta?Ta.value:Ta.textContent,Ao=!0)),kt=Md(De,nn),0<kt.length&&(nn=new sy(nn,l,null,p,Ye),Xe.push({event:nn,listeners:kt}),Ut?nn.data=Ut:(Ut=cy(p),Ut!==null&&(nn.data=Ut)))),(Ut=ZT?e_(l,p):t_(l,p))&&(nn=Md(De,"onBeforeInput"),0<nn.length&&(kt=new sy("onBeforeInput","beforeinput",null,p,Ye),Xe.push({event:kt,listeners:nn}),kt.data=Ut)),V_(Xe,l,De,p,Ye)}Gw(Xe,u)})}function wc(l,u,p){return{instance:l,listener:u,currentTarget:p}}function Md(l,u){for(var p=u+"Capture",g=[];l!==null;){var w=l,C=w.stateNode;if(w=w.tag,w!==5&&w!==26&&w!==27||C===null||(w=Wr(l,p),w!=null&&g.unshift(wc(l,w,C)),w=Wr(l,u),w!=null&&g.push(wc(l,w,C))),l.tag===3)return g;l=l.return}return[]}function Q_(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function Kw(l,u,p,g,w){for(var C=u._reactName,I=[];p!==null&&p!==g;){var G=p,re=G.alternate,De=G.stateNode;if(G=G.tag,re!==null&&re===g)break;G!==5&&G!==26&&G!==27||De===null||(re=De,w?(De=Wr(p,C),De!=null&&I.unshift(wc(p,De,re))):w||(De=Wr(p,C),De!=null&&I.push(wc(p,De,re)))),p=p.return}I.length!==0&&l.push({event:u,listeners:I})}var X_=/\r\n?/g,J_=/\u0000|\uFFFD/g;function Qw(l){return(typeof l=="string"?l:""+l).replace(X_,`
|
|
34
|
+
`).replace(J_,"")}function Xw(l,u){return u=Qw(u),Qw(l)===u}function vn(l,u,p,g,w,C){switch(p){case"children":typeof g=="string"?u==="body"||u==="textarea"&&g===""||la(l,g):(typeof g=="number"||typeof g=="bigint")&&u!=="body"&&la(l,""+g);break;case"className":oa(l,"class",g);break;case"tabIndex":oa(l,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":oa(l,p,g);break;case"style":Il(l,g,C);break;case"data":if(u!=="object"){oa(l,"data",g);break}case"src":case"href":if(g===""&&(u!=="a"||p!=="href")){l.removeAttribute(p);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){l.removeAttribute(p);break}g=vo(""+g),l.setAttribute(p,g);break;case"action":case"formAction":if(typeof g=="function"){l.setAttribute(p,"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 C=="function"&&(p==="formAction"?(u!=="input"&&vn(l,u,"name",w.name,w,null),vn(l,u,"formEncType",w.formEncType,w,null),vn(l,u,"formMethod",w.formMethod,w,null),vn(l,u,"formTarget",w.formTarget,w,null)):(vn(l,u,"encType",w.encType,w,null),vn(l,u,"method",w.method,w,null),vn(l,u,"target",w.target,w,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){l.removeAttribute(p);break}g=vo(""+g),l.setAttribute(p,g);break;case"onClick":g!=null&&(l.onclick=Na);break;case"onScroll":g!=null&&Kt("scroll",l);break;case"onScrollEnd":g!=null&&Kt("scrollend",l);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(p=g.__html,p!=null){if(w.children!=null)throw Error(s(60));l.innerHTML=p}}break;case"multiple":l.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":l.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){l.removeAttribute("xlink:href");break}p=vo(""+g),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,""+g):l.removeAttribute(p);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":g&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,""):l.removeAttribute(p);break;case"capture":case"download":g===!0?l.setAttribute(p,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?l.setAttribute(p,g):l.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?l.setAttribute(p,g):l.removeAttribute(p);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?l.removeAttribute(p):l.setAttribute(p,g);break;case"popover":Kt("beforetoggle",l),Kt("toggle",l),ja(l,"popover",g);break;case"xlinkActuate":os(l,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":os(l,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":os(l,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":os(l,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":os(l,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":os(l,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":os(l,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":os(l,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":os(l,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":ja(l,"is",g);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=Ti.get(p)||p,ja(l,p,g))}}function xm(l,u,p,g,w,C){switch(p){case"style":Il(l,g,C);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(s(61));if(p=g.__html,p!=null){if(w.children!=null)throw Error(s(60));l.innerHTML=p}}break;case"children":typeof g=="string"?la(l,g):(typeof g=="number"||typeof g=="bigint")&&la(l,""+g);break;case"onScroll":g!=null&&Kt("scroll",l);break;case"onScrollEnd":g!=null&&Kt("scrollend",l);break;case"onClick":g!=null&&(l.onclick=Na);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hr.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(w=p.endsWith("Capture"),u=p.slice(2,w?p.length-7:void 0),C=l[Ft]||null,C=C!=null?C[p]:null,typeof C=="function"&&l.removeEventListener(u,C,w),typeof g=="function")){typeof C!="function"&&C!==null&&(p in l?l[p]=null:l.hasAttribute(p)&&l.removeAttribute(p)),l.addEventListener(u,g,w);break e}p in l?l[p]=g:g===!0?l.setAttribute(p,""):ja(l,p,g)}}}function fs(l,u,p){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Kt("error",l),Kt("load",l);var g=!1,w=!1,C;for(C in p)if(p.hasOwnProperty(C)){var I=p[C];if(I!=null)switch(C){case"src":g=!0;break;case"srcSet":w=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,u));default:vn(l,u,C,I,p,null)}}w&&vn(l,u,"srcSet",p.srcSet,p,null),g&&vn(l,u,"src",p.src,p,null);return;case"input":Kt("invalid",l);var G=C=I=w=null,re=null,De=null;for(g in p)if(p.hasOwnProperty(g)){var Ye=p[g];if(Ye!=null)switch(g){case"name":w=Ye;break;case"type":I=Ye;break;case"checked":re=Ye;break;case"defaultChecked":De=Ye;break;case"value":C=Ye;break;case"defaultValue":G=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(s(137,u));break;default:vn(l,u,g,Ye,p,null)}}jn(l,C,G,re,De,I,w,!1);return;case"select":Kt("invalid",l),g=I=C=null;for(w in p)if(p.hasOwnProperty(w)&&(G=p[w],G!=null))switch(w){case"value":C=G;break;case"defaultValue":I=G;break;case"multiple":g=G;default:vn(l,u,w,G,p,null)}u=C,p=I,l.multiple=!!g,u!=null?On(l,!!g,u,!1):p!=null&&On(l,!!g,p,!0);return;case"textarea":Kt("invalid",l),C=w=g=null;for(I in p)if(p.hasOwnProperty(I)&&(G=p[I],G!=null))switch(I){case"value":g=G;break;case"defaultValue":w=G;break;case"children":C=G;break;case"dangerouslySetInnerHTML":if(G!=null)throw Error(s(91));break;default:vn(l,u,I,G,p,null)}Ba(l,g,w,C);return;case"option":for(re in p)if(p.hasOwnProperty(re)&&(g=p[re],g!=null))switch(re){case"selected":l.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:vn(l,u,re,g,p,null)}return;case"dialog":Kt("beforetoggle",l),Kt("toggle",l),Kt("cancel",l),Kt("close",l);break;case"iframe":case"object":Kt("load",l);break;case"video":case"audio":for(g=0;g<vc.length;g++)Kt(vc[g],l);break;case"image":Kt("error",l),Kt("load",l);break;case"details":Kt("toggle",l);break;case"embed":case"source":case"link":Kt("error",l),Kt("load",l);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(De in p)if(p.hasOwnProperty(De)&&(g=p[De],g!=null))switch(De){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,u));default:vn(l,u,De,g,p,null)}return;default:if(yo(u)){for(Ye in p)p.hasOwnProperty(Ye)&&(g=p[Ye],g!==void 0&&xm(l,u,Ye,g,p,void 0));return}}for(G in p)p.hasOwnProperty(G)&&(g=p[G],g!=null&&vn(l,u,G,g,p,null))}function Z_(l,u,p,g){switch(u){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var w=null,C=null,I=null,G=null,re=null,De=null,Ye=null;for(He in p){var Xe=p[He];if(p.hasOwnProperty(He)&&Xe!=null)switch(He){case"checked":break;case"value":break;case"defaultValue":re=Xe;default:g.hasOwnProperty(He)||vn(l,u,He,null,g,Xe)}}for(var Pe in g){var He=g[Pe];if(Xe=p[Pe],g.hasOwnProperty(Pe)&&(He!=null||Xe!=null))switch(Pe){case"type":C=He;break;case"name":w=He;break;case"checked":De=He;break;case"defaultChecked":Ye=He;break;case"value":I=He;break;case"defaultValue":G=He;break;case"children":case"dangerouslySetInnerHTML":if(He!=null)throw Error(s(137,u));break;default:He!==Xe&&vn(l,u,Pe,He,g,Xe)}}jt(l,I,G,re,De,Ye,C,w);return;case"select":He=I=G=Pe=null;for(C in p)if(re=p[C],p.hasOwnProperty(C)&&re!=null)switch(C){case"value":break;case"multiple":He=re;default:g.hasOwnProperty(C)||vn(l,u,C,null,g,re)}for(w in g)if(C=g[w],re=p[w],g.hasOwnProperty(w)&&(C!=null||re!=null))switch(w){case"value":Pe=C;break;case"defaultValue":G=C;break;case"multiple":I=C;default:C!==re&&vn(l,u,w,C,g,re)}u=G,p=I,g=He,Pe!=null?On(l,!!p,Pe,!1):!!g!=!!p&&(u!=null?On(l,!!p,u,!0):On(l,!!p,p?[]:"",!1));return;case"textarea":He=Pe=null;for(G in p)if(w=p[G],p.hasOwnProperty(G)&&w!=null&&!g.hasOwnProperty(G))switch(G){case"value":break;case"children":break;default:vn(l,u,G,null,g,w)}for(I in g)if(w=g[I],C=p[I],g.hasOwnProperty(I)&&(w!=null||C!=null))switch(I){case"value":Pe=w;break;case"defaultValue":He=w;break;case"children":break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:w!==C&&vn(l,u,I,w,g,C)}ks(l,Pe,He);return;case"option":for(var yt in p)if(Pe=p[yt],p.hasOwnProperty(yt)&&Pe!=null&&!g.hasOwnProperty(yt))switch(yt){case"selected":l.selected=!1;break;default:vn(l,u,yt,null,g,Pe)}for(re in g)if(Pe=g[re],He=p[re],g.hasOwnProperty(re)&&Pe!==He&&(Pe!=null||He!=null))switch(re){case"selected":l.selected=Pe&&typeof Pe!="function"&&typeof Pe!="symbol";break;default:vn(l,u,re,Pe,g,He)}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 Rt in p)Pe=p[Rt],p.hasOwnProperty(Rt)&&Pe!=null&&!g.hasOwnProperty(Rt)&&vn(l,u,Rt,null,g,Pe);for(De in g)if(Pe=g[De],He=p[De],g.hasOwnProperty(De)&&Pe!==He&&(Pe!=null||He!=null))switch(De){case"children":case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(s(137,u));break;default:vn(l,u,De,Pe,g,He)}return;default:if(yo(u)){for(var wn in p)Pe=p[wn],p.hasOwnProperty(wn)&&Pe!==void 0&&!g.hasOwnProperty(wn)&&xm(l,u,wn,void 0,g,Pe);for(Ye in g)Pe=g[Ye],He=p[Ye],!g.hasOwnProperty(Ye)||Pe===He||Pe===void 0&&He===void 0||xm(l,u,Ye,Pe,g,He);return}}for(var Ae in p)Pe=p[Ae],p.hasOwnProperty(Ae)&&Pe!=null&&!g.hasOwnProperty(Ae)&&vn(l,u,Ae,null,g,Pe);for(Xe in g)Pe=g[Xe],He=p[Xe],!g.hasOwnProperty(Xe)||Pe===He||Pe==null&&He==null||vn(l,u,Xe,Pe,g,He)}function Jw(l){switch(l){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function eE(){if(typeof performance.getEntriesByType=="function"){for(var l=0,u=0,p=performance.getEntriesByType("resource"),g=0;g<p.length;g++){var w=p[g],C=w.transferSize,I=w.initiatorType,G=w.duration;if(C&&G&&Jw(I)){for(I=0,G=w.responseEnd,g+=1;g<p.length;g++){var re=p[g],De=re.startTime;if(De>G)break;var Ye=re.transferSize,Xe=re.initiatorType;Ye&&Jw(Xe)&&(re=re.responseEnd,I+=Ye*(re<G?1:(G-De)/(re-De)))}if(--g,u+=8*(C+I)/(w.duration/1e3),l++,10<l)break}}if(0<l)return u/l/1e6}return navigator.connection&&(l=navigator.connection.downlink,typeof l=="number")?l:5}var ym=null,vm=null;function Dd(l){return l.nodeType===9?l:l.ownerDocument}function Zw(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function e0(l,u){if(l===0)switch(u){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&u==="foreignObject"?0:l}function wm(l,u){return l==="textarea"||l==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.children=="bigint"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var km=null;function tE(){var l=window.event;return l&&l.type==="popstate"?l===km?!1:(km=l,!0):(km=null,!1)}var t0=typeof setTimeout=="function"?setTimeout:void 0,nE=typeof clearTimeout=="function"?clearTimeout:void 0,n0=typeof Promise=="function"?Promise:void 0,sE=typeof queueMicrotask=="function"?queueMicrotask:typeof n0<"u"?function(l){return n0.resolve(null).then(l).catch(aE)}:t0;function aE(l){setTimeout(function(){throw l})}function li(l){return l==="head"}function s0(l,u){var p=u,g=0;do{var w=p.nextSibling;if(l.removeChild(p),w&&w.nodeType===8)if(p=w.data,p==="/$"||p==="/&"){if(g===0){l.removeChild(w),Zo(u);return}g--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")g++;else if(p==="html")kc(l.ownerDocument.documentElement);else if(p==="head"){p=l.ownerDocument.head,kc(p);for(var C=p.firstChild;C;){var I=C.nextSibling,G=C.nodeName;C[$s]||G==="SCRIPT"||G==="STYLE"||G==="LINK"&&C.rel.toLowerCase()==="stylesheet"||p.removeChild(C),C=I}}else p==="body"&&kc(l.ownerDocument.body);p=w}while(p);Zo(u)}function a0(l,u){var p=l;l=0;do{var g=p.nextSibling;if(p.nodeType===1?u?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(u?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),g&&g.nodeType===8)if(p=g.data,p==="/$"){if(l===0)break;l--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||l++;p=g}while(p)}function Sm(l){var u=l.firstChild;for(u&&u.nodeType===10&&(u=u.nextSibling);u;){var p=u;switch(u=u.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":Sm(p),ra(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}l.removeChild(p)}}function rE(l,u,p,g){for(;l.nodeType===1;){var w=p;if(l.nodeName.toLowerCase()!==u.toLowerCase()){if(!g&&(l.nodeName!=="INPUT"||l.type!=="hidden"))break}else if(g){if(!l[$s])switch(u){case"meta":if(!l.hasAttribute("itemprop"))break;return l;case"link":if(C=l.getAttribute("rel"),C==="stylesheet"&&l.hasAttribute("data-precedence"))break;if(C!==w.rel||l.getAttribute("href")!==(w.href==null||w.href===""?null:w.href)||l.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin)||l.getAttribute("title")!==(w.title==null?null:w.title))break;return l;case"style":if(l.hasAttribute("data-precedence"))break;return l;case"script":if(C=l.getAttribute("src"),(C!==(w.src==null?null:w.src)||l.getAttribute("type")!==(w.type==null?null:w.type)||l.getAttribute("crossorigin")!==(w.crossOrigin==null?null:w.crossOrigin))&&C&&l.hasAttribute("async")&&!l.hasAttribute("itemprop"))break;return l;default:return l}}else if(u==="input"&&l.type==="hidden"){var C=w.name==null?null:""+w.name;if(w.type==="hidden"&&l.getAttribute("name")===C)return l}else return l;if(l=ga(l.nextSibling),l===null)break}return null}function iE(l,u,p){if(u==="")return null;for(;l.nodeType!==3;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!p||(l=ga(l.nextSibling),l===null))return null;return l}function r0(l,u){for(;l.nodeType!==8;)if((l.nodeType!==1||l.nodeName!=="INPUT"||l.type!=="hidden")&&!u||(l=ga(l.nextSibling),l===null))return null;return l}function Cm(l){return l.data==="$?"||l.data==="$~"}function Am(l){return l.data==="$!"||l.data==="$?"&&l.ownerDocument.readyState!=="loading"}function oE(l,u){var p=l.ownerDocument;if(l.data==="$~")l._reactRetry=u;else if(l.data!=="$?"||p.readyState!=="loading")u();else{var g=function(){u(),p.removeEventListener("DOMContentLoaded",g)};p.addEventListener("DOMContentLoaded",g),l._reactRetry=g}}function ga(l){for(;l!=null;l=l.nextSibling){var u=l.nodeType;if(u===1||u===3)break;if(u===8){if(u=l.data,u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"||u==="F!"||u==="F")break;if(u==="/$"||u==="/&")return null}}return l}var jm=null;function i0(l){l=l.nextSibling;for(var u=0;l;){if(l.nodeType===8){var p=l.data;if(p==="/$"||p==="/&"){if(u===0)return ga(l.nextSibling);u--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||u++}l=l.nextSibling}return null}function o0(l){l=l.previousSibling;for(var u=0;l;){if(l.nodeType===8){var p=l.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(u===0)return l;u--}else p!=="/$"&&p!=="/&"||u++}l=l.previousSibling}return null}function l0(l,u,p){switch(u=Dd(p),l){case"html":if(l=u.documentElement,!l)throw Error(s(452));return l;case"head":if(l=u.head,!l)throw Error(s(453));return l;case"body":if(l=u.body,!l)throw Error(s(454));return l;default:throw Error(s(451))}}function kc(l){for(var u=l.attributes;u.length;)l.removeAttributeNode(u[0]);ra(l)}var ba=new Map,c0=new Set;function Rd(l){return typeof l.getRootNode=="function"?l.getRootNode():l.nodeType===9?l:l.ownerDocument}var Ar=W.d;W.d={f:lE,r:cE,D:uE,C:dE,L:fE,m:pE,X:mE,S:hE,M:gE};function lE(){var l=Ar.f(),u=Cd();return l||u}function cE(l){var u=Et(l);u!==null&&u.tag===5&&u.type==="form"?jv(u):Ar.r(l)}var Qo=typeof document>"u"?null:document;function u0(l,u,p){var g=Qo;if(g&&typeof u=="string"&&u){var w=zt(u);w='link[rel="'+l+'"][href="'+w+'"]',typeof p=="string"&&(w+='[crossorigin="'+p+'"]'),c0.has(w)||(c0.add(w),l={rel:l,crossOrigin:p,href:u},g.querySelector(w)===null&&(u=g.createElement("link"),fs(u,"link",l),kn(u),g.head.appendChild(u)))}}function uE(l){Ar.D(l),u0("dns-prefetch",l,null)}function dE(l,u){Ar.C(l,u),u0("preconnect",l,u)}function fE(l,u,p){Ar.L(l,u,p);var g=Qo;if(g&&l&&u){var w='link[rel="preload"][as="'+zt(u)+'"]';u==="image"&&p&&p.imageSrcSet?(w+='[imagesrcset="'+zt(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(w+='[imagesizes="'+zt(p.imageSizes)+'"]')):w+='[href="'+zt(l)+'"]';var C=w;switch(u){case"style":C=Xo(l);break;case"script":C=Jo(l)}ba.has(C)||(l=m({rel:"preload",href:u==="image"&&p&&p.imageSrcSet?void 0:l,as:u},p),ba.set(C,l),g.querySelector(w)!==null||u==="style"&&g.querySelector(Sc(C))||u==="script"&&g.querySelector(Cc(C))||(u=g.createElement("link"),fs(u,"link",l),kn(u),g.head.appendChild(u)))}}function pE(l,u){Ar.m(l,u);var p=Qo;if(p&&l){var g=u&&typeof u.as=="string"?u.as:"script",w='link[rel="modulepreload"][as="'+zt(g)+'"][href="'+zt(l)+'"]',C=w;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=Jo(l)}if(!ba.has(C)&&(l=m({rel:"modulepreload",href:l},u),ba.set(C,l),p.querySelector(w)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(Cc(C)))return}g=p.createElement("link"),fs(g,"link",l),kn(g),p.head.appendChild(g)}}}function hE(l,u,p){Ar.S(l,u,p);var g=Qo;if(g&&l){var w=Vn(g).hoistableStyles,C=Xo(l);u=u||"default";var I=w.get(C);if(!I){var G={loading:0,preload:null};if(I=g.querySelector(Sc(C)))G.loading=5;else{l=m({rel:"stylesheet",href:l,"data-precedence":u},p),(p=ba.get(C))&&Nm(l,p);var re=I=g.createElement("link");kn(re),fs(re,"link",l),re._p=new Promise(function(De,Ye){re.onload=De,re.onerror=Ye}),re.addEventListener("load",function(){G.loading|=1}),re.addEventListener("error",function(){G.loading|=2}),G.loading|=4,Od(I,u,g)}I={type:"stylesheet",instance:I,count:1,state:G},w.set(C,I)}}}function mE(l,u){Ar.X(l,u);var p=Qo;if(p&&l){var g=Vn(p).hoistableScripts,w=Jo(l),C=g.get(w);C||(C=p.querySelector(Cc(w)),C||(l=m({src:l,async:!0},u),(u=ba.get(w))&&Tm(l,u),C=p.createElement("script"),kn(C),fs(C,"link",l),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},g.set(w,C))}}function gE(l,u){Ar.M(l,u);var p=Qo;if(p&&l){var g=Vn(p).hoistableScripts,w=Jo(l),C=g.get(w);C||(C=p.querySelector(Cc(w)),C||(l=m({src:l,async:!0,type:"module"},u),(u=ba.get(w))&&Tm(l,u),C=p.createElement("script"),kn(C),fs(C,"link",l),p.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},g.set(w,C))}}function d0(l,u,p,g){var w=(w=Z.current)?Rd(w):null;if(!w)throw Error(s(446));switch(l){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(u=Xo(p.href),p=Vn(w).hoistableStyles,g=p.get(u),g||(g={type:"style",instance:null,count:0,state:null},p.set(u,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){l=Xo(p.href);var C=Vn(w).hoistableStyles,I=C.get(l);if(I||(w=w.ownerDocument||w,I={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(l,I),(C=w.querySelector(Sc(l)))&&!C._p&&(I.instance=C,I.state.loading=5),ba.has(l)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},ba.set(l,p),C||bE(w,l,p,I.state))),u&&g===null)throw Error(s(528,""));return I}if(u&&g!==null)throw Error(s(529,""));return null;case"script":return u=p.async,p=p.src,typeof p=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=Jo(p),p=Vn(w).hoistableScripts,g=p.get(u),g||(g={type:"script",instance:null,count:0,state:null},p.set(u,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,l))}}function Xo(l){return'href="'+zt(l)+'"'}function Sc(l){return'link[rel="stylesheet"]['+l+"]"}function f0(l){return m({},l,{"data-precedence":l.precedence,precedence:null})}function bE(l,u,p,g){l.querySelector('link[rel="preload"][as="style"]['+u+"]")?g.loading=1:(u=l.createElement("link"),g.preload=u,u.addEventListener("load",function(){return g.loading|=1}),u.addEventListener("error",function(){return g.loading|=2}),fs(u,"link",p),kn(u),l.head.appendChild(u))}function Jo(l){return'[src="'+zt(l)+'"]'}function Cc(l){return"script[async]"+l}function p0(l,u,p){if(u.count++,u.instance===null)switch(u.type){case"style":var g=l.querySelector('style[data-href~="'+zt(p.href)+'"]');if(g)return u.instance=g,kn(g),g;var w=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return g=(l.ownerDocument||l).createElement("style"),kn(g),fs(g,"style",w),Od(g,p.precedence,l),u.instance=g;case"stylesheet":w=Xo(p.href);var C=l.querySelector(Sc(w));if(C)return u.state.loading|=4,u.instance=C,kn(C),C;g=f0(p),(w=ba.get(w))&&Nm(g,w),C=(l.ownerDocument||l).createElement("link"),kn(C);var I=C;return I._p=new Promise(function(G,re){I.onload=G,I.onerror=re}),fs(C,"link",g),u.state.loading|=4,Od(C,p.precedence,l),u.instance=C;case"script":return C=Jo(p.src),(w=l.querySelector(Cc(C)))?(u.instance=w,kn(w),w):(g=p,(w=ba.get(C))&&(g=m({},p),Tm(g,w)),l=l.ownerDocument||l,w=l.createElement("script"),kn(w),fs(w,"link",g),l.head.appendChild(w),u.instance=w);case"void":return null;default:throw Error(s(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(g=u.instance,u.state.loading|=4,Od(g,p.precedence,l));return u.instance}function Od(l,u,p){for(var g=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),w=g.length?g[g.length-1]:null,C=w,I=0;I<g.length;I++){var G=g[I];if(G.dataset.precedence===u)C=G;else if(C!==w)break}C?C.parentNode.insertBefore(l,C.nextSibling):(u=p.nodeType===9?p.head:p,u.insertBefore(l,u.firstChild))}function Nm(l,u){l.crossOrigin==null&&(l.crossOrigin=u.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=u.referrerPolicy),l.title==null&&(l.title=u.title)}function Tm(l,u){l.crossOrigin==null&&(l.crossOrigin=u.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=u.referrerPolicy),l.integrity==null&&(l.integrity=u.integrity)}var Ld=null;function h0(l,u,p){if(Ld===null){var g=new Map,w=Ld=new Map;w.set(p,g)}else w=Ld,g=w.get(p),g||(g=new Map,w.set(p,g));if(g.has(l))return g;for(g.set(l,null),p=p.getElementsByTagName(l),w=0;w<p.length;w++){var C=p[w];if(!(C[$s]||C[ft]||l==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var I=C.getAttribute(u)||"";I=l+I;var G=g.get(I);G?G.push(C):g.set(I,[C])}}return g}function m0(l,u,p){l=l.ownerDocument||l,l.head.insertBefore(p,u==="title"?l.querySelector("head > title"):null)}function xE(l,u,p){if(p===1||u.itemProp!=null)return!1;switch(l){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return l=u.disabled,typeof u.precedence=="string"&&l==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function g0(l){return!(l.type==="stylesheet"&&(l.state.loading&3)===0)}function yE(l,u,p,g){if(p.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var w=Xo(g.href),C=u.querySelector(Sc(w));if(C){u=C._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(l.count++,l=Pd.bind(l),u.then(l,l)),p.state.loading|=4,p.instance=C,kn(C);return}C=u.ownerDocument||u,g=f0(g),(w=ba.get(w))&&Nm(g,w),C=C.createElement("link"),kn(C);var I=C;I._p=new Promise(function(G,re){I.onload=G,I.onerror=re}),fs(C,"link",g),p.instance=C}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(p,u),(u=p.state.preload)&&(p.state.loading&3)===0&&(l.count++,p=Pd.bind(l),u.addEventListener("load",p),u.addEventListener("error",p))}}var _m=0;function vE(l,u){return l.stylesheets&&l.count===0&&Bd(l,l.stylesheets),0<l.count||0<l.imgCount?function(p){var g=setTimeout(function(){if(l.stylesheets&&Bd(l,l.stylesheets),l.unsuspend){var C=l.unsuspend;l.unsuspend=null,C()}},6e4+u);0<l.imgBytes&&_m===0&&(_m=62500*eE());var w=setTimeout(function(){if(l.waitingForImages=!1,l.count===0&&(l.stylesheets&&Bd(l,l.stylesheets),l.unsuspend)){var C=l.unsuspend;l.unsuspend=null,C()}},(l.imgBytes>_m?50:800)+u);return l.unsuspend=p,function(){l.unsuspend=null,clearTimeout(g),clearTimeout(w)}}:null}function Pd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bd(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var Id=null;function Bd(l,u){l.stylesheets=null,l.unsuspend!==null&&(l.count++,Id=new Map,u.forEach(wE,l),Id=null,Pd.call(l))}function wE(l,u){if(!(u.state.loading&4)){var p=Id.get(l);if(p)var g=p.get(null);else{p=new Map,Id.set(l,p);for(var w=l.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<w.length;C++){var I=w[C];(I.nodeName==="LINK"||I.getAttribute("media")!=="not all")&&(p.set(I.dataset.precedence,I),g=I)}g&&p.set(null,g)}w=u.instance,I=w.getAttribute("data-precedence"),C=p.get(I)||g,C===g&&p.set(null,w),p.set(I,w),this.count++,g=Pd.bind(this),w.addEventListener("load",g),w.addEventListener("error",g),C?C.parentNode.insertBefore(w,C.nextSibling):(l=l.nodeType===9?l.head:l,l.insertBefore(w,l.firstChild)),u.state.loading|=4}}var Ac={$$typeof:j,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function kE(l,u,p,g,w,C,I,G,re){this.tag=1,this.containerInfo=l,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=he(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=he(0),this.hiddenUpdates=he(null),this.identifierPrefix=g,this.onUncaughtError=w,this.onCaughtError=C,this.onRecoverableError=I,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=re,this.incompleteTransitions=new Map}function b0(l,u,p,g,w,C,I,G,re,De,Ye,Xe){return l=new kE(l,u,p,I,re,De,Ye,Xe,G),u=1,C===!0&&(u|=24),C=Ws(3,null,null,u),l.current=C,C.stateNode=l,u=lh(),u.refCount++,l.pooledCache=u,u.refCount++,C.memoizedState={element:g,isDehydrated:p,cache:u},fh(C),l}function x0(l){return l?(l=_o,l):_o}function y0(l,u,p,g,w,C){w=x0(w),g.context===null?g.context=w:g.pendingContext=w,g=Xr(u),g.payload={element:p},C=C===void 0?null:C,C!==null&&(g.callback=C),p=Jr(l,g,u),p!==null&&(Rs(p,l,u),sc(p,l,u))}function v0(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var p=l.retryLane;l.retryLane=p!==0&&p<u?p:u}}function Em(l,u){v0(l,u),(l=l.alternate)&&v0(l,u)}function w0(l){if(l.tag===13||l.tag===31){var u=Di(l,67108864);u!==null&&Rs(u,l,67108864),Em(l,67108864)}}function k0(l){if(l.tag===13||l.tag===31){var u=Ks();u=Ct(u);var p=Di(l,u);p!==null&&Rs(p,l,u),Em(l,u)}}var Fd=!0;function SE(l,u,p,g){var w=z.T;z.T=null;var C=W.p;try{W.p=2,Mm(l,u,p,g)}finally{W.p=C,z.T=w}}function CE(l,u,p,g){var w=z.T;z.T=null;var C=W.p;try{W.p=8,Mm(l,u,p,g)}finally{W.p=C,z.T=w}}function Mm(l,u,p,g){if(Fd){var w=Dm(g);if(w===null)bm(l,u,g,zd,p),C0(l,g);else if(jE(w,l,u,p,g))g.stopPropagation();else if(C0(l,g),u&4&&-1<AE.indexOf(l)){for(;w!==null;){var C=Et(w);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var I=et(C.pendingLanes);if(I!==0){var G=C;for(G.pendingLanes|=2,G.entangledLanes|=2;I;){var re=1<<31-pe(I);G.entanglements[1]|=re,I&=~re}Ha(C),(pn&6)===0&&(kd=ot()+500,yc(0))}}break;case 31:case 13:G=Di(C,2),G!==null&&Rs(G,C,2),Cd(),Em(C,2)}if(C=Dm(g),C===null&&bm(l,u,g,zd,p),C===w)break;w=C}w!==null&&g.stopPropagation()}else bm(l,u,g,null,p)}}function Dm(l){return l=zl(l),Rm(l)}var zd=null;function Rm(l){if(zd=null,l=ms(l),l!==null){var u=r(l);if(u===null)l=null;else{var p=u.tag;if(p===13){if(l=i(u),l!==null)return l;l=null}else if(p===31){if(l=c(u),l!==null)return l;l=null}else if(p===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;l=null}else u!==l&&(l=null)}}return zd=l,null}function S0(l){switch(l){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(ce()){case J:return 2;case ae:return 8;case Se:case ee:return 32;case ge:return 268435456;default:return 32}default:return 32}}var Om=!1,ci=null,ui=null,di=null,jc=new Map,Nc=new Map,fi=[],AE="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 C0(l,u){switch(l){case"focusin":case"focusout":ci=null;break;case"dragenter":case"dragleave":ui=null;break;case"mouseover":case"mouseout":di=null;break;case"pointerover":case"pointerout":jc.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nc.delete(u.pointerId)}}function Tc(l,u,p,g,w,C){return l===null||l.nativeEvent!==C?(l={blockedOn:u,domEventName:p,eventSystemFlags:g,nativeEvent:C,targetContainers:[w]},u!==null&&(u=Et(u),u!==null&&w0(u)),l):(l.eventSystemFlags|=g,u=l.targetContainers,w!==null&&u.indexOf(w)===-1&&u.push(w),l)}function jE(l,u,p,g,w){switch(u){case"focusin":return ci=Tc(ci,l,u,p,g,w),!0;case"dragenter":return ui=Tc(ui,l,u,p,g,w),!0;case"mouseover":return di=Tc(di,l,u,p,g,w),!0;case"pointerover":var C=w.pointerId;return jc.set(C,Tc(jc.get(C)||null,l,u,p,g,w)),!0;case"gotpointercapture":return C=w.pointerId,Nc.set(C,Tc(Nc.get(C)||null,l,u,p,g,w)),!0}return!1}function A0(l){var u=ms(l.target);if(u!==null){var p=r(u);if(p!==null){if(u=p.tag,u===13){if(u=i(p),u!==null){l.blockedOn=u,gt(l.priority,function(){k0(p)});return}}else if(u===31){if(u=c(p),u!==null){l.blockedOn=u,gt(l.priority,function(){k0(p)});return}}else if(u===3&&p.stateNode.current.memoizedState.isDehydrated){l.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}l.blockedOn=null}function $d(l){if(l.blockedOn!==null)return!1;for(var u=l.targetContainers;0<u.length;){var p=Dm(l.nativeEvent);if(p===null){p=l.nativeEvent;var g=new p.constructor(p.type,p);Fl=g,p.target.dispatchEvent(g),Fl=null}else return u=Et(p),u!==null&&w0(u),l.blockedOn=p,!1;u.shift()}return!0}function j0(l,u,p){$d(l)&&p.delete(u)}function NE(){Om=!1,ci!==null&&$d(ci)&&(ci=null),ui!==null&&$d(ui)&&(ui=null),di!==null&&$d(di)&&(di=null),jc.forEach(j0),Nc.forEach(j0)}function Hd(l,u){l.blockedOn===u&&(l.blockedOn=null,Om||(Om=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,NE)))}var Ud=null;function N0(l){Ud!==l&&(Ud=l,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ud===l&&(Ud=null);for(var u=0;u<l.length;u+=3){var p=l[u],g=l[u+1],w=l[u+2];if(typeof g!="function"){if(Rm(g||p)===null)continue;break}var C=Et(p);C!==null&&(l.splice(u,3),u-=3,Dh(C,{pending:!0,data:w,method:p.method,action:g},g,w))}}))}function Zo(l){function u(re){return Hd(re,l)}ci!==null&&Hd(ci,l),ui!==null&&Hd(ui,l),di!==null&&Hd(di,l),jc.forEach(u),Nc.forEach(u);for(var p=0;p<fi.length;p++){var g=fi[p];g.blockedOn===l&&(g.blockedOn=null)}for(;0<fi.length&&(p=fi[0],p.blockedOn===null);)A0(p),p.blockedOn===null&&fi.shift();if(p=(l.ownerDocument||l).$$reactFormReplay,p!=null)for(g=0;g<p.length;g+=3){var w=p[g],C=p[g+1],I=w[Ft]||null;if(typeof C=="function")I||N0(p);else if(I){var G=null;if(C&&C.hasAttribute("formAction")){if(w=C,I=C[Ft]||null)G=I.formAction;else if(Rm(w)!==null)continue}else G=I.action;typeof G=="function"?p[g+1]=G:(p.splice(g,3),g-=3),N0(p)}}}function T0(){function l(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(I){return w=I})},focusReset:"manual",scroll:"manual"})}function u(){w!==null&&(w(),w=null),g||setTimeout(p,20)}function p(){if(!g&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,w=null;return navigation.addEventListener("navigate",l),navigation.addEventListener("navigatesuccess",u),navigation.addEventListener("navigateerror",u),setTimeout(p,100),function(){g=!0,navigation.removeEventListener("navigate",l),navigation.removeEventListener("navigatesuccess",u),navigation.removeEventListener("navigateerror",u),w!==null&&(w(),w=null)}}}function Lm(l){this._internalRoot=l}Wd.prototype.render=Lm.prototype.render=function(l){var u=this._internalRoot;if(u===null)throw Error(s(409));var p=u.current,g=Ks();y0(p,g,l,u,null,null)},Wd.prototype.unmount=Lm.prototype.unmount=function(){var l=this._internalRoot;if(l!==null){this._internalRoot=null;var u=l.containerInfo;y0(l.current,2,null,l,null,null),Cd(),u[cn]=null}};function Wd(l){this._internalRoot=l}Wd.prototype.unstable_scheduleHydration=function(l){if(l){var u=Vt();l={blockedOn:null,target:l,priority:u};for(var p=0;p<fi.length&&u!==0&&u<fi[p].priority;p++);fi.splice(p,0,l),p===0&&A0(l)}};var _0=e.version;if(_0!=="19.2.4")throw Error(s(527,_0,"19.2.4"));W.findDOMNode=function(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(s(188)):(l=Object.keys(l).join(","),Error(s(268,l)));return l=f(u),l=l!==null?h(l):null,l=l===null?null:l.stateNode,l};var TE={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qd.isDisabled&&qd.supportsFiber)try{oe=qd.inject(TE),Le=qd}catch{}}return Ec.createRoot=function(l,u){if(!a(l))throw Error(s(299));var p=!1,g="",w=Pv,C=Iv,I=Bv;return u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(w=u.onUncaughtError),u.onCaughtError!==void 0&&(C=u.onCaughtError),u.onRecoverableError!==void 0&&(I=u.onRecoverableError)),u=b0(l,1,!1,null,null,p,g,null,w,C,I,T0),l[cn]=u.current,gm(l),new Lm(u)},Ec.hydrateRoot=function(l,u,p){if(!a(l))throw Error(s(299));var g=!1,w="",C=Pv,I=Iv,G=Bv,re=null;return p!=null&&(p.unstable_strictMode===!0&&(g=!0),p.identifierPrefix!==void 0&&(w=p.identifierPrefix),p.onUncaughtError!==void 0&&(C=p.onUncaughtError),p.onCaughtError!==void 0&&(I=p.onCaughtError),p.onRecoverableError!==void 0&&(G=p.onRecoverableError),p.formState!==void 0&&(re=p.formState)),u=b0(l,1,!0,u,p??null,g,w,re,C,I,G,T0),u.context=x0(null),p=u.current,g=Ks(),g=Ct(g),w=Xr(g),w.callback=null,Jr(p,w,g),p=g,u.current.lanes=p,_e(u,p),Ha(u),l[cn]=u.current,gm(l),new Wd(u)},Ec.version="19.2.4",Ec}var z0;function CM(){if(z0)return Bm.exports;z0=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(e){console.error(e)}}return t(),Bm.exports=SM(),Bm.exports}var AM=CM();const It=t=>typeof t=="string",Mc=()=>{let t,e;const n=new Promise((s,a)=>{t=s,e=a});return n.resolve=t,n.reject=e,n},$0=t=>t==null?"":String(t),jM=(t,e,n)=>{t.forEach(s=>{e[s]&&(n[s]=e[s])})},NM=/###/g,H0=t=>t&&t.includes("###")?t.replace(NM,"."):t,U0=t=>!t||It(t),su=(t,e,n)=>{const s=It(e)?e.split("."):e;let a=0;for(;a<s.length-1;){if(U0(t))return{};const r=H0(s[a]);!t[r]&&n&&(t[r]=new n),Object.prototype.hasOwnProperty.call(t,r)?t=t[r]:t={},++a}return U0(t)?{}:{obj:t,k:H0(s[a])}},W0=(t,e,n)=>{const{obj:s,k:a}=su(t,e,Object);if(s!==void 0||e.length===1){s[a]=n;return}let r=e[e.length-1],i=e.slice(0,e.length-1),c=su(t,i,Object);for(;c.obj===void 0&&i.length;)r=`${i[i.length-1]}.${r}`,i=i.slice(0,i.length-1),c=su(t,i,Object),c!=null&&c.obj&&typeof c.obj[`${c.k}.${r}`]<"u"&&(c.obj=void 0);c.obj[`${c.k}.${r}`]=n},TM=(t,e,n,s)=>{const{obj:a,k:r}=su(t,e,Object);a[r]=a[r]||[],a[r].push(n)},Lf=(t,e)=>{const{obj:n,k:s}=su(t,e);if(n&&Object.prototype.hasOwnProperty.call(n,s))return n[s]},_M=(t,e,n)=>{const s=Lf(t,n);return s!==void 0?s:Lf(e,n)},VA=(t,e,n)=>{for(const s in e)s!=="__proto__"&&s!=="constructor"&&(s in t?It(t[s])||t[s]instanceof String||It(e[s])||e[s]instanceof String?n&&(t[s]=e[s]):VA(t[s],e[s],n):t[s]=e[s]);return t},qi=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),EM={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},MM=t=>It(t)?t.replace(/[&<>"'\/]/g,e=>EM[e]):t;class DM{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const n=this.regExpMap.get(e);if(n!==void 0)return n;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}const RM=[" ",",","?","!",";"],OM=new DM(20),LM=(t,e,n)=>{e=e||"",n=n||"";const s=RM.filter(i=>!e.includes(i)&&!n.includes(i));if(s.length===0)return!0;const a=OM.getRegExp(`(${s.map(i=>i==="?"?"\\?":i).join("|")})`);let r=!a.test(t);if(!r){const i=t.indexOf(n);i>0&&!a.test(t.substring(0,i))&&(r=!0)}return r},ab=(t,e,n=".")=>{if(!t)return;if(t[e])return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;const s=e.split(n);let a=t;for(let r=0;r<s.length;){if(!a||typeof a!="object")return;let i,c="";for(let d=r;d<s.length;++d)if(d!==r&&(c+=n),c+=s[d],i=a[c],i!==void 0){if(["string","number","boolean"].includes(typeof i)&&d<s.length-1)continue;r+=d-r+1;break}a=i}return a},gu=t=>t==null?void 0:t.replace(/_/g,"-"),PM={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){var n,s;(s=(n=console==null?void 0:console[t])==null?void 0:n.apply)==null||s.call(n,console,e)}};class Pf{constructor(e,n={}){this.init(e,n)}init(e,n={}){this.prefix=n.prefix||"i18next:",this.logger=e||PM,this.options=n,this.debug=n.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,n,s,a){return a&&!this.debug?null:(It(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[n](e))}create(e){return new Pf(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Pf(this.logger,e)}}var Ya=new Pf;class mp{constructor(){this.observers={}}on(e,n){return e.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const a=this.observers[s].get(n)||0;this.observers[s].set(n,a+1)}),this}off(e,n){if(this.observers[e]){if(!n){delete this.observers[e];return}this.observers[e].delete(n)}}once(e,n){const s=(...a)=>{n(...a),this.off(e,s)};return this.on(e,s),this}emit(e,...n){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([a,r])=>{for(let i=0;i<r;i++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,r])=>{for(let i=0;i<r;i++)a(e,...n)})}}class q0 extends mp{constructor(e,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){const n=this.options.ns.indexOf(e);n>-1&&this.options.ns.splice(n,1)}getResource(e,n,s,a={}){var f,h;const r=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let c;e.includes(".")?c=e.split("."):(c=[e,n],s&&(Array.isArray(s)?c.push(...s):It(s)&&r?c.push(...s.split(r)):c.push(s)));const d=Lf(this.data,c);return!d&&!n&&!s&&e.includes(".")&&(e=c[0],n=c[1],s=c.slice(2).join(".")),d||!i||!It(s)?d:ab((h=(f=this.data)==null?void 0:f[e])==null?void 0:h[n],s,r)}addResource(e,n,s,a,r={silent:!1}){const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let c=[e,n];s&&(c=c.concat(i?s.split(i):s)),e.includes(".")&&(c=e.split("."),a=n,n=c[1]),this.addNamespaces(n),W0(this.data,c,a),r.silent||this.emit("added",e,n,s,a)}addResources(e,n,s,a={silent:!1}){for(const r in s)(It(s[r])||Array.isArray(s[r]))&&this.addResource(e,n,r,s[r],{silent:!0});a.silent||this.emit("added",e,n,s)}addResourceBundle(e,n,s,a,r,i={silent:!1,skipCopy:!1}){let c=[e,n];e.includes(".")&&(c=e.split("."),a=s,s=n,n=c[1]),this.addNamespaces(n);let d=Lf(this.data,c)||{};i.skipCopy||(s=JSON.parse(JSON.stringify(s))),a?VA(d,s,r):d={...d,...s},W0(this.data,c,d),i.silent||this.emit("added",e,n,s)}removeResourceBundle(e,n){this.hasResourceBundle(e,n)&&delete this.data[e][n],this.removeNamespaces(n),this.emit("removed",e,n)}hasResourceBundle(e,n){return this.getResource(e,n)!==void 0}getResourceBundle(e,n){return n||(n=this.options.defaultNS),this.getResource(e,n)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const n=this.getDataByLanguage(e);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var GA={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,n,s,a){return t.forEach(r=>{var i;e=((i=this.processors[r])==null?void 0:i.process(e,n,s,a))??e}),e}};const YA=Symbol("i18next/PATH_KEY");function IM(){const t=[],e=Object.create(null);let n;return e.get=(s,a)=>{var r;return(r=n==null?void 0:n.revoke)==null||r.call(n),a===YA?t:(t.push(a),n=Proxy.revocable(s,e),n.proxy)},Proxy.revocable(Object.create(null),e).proxy}function hl(t,e){const{[YA]:n}=t(IM()),s=(e==null?void 0:e.keySeparator)??".",a=(e==null?void 0:e.nsSeparator)??":";if(n.length>1&&a){const r=e==null?void 0:e.ns,i=Array.isArray(r)?r:null;if(i&&i.length>1&&i.slice(1).includes(n[0]))return`${n[0]}${a}${n.slice(1).join(s)}`}return n.join(s)}const $m=t=>!It(t)&&typeof t!="boolean"&&typeof t!="number";class If extends mp{constructor(e,n={}){super(),jM(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ya.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,n={interpolation:{}}){const s={...n};if(e==null)return!1;const a=this.resolve(e,s);if((a==null?void 0:a.res)===void 0)return!1;const r=$m(a.res);return!(s.returnObjects===!1&&r)}extractFromKey(e,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let r=n.ns||this.options.defaultNS||[];const i=s&&e.includes(s),c=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!LM(e,s,a);if(i&&!c){const d=e.match(this.interpolator.nestingRegexp);if(d&&d.length>0)return{key:e,namespaces:It(r)?[r]:r};const f=e.split(s);(s!==a||s===a&&this.options.ns.includes(f[0]))&&(r=f.shift()),e=f.join(a)}return{key:e,namespaces:It(r)?[r]:r}}translate(e,n,s){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),e==null)return"";typeof e=="function"&&(e=hl(e,{...this.options,...a})),Array.isArray(e)||(e=[String(e)]),e=e.map($=>typeof $=="function"?hl($,{...this.options,...a}):String($));const r=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:c,namespaces:d}=this.extractFromKey(e[e.length-1],a),f=d[d.length-1];let h=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const m=a.lng||this.language,x=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((m==null?void 0:m.toLowerCase())==="cimode")return x?r?{res:`${f}${h}${c}`,usedKey:c,exactUsedKey:c,usedLng:m,usedNS:f,usedParams:this.getUsedParamsDetails(a)}:`${f}${h}${c}`:r?{res:c,usedKey:c,exactUsedKey:c,usedLng:m,usedNS:f,usedParams:this.getUsedParamsDetails(a)}:c;const y=this.resolve(e,a);let v=y==null?void 0:y.res;const S=(y==null?void 0:y.usedKey)||c,A=(y==null?void 0:y.exactUsedKey)||c,k=["[object Number]","[object Function]","[object RegExp]"],N=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,j=!this.i18nFormat||this.i18nFormat.handleAsObject,E=a.count!==void 0&&!It(a.count),D=If.hasDefaultValue(a),_=E?this.pluralResolver.getSuffix(m,a.count,a):"",B=a.ordinal&&E?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",O=E&&!a.ordinal&&a.count===0,T=O&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${_}`]||a[`defaultValue${B}`]||a.defaultValue;let M=v;j&&!v&&D&&(M=T);const R=$m(M),F=Object.prototype.toString.apply(M);if(j&&M&&R&&!k.includes(F)&&!(It(N)&&Array.isArray(M))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const $=this.options.returnedObjectHandler?this.options.returnedObjectHandler(S,M,{...a,ns:d}):`key '${c} (${this.language})' returned an object instead of string.`;return r?(y.res=$,y.usedParams=this.getUsedParamsDetails(a),y):$}if(i){const $=Array.isArray(M),U=$?[]:{},L=$?A:S;for(const z in M)if(Object.prototype.hasOwnProperty.call(M,z)){const W=`${L}${i}${z}`;D&&!v?U[z]=this.translate(W,{...a,defaultValue:$m(T)?T[z]:void 0,joinArrays:!1,ns:d}):U[z]=this.translate(W,{...a,joinArrays:!1,ns:d}),U[z]===W&&(U[z]=M[z])}v=U}}else if(j&&It(N)&&Array.isArray(v))v=v.join(N),v&&(v=this.extendTranslation(v,e,a,s));else{let $=!1,U=!1;!this.isValidLookup(v)&&D&&($=!0,v=T),this.isValidLookup(v)||(U=!0,v=c);const z=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:v,W=D&&T!==v&&this.options.updateMissing;if(U||$||W){if(this.logger.log(W?"updateKey":"missingKey",m,f,c,W?T:v),i){const K=this.resolve(c,{...a,keySeparator:!1});K&&K.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let V=[];const Y=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&Y&&Y[0])for(let K=0;K<Y.length;K++)V.push(Y[K]);else this.options.saveMissingTo==="all"?V=this.languageUtils.toResolveHierarchy(a.lng||this.language):V.push(a.lng||this.language);const P=(K,Q,q)=>{var ue;const be=D&&q!==v?q:z;this.options.missingKeyHandler?this.options.missingKeyHandler(K,f,Q,be,W,a):(ue=this.backendConnector)!=null&&ue.saveMissing&&this.backendConnector.saveMissing(K,f,Q,be,W,a),this.emit("missingKey",K,f,Q,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&E?V.forEach(K=>{const Q=this.pluralResolver.getSuffixes(K,a);O&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!Q.includes(`${this.options.pluralSeparator}zero`)&&Q.push(`${this.options.pluralSeparator}zero`),Q.forEach(q=>{P([K],c+q,a[`defaultValue${q}`]||T)})}):P(V,c,T))}v=this.extendTranslation(v,e,a,y,s),U&&v===c&&this.options.appendNamespaceToMissingKey&&(v=`${f}${h}${c}`),(U||$)&&this.options.parseMissingKeyHandler&&(v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}${h}${c}`:c,$?v:void 0,a))}return r?(y.res=v,y.usedParams=this.getUsedParamsDetails(a),y):v}extendTranslation(e,n,s,a,r){var d,f;if((d=this.i18nFormat)!=null&&d.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const h=It(e)&&(((f=s==null?void 0:s.interpolation)==null?void 0:f.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(h){const y=e.match(this.interpolator.nestingRegexp);m=y&&y.length}let x=s.replace&&!It(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(x={...this.options.interpolation.defaultVariables,...x}),e=this.interpolator.interpolate(e,x,s.lng||this.language||a.usedLng,s),h){const y=e.match(this.interpolator.nestingRegexp),v=y&&y.length;m<v&&(s.nest=!1)}!s.lng&&a&&a.res&&(s.lng=this.language||a.usedLng),s.nest!==!1&&(e=this.interpolator.nest(e,(...y)=>(r==null?void 0:r[0])===y[0]&&!s.context?(this.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${n[0]}`),null):this.translate(...y,n),s)),s.interpolation&&this.interpolator.reset()}const i=s.postProcess||this.options.postProcess,c=It(i)?[i]:i;return e!=null&&(c!=null&&c.length)&&s.applyPostProcessor!==!1&&(e=GA.handle(c,e,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,n={}){let s,a,r,i,c;return It(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(d=>typeof d=="function"?hl(d,{...this.options,...n}):d)),e.forEach(d=>{if(this.isValidLookup(s))return;const f=this.extractFromKey(d,n),h=f.key;a=h;let m=f.namespaces;this.options.fallbackNS&&(m=m.concat(this.options.fallbackNS));const x=n.count!==void 0&&!It(n.count),y=x&&!n.ordinal&&n.count===0,v=n.context!==void 0&&(It(n.context)||typeof n.context=="number")&&n.context!=="",S=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(A=>{var k,N;this.isValidLookup(s)||(c=A,!this.checkedLoadedFor[`${S[0]}-${A}`]&&((k=this.utils)!=null&&k.hasLoadedNamespace)&&!((N=this.utils)!=null&&N.hasLoadedNamespace(c))&&(this.checkedLoadedFor[`${S[0]}-${A}`]=!0,this.logger.warn(`key "${a}" for languages "${S.join(", ")}" won't get resolved as namespace "${c}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),S.forEach(j=>{var _;if(this.isValidLookup(s))return;i=j;const E=[h];if((_=this.i18nFormat)!=null&&_.addLookupKeys)this.i18nFormat.addLookupKeys(E,h,j,A,n);else{let B;x&&(B=this.pluralResolver.getSuffix(j,n.count,n));const O=`${this.options.pluralSeparator}zero`,T=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(x&&(n.ordinal&&B.startsWith(T)&&E.push(h+B.replace(T,this.options.pluralSeparator)),E.push(h+B),y&&E.push(h+O)),v){const M=`${h}${this.options.contextSeparator||"_"}${n.context}`;E.push(M),x&&(n.ordinal&&B.startsWith(T)&&E.push(M+B.replace(T,this.options.pluralSeparator)),E.push(M+B),y&&E.push(M+O))}}let D;for(;D=E.pop();)this.isValidLookup(s)||(r=D,s=this.getResource(j,A,D,n))}))})}),{res:s,usedKey:a,exactUsedKey:r,usedLng:i,usedNS:c}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,n,s,a={}){var r;return(r=this.i18nFormat)!=null&&r.getResource?this.i18nFormat.getResource(e,n,s,a):this.resourceStore.getResource(e,n,s,a)}getUsedParamsDetails(e={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!It(e.replace);let a=s?e.replace:e;if(s&&typeof e.count<"u"&&(a.count=e.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!s){a={...a};for(const r of n)delete a[r]}return a}static hasDefaultValue(e){const n="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&s.startsWith(n)&&e[s]!==void 0)return!0;return!1}}class V0{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ya.create("languageUtils")}getScriptPartFromCode(e){if(e=gu(e),!e||!e.includes("-"))return null;const n=e.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(e){if(e=gu(e),!e||!e.includes("-"))return e;const n=e.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(e){if(It(e)&&e.includes("-")){let n;try{n=Intl.getCanonicalLocales(e)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let n;return e.forEach(s=>{if(n)return;const a=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&e.forEach(s=>{if(n)return;const a=this.getScriptPartFromCode(s);if(this.isSupportedCode(a))return n=a;const r=this.getLanguagePartFromCode(s);if(this.isSupportedCode(r))return n=r;n=this.options.supportedLngs.find(i=>i===r?!0:!i.includes("-")&&!r.includes("-")?!1:!!(i.includes("-")&&!r.includes("-")&&i.slice(0,i.indexOf("-"))===r||i.startsWith(r)&&r.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(e,n){if(!e)return[];if(typeof e=="function"&&(e=e(n)),It(e)&&(e=[e]),Array.isArray(e))return e;if(!n)return e.default||[];let s=e[n];return s||(s=e[this.getScriptPartFromCode(n)]),s||(s=e[this.formatLanguageCode(n)]),s||(s=e[this.getLanguagePartFromCode(n)]),s||(s=e.default),s||[]}toResolveHierarchy(e,n){const s=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],e),a=[],r=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return It(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&r(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&r(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&r(this.getLanguagePartFromCode(e))):It(e)&&r(this.formatLanguageCode(e)),s.forEach(i=>{a.includes(i)||r(this.formatLanguageCode(i))}),a}}const G0={zero:0,one:1,two:2,few:3,many:4,other:5},Y0={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class BM{constructor(e,n={}){this.languageUtils=e,this.options=n,this.logger=Ya.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,n={}){const s=gu(e==="dev"?"en":e),a=n.ordinal?"ordinal":"cardinal",r=JSON.stringify({cleanedCode:s,type:a});if(r in this.pluralRulesCache)return this.pluralRulesCache[r];let i;try{i=new Intl.PluralRules(s,{type:a})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),Y0;if(!e.match(/-|_/))return Y0;const d=this.languageUtils.getLanguagePartFromCode(e);i=this.getRule(d,n)}return this.pluralRulesCache[r]=i,i}needsPlural(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),(s==null?void 0:s.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,n,s={}){return this.getSuffixes(e,s).map(a=>`${n}${a}`)}getSuffixes(e,n={}){let s=this.getRule(e,n);return s||(s=this.getRule("dev",n)),s?s.resolvedOptions().pluralCategories.sort((a,r)=>G0[a]-G0[r]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(e,n,s={}){const a=this.getRule(e,s);return a?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",n,s))}}const K0=(t,e,n,s=".",a=!0)=>{let r=_M(t,e,n);return!r&&a&&It(n)&&(r=ab(t,n,s),r===void 0&&(r=ab(e,n,s))),r},Hm=t=>t.replace(/\$/g,"$$$$");class Q0{constructor(e={}){var n;this.logger=Ya.create("interpolator"),this.options=e,this.format=((n=e==null?void 0:e.interpolation)==null?void 0:n.format)||(s=>s),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:n,escapeValue:s,useRawValueToEscape:a,prefix:r,prefixEscaped:i,suffix:c,suffixEscaped:d,formatSeparator:f,unescapeSuffix:h,unescapePrefix:m,nestingPrefix:x,nestingPrefixEscaped:y,nestingSuffix:v,nestingSuffixEscaped:S,nestingOptionsSeparator:A,maxReplaces:k,alwaysFormat:N}=e.interpolation;this.escape=n!==void 0?n:MM,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=r?qi(r):i||"{{",this.suffix=c?qi(c):d||"}}",this.formatSeparator=f||",",this.unescapePrefix=h?"":m||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=x?qi(x):y||qi("$t("),this.nestingSuffix=v?qi(v):S||qi(")"),this.nestingOptionsSeparator=A||",",this.maxReplaces=k||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(n,s)=>(n==null?void 0:n.source)===s?(n.lastIndex=0,n):new RegExp(s,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,n,s,a){var y;let r,i,c;const d=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},f=v=>{if(!v.includes(this.formatSeparator)){const N=K0(n,d,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(N,void 0,s,{...a,...n,interpolationkey:v}):N}const S=v.split(this.formatSeparator),A=S.shift().trim(),k=S.join(this.formatSeparator).trim();return this.format(K0(n,d,A,this.options.keySeparator,this.options.ignoreJSONStructure),k,s,{...a,...n,interpolationkey:A})};this.resetRegExp();const h=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,m=((y=a==null?void 0:a.interpolation)==null?void 0:y.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:v=>Hm(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?Hm(this.escape(v)):Hm(v)}].forEach(v=>{for(c=0;r=v.regex.exec(e);){const S=r[1].trim();if(i=f(S),i===void 0)if(typeof h=="function"){const k=h(e,r,a);i=It(k)?k:""}else if(a&&Object.prototype.hasOwnProperty.call(a,S))i="";else if(m){i=r[0];continue}else this.logger.warn(`missed to pass in variable ${S} for interpolating ${e}`),i="";else!It(i)&&!this.useRawValueToEscape&&(i=$0(i));const A=v.safeValue(i);if(e=e.replace(r[0],A),m?(v.regex.lastIndex+=i.length,v.regex.lastIndex-=r[0].length):v.regex.lastIndex=0,c++,c>=this.maxReplaces)break}}),e}nest(e,n,s={}){let a,r,i;const c=(d,f)=>{const h=this.nestingOptionsSeparator;if(!d.includes(h))return d;const m=d.split(new RegExp(`${qi(h)}[ ]*{`));let x=`{${m[1]}`;d=m[0],x=this.interpolate(x,i);const y=x.match(/'/g),v=x.match(/"/g);(((y==null?void 0:y.length)??0)%2===0&&!v||((v==null?void 0:v.length)??0)%2!==0)&&(x=x.replace(/'/g,'"'));try{i=JSON.parse(x),f&&(i={...f,...i})}catch(S){return this.logger.warn(`failed parsing options string in nesting for key ${d}`,S),`${d}${h}${x}`}return i.defaultValue&&i.defaultValue.includes(this.prefix)&&delete i.defaultValue,d};for(;a=this.nestingRegexp.exec(e);){let d=[];i={...s},i=i.replace&&!It(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const f=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(f!==-1&&(d=a[1].slice(f).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),a[1]=a[1].slice(0,f)),r=n(c.call(this,a[1].trim(),i),i),r&&a[0]===e&&!It(r))return r;It(r)||(r=$0(r)),r||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`),r=""),d.length&&(r=d.reduce((h,m)=>this.format(h,m,s.lng,{...s,interpolationkey:a[1].trim()}),r.trim())),e=e.replace(a[0],r),this.regexp.lastIndex=0}return e}}const FM=t=>{let e=t.toLowerCase().trim();const n={};if(t.includes("(")){const s=t.split("(");e=s[0].toLowerCase().trim();const a=s[1].slice(0,-1);e==="currency"&&!a.includes(":")?n.currency||(n.currency=a.trim()):e==="relativetime"&&!a.includes(":")?n.range||(n.range=a.trim()):a.split(";").forEach(i=>{if(i){const[c,...d]=i.split(":"),f=d.join(":").trim().replace(/^'+|'+$/g,""),h=c.trim();n[h]||(n[h]=f),f==="false"&&(n[h]=!1),f==="true"&&(n[h]=!0),isNaN(f)||(n[h]=parseInt(f,10))}})}return{formatName:e,formatOptions:n}},X0=t=>{const e={};return(n,s,a)=>{let r=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(r={...r,[a.interpolationkey]:void 0});const i=s+JSON.stringify(r);let c=e[i];return c||(c=t(gu(s),a),e[i]=c),c(n)}},zM=t=>(e,n,s)=>t(gu(n),s)(e);class $M{constructor(e={}){this.logger=Ya.create("formatter"),this.options=e,this.init(e)}init(e,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const s=n.cacheInBuiltFormats?X0:zM;this.formats={number:s((a,r)=>{const i=new Intl.NumberFormat(a,{...r});return c=>i.format(c)}),currency:s((a,r)=>{const i=new Intl.NumberFormat(a,{...r,style:"currency"});return c=>i.format(c)}),datetime:s((a,r)=>{const i=new Intl.DateTimeFormat(a,{...r});return c=>i.format(c)}),relativetime:s((a,r)=>{const i=new Intl.RelativeTimeFormat(a,{...r});return c=>i.format(c,r.range||"day")}),list:s((a,r)=>{const i=new Intl.ListFormat(a,{...r});return c=>i.format(c)})}}add(e,n){this.formats[e.toLowerCase().trim()]=n}addCached(e,n){this.formats[e.toLowerCase().trim()]=X0(n)}format(e,n,s,a={}){if(!n||e==null)return e;const r=n.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&!r[0].includes(")")&&r.find(c=>c.includes(")"))){const c=r.findIndex(d=>d.includes(")"));r[0]=[r[0],...r.splice(1,c)].join(this.formatSeparator)}return r.reduce((c,d)=>{var m;const{formatName:f,formatOptions:h}=FM(d);if(this.formats[f]){let x=c;try{const y=((m=a==null?void 0:a.formatParams)==null?void 0:m[a.interpolationkey])||{},v=y.locale||y.lng||a.locale||a.lng||s;x=this.formats[f](c,v,{...h,...a,...y})}catch(y){this.logger.warn(y)}return x}else this.logger.warn(`there was no format function for ${f}`);return c},e)}}const HM=(t,e)=>{t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)};class UM extends mp{constructor(e,n,s,a={}){var r,i;super(),this.backend=e,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=a,this.logger=Ya.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(i=(r=this.backend)==null?void 0:r.init)==null||i.call(r,s,a.backend,a)}queueLoad(e,n,s,a){const r={},i={},c={},d={};return e.forEach(f=>{let h=!0;n.forEach(m=>{const x=`${f}|${m}`;!s.reload&&this.store.hasResourceBundle(f,m)?this.state[x]=2:this.state[x]<0||(this.state[x]===1?i[x]===void 0&&(i[x]=!0):(this.state[x]=1,h=!1,i[x]===void 0&&(i[x]=!0),r[x]===void 0&&(r[x]=!0),d[m]===void 0&&(d[m]=!0)))}),h||(c[f]=!0)}),(Object.keys(r).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(r),pending:Object.keys(i),toLoadLanguages:Object.keys(c),toLoadNamespaces:Object.keys(d)}}loaded(e,n,s){const a=e.split("|"),r=a[0],i=a[1];n&&this.emit("failedLoading",r,i,n),!n&&s&&this.store.addResourceBundle(r,i,s,void 0,void 0,{skipCopy:!0}),this.state[e]=n?-1:2,n&&s&&(this.state[e]=0);const c={};this.queue.forEach(d=>{TM(d.loaded,[r],i),HM(d,e),n&&d.errors.push(n),d.pendingCount===0&&!d.done&&(Object.keys(d.loaded).forEach(f=>{c[f]||(c[f]={});const h=d.loaded[f];h.length&&h.forEach(m=>{c[f][m]===void 0&&(c[f][m]=!0)})}),d.done=!0,d.errors.length?d.callback(d.errors):d.callback())}),this.emit("loaded",c),this.queue=this.queue.filter(d=>!d.done)}read(e,n,s,a=0,r=this.retryTimeout,i){if(!e.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:n,fcName:s,tried:a,wait:r,callback:i});return}this.readingCalls++;const c=(f,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const m=this.waitingReads.shift();this.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(f&&h&&a<this.maxRetries){setTimeout(()=>{this.read(e,n,s,a+1,r*2,i)},r);return}i(f,h)},d=this.backend[s].bind(this.backend);if(d.length===2){try{const f=d(e,n);f&&typeof f.then=="function"?f.then(h=>c(null,h)).catch(c):c(null,f)}catch(f){c(f)}return}return d(e,n,c)}prepareLoading(e,n,s={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();It(e)&&(e=this.languageUtils.toResolveHierarchy(e)),It(n)&&(n=[n]);const r=this.queueLoad(e,n,s,a);if(!r.toLoad.length)return r.pending.length||a(),null;r.toLoad.forEach(i=>{this.loadOne(i)})}load(e,n,s){this.prepareLoading(e,n,{},s)}reload(e,n,s){this.prepareLoading(e,n,{reload:!0},s)}loadOne(e,n=""){const s=e.split("|"),a=s[0],r=s[1];this.read(a,r,"read",void 0,void 0,(i,c)=>{i&&this.logger.warn(`${n}loading namespace ${r} for language ${a} failed`,i),!i&&c&&this.logger.log(`${n}loaded namespace ${r} for language ${a}`,c),this.loaded(e,i,c)})}saveMissing(e,n,s,a,r,i={},c=()=>{}){var d,f,h,m,x;if((f=(d=this.services)==null?void 0:d.utils)!=null&&f.hasLoadedNamespace&&!((m=(h=this.services)==null?void 0:h.utils)!=null&&m.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${s}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(s==null||s==="")){if((x=this.backend)!=null&&x.create){const y={...i,isUpdate:r},v=this.backend.create.bind(this.backend);if(v.length<6)try{let S;v.length===5?S=v(e,n,s,a,y):S=v(e,n,s,a),S&&typeof S.then=="function"?S.then(A=>c(null,A)).catch(c):c(null,S)}catch(S){c(S)}else v(e,n,s,a,c,y)}!e||!e[0]||this.store.addResource(e[0],n,s,a)}}}const Um=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let e={};if(typeof t[1]=="object"&&(e=t[1]),It(t[1])&&(e.defaultValue=t[1]),It(t[2])&&(e.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const n=t[3]||t[2];Object.keys(n).forEach(s=>{e[s]=n[s]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),J0=t=>(It(t.ns)&&(t.ns=[t.ns]),It(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),It(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&!t.supportedLngs.includes("cimode")&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t),Vd=()=>{},WM=t=>{Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(n=>{typeof t[n]=="function"&&(t[n]=t[n].bind(t))})};class au extends mp{constructor(e={},n){if(super(),this.options=J0(e),this.services={},this.logger=Ya,this.modules={external:[]},WM(this),n&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,n),this;setTimeout(()=>{this.init(e,n)},0)}}init(e={},n){this.isInitializing=!0,typeof e=="function"&&(n=e,e={}),e.defaultNS==null&&e.ns&&(It(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const s=Um();this.options={...s,...this.options,...J0(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler);const a=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?Ya.init(a(this.modules.logger),this.options):Ya.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:f=$M;const h=new V0(this.options);this.store=new q0(this.options.resources,this.options);const m=this.services;m.logger=Ya,m.resourceStore=this.store,m.languageUtils=h,m.pluralResolver=new BM(h,{prepend:this.options.pluralSeparator}),f&&(m.formatter=a(f),m.formatter.init&&m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new Q0(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new UM(a(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",(x,...y)=>{this.emit(x,...y)}),this.modules.languageDetector&&(m.languageDetector=a(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=a(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new If(this.services,this.options),this.translator.on("*",(x,...y)=>{this.emit(x,...y)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,n||(n=Vd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=(...h)=>this.store[f](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=(...h)=>(this.store[f](...h),this)});const c=Mc(),d=()=>{const f=(h,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(m),n(h,m)};if(this.languages&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initAsync?d():setTimeout(d,0),c}loadResources(e,n=Vd){var r,i;let s=n;const a=It(e)?e:this.language;if(typeof e=="function"&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const c=[],d=f=>{if(!f||f==="cimode")return;this.services.languageUtils.toResolveHierarchy(f).forEach(m=>{m!=="cimode"&&(c.includes(m)||c.push(m))})};a?d(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>d(h)),(i=(r=this.options.preload)==null?void 0:r.forEach)==null||i.call(r,f=>d(f)),this.services.backendConnector.load(c,this.options.ns,f=>{!f&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(f)})}else s(null)}reloadResources(e,n,s){const a=Mc();return typeof e=="function"&&(s=e,e=void 0),typeof n=="function"&&(s=n,n=void 0),e||(e=this.languages),n||(n=this.options.ns),s||(s=Vd),this.services.backendConnector.reload(e,n,r=>{a.resolve(),s(r)}),a}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&GA.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!["cimode","dev"].includes(s)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,n){this.isLanguageChangingTo=e;const s=Mc();this.emit("languageChanging",e);const a=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},r=(c,d)=>{d?this.isLanguageChangingTo===e&&(a(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,s.resolve((...f)=>this.t(...f)),n&&n(c,(...f)=>this.t(...f))},i=c=>{var h,m;!e&&!c&&this.services.languageDetector&&(c=[]);const d=It(c)?c:c&&c[0],f=this.store.hasLanguageSomeTranslations(d)?d:this.services.languageUtils.getBestMatchFromCodes(It(c)?[c]:c);f&&(this.language||a(f),this.translator.language||this.translator.changeLanguage(f),(m=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||m.call(h,f)),this.loadResources(f,x=>{r(x,f)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(e),s}getFixedT(e,n,s){const a=(r,i,...c)=>{let d;typeof i!="object"?d=this.options.overloadTranslationOptionHandler([r,i].concat(c)):d={...i},d.lng=d.lng||a.lng,d.lngs=d.lngs||a.lngs,d.ns=d.ns||a.ns,d.keyPrefix!==""&&(d.keyPrefix=d.keyPrefix||s||a.keyPrefix);const f={...this.options,...d};typeof d.keyPrefix=="function"&&(d.keyPrefix=hl(d.keyPrefix,f));const h=this.options.keySeparator||".";let m;return d.keyPrefix&&Array.isArray(r)?m=r.map(x=>(typeof x=="function"&&(x=hl(x,f)),`${d.keyPrefix}${h}${x}`)):(typeof r=="function"&&(r=hl(r,f)),m=d.keyPrefix?`${d.keyPrefix}${h}${r}`:r),this.t(m,d)};return It(e)?a.lng=e:a.lngs=e,a.ns=n,a.keyPrefix=s,a}t(...e){var n;return(n=this.translator)==null?void 0:n.translate(...e)}exists(...e){var n;return(n=this.translator)==null?void 0:n.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,r=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const i=(c,d)=>{const f=this.services.backendConnector.state[`${c}|${d}`];return f===-1||f===0||f===2};if(n.precheck){const c=n.precheck(this,i);if(c!==void 0)return c}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(s,e)&&(!a||i(r,e)))}loadNamespaces(e,n){const s=Mc();return this.options.ns?(It(e)&&(e=[e]),e.forEach(a=>{this.options.ns.includes(a)||this.options.ns.push(a)}),this.loadResources(a=>{s.resolve(),n&&n(a)}),s):(n&&n(),Promise.resolve())}loadLanguages(e,n){const s=Mc();It(e)&&(e=[e]);const a=this.options.preload||[],r=e.filter(i=>!a.includes(i)&&this.services.languageUtils.isSupportedCode(i));return r.length?(this.options.preload=a.concat(r),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}dir(e){var a,r;if(e||(e=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const i=new Intl.Locale(e);if(i&&i.getTextInfo){const c=i.getTextInfo();if(c&&c.direction)return c.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],s=((r=this.services)==null?void 0:r.languageUtils)||new V0(Um());return e.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(s.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},n){const s=new au(e,n);return s.createInstance=au.createInstance,s}cloneInstance(e={},n=Vd){const s=e.forkResourceStore;s&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},r=new au(a);if((e.debug!==void 0||e.prefix!==void 0)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(c=>{r[c]=this[c]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s){const c=Object.keys(this.store.data).reduce((d,f)=>(d[f]={...this.store.data[f]},d[f]=Object.keys(d[f]).reduce((h,m)=>(h[m]={...d[f][m]},h),d[f]),d),{});r.store=new q0(c,a),r.services.resourceStore=r.store}if(e.interpolation){const d={...Um().interpolation,...this.options.interpolation,...e.interpolation},f={...a,interpolation:d};r.services.interpolator=new Q0(f)}return r.translator=new If(r.services,a),r.translator.on("*",(c,...d)=>{r.emit(c,...d)}),r.init(a,n),r.translator.options=a,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Tn=au.createInstance();Tn.createInstance;Tn.dir;Tn.init;Tn.loadResources;Tn.reloadResources;Tn.use;Tn.changeLanguage;Tn.getFixedT;Tn.t;Tn.exists;Tn.setDefaultNamespace;Tn.hasLoadedNamespace;Tn.loadNamespaces;Tn.loadLanguages;const qM=(t,e,n,s)=>{var r,i,c,d;const a=[n,{code:e,...s||{}}];if((i=(r=t==null?void 0:t.services)==null?void 0:r.logger)!=null&&i.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);io(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(d=(c=t==null?void 0:t.services)==null?void 0:c.logger)!=null&&d.warn?t.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Z0={},rb=(t,e,n,s)=>{io(n)&&Z0[n]||(io(n)&&(Z0[n]=new Date),qM(t,e,n,s))},KA=(t,e)=>()=>{if(t.isInitialized)e();else{const n=()=>{setTimeout(()=>{t.off("initialized",n)},0),e()};t.on("initialized",n)}},ib=(t,e,n)=>{t.loadNamespaces(e,KA(t,n))},ek=(t,e,n,s)=>{if(io(n)&&(n=[n]),t.options.preload&&t.options.preload.indexOf(e)>-1)return ib(t,n,s);n.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,KA(t,s))},VM=(t,e,n={})=>!e.languages||!e.languages.length?(rb(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:n.lng,precheck:(s,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!a(s.isLanguageChangingTo,t))return!1}}),io=t=>typeof t=="string",GM=t=>typeof t=="object"&&t!==null,YM=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,KM={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},QM=t=>KM[t],XM=t=>t.replace(YM,QM);let ob={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:XM,transDefaultProps:void 0};const JM=(t={})=>{ob={...ob,...t}},ZM=()=>ob;let QA;const eD=t=>{QA=t},tD=()=>QA,nD={type:"3rdParty",init(t){JM(t.options.react),eD(t)}},sD=b.createContext();class aD{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var Wm={exports:{}},qm={};/**
|
|
35
|
+
* @license React
|
|
36
|
+
* use-sync-external-store-shim.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var tk;function rD(){if(tk)return qm;tk=1;var t=qb();function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,r=t.useLayoutEffect,i=t.useDebugValue;function c(m,x){var y=x(),v=s({inst:{value:y,getSnapshot:x}}),S=v[0].inst,A=v[1];return r(function(){S.value=y,S.getSnapshot=x,d(S)&&A({inst:S})},[m,y,x]),a(function(){return d(S)&&A({inst:S}),m(function(){d(S)&&A({inst:S})})},[m]),i(y),y}function d(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}catch{return!0}}function f(m,x){return x()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return qm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,qm}var nk;function iD(){return nk||(nk=1,Wm.exports=rD()),Wm.exports}var oD=iD();const lD=(t,e)=>{if(io(e))return e;if(GM(e)&&io(e.defaultValue))return e.defaultValue;if(typeof t=="function")return"";if(Array.isArray(t)){const n=t[t.length-1];return typeof n=="function"?"":n}return t},cD={t:lD,ready:!1},uD=()=>()=>{},ht=(t,e={})=>{var T,M,R;const{i18n:n}=e,{i18n:s,defaultNS:a}=b.useContext(sD)||{},r=n||s||tD();r&&!r.reportNamespaces&&(r.reportNamespaces=new aD),r||rb(r,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=b.useMemo(()=>{var F;return{...ZM(),...(F=r==null?void 0:r.options)==null?void 0:F.react,...e}},[r,e]),{useSuspense:c,keyPrefix:d}=i,f=t||a||((T=r==null?void 0:r.options)==null?void 0:T.defaultNS),h=io(f)?[f]:f||["translation"],m=b.useMemo(()=>h,h);(R=(M=r==null?void 0:r.reportNamespaces)==null?void 0:M.addUsedNamespaces)==null||R.call(M,m);const x=b.useRef(0),y=b.useCallback(F=>{if(!r)return uD;const{bindI18n:$,bindI18nStore:U}=i,L=()=>{x.current+=1,F()};return $&&r.on($,L),U&&r.store.on(U,L),()=>{$&&$.split(" ").forEach(z=>r.off(z,L)),U&&U.split(" ").forEach(z=>r.store.off(z,L))}},[r,i]),v=b.useRef(),S=b.useCallback(()=>{if(!r)return cD;const F=!!(r.isInitialized||r.initializedStoreOnce)&&m.every(V=>VM(V,r,i)),$=e.lng||r.language,U=x.current,L=v.current;if(L&&L.ready===F&&L.lng===$&&L.keyPrefix===d&&L.revision===U)return L;const W={t:r.getFixedT($,i.nsMode==="fallback"?m:m[0],d),ready:F,lng:$,keyPrefix:d,revision:U};return v.current=W,W},[r,m,d,i,e.lng]),[A,k]=b.useState(0),{t:N,ready:j}=oD.useSyncExternalStore(y,S,S);b.useEffect(()=>{if(r&&!j&&!c){const F=()=>k($=>$+1);e.lng?ek(r,e.lng,m,F):ib(r,m,F)}},[r,e.lng,m,j,c,A]);const E=r||{},D=b.useRef(null),_=b.useRef(),B=F=>{const $=Object.getOwnPropertyDescriptors(F);$.__original&&delete $.__original;const U=Object.create(Object.getPrototypeOf(F),$);if(!Object.prototype.hasOwnProperty.call(U,"__original"))try{Object.defineProperty(U,"__original",{value:F,writable:!1,enumerable:!1,configurable:!1})}catch{}return U},O=b.useMemo(()=>{const F=E,$=F==null?void 0:F.language;let U=F;F&&(D.current&&D.current.__original===F?_.current!==$?(U=B(F),D.current=U,_.current=$):U=D.current:(U=B(F),D.current=U,_.current=$));const L=!j&&!c?(...W)=>(rb(r,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),N(...W)):N,z=[L,U,j];return z.t=L,z.i18n=U,z.ready=j,z},[N,E,j,E.resolvedLanguage,E.language,E.languages]);if(r&&c&&!j)throw new Promise(F=>{const $=()=>F();e.lng?ek(r,e.lng,m,$):ib(r,m,$)});return O};function lb(t){"@babel/helpers - typeof";return lb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lb(t)}function XA(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":lb(XMLHttpRequest))==="object"}function dD(t){return!!t&&typeof t.then=="function"}function fD(t){return dD(t)?t:Promise.resolve(t)}var pD=/\{\{(.+?)\}\}/g;function sk(t,e){return t.replace(pD,function(n,s){var a=e[s.trim()];return a??n})}const hD="modulepreload",mD=function(t){return"/"+t},ak={},vt=function(e,n,s){let a=Promise.resolve();if(n&&n.length>0){let i=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=i(n.map(f=>{if(f=mD(f),f in ak)return;ak[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":hD,h||(x.as="script"),x.crossOrigin="",x.href=f,d&&x.setAttribute("nonce",d),document.head.appendChild(x),h)return new Promise((y,v)=>{x.addEventListener("load",y),x.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function r(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&r(c.reason);return e().catch(r)})};function rk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function ik(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?rk(Object(n),!0).forEach(function(s){gD(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):rk(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function gD(t,e,n){return(e=bD(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bD(t){var e=xD(t,"string");return oo(e)=="symbol"?e:e+""}function xD(t,e){if(oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(oo(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oo(t){"@babel/helpers - typeof";return oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oo(t)}var ki=typeof fetch=="function"?fetch:void 0;typeof global<"u"&&global.fetch?ki=global.fetch:typeof window<"u"&&window.fetch&&(ki=window.fetch);var bu;XA()&&(typeof global<"u"&&global.XMLHttpRequest?bu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(bu=window.XMLHttpRequest));var Bf;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Bf=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Bf=window.ActiveXObject));typeof ki!="function"&&(ki=void 0);if(!ki&&!bu&&!Bf)try{vt(()=>import("./browser-ponyfill-DZOWXZ4K.js").then(t=>t.b),__vite__mapDeps([0,1])).then(function(t){ki=t.default}).catch(function(){})}catch{}var cb=function(e,n){if(n&&oo(n)==="object"){var s="";for(var a in n)s+="&"+encodeURIComponent(a)+"="+encodeURIComponent(n[a]);if(!s)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+s.slice(1)}return e},ok=function(e,n,s,a){var r=function(d){if(!d.ok)return s(d.statusText||"Error",{status:d.status});d.text().then(function(f){s(null,{status:d.status,data:f})}).catch(s)};if(a){var i=a(e,n);if(i instanceof Promise){i.then(r).catch(s);return}}typeof fetch=="function"?fetch(e,n).then(r).catch(s):ki(e,n).then(r).catch(s)},lk=!1,yD=function(e,n,s,a){e.queryStringParams&&(n=cb(n,e.queryStringParams));var r=ik({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(r["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),s&&(r["Content-Type"]="application/json");var i=typeof e.requestOptions=="function"?e.requestOptions(s):e.requestOptions,c=ik({method:s?"POST":"GET",body:s?e.stringify(s):void 0,headers:r},lk?{}:i),d=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{ok(n,c,a,d)}catch(f){if(!i||Object.keys(i).length===0||!f.message||f.message.indexOf("not implemented")<0)return a(f);try{Object.keys(i).forEach(function(h){delete c[h]}),ok(n,c,a,d),lk=!0}catch(h){a(h)}}},vD=function(e,n,s,a){s&&oo(s)==="object"&&(s=cb("",s).slice(1)),e.queryStringParams&&(n=cb(n,e.queryStringParams));try{var r=bu?new bu:new Bf("MSXML2.XMLHTTP.3.0");r.open(s?"POST":"GET",n,1),e.crossDomain||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=!!e.withCredentials,s&&r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.overrideMimeType&&r.overrideMimeType("application/json");var i=e.customHeaders;if(i=typeof i=="function"?i():i,i)for(var c in i)r.setRequestHeader(c,i[c]);r.onreadystatechange=function(){r.readyState>3&&a(r.status>=400?r.statusText:null,{status:r.status,data:r.responseText})},r.send(s)}catch(d){console&&console.log(d)}},wD=function(e,n,s,a){if(typeof s=="function"&&(a=s,s=void 0),a=a||function(){},ki&&n.indexOf("file:")!==0)return yD(e,n,s,a);if(XA()||typeof ActiveXObject=="function")return vD(e,n,s,a);a(new Error("No fetch and no xhr implementation found!"))};function yl(t){"@babel/helpers - typeof";return yl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yl(t)}function ck(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Vm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ck(Object(n),!0).forEach(function(s){JA(t,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ck(Object(n)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(n,s))})}return t}function kD(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SD(t,e){for(var n=0;n<e.length;n++){var s=e[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,ZA(s.key),s)}}function CD(t,e,n){return e&&SD(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function JA(t,e,n){return(e=ZA(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZA(t){var e=AD(t,"string");return yl(e)=="symbol"?e:e+""}function AD(t,e){if(yl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var s=n.call(t,e);if(yl(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var jD=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,s,a){return JA({},s,a||"")},parseLoadPayload:function(n,s){},request:wD,reloadInterval:typeof window<"u"?!1:3600*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},ej=(function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};kD(this,t),this.services=e,this.options=n,this.allOptions=s,this.type="backend",this.init(e,n,s)}return CD(t,[{key:"init",value:function(n){var s=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Vm(Vm(Vm({},jD()),this.options||{}),a),this.allOptions=r,this.services&&this.options.reloadInterval){var i=setInterval(function(){return s.reload()},this.options.reloadInterval);yl(i)==="object"&&typeof i.unref=="function"&&i.unref()}}},{key:"readMulti",value:function(n,s,a){this._readAny(n,n,s,s,a)}},{key:"read",value:function(n,s,a){this._readAny([n],n,[s],s,a)}},{key:"_readAny",value:function(n,s,a,r,i){var c=this,d=this.options.loadPath;typeof this.options.loadPath=="function"&&(d=this.options.loadPath(n,a)),d=fD(d),d.then(function(f){if(!f)return i(null,{});var h=sk(f,{lng:n.join("+"),ns:a.join("+")});c.loadUrl(h,i,s,r)})}},{key:"loadUrl",value:function(n,s,a,r){var i=this,c=typeof a=="string"?[a]:a,d=typeof r=="string"?[r]:r,f=this.options.parseLoadPayload(c,d);this.options.request(this.options,n,f,function(h,m){if(m&&(m.status>=500&&m.status<600||!m.status))return s("failed loading "+n+"; status code: "+m.status,!0);if(m&&m.status>=400&&m.status<500)return s("failed loading "+n+"; status code: "+m.status,!1);if(!m&&h&&h.message){var x=h.message.toLowerCase(),y=["failed","fetch","network","load"].find(function(A){return x.indexOf(A)>-1});if(y)return s("failed loading "+n+": "+h.message,!0)}if(h)return s(h,!1);var v,S;try{typeof m.data=="string"?v=i.options.parse(m.data,a,r):v=m.data}catch{S="failed parsing "+n+" to json"}if(S)return s(S,!1);s(null,v)})}},{key:"create",value:function(n,s,a,r,i){var c=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var d=this.options.parsePayload(s,a,r),f=0,h=[],m=[];n.forEach(function(x){var y=c.options.addPath;typeof c.options.addPath=="function"&&(y=c.options.addPath(x,s));var v=sk(y,{lng:x,ns:s});c.options.request(c.options,v,d,function(S,A){f+=1,h.push(S),m.push(A),f===n.length&&typeof i=="function"&&i(h,m)})})}}},{key:"reload",value:function(){var n=this,s=this.services,a=s.backendConnector,r=s.languageUtils,i=s.logger,c=a.language;if(!(c&&c.toLowerCase()==="cimode")){var d=[],f=function(m){var x=r.toResolveHierarchy(m);x.forEach(function(y){d.indexOf(y)<0&&d.push(y)})};f(c),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),d.forEach(function(h){n.allOptions.ns.forEach(function(m){a.read(h,m,"read",null,null,function(x,y){x&&i.warn("loading namespace ".concat(m," for language ").concat(h," failed"),x),!x&&y&&i.log("loaded namespace ".concat(m," for language ").concat(h),y),a.loaded("".concat(h,"|").concat(m),x,y)})})})}}}])})();ej.type="backend";const{slice:ND,forEach:TD}=[];function _D(t){return TD.call(ND.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}function ED(t){return typeof t!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(t))}const uk=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,MD=function(t,e){const s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(e);let r=`${t}=${a}`;if(s.maxAge>0){const i=s.maxAge-0;if(Number.isNaN(i))throw new Error("maxAge should be a Number");r+=`; Max-Age=${Math.floor(i)}`}if(s.domain){if(!uk.test(s.domain))throw new TypeError("option domain is invalid");r+=`; Domain=${s.domain}`}if(s.path){if(!uk.test(s.path))throw new TypeError("option path is invalid");r+=`; Path=${s.path}`}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");r+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(r+="; HttpOnly"),s.secure&&(r+="; Secure"),s.sameSite)switch(typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite){case!0:r+="; SameSite=Strict";break;case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return s.partitioned&&(r+="; Partitioned"),r},dk={create(t,e,n,s){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+n*60*1e3)),s&&(a.domain=s),document.cookie=MD(t,e,a)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let s=0;s<n.length;s++){let a=n[s];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(e)===0)return a.substring(e.length,a.length)}return null},remove(t,e){this.create(t,"",-1,e)}};var DD={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return dk.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:s,cookieDomain:a,cookieOptions:r}=e;n&&typeof document<"u"&&dk.create(n,t,s,a,r)}},RD={name:"querystring",lookup(t){var s;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:a}=window.location;!window.location.search&&((s=window.location.hash)==null?void 0:s.indexOf("?"))>-1&&(a=window.location.hash.substring(window.location.hash.indexOf("?")));const i=a.substring(1).split("&");for(let c=0;c<i.length;c++){const d=i[c].indexOf("=");d>0&&i[c].substring(0,d)===e&&(n=i[c].substring(d+1))}}return n}},OD={name:"hash",lookup(t){var a;let{lookupHash:e,lookupFromHashIndex:n}=t,s;if(typeof window<"u"){const{hash:r}=window.location;if(r&&r.length>2){const i=r.substring(1);if(e){const c=i.split("&");for(let d=0;d<c.length;d++){const f=c[d].indexOf("=");f>0&&c[d].substring(0,f)===e&&(s=c[d].substring(f+1))}}if(s)return s;if(!s&&n>-1){const c=r.match(/\/([a-zA-Z-]*)/g);return Array.isArray(c)?(a=c[typeof n=="number"?n:0])==null?void 0:a.replace("/",""):void 0}}}return s}};let el=null;const fk=()=>{if(el!==null)return el;try{if(el=typeof window<"u"&&window.localStorage!==null,!el)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{el=!1}return el};var LD={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&fk())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&fk()&&window.localStorage.setItem(n,t)}};let tl=null;const pk=()=>{if(tl!==null)return tl;try{if(tl=typeof window<"u"&&window.sessionStorage!==null,!tl)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{tl=!1}return tl};var PD={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&pk())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&pk()&&window.sessionStorage.setItem(n,t)}},ID={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:s,language:a}=navigator;if(n)for(let r=0;r<n.length;r++)e.push(n[r]);s&&e.push(s),a&&e.push(a)}return e.length>0?e:void 0}},BD={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const s=e||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(n=s.getAttribute("lang")),n}},FD={name:"path",lookup(t){var a;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(a=n[typeof e=="number"?e:0])==null?void 0:a.replace("/",""):void 0}},zD={name:"subdomain",lookup(t){var a,r;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,s=typeof window<"u"&&((r=(a=window.location)==null?void 0:a.hostname)==null?void 0:r.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(s)return s[n]}};let tj=!1;try{document.cookie,tj=!0}catch{}const nj=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];tj||nj.splice(1,1);const $D=()=>({order:nj,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class sj{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=_D(n,this.options||{},$D()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(DD),this.addDetector(RD),this.addDetector(LD),this.addDetector(PD),this.addDetector(ID),this.addDetector(BD),this.addDetector(FD),this.addDetector(zD),this.addDetector(OD)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(s=>{if(this.detectors[s]){let a=this.detectors[s].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(n=n.concat(a))}}),n=n.filter(s=>s!=null&&!ED(s)).map(s=>this.options.convertDetectedLanguage(s)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(s=>{this.detectors[s]&&this.detectors[s].cacheUserLanguage(e,this.options)}))}}sj.type="languageDetector";const Ff={idle:"#4aff9e",working:"#4a9eff",waiting:"#ff9e4a",waiting_permission:"#ffcc00",error:"#ff4a4a",offline:"#888888",orphaned:"#ff9e4a",default:"#888888"},ub={running:"#4aff9e",stopped:"#888888",error:"#ff4a4a",unknown:"#ffaa00",starting:"#4a9eff",stopping:"#ffaa00"},HD={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888888"},Eq=["#4a9eff","#4aff9e","#ff9e4a","#ff4a9e","#9e4aff","#ff4a4a","#4affff","#ffff4a","#4ad7ff","#00e6a8","#ff6b4a","#ff66cc","#b84aff","#ff4a7a","#00d9ff","#e6ff4a","#1a3a6e","#1a5e3a","#6e3a1a","#6e1a4a","#4a1a6e","#6e1a1a","#1a5e5e","#5e5e1a","#1a4a6e","#145a47","#6e2c1a","#6e1a5e","#3b1a6e","#6e1a33","#14566e","#4f5e1a"],Gd={recent:"#50fa7b",short:"#f1fa8c",medium:"#ffb86c",long:"#ff5555"};function Gb(t){const n=Math.floor((Date.now()-t)/1e3)/60;return n<1?Gd.recent:n<5?Gd.short:n<30?Gd.medium:Gd.long}function Yb(t){return Ff[t]??Ff.default}let kf=null;function aj(){if(!kf)try{kf=globalThis.__i18n}catch{}return kf}function UD(t){kf=t}function WD(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString()}function qD(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t.toString()}function VD(t){var a;const e=aj(),n=(a=e==null?void 0:e.t)==null?void 0:a.bind(e),s=Math.floor((Date.now()-t)/1e3);return s<60?n?n("common:time.seconds",{count:s}):`${s}s`:s<3600?n?n("common:time.minutes",{count:Math.floor(s/60)}):`${Math.floor(s/60)}m`:s<86400?n?n("common:time.hours",{count:Math.floor(s/3600)}):`${Math.floor(s/3600)}h`:n?n("common:time.days",{count:Math.floor(s/86400)}):`${Math.floor(s/86400)}d`}function Kb(t){var f;const e=aj(),n=(f=e==null?void 0:e.t)==null?void 0:f.bind(e),s=Math.floor((Date.now()-t)/1e3);if(s<5)return n?n("common:time.justNow"):"just now";if(s<60)return n?n("common:time.secondsAgo",{count:s}):`${s}s ago`;const a=Math.floor(s/60);if(a<60){const h=s%60;return h>0?n?n("common:time.minutesSecondsAgo",{minutes:a,seconds:h}):`${a}m ${h}s ago`:n?n("common:time.minutesAgo",{count:a}):`${a}m ago`}const r=Math.floor(a/60),i=a%60;if(r<24)return i>0?n?n("common:time.hoursMinutesAgo",{hours:r,minutes:i}):`${r}h ${i}m ago`:n?n("common:time.hoursAgo",{count:r}):`${r}h ago`;const c=Math.floor(r/24),d=r%24;return d>0?n?n("common:time.daysHoursAgo",{days:c,hours:d}):`${c}d ${d}h ago`:n?n("common:time.daysAgo",{count:c}):`${c}d ago`}function ru(t,e){return t?e?t.replace(/\s*\(?\s*~?\$[\d,.]+\s*\)?/g,"").replace(/\s*cost[:\s]+~?\$[\d,.]+/gi,"").replace(/\s*price[:\s]+~?\$[\d,.]+/gi,"").replace(/\s*\(~?\$[\d,.]+\s*(?:USD|cost|spent)?\)/gi,"").replace(/\s*-\s*~?\$[\d,.]+\s*$/g,"").replace(/[^\S\n]+/g," ").trim():t:""}Tn.use(ej).use(sj).use(nD).init({fallbackLng:"en",ns:["common","tools","config","errors","notifications","dashboard","terminal"],defaultNS:"common",backend:{loadPath:"/locales/{{lng}}/{{ns}}.json"},detection:{order:["localStorage","navigator"],lookupLocalStorage:"tide-commander-language",caches:["localStorage"]},interpolation:{escapeValue:!1},react:{useSuspense:!0}}).then(()=>{UD(Tn)});const pt={CONFIG:"tide-commander-config",SHOW_FPS:"tide-show-fps",SETTINGS:"tide-settings",SHORTCUTS:"tide-shortcuts",MOUSE_CONTROLS:"tide-mouse-controls",BACKEND_URL:"tide-backend-url",AUTH_TOKEN:"tide-auth-token",SCENE_VIEW_MODE:"tide-scene-view-mode",CAMERA_STATE:"tide-camera-state",CAMERA_STATE_2D:"tide-camera-state-2d",VIEW_MODE:"guake-view-mode",ADVANCED_VIEW:"guake-advanced-view",TERMINAL_HEIGHT:"guake-terminal-height",TERMINAL_FULLSCREEN:"guake-terminal-fullscreen",INPUT_TEXT_PREFIX:"guake-input-",PASTED_TEXTS_PREFIX:"guake-pasted-",COMMANDER_TAB:"commander-active-tab",COMMANDER_FILTERS:"commander-filters",LAST_CWD:"tide-last-cwd",GLOBAL_SUPERVISOR_COLLAPSED:"tide-global-supervisor-collapsed",TOOLS_COLLAPSED:"tide-tool-history-collapsed",FILES_COLLAPSED:"tide-file-history-collapsed",MOBILE_VIEW:"tide-mobile-view",TREE_PANEL_WIDTH:"tide-tree-panel-width",MOBILE_TREE_PANEL_HEIGHT:"tide-mobile-tree-panel-height",AGENT_ORDER:"tide-agent-order",AOP_CONFIG:"tide-aop-config",AOP_OPEN:"tide-aop-open",MOBILE_OVERVIEW_HEIGHT:"tide-mobile-overview-height",SPLIT_PANE_AGENT_IDS:"tide-split-pane-agent-ids",SPLIT_PANE_ORIENTATION:"tide-split-pane-orientation",GIT_PANEL_OPEN:"guake-git-panel-open",GIT_PANEL_MODE:"guake-git-panel-mode",GIT_PANEL_VIEW_MODE:"guake-git-view-mode",GIT_PANEL_FOLDER_IDX:"guake-git-folder-idx",BUILDINGS_PANEL_OPEN:"guake-buildings-panel-open",WORKFLOW_PANEL_OPEN:"guake-workflow-panel-open",SIDE_PANEL_WIDTH:"guake-side-panel-width",UNSEEN_AGENTS:"tide-unseen-agents",PENDING_MESSAGES:"tide-pending-messages"},db="tide-backend-url-change";function ea(t,e){try{const n=localStorage.getItem(t);return n===null?e:JSON.parse(n)}catch{return e}}function ka(t,e=""){try{return localStorage.getItem(t)??e}catch{return e}}function bi(t,e=!1){try{const n=localStorage.getItem(t);return n===null?e:n==="true"}catch{return e}}function Qb(t,e){try{const n=localStorage.getItem(t);if(n===null)return e;const s=Number(n);return isNaN(s)?e:s}catch{return e}}function wa(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function Ja(t,e){try{localStorage.setItem(t,e)}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function xi(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function Xb(t,e){try{localStorage.setItem(t,String(e))}catch(n){console.error(`Failed to save to localStorage: ${t}`,n)}}function hk(t){try{localStorage.removeItem(t)}catch(e){console.error(`Failed to remove from localStorage: ${t}`,e)}}function Aa(){const t=Jb();return t?t.replace(/\/$/,""):`${window.location.protocol}//${window.location.host}`}function ji(){return ka(pt.AUTH_TOKEN,"")}function Jb(){return ka(pt.BACKEND_URL,"")}function GD(t){const e=t.trim();Ja(pt.BACKEND_URL,e),typeof window<"u"&&window.dispatchEvent(new CustomEvent(db,{detail:e}))}function YD(t){if(typeof window>"u")return()=>{};const e=s=>{t(s.detail)},n=s=>{s.key===pt.BACKEND_URL&&t(s.newValue??"")};return window.addEventListener(db,e),window.addEventListener("storage",n),()=>{window.removeEventListener(db,e),window.removeEventListener("storage",n)}}function Ot(t){return`${Aa()}${t}`}async function Pt(t,e){const n=ji(),s=new Headers(e==null?void 0:e.headers);return n&&s.set("X-Auth-Token",n),fetch(t,{...e,headers:s,cache:"no-store"})}function fb(t){const e=ji();if(!e)return t;try{const n=!t.startsWith("http://")&&!t.startsWith("https://"),s=n?"http://dummy":void 0,a=new URL(t,s);return a.searchParams.set("token",e),n?a.pathname+a.search:a.toString()}catch{const n=t.includes("?")?"&":"?";return`${t}${n}token=${encodeURIComponent(e)}`}}function ts(t=!1,e){const[n,s]=b.useState(t),[a,r]=b.useState(e),i=b.useCallback(f=>{f!==void 0&&r(f),s(!0)},[]),c=b.useCallback(()=>{s(!1)},[]),d=b.useCallback(()=>{s(f=>!f)},[]);return{isOpen:n,data:a,open:i,close:c,toggle:d,setData:r}}function KD(){const[t,e]=b.useState(null),n=b.useCallback(a=>{e(a)},[]),s=b.useCallback(()=>{e(null)},[]);return{isOpen:t!==null,id:t,open:n,close:s}}function QD(){const[t,e]=b.useState(!1),[n,s]=b.useState({x:0,y:0}),[a,r]=b.useState({x:0,z:0}),[i,c]=b.useState({type:"ground"}),d=b.useCallback((h,m,x)=>{s(h),r(m),c(x),e(!0)},[]),f=b.useCallback(()=>{e(!1)},[]);return{isOpen:t,screenPosition:n,worldPosition:a,target:i,open:d,close:f}}const ta=[],XD=new Set;function zf(){XD.forEach(t=>t())}function JD(t,e){const n=ta.findIndex(s=>s.id===t);return n!==-1&&ta.splice(n,1),ta.push({id:t,close:e}),zf(),()=>{const s=ta.findIndex(a=>a.id===t);s!==-1&&(ta.splice(s,1),zf())}}function Sf(){return ta.length===0?!1:(ta.pop().close(),zf(),!0)}function ZD(t){const e=ta.findIndex(n=>n.id===t);return e===-1?!1:e<ta.length-1}function eR(...t){const e=new Set(t);for(;ta.length>0;){const n=ta[ta.length-1];if(e.has(n.id))break;ta.pop().close()}zf()}function Qt(t,e,n){const s=b.useRef(n);s.current=n,b.useEffect(()=>e?JD(t,()=>s.current()):void 0,[t,e])}const xu=5,Gm={0:0,1:4,2:8,3:14,4:25,5:50};let iu=null,mk=!1;async function tR(){if(mk)return iu;mk=!0;try{const t=await vt(()=>import("./index-DESPWRkl.js"),__vite__mapDeps([2,3,1,4]));iu={Haptics:t.Haptics,ImpactStyle:t.ImpactStyle}}catch{}return iu}tR();function $f(t){const e=Math.round(t),n=e<=0?0:e>=xu?xu:e;if(n!==0){if(iu){const{Haptics:s,ImpactStyle:a}=iu;if(n<=2&&typeof s.selectionChanged=="function"){s.selectionChanged().catch(()=>{navigator.vibrate&&navigator.vibrate(Gm[n])});return}const i={3:"Light",4:"Medium",5:"Heavy"}[n];if(i&&a[i]){s.impact({style:a[i]}).catch(()=>{navigator.vibrate&&navigator.vibrate(Gm[n])});return}}navigator.vibrate&&navigator.vibrate(Gm[n])}}function gk(t,e){const{threshold:n=80,maxVerticalMovement:s=50,enabled:a=!0,onSwipeLeft:r,onSwipeRight:i,onSwipeMove:c,onSwipeCancel:d,vibrationIntensity:f=1}=e,h=b.useRef({startX:0,startY:0,startTime:0,isTracking:!1,hasMovedEnough:!1}),m=b.useCallback(S=>{if(S.touches.length!==1)return;const A=S.touches[0];h.current={startX:A.clientX,startY:A.clientY,startTime:Date.now(),isTracking:!0,hasMovedEnough:!1}},[]),x=b.useCallback(S=>{if(!h.current.isTracking||S.touches.length!==1)return;const A=S.touches[0],k=A.clientX-h.current.startX;if(Math.abs(A.clientY-h.current.startY)>s){h.current.isTracking=!1,h.current.hasMovedEnough&&(d==null||d());return}const E=window.innerWidth*.4,D=Math.max(-1,Math.min(1,k/E));Math.abs(k)>=12&&(h.current.hasMovedEnough=!0,c==null||c(D))},[s,c,d]),y=b.useCallback(S=>{const A=h.current.isTracking,k=h.current.hasMovedEnough;if(!A)return;const N=S.changedTouches[0],j=N.clientX-h.current.startX,E=Math.abs(N.clientY-h.current.startY),D=Date.now()-h.current.startTime;h.current.isTracking=!1,h.current.hasMovedEnough=!1,Math.abs(j)>=n&&E<=s&&D<500?($f(f),j>0?i==null||i():r==null||r()):k&&(d==null||d())},[n,s,f,r,i,d]),v=b.useCallback(()=>{const S=h.current.hasMovedEnough;h.current.isTracking=!1,h.current.hasMovedEnough=!1,S&&(d==null||d())},[d]);b.useEffect(()=>{const S=t.current;if(!(!S||!a||!(window.innerWidth<=768&&"ontouchstart"in window)))return S.addEventListener("touchstart",m,{passive:!0}),S.addEventListener("touchmove",x,{passive:!0}),S.addEventListener("touchend",y,{passive:!0}),S.addEventListener("touchcancel",v,{passive:!0}),()=>{S.removeEventListener("touchstart",m),S.removeEventListener("touchmove",x),S.removeEventListener("touchend",y),S.removeEventListener("touchcancel",v)}},[t,a,m,x,y,v])}const bk=8,nR=.93,xk=.4;function sR(t){const{gestureRef:e,agentListRef:n,enabled:s,onSelect:a}=t,[r,i]=b.useState(!1),[c,d]=b.useState(null),f=b.useRef(!1),h=b.useRef(null),m=b.useRef(a);m.current=a;const x=b.useCallback(()=>{if(f.current)return;f.current=!0,i(!0);const A=n.current;if(A){const k=Math.round(A.clientHeight/2);A.style.paddingTop=`${k}px`,A.style.paddingBottom=`${k}px`}},[n]),y=b.useCallback(()=>{f.current=!1,h.current=null,i(!1),d(null);const A=n.current;A&&(A.style.paddingTop="",A.style.paddingBottom="")},[n]),v=b.useCallback(A=>{const k=n.current;if(!k)return;k.scrollTop+=A;const N=k.getBoundingClientRect(),j=N.top+N.height/2,E=N.left+N.width/2,D=document.elementFromPoint(E,j);let _=null;if(D){const B=D.closest("[data-agent-id]");B&&k.contains(B)&&(_=B.dataset.agentId)}if(_!==h.current&&(h.current=_,d(_),_)){const B=H.getState().settings.vibrationIntensity??1;$f(B)}},[n]),S=b.useCallback(()=>{const A=h.current;if(A){const k=H.getState().settings.vibrationIntensity??1,N=k<=0?0:Math.min(k+1,xu);$f(N),m.current(A)}y()},[y]);return b.useEffect(()=>{const A=e.current;if(!A||!s)return;const k=A.style.touchAction;A.style.touchAction="none";let N=!1,j=!1,E=0,D=0,_=0,B=0,O=0,T=0,M=0,R=0;const F=()=>{M&&(cancelAnimationFrame(M),M=0)},$=()=>{if(Math.abs(T)<xk){T=0;return}A.scrollTop+=T,T*=nR,M=requestAnimationFrame($)},U=V=>{if(F(),V.touches.length>=2){V.preventDefault(),N=!1,j=!1,R=(V.touches[0].clientY+V.touches[1].clientY)/2,x(),v(0);return}N=!0,j=!1,E=V.touches[0].clientX,D=V.touches[0].clientY,_=A.scrollTop,B=D,O=performance.now(),T=0},L=V=>{if(V.touches.length>=2){if(V.preventDefault(),(j||N)&&(j=!1,N=!1),!f.current){R=(V.touches[0].clientY+V.touches[1].clientY)/2,x(),v(0);return}const K=(V.touches[0].clientY+V.touches[1].clientY)/2,Q=R-K;R=K,v(Q);return}if(f.current&&V.touches.length===1){V.preventDefault();const K=V.touches[0].clientY,Q=R-K;R=K,v(Q);return}if(!N&&!j)return;const Y=V.touches[0].clientX,P=V.touches[0].clientY;if(N&&!j){const K=Math.abs(Y-E),Q=Math.abs(P-D);if(K<bk&&Q<bk)return;if(Q>=K)j=!0,N=!1,V.preventDefault();else{N=!1;return}}if(j){V.preventDefault();const K=performance.now(),Q=K-O;A.scrollTop=_+(D-P),Q>0&&(T=(B-P)/Q*16),B=P,O=K}},z=V=>{if(f.current&&V.touches.length===0){S();return}f.current||(j||N)&&V.touches.length===0&&(j&&Math.abs(T)>xk&&(M=requestAnimationFrame($)),j=!1,N=!1)},W=()=>{j=!1,N=!1,F(),f.current&&y()};return A.addEventListener("touchstart",U,{passive:!1}),A.addEventListener("touchmove",L,{passive:!1}),A.addEventListener("touchend",z,{passive:!0}),A.addEventListener("touchcancel",W,{passive:!0}),()=>{A.removeEventListener("touchstart",U),A.removeEventListener("touchmove",L),A.removeEventListener("touchend",z),A.removeEventListener("touchcancel",W),A.style.touchAction=k,F();const V=n.current;V&&(V.style.paddingTop="",V.style.paddingBottom="")}},[e,n,s,x,y,v,S]),{isActive:r,hoveredAgentId:c}}const aR={width:400,height:300,copyStyleSheets:!0,keepOnTop:"focus"};function rR(){return"documentPictureInPicture"in window}function iR(t,e){for(const r of t.styleSheets)try{if(r.cssRules){const i=e.createElement("style");for(const c of r.cssRules)i.appendChild(e.createTextNode(c.cssText));e.head.appendChild(i)}}catch{if(r.href){const i=e.createElement("link");i.rel="stylesheet",i.href=r.href,e.head.appendChild(i)}}const n=t.documentElement.style.cssText;n&&(e.documentElement.style.cssText=n);const s=getComputedStyle(t.documentElement),a=[];for(let r=0;r<s.length;r++){const i=s[r];i.startsWith("--")&&a.push(`${i}: ${s.getPropertyValue(i)}`)}if(a.length>0){const r=e.createElement("style");r.textContent=`:root { ${a.join("; ")} }`,e.head.appendChild(r)}}function oR(){const[t,e]=b.useState(!1),[n,s]=b.useState(null),[a,r]=b.useState(null),i=b.useRef(null),c=rR(),d=b.useCallback(()=>{if(i.current){const m=i.current.__cleanupFns;m&&m.forEach(x=>x()),i.current.close(),i.current=null}s(null),r(null),e(!1)},[]),f=b.useCallback(async m=>{if(!c)return console.warn("Document Picture-in-Picture is not supported in this browser"),!1;i.current&&d();const x={...aR,...m};try{const v=await window.documentPictureInPicture.requestWindow({width:x.width,height:x.height,disallowReturnToOpener:!0});i.current=v,x.copyStyleSheets&&iR(document,v.document);const S=v.document.createElement("div");S.id="pip-root",S.style.width="100%",S.style.height="100%",v.document.body.appendChild(S),v.document.body.style.margin="0",v.document.body.style.padding="0",v.document.body.style.overflow="hidden",v.addEventListener("pagehide",()=>{i.current=null,s(null),r(null),e(!1)});const A=[];if(x.keepOnTop&&x.keepOnTop!=="none"){const k=x.keepOnTop==="raise",N=()=>{i.current&&!i.current.closed&&setTimeout(()=>{i.current&&!i.current.closed&&(i.current.focus(),k&&setTimeout(()=>window.focus(),10))},50)},j=()=>{document.visibilityState==="visible"&&i.current&&!i.current.closed&&setTimeout(()=>{i.current&&!i.current.closed&&(i.current.focus(),k&&setTimeout(()=>window.focus(),10))},100)};window.addEventListener("focus",N),document.addEventListener("visibilitychange",j),A.push(()=>window.removeEventListener("focus",N),()=>document.removeEventListener("visibilitychange",j))}return v.__cleanupFns=A,s(v),r(S),e(!0),!0}catch(y){return console.error("Failed to open Picture-in-Picture window:",y),!1}},[c,d]),h=b.useCallback(async m=>{t?d():await f(m)},[t,f,d]);return b.useEffect(()=>()=>{i.current&&i.current.close()},[]),b.useMemo(()=>({isOpen:t,pipWindow:n,pipContainer:a,isSupported:c,open:f,close:d,toggle:h}),[t,n,a,c,f,d,h])}function Dc(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}class lR{constructor(){Je(this,"messages",new Map);Je(this,"logs",[]);Je(this,"maxMessagesPerAgent",200);Je(this,"maxLogs",500);Je(this,"enabled",!0);Je(this,"listeners",new Set);Je(this,"logListeners",new Set)}setEnabled(e){this.enabled=e,this.notifyListeners("all")}isEnabled(){return this.enabled}captureSent(e,n){try{const s=JSON.parse(n);console.log(`[AgentDebugger] SENT - agent: ${e.slice(0,4)}, type: ${s.type}, size: ${n.length}B`),this.addMessage(e,{id:Dc(),agentId:e,direction:"sent",type:s.type||"unknown",payload:s.payload||s,timestamp:Date.now(),size:n.length,raw:n})}catch(s){console.error("[AgentDebugger] Failed to parse SENT message:",String(s).slice(0,80)),this.addMessage(e,{id:Dc(),agentId:e,direction:"sent",type:"parse_error",payload:{error:String(s)},timestamp:Date.now(),size:n.length,raw:n})}}captureReceived(e,n){try{const s=JSON.parse(n);console.log(`[AgentDebugger] RECEIVED - agent: ${e.slice(0,4)}, type: ${s.type}, size: ${n.length}B`),this.addMessage(e,{id:Dc(),agentId:e,direction:"received",type:s.type||"unknown",payload:s.payload||s,timestamp:Date.now(),size:n.length,raw:n})}catch(s){console.error("[AgentDebugger] Failed to parse RECEIVED message:",String(s).slice(0,80)),this.addMessage(e,{id:Dc(),agentId:e,direction:"received",type:"parse_error",payload:{error:String(s)},timestamp:Date.now(),size:n.length,raw:n})}}addMessage(e,n){let s=this.messages.get(e);s||(s=[],this.messages.set(e,s)),s.push(n),console.log(`[AgentDebugger] Added message for ${e}, total: ${s.length}, type: ${n.type}, direction: ${n.direction}`),s.length>this.maxMessagesPerAgent&&s.shift(),this.notifyListeners(e)}getMessages(e){return this.messages.get(e)||[]}getStats(e){const n=this.getMessages(e),s=n.filter(i=>i.direction==="sent").length,a=n.filter(i=>i.direction==="received").length,r=[...new Set(n.map(i=>i.type))];return{total:n.length,sent:s,received:a,messageTypes:r}}clearMessages(e){this.messages.delete(e),this.notifyListeners(e)}clearAllMessages(){this.messages.clear(),this.notifyListeners("all")}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(e){this.listeners.forEach(n=>n(e))}getAgentIds(){return Array.from(this.messages.keys())}log(e,n,s,a){const r={id:Dc(),level:e,message:n,data:s,timestamp:Date.now(),source:a};this.logs.push(r),this.logs.length>this.maxLogs&&this.logs.shift(),this.notifyLogListeners()}debug(e,n,s){this.log("debug",e,n,s)}info(e,n,s){this.log("info",e,n,s)}warn(e,n,s){this.log("warn",e,n,s)}error(e,n,s){this.log("error",e,n,s)}getLogs(){return this.logs}clearLogs(){this.logs=[],this.notifyLogListeners()}subscribeLogs(e){return this.logListeners.add(e),()=>this.logListeners.delete(e)}notifyLogListeners(){this.logListeners.forEach(e=>e())}}const ps=new lR,yu={debug:(t,e,n)=>ps.debug(t,e,n),info:(t,e,n)=>ps.info(t,e,n),warn:(t,e,n)=>ps.warn(t,e,n),error:(t,e,n)=>ps.error(t,e,n)};/*! Capacitor: https://capacitorjs.com/ - MIT License */var vl;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(vl||(vl={}));class Ym extends Error{constructor(e,n,s){super(e),this.message=e,this.code=n,this.data=s}}const cR=t=>{var e,n;return t!=null&&t.androidBridge?"android":!((n=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},uR=t=>{const e=t.CapacitorCustomPlatform||null,n=t.Capacitor||{},s=n.Plugins=n.Plugins||{},a=()=>e!==null?e.name:cR(t),r=()=>a()!=="web",i=m=>{const x=f.get(m);return!!(x!=null&&x.platforms.has(a())||c(m))},c=m=>{var x;return(x=n.PluginHeaders)===null||x===void 0?void 0:x.find(y=>y.name===m)},d=m=>t.console.error(m),f=new Map,h=(m,x={})=>{const y=f.get(m);if(y)return console.warn(`Capacitor plugin "${m}" already registered. Cannot register plugins twice.`),y.proxy;const v=a(),S=c(m);let A;const k=async()=>(!A&&v in x?A=typeof x[v]=="function"?A=await x[v]():A=x[v]:e!==null&&!A&&"web"in x&&(A=typeof x.web=="function"?A=await x.web():A=x.web),A),N=(O,T)=>{var M,R;if(S){const F=S==null?void 0:S.methods.find($=>T===$.name);if(F)return F.rtype==="promise"?$=>n.nativePromise(m,T.toString(),$):($,U)=>n.nativeCallback(m,T.toString(),$,U);if(O)return(M=O[T])===null||M===void 0?void 0:M.bind(O)}else{if(O)return(R=O[T])===null||R===void 0?void 0:R.bind(O);throw new Ym(`"${m}" plugin is not implemented on ${v}`,vl.Unimplemented)}},j=O=>{let T;const M=(...R)=>{const F=k().then($=>{const U=N($,O);if(U){const L=U(...R);return T=L==null?void 0:L.remove,L}else throw new Ym(`"${m}.${O}()" is not implemented on ${v}`,vl.Unimplemented)});return O==="addListener"&&(F.remove=async()=>T()),F};return M.toString=()=>`${O.toString()}() { [capacitor code] }`,Object.defineProperty(M,"name",{value:O,writable:!1,configurable:!1}),M},E=j("addListener"),D=j("removeListener"),_=(O,T)=>{const M=E({eventName:O},T),R=async()=>{const $=await M;D({eventName:O,callbackId:$},T)},F=new Promise($=>M.then(()=>$({remove:R})));return F.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await R()},F},B=new Proxy({},{get(O,T){switch(T){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return S?_:E;case"removeListener":return D;default:return j(T)}}});return s[m]=B,f.set(m,{name:m,proxy:B,platforms:new Set([...Object.keys(x),...S?[v]:[]])}),B};return n.convertFileSrc||(n.convertFileSrc=m=>m),n.getPlatform=a,n.handleError=d,n.isNativePlatform=r,n.isPluginAvailable=i,n.registerPlugin=h,n.Exception=Ym,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},dR=t=>t.Capacitor=uR(t),Hf=dR(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),_u=Hf.registerPlugin;class Zb{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,n){let s=!1;this.listeners[e]||(this.listeners[e]=[],s=!0),this.listeners[e].push(n);const r=this.windowListeners[e];r&&!r.registered&&this.addWindowListener(r),s&&this.sendRetainedArgumentsForEvent(e);const i=async()=>this.removeListener(e,n);return Promise.resolve({remove:i})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n,s){const a=this.listeners[e];if(!a){if(s){let r=this.retainedEventArguments[e];r||(r=[]),r.push(n),this.retainedEventArguments[e]=r}return}a.forEach(r=>r(n))}hasListeners(e){var n;return!!(!((n=this.listeners[e])===null||n===void 0)&&n.length)}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:s=>{this.notifyListeners(n,s)}}}unimplemented(e="not implemented"){return new Hf.Exception(e,vl.Unimplemented)}unavailable(e="not available"){return new Hf.Exception(e,vl.Unavailable)}async removeListener(e,n){const s=this.listeners[e];if(!s)return;const a=s.indexOf(n);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const n=this.retainedEventArguments[e];n&&(delete this.retainedEventArguments[e],n.forEach(s=>{this.notifyListeners(e,s)}))}}const yk=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),vk=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class fR extends Zb{async getCookies(){const e=document.cookie,n={};return e.split(";").forEach(s=>{if(s.length<=0)return;let[a,r]=s.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=vk(a).trim(),r=vk(r).trim(),n[a]=r}),n}async setCookie(e){try{const n=yk(e.key),s=yk(e.value),a=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",r=(e.path||"/").replace("path=",""),i=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${s||""}${a}; path=${r}; ${i};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}_u("CapacitorCookies",{web:()=>new fR});const pR=async t=>new Promise((e,n)=>{const s=new FileReader;s.onload=()=>{const a=s.result;e(a.indexOf(",")>=0?a.split(",")[1]:a)},s.onerror=a=>n(a),s.readAsDataURL(t)}),hR=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(a=>a.toLocaleLowerCase()).reduce((a,r,i)=>(a[r]=t[e[i]],a),{})},mR=(t,e=!0)=>t?Object.entries(t).reduce((s,a)=>{const[r,i]=a;let c,d;return Array.isArray(i)?(d="",i.forEach(f=>{c=e?encodeURIComponent(f):f,d+=`${r}=${c}&`}),d.slice(0,-1)):(c=e?encodeURIComponent(i):i,d=`${r}=${c}`),`${s}&${d}`},"").substr(1):null,gR=(t,e={})=>{const n=Object.assign({method:t.method||"GET",headers:t.headers},e),a=hR(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(a.includes("application/x-www-form-urlencoded")){const r=new URLSearchParams;for(const[i,c]of Object.entries(t.data||{}))r.set(i,c);n.body=r.toString()}else if(a.includes("multipart/form-data")||t.data instanceof FormData){const r=new FormData;if(t.data instanceof FormData)t.data.forEach((c,d)=>{r.append(d,c)});else for(const c of Object.keys(t.data))r.append(c,t.data[c]);n.body=r;const i=new Headers(n.headers);i.delete("content-type"),n.headers=i}else(a.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n};class bR extends Zb{async request(e){const n=gR(e,e.webFetchExtra),s=mR(e.params,e.shouldEncodeUrlParams),a=s?`${e.url}?${s}`:e.url,r=await fetch(a,n),i=r.headers.get("content-type")||"";let{responseType:c="text"}=r.ok?e:{};i.includes("application/json")&&(c="json");let d,f;switch(c){case"arraybuffer":case"blob":f=await r.blob(),d=await pR(f);break;case"json":d=await r.json();break;case"document":case"text":default:d=await r.text()}const h={};return r.headers.forEach((m,x)=>{h[x]=m}),{data:d,headers:h,status:r.status,url:r.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}const Mq=_u("CapacitorHttp",{web:()=>new bR});var wk;(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(wk||(wk={}));var kk;(function(t){t.StatusBar="StatusBar",t.NavigationBar="NavigationBar"})(kk||(kk={}));class xR extends Zb{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}}_u("SystemBars",{web:()=>new xR});var Sk;(function(t){t[t.Sunday=1]="Sunday",t[t.Monday=2]="Monday",t[t.Tuesday=3]="Tuesday",t[t.Wednesday=4]="Wednesday",t[t.Thursday=5]="Thursday",t[t.Friday=6]="Friday",t[t.Saturday=7]="Saturday"})(Sk||(Sk={}));const ex=_u("LocalNotifications",{web:()=>vt(()=>import("./web-CwCZTch8.js"),__vite__mapDeps([5,3,1,4])).then(t=>new t.LocalNotificationsWeb)}),yR=_u("ServerConfig");let vR=100;const wR="agent_alerts",pb="tide-notification-tap";function kR(){return typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window}function rj(t){if(kR()){H.openTerminalOnMobile(t);return}if(document.querySelector(".commander-overlay")){H.requestCommanderExpand(t);return}H.selectAgent(t),H.setTerminalOpen(!0)}function Eu(){try{return Hf.isNativePlatform()}catch{return!1}}async function SR(){if(Eu())try{const t=await ex.requestPermissions();return console.log("[Notifications] Permission result:",t.display),t.display==="granted"}catch(t){return console.error("[Notifications] Failed to request permissions:",t),!1}else return"Notification"in window?await Notification.requestPermission()==="granted":!1}async function CR(t){const{title:e,body:n,icon:s,data:a}=t;if(Eu())try{const r=vR++;console.log("[Notifications] Scheduling native notification id="+r,e),await ex.schedule({notifications:[{id:r,title:e,body:n,extra:a,channelId:wR,smallIcon:"ic_launcher",autoCancel:!0}]}),console.log("[Notifications] Notification scheduled successfully")}catch(r){console.error("[Notifications] Failed to schedule notification:",r)}else if("Notification"in window&&Notification.permission==="granted"){const r=new Notification(e,{body:n,icon:s,data:a});r.onclick=()=>{window.focus(),a&&window.dispatchEvent(new CustomEvent(pb,{detail:a}))}}}let Km=!1;async function AR(t){const e=[];if(Km)return()=>{};if(Km=!0,t){const n=s=>{const a=s;a.detail&&t(a.detail)};window.addEventListener(pb,n),e.push(()=>window.removeEventListener(pb,n))}if(Eu())try{const n=await ex.addListener("localNotificationActionPerformed",s=>{t&&s.notification.extra&&t(s.notification.extra)});e.push(()=>n.remove())}catch(n){console.error("[Notifications] Failed to add tap listener:",n)}return()=>{e.forEach(n=>n()),Km=!1}}function jR(t,e){Eu()&&yR.syncConfig({url:t,token:e}).catch(n=>{console.warn("[Notifications] Failed to sync config to native service:",n)})}window.__tideWsState||(window.__tideWsState={ws:null,isConnecting:!1,reconnectAttempts:0,reconnectTimeout:null});const gp=()=>window.__tideWsState.ws,Ck=t=>{window.__tideWsState.ws=t},NR=()=>window.__tideWsState.isConnecting,Rc=t=>{window.__tideWsState.isConnecting=t},hb=()=>window.__tideWsState.reconnectAttempts,mb=t=>{window.__tideWsState.reconnectAttempts=t},ij=()=>window.__tideWsState.reconnectTimeout,oj=t=>{window.__tideWsState.reconnectTimeout=t},Ak=10,tx="tide_ws_has_connected";function jk(){return sessionStorage.getItem(tx)==="true"}function TR(t){sessionStorage.setItem(tx,"true")}function _R(){sessionStorage.removeItem(tx)}let lj=null;const ER=t=>{lj=t},Nk=()=>lj,Oe={onToast:null,onAgentCreated:null,onAgentUpdated:null,onAgentDeleted:null,onAgentsSync:null,onAreasSync:null,onSpawnError:null,onSpawnSuccess:null,onToolUse:null,onDirectoryNotFound:null,onDelegation:null,onCustomClassesSync:null,onReconnect:null,onAgentNotification:null,onBuildingUpdated:null,onSubagentStarted:null,onSubagentCompleted:null};function cj(t){t.onToast&&(Oe.onToast=t.onToast),t.onAgentCreated&&(Oe.onAgentCreated=t.onAgentCreated),t.onAgentUpdated&&(Oe.onAgentUpdated=t.onAgentUpdated),t.onAgentDeleted&&(Oe.onAgentDeleted=t.onAgentDeleted),t.onAgentsSync&&(Oe.onAgentsSync=t.onAgentsSync),t.onAreasSync&&(Oe.onAreasSync=t.onAreasSync),t.onSpawnError&&(Oe.onSpawnError=t.onSpawnError),t.onSpawnSuccess&&(Oe.onSpawnSuccess=t.onSpawnSuccess),t.onToolUse&&(Oe.onToolUse=t.onToolUse),t.onDirectoryNotFound&&(Oe.onDirectoryNotFound=t.onDirectoryNotFound),t.onDelegation&&(Oe.onDelegation=t.onDelegation),t.onCustomClassesSync&&(Oe.onCustomClassesSync=t.onCustomClassesSync),t.onReconnect&&(Oe.onReconnect=t.onReconnect),t.onAgentNotification&&(Oe.onAgentNotification=t.onAgentNotification),t.onBuildingUpdated&&(Oe.onBuildingUpdated=t.onBuildingUpdated),t.onSubagentStarted&&(Oe.onSubagentStarted=t.onSubagentStarted),t.onSubagentCompleted&&(Oe.onSubagentCompleted=t.onSubagentCompleted)}function MR(){Oe.onToast=null,Oe.onAgentCreated=null,Oe.onAgentUpdated=null,Oe.onAgentDeleted=null,Oe.onAgentsSync=null,Oe.onAreasSync=null,Oe.onSpawnError=null,Oe.onSpawnSuccess=null,Oe.onToolUse=null,Oe.onDirectoryNotFound=null,Oe.onDelegation=null,Oe.onCustomClassesSync=null,Oe.onReconnect=null,Oe.onAgentNotification=null,Oe.onSubagentStarted=null,Oe.onSubagentCompleted=null}function DR(){Oe.onAgentCreated=null,Oe.onAgentUpdated=null,Oe.onAgentDeleted=null,Oe.onAgentsSync=null,Oe.onAreasSync=null,Oe.onToolUse=null,Oe.onDelegation=null,Oe.onCustomClassesSync=null,Oe.onBuildingUpdated=null,Oe.onSubagentStarted=null,Oe.onSubagentCompleted=null}const Yd=new Map,RR=new Map,gb={start(t){},end(t){},async measure(t,e){this.start(t);try{return await e()}finally{this.end(t)}},measureSync(t,e){this.start(t);try{return e()}finally{this.end(t)}},getMetrics(t){const e={},n=t?Yd.has(t)?[[t,Yd.get(t)]]:[]:Array.from(Yd.entries());for(const[s,a]of n){const r=[...a.samples].sort((f,h)=>f-h),i=Math.floor(r.length*.5),c=Math.floor(r.length*.95),d=Math.floor(r.length*.99);e[s]={count:a.count,avgMs:a.totalMs/a.count,minMs:a.minMs,maxMs:a.maxMs,lastMs:a.lastMs,p50Ms:r[i]||0,p95Ms:r[c]||0,p99Ms:r[d]||0}}return e},clear(){Yd.clear(),RR.clear()},report(){}};class OR{constructor(){Je(this,"frames",[]);Je(this,"lastFrameTime",0);Je(this,"frameCount",0);Je(this,"fps",0);Je(this,"minFps",1/0);Je(this,"maxFps",0);Je(this,"fpsHistory",[]);Je(this,"maxHistorySize",60)}tick(e=200){const n=performance.now();if(this.lastFrameTime>0){const s=n-this.lastFrameTime;s<e&&(this.frames.push(s),this.frames.length>60&&this.frames.shift())}this.lastFrameTime=n,this.frameCount++}update(){if(this.frames.length===0)return;const e=this.frames.reduce((n,s)=>n+s,0)/this.frames.length;this.fps=1e3/e,this.minFps=Math.min(this.minFps,this.fps),this.maxFps=Math.max(this.maxFps,this.fps),this.fpsHistory.push(this.fps),this.fpsHistory.length>this.maxHistorySize&&this.fpsHistory.shift()}getFPS(){return Math.round(this.fps)}getStats(){const e=this.fpsHistory.length>0?this.fpsHistory.reduce((n,s)=>n+s,0)/this.fpsHistory.length:this.fps;return{current:Math.round(this.fps),min:Math.round(this.minFps===1/0?0:this.minFps),max:Math.round(this.maxFps),avg:Math.round(e)}}reset(){this.frames=[],this.lastFrameTime=0,this.frameCount=0,this.fps=0,this.minFps=1/0,this.maxFps=0,this.fpsHistory=[]}}const Kd=new OR;class LR{constructor(){Je(this,"snapshots",[]);Je(this,"maxSnapshots",120);Je(this,"intervalId",null);Je(this,"leakThresholdMB",50);Je(this,"baselineUsedMB",0)}getUsage(){const e=performance.memory;return e?{usedMB:Math.round(e.usedJSHeapSize/1024/1024),totalMB:Math.round(e.totalJSHeapSize/1024/1024),limitMB:Math.round(e.jsHeapSizeLimit/1024/1024)}:null}log(){const e=this.getUsage();e&&console.log(`[Memory] Used: ${e.usedMB}MB / ${e.totalMB}MB (limit: ${e.limitMB}MB)`)}startMonitoring(e=1e3){if(this.intervalId)return;const n=this.getUsage();n&&(this.baselineUsedMB=n.usedMB),this.intervalId=setInterval(()=>{this.takeSnapshot()},e),console.log("[Memory] Monitoring started. Use memory.report() to see analysis.")}stopMonitoring(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null,console.log("[Memory] Monitoring stopped."))}takeSnapshot(){const e=this.getUsage();if(!e)return;const n={timestamp:Date.now(),heapUsedMB:e.usedMB,heapTotalMB:e.totalMB,heapLimitMB:e.limitMB};this.snapshots.push(n),this.snapshots.length>this.maxSnapshots&&this.snapshots.shift();const s=e.usedMB-this.baselineUsedMB;s>this.leakThresholdMB&&console.warn(`[Memory] Warning: Heap grew by ${s}MB since monitoring started (baseline: ${this.baselineUsedMB}MB, current: ${e.usedMB}MB)`)}getGrowthRate(){if(this.snapshots.length<10)return null;const e=this.snapshots[0],n=this.snapshots[this.snapshots.length-1],s=(n.timestamp-e.timestamp)/1e3/60;return s<.1?null:(n.heapUsedMB-e.heapUsedMB)/s}report(){const e=this.getUsage();if(!e){console.log("[Memory] Memory API not available (Chrome only)");return}console.group("%c[Memory Report]","color: #ff6600; font-weight: bold"),console.log(`Current: ${e.usedMB}MB / ${e.totalMB}MB (limit: ${e.limitMB}MB)`),console.log(`Baseline: ${this.baselineUsedMB}MB`),console.log(`Growth: ${e.usedMB-this.baselineUsedMB}MB since monitoring started`);const n=this.getGrowthRate();if(n!==null&&(console.log(`Growth Rate: ${n.toFixed(2)}MB/min`),n>5&&console.warn("POTENTIAL MEMORY LEAK: Growth rate exceeds 5MB/min")),this.snapshots.length>1){const s=Math.min(...this.snapshots.map(r=>r.heapUsedMB)),a=Math.max(...this.snapshots.map(r=>r.heapUsedMB));console.log(`Range: ${s}MB - ${a}MB (${a-s}MB variance)`)}console.groupEnd()}getThreeJsInfo(e){var n;return(n=e==null?void 0:e.info)!=null&&n.memory?{geometries:e.info.memory.geometries,textures:e.info.memory.textures}:null}reset(){this.snapshots=[];const e=this.getUsage();e&&(this.baselineUsedMB=e.usedMB),console.log("[Memory] Reset. New baseline:",this.baselineUsedMB,"MB")}}const Oc=new LR;function Qc(t,e,n,s,a,r){}function uj(t,e){b.useRef(0),b.useEffect(()=>{},[t,5e3,!0])}if(typeof window<"u"){setInterval(()=>{try{performance.clearMarks(),performance.clearMeasures(),performance.clearResourceTimings()}catch{}},6e4);try{performance.setResourceTimingBufferSize(0)}catch{}}const bb=pt.PENDING_MESSAGES,PR=300*1e3;function dj(){try{const t=localStorage.getItem(bb);if(!t)return[];const e=JSON.parse(t),n=Date.now();return e.filter(s=>n-s.queuedAt<PR)}catch{return[]}}function fj(t){try{t.length===0?localStorage.removeItem(bb):localStorage.setItem(bb,JSON.stringify(t))}catch{}}function Qd(t){const e=dj();e.push({message:t,queuedAt:Date.now()}),fj(e)}function IR(){var s;const t=dj();if(t.length===0)return 0;let e=0;const n=[];for(const a of t)BR(a.message)?e++:n.push(a);if(fj(n),e>0){const a=e===1?"queued message":"queued messages";(s=Oe.onToast)==null||s.call(Oe,"success","Messages Sent",`${e} ${a} delivered after reconnecting.`)}return e}function nx(t){if(t.payload&&typeof t.payload=="object"){const e=t.payload;if(e.agentId)return e.agentId;if(e.parentAgentId)return e.parentAgentId;if(e.bossId)return e.bossId;if(e.id)return e.id}return null}function BR(t){const e=gp();if(!e||e.readyState!==WebSocket.OPEN)return!1;try{const n=JSON.stringify(t),s=nx(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",s,"payload:",t.payload),s&&ps.captureSent(s,n),e.send(n),!0}catch{return!1}}function sx(t){var n,s,a,r,i,c,d,f,h,m;const e=gp();if(!e)return(n=Nk())==null||n(),t.type==="send_command"?(Qd(t),(s=Oe.onToast)==null||s.call(Oe,"warning","Message Queued","Connection lost. Your message will be sent when reconnected.")):(a=Oe.onToast)==null||a.call(Oe,"error","Not Connected","Connecting to server... Please try again in a moment."),!1;if(e.readyState!==WebSocket.OPEN)return e.readyState===WebSocket.CONNECTING?t.type==="send_command"?(Qd(t),(r=Oe.onToast)==null||r.call(Oe,"warning","Message Queued","Still connecting. Your message will be sent automatically.")):(i=Oe.onToast)==null||i.call(Oe,"warning","Connecting...","WebSocket is still connecting. Please wait a moment and try again."):(e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING)&&((c=Nk())==null||c(),t.type==="send_command"?(Qd(t),(d=Oe.onToast)==null||d.call(Oe,"warning","Message Queued","Connection lost. Your message will be sent when reconnected.")):(f=Oe.onToast)==null||f.call(Oe,"warning","Reconnecting...","Connection lost. Reconnecting to server...")),!1;try{const x=JSON.stringify(t),y=nx(t);return console.log("[AgentDebugger] SENT - type:",t.type,"agentId:",y,"payload:",t.payload),y&&ps.captureSent(y,x),e.send(x),!0}catch(x){return t.type==="send_command"?(Qd(t),(h=Oe.onToast)==null||h.call(Oe,"warning","Message Queued","Send failed. Your message will be retried when reconnected.")):(m=Oe.onToast)==null||m.call(Oe,"error","Send Failed",`Failed to send message: ${x}`),!1}}const Xc=new Set,FR=5e3;function Tk(t){if(!t.isDetached||!t.sessionId){Xc.delete(t.id);return}Xc.has(t.id)||(Xc.add(t.id),sx({type:"reattach_agent",payload:{agentId:t.id}}),setTimeout(()=>{Xc.delete(t.id)},FR))}function zR(t){var e,n,s,a,r,i,c,d,f,h,m,x,y,v,S,A,k,N,j,E,D,_,B,O;switch(gb.start(`ws:${t.type}`),t.type){case"agents_update":{const T=t.payload,M=T.filter(R=>R.class==="boss"||R.isBoss);M.length>0&&console.log("[WS agents_update] Boss agents received:",M.map(R=>({id:R.id,name:R.name,subordinateIds:R.subordinateIds}))),H.setAgents(T),(e=Oe.onAgentsSync)==null||e.call(Oe,T),H.loadToolHistory();for(const R of T)Tk(R);break}case"agent_created":{const T=t.payload;console.log("[WebSocket] Agent created:",T),H.addAgent(T);const M=(n=window.__spawnModalAreaContext)==null?void 0:n.areaId;M&&(H.assignAgentToArea(T.id,M),window.__spawnModalAreaContext=null),H.selectAgent(T.id),(s=Oe.onAgentCreated)==null||s.call(Oe,T),(a=Oe.onSpawnSuccess)==null||a.call(Oe),window.__spawnModalSuccess&&(console.log("[WebSocket] Calling __spawnModalSuccess"),window.__spawnModalSuccess()),(r=Oe.onToast)==null||r.call(Oe,"success","Agent Deployed",`${T.name} is ready for commands`);break}case"agent_updated":{const T=t.payload,R=H.getState().agents.get(T.id),F=(R==null?void 0:R.status)!==T.status;console.log(`[Tide] Agent updated: ${T.name} (${T.id}) status=${T.status} (was ${R==null?void 0:R.status})${F?" ⚡ STATUS CHANGED":""}`),F&&console.log(`[Tide] 🔔 Status change for ${T.name}: ${R==null?void 0:R.status} → ${T.status}`),F&&(R==null?void 0:R.status)==="working"&&T.status==="idle"&&H.triggerHistoryRefresh(T.id);const $=R?R.position.x!==T.position.x||R.position.z!==T.position.z:!1;H.updateAgent(T),Tk(T),(i=Oe.onAgentUpdated)==null||i.call(Oe,T,$);break}case"agent_deleted":{const{id:T}=t.payload;Xc.delete(T),H.removeAgent(T),(c=Oe.onAgentDeleted)==null||c.call(Oe,T);break}case"activity":{const T=t.payload;H.addActivity(T);break}case"event":{const T=t.payload;if(yu.debug(`Event: ${T.type}`,{agentId:T.agentId,toolName:T.toolName},"ws:event"),T.type==="tool_start"&&T.toolName&&((d=Oe.onToolUse)==null||d.call(Oe,T.agentId,T.toolName,T.toolInput),H.addToolExecution(T.agentId,T.toolName,T.toolInput),T.toolInput)){const M=T.toolInput.file_path||T.toolInput.path;M&&(T.toolName==="Write"?H.addFileChange(T.agentId,"created",M):T.toolName==="Edit"?H.addFileChange(T.agentId,"modified",M):T.toolName==="Read"&&H.addFileChange(T.agentId,"read",M))}break}case"output":{const T=t.payload;yu.debug(`Output: "${T.text.slice(0,80)}..."`,{agentId:T.agentId,isStreaming:T.isStreaming,length:T.text.length,hasSkillUpdate:!!T.skillUpdate,uuid:T.uuid,toolName:T.toolName},"ws:output"),H.addOutput(T.agentId,{text:T.text,isStreaming:T.isStreaming,timestamp:T.timestamp,isDelegation:T.isDelegation,skillUpdate:T.skillUpdate,subagentName:T.subagentName,uuid:T.uuid,toolName:T.toolName,toolInput:T.toolInput,toolOutput:T.toolOutput});break}case"context_stats":{const{agentId:T,stats:M}=t.payload;console.log(`[Tide] Received context stats for agent ${T}: ${M.usedPercent}% used`),H.updateAgentContextStats(T,M);break}case"context_update":{const{agentId:T,contextUsed:M,contextLimit:R}=t.payload;H.updateAgentContext(T,M,R);break}case"compacting_status":{const{agentId:T,active:M}=t.payload;H.setAgentCompacting(T,M);break}case"error":{const T=t.payload;console.error("[WebSocket] Error from server:",T.message),(f=Oe.onToast)==null||f.call(Oe,"error","Error",T.message),(h=Oe.onSpawnError)==null||h.call(Oe),window.__spawnModalError&&(console.log("[WebSocket] Calling __spawnModalError"),window.__spawnModalError());break}case"directory_not_found":{const{path:T}=t.payload;console.log("[WebSocket] Directory not found:",T),(m=Oe.onDirectoryNotFound)==null||m.call(Oe,T),window.__spawnModalDirNotFound&&(console.log("[WebSocket] Calling __spawnModalDirNotFound"),window.__spawnModalDirNotFound(T));break}case"command_started":{const{agentId:T,command:M}=t.payload,R=M.trim();if(R==="/context"||R==="/cost"||R==="/compact")break;H.addUserPromptToOutput(T,M);break}case"session_updated":{const{agentId:T}=t.payload;H.loadToolHistory(),H.triggerHistoryRefresh(T);const M=H.getState().agents.get(T);M&&H.updateAgent({...M});break}case"supervisor_report":{const T=t.payload;H.setSupervisorReport(T);break}case"narrative_update":{const{agentId:T,narrative:M}=t.payload;H.addNarrative(T,M);break}case"supervisor_status":{const T=t.payload;H.setSupervisorStatus(T);break}case"agent_supervisor_history":{const T=t.payload;H.setAgentSupervisorHistory(T);break}case"agent_analysis":{const{agentId:T,analysis:M}=t.payload;H.addAgentAnalysis(T,M);break}case"areas_update":{const T=t.payload;H.setAreasFromServer(T),(x=Oe.onAreasSync)==null||x.call(Oe);break}case"buildings_update":{const T=t.payload;H.setBuildingsFromServer(T);break}case"building_created":{const T=t.payload;H.addBuilding(T);break}case"building_updated":{const T=t.payload;H.updateBuildingFromServer(T),(y=Oe.onBuildingUpdated)==null||y.call(Oe,T);break}case"building_deleted":{const{id:T}=t.payload;H.removeBuildingFromServer(T);break}case"building_logs":{const{buildingId:T,logs:M}=t.payload;H.addBuildingLogs(T,M);break}case"pm2_logs_chunk":{const{buildingId:T,chunk:M}=t.payload;H.appendStreamingLogChunk(T,M);break}case"pm2_logs_streaming":{const{buildingId:T,streaming:M}=t.payload;H.setStreamingStatus(T,M);break}case"docker_logs_chunk":{const{buildingId:T,chunk:M}=t.payload;H.appendStreamingLogChunk(T,M);break}case"docker_logs_streaming":{const{buildingId:T,streaming:M}=t.payload;H.setStreamingStatus(T,M);break}case"docker_containers_list":{const{containers:T,composeProjects:M}=t.payload;console.log(`[WebSocket] Received ${T.length} containers, ${M.length} compose projects`),H.setDockerContainersList(T,M);break}case"boss_building_logs_chunk":{const{bossBuildingId:T,subordinateBuildingId:M,subordinateBuildingName:R,chunk:F,isError:$}=t.payload;H.appendBossStreamingLogChunk(T,M,R,F,$);break}case"boss_building_subordinates_updated":{const{bossBuildingId:T,subordinateBuildingIds:M}=t.payload;H.updateBuilding(T,{subordinateBuildingIds:M});break}case"permission_request":{const T=t.payload;H.addPermissionRequest(T);break}case"permission_resolved":{const{requestId:T,approved:M}=t.payload;H.resolvePermissionRequest(T,M);break}case"delegation_decision":{const T=t.payload;H.handleDelegationDecision(T),T.status==="sent"&&((v=Oe.onToast)==null||v.call(Oe,"info","Task Delegated",`Delegated to ${T.selectedAgentName}: ${T.reasoning.slice(0,80)}...`),T.bossId&&T.selectedAgentId&&((S=Oe.onDelegation)==null||S.call(Oe,T.bossId,T.selectedAgentId)));break}case"boss_subordinates_updated":{const{bossId:T,subordinateIds:M}=t.payload;H.updateBossSubordinates(T,M);break}case"delegation_history":{const{bossId:T,decisions:M}=t.payload;H.setDelegationHistory(T,M);break}case"boss_spawned_agent":{const{agent:T,bossPosition:M}=t.payload;console.log("[WebSocket] Boss spawned agent:",T.name,"- walking to boss at",M),H.addAgent(T),(A=Oe.onAgentCreated)==null||A.call(Oe,T),sx({type:"move_agent",payload:{agentId:T.id,position:M}}),(k=Oe.onToast)==null||k.call(Oe,"success","Agent Deployed",`${T.name} spawned by boss, walking to position`);break}case"agent_task_started":{const{bossId:T,subordinateId:M,subordinateName:R,taskDescription:F}=t.payload;console.log(`[WebSocket] Agent ${R} started task for boss ${T}: ${F.slice(0,50)}...`),H.handleAgentTaskStarted(T,M,R,F);break}case"agent_task_output":{const{bossId:T,subordinateId:M,output:R,isStreaming:F,timestamp:$,subagentName:U,toolName:L,toolInput:z,toolOutput:W}=t.payload;H.handleAgentTaskOutput(T,M,{text:R,isStreaming:F||!1,timestamp:$||Date.now(),subagentName:U,toolName:L,toolInput:z,toolOutput:W});break}case"agent_task_completed":{const{bossId:T,subordinateId:M,success:R}=t.payload;console.log(`[WebSocket] Agent task completed for boss ${T}, subordinate ${M}, success: ${R}`),H.handleAgentTaskCompleted(T,M,R);break}case"skills_update":{const T=t.payload;H.setSkillsFromServer(T);break}case"skill_created":{const T=t.payload;H.addSkillFromServer(T),console.log(`[WebSocket] Skill created: ${T.name}`);break}case"skill_updated":{const T=t.payload;H.updateSkillFromServer(T),console.log(`[WebSocket] Skill updated: ${T.name}`);break}case"skill_deleted":{const{id:T}=t.payload;H.removeSkillFromServer(T),console.log(`[WebSocket] Skill deleted: ${T}`);break}case"agent_skills":{const{agentId:T,skills:M}=t.payload;console.log(`[WebSocket] Agent ${T} has ${M.length} skills`);break}case"custom_agent_classes_update":{const T=t.payload;H.setCustomAgentClassesFromServer(T),console.log(`[WebSocket] Received ${T.length} custom agent classes`);const M=new Map;for(const R of T)M.set(R.id,R);(N=Oe.onCustomClassesSync)==null||N.call(Oe,M);break}case"custom_agent_class_created":{const T=t.payload;H.addCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class created: ${T.name}`),(j=Oe.onCustomClassesSync)==null||j.call(Oe,H.getState().customAgentClasses);break}case"custom_agent_class_updated":{const T=t.payload;H.updateCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class updated: ${T.name}`),(E=Oe.onCustomClassesSync)==null||E.call(Oe,H.getState().customAgentClasses);break}case"custom_agent_class_deleted":{const{id:T}=t.payload;H.removeCustomAgentClassFromServer(T),console.log(`[WebSocket] Custom agent class deleted: ${T}`),(D=Oe.onCustomClassesSync)==null||D.call(Oe,H.getState().customAgentClasses);break}case"global_usage":{const T=t.payload;console.log("[WebSocket] Global usage update:",T),H.setGlobalUsage(T);break}case"agent_notification":{const T=t.payload;console.log(`[WebSocket] Agent notification from ${T.agentName}: ${T.title}`),(_=Oe.onAgentNotification)==null||_.call(Oe,T);break}case"focus_agent":{const{agentId:T,openTerminal:M}=t.payload;if(!H.getState().agents.get(T)){console.warn(`[WebSocket] focus_agent ignored - agent not found: ${T}`);break}H.selectAgent(T),M&&H.setTerminalOpen(!0);const F=[0,80,220,500,1e3];for(const $ of F)window.setTimeout(()=>{window.focus()},$);break}case"exec_task_started":{const{taskId:T,agentId:M,agentName:R,command:F,cwd:$}=t.payload;console.log(`[WebSocket] Exec task started: ${T} for agent ${R}: ${F.slice(0,50)}...`),H.handleExecTaskStarted(T,M,R,F,$);break}case"exec_task_output":{const{taskId:T,agentId:M,output:R,isError:F}=t.payload;H.handleExecTaskOutput(T,M,R,F);break}case"exec_task_completed":{const{taskId:T,agentId:M,exitCode:R,success:F}=t.payload;console.log(`[WebSocket] Exec task completed: ${T} for agent ${M}, success: ${F}`),H.handleExecTaskCompleted(T,M,R,F);break}case"subagent_started":{const T=t.payload;console.log(`[WebSocket] Subagent started: ${T.name} (${T.id}) for agent ${T.parentAgentId}`),H.addSubagent(T),(B=Oe.onSubagentStarted)==null||B.call(Oe,T);break}case"subagent_output":{const{subagentId:T,parentAgentId:M,text:R,timestamp:F}=t.payload,$=R.indexOf(":");if($>0){const U=R.slice(0,$).trim(),L=R.slice($+1).trim();H.addSubagentActivity(T,M,{toolName:U,description:L,timestamp:F})}else R.startsWith("Using ")&&H.addSubagentActivity(T,M,{toolName:R.slice(6).trim(),description:"",timestamp:F});break}case"subagent_completed":{const{subagentId:T,parentAgentId:M,success:R,resultPreview:F,subagentName:$,durationMs:U,tokensUsed:L,toolUseCount:z}=t.payload;console.log(`[WebSocket] Subagent completed: ${T} for agent ${M}, success: ${R}`),(U||L||z)&&H.updateSubagentStats(T,M,{durationMs:U||0,tokensUsed:L||0,toolUseCount:z||0}),H.completeSubagent(T,M,R),(O=Oe.onSubagentCompleted)==null||O.call(Oe,T);const W=H.getSubagent(T)||H.getSubagentByToolUseId(T),V=$||(W==null?void 0:W.name)||T,Y=R?"✅":"❌",P=U?` (${(U/1e3).toFixed(0)}s · ${((L||0)/1e3).toFixed(1)}K tokens · ${z||0} tools)`:"";H.addOutput(M,{text:`${Y} Subagent ${V} ${R?"completed":"failed"}${P}`,isStreaming:!1,timestamp:Date.now(),subagentName:V,toolOutput:F});break}case"subagent_stream":{const{toolUseId:T,parentAgentId:M,entries:R}=t.payload;H.addSubagentStreamEntries(T,M,R);break}case"secrets_update":{const T=t.payload;H.setSecretsFromServer(T),console.log(`[WebSocket] Received ${T.length} secrets`);break}case"secret_created":{const T=t.payload;H.addSecretFromServer(T),console.log(`[WebSocket] Secret created: ${T.name}`);break}case"secret_updated":{const T=t.payload;H.updateSecretFromServer(T),console.log(`[WebSocket] Secret updated: ${T.name}`);break}case"secret_deleted":{const{id:T}=t.payload;H.removeSecretFromServer(T),console.log(`[WebSocket] Secret deleted: ${T}`);break}case"database_connection_result":{const{buildingId:T,connectionId:M,success:R,error:F,serverVersion:$}=t.payload;H.setConnectionStatus(T,M,{connected:R,error:F,serverVersion:$}),console.log(`[WebSocket] Database connection ${R?"succeeded":"failed"}: ${M}`);break}case"databases_list":{const{buildingId:T,connectionId:M,databases:R}=t.payload;H.setDatabases(T,M,R),console.log(`[WebSocket] Received ${R.length} databases for ${M}`);break}case"tables_list":{const{buildingId:T,connectionId:M,database:R,tables:F}=t.payload;H.setTables(T,M,R,F),console.log(`[WebSocket] Received ${F.length} tables for ${R}`);break}case"table_schema":{const{buildingId:T,connectionId:M,database:R,table:F,columns:$,indexes:U,foreignKeys:L}=t.payload;H.setTableSchema(T,M,R,F,{columns:$,indexes:U||[],foreignKeys:L||[]}),console.log(`[WebSocket] Received schema for ${F}`);break}case"query_result":{const{buildingId:T,result:M}=t.payload;H.setQueryResult(T,M),console.log(`[WebSocket] Query ${M.status}: ${M.rowCount??M.affectedRows??0} rows in ${M.duration}ms`);break}case"silent_query_result":{const{buildingId:T,query:M,requestId:R,success:F,affectedRows:$,error:U}=t.payload;H.setSilentQueryResult(T,{query:M,requestId:R,success:F,affectedRows:$,error:U}),console.log(`[WebSocket] Silent query ${F?"succeeded":"failed"}: ${$??0} affected rows`);break}case"query_history_update":{const{buildingId:T,history:M}=t.payload;H.setQueryHistory(T,M),console.log(`[WebSocket] Received ${M.length} query history entries for ${T}`);break}}gb.end(`ws:${t.type}`)}ER(()=>vu());let _k=!1;function pj(){const t=gp();t&&t.readyState===WebSocket.OPEN&&t.close(1e3,"Page unloading");const e=ij();e&&clearTimeout(e),window.__tideWsState&&(window.__tideWsState.ws=null,window.__tideWsState.reconnectTimeout=null,window.__tideWsState.isConnecting=!1,window.__tideWsState.reconnectAttempts=0),_R()}function $R(){_k||(window.addEventListener("beforeunload",pj),_k=!0)}function hj(){pj(),H.setConnected(!1),H.stopStatusPolling()}function HR(){hj(),mb(0),setTimeout(()=>vu(),100)}function vu(){$R();const t=ij();t&&(clearTimeout(t),oj(null));const e=gp();if(NR()||e&&e.readyState===WebSocket.CONNECTING)return;if(e&&e.readyState===WebSocket.OPEN){jk()&&Oe.onReconnect&&Oe.onReconnect();return}mb(hb()+1),Rc(!0);const n=Jb(),s=ji(),a=6200;let r;if(n){const c=n.replace(/^https:\/\//,"wss://").replace(/^http:\/\//,"ws://");r=c.endsWith("/ws")?c:`${c.replace(/\/$/,"")}/ws`}else r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;let i=null;try{s?i=new WebSocket(r,[`auth-${s}`]):i=new WebSocket(r)}catch{Rc(!1),Ek();return}Ck(i),i.onopen=()=>{var d,f,h;const c=jk();Rc(!1),mb(0),TR(),H.setConnected(!0),H.startStatusPolling(),H.clearAllPermissions(),c?((d=Oe.onToast)==null||d.call(Oe,"success","Reconnected","Connection restored - refreshing data..."),(f=Oe.onReconnect)==null||f.call(Oe)):(h=Oe.onToast)==null||h.call(Oe,"success","Connected","Connected to Tide Commander server"),jR(n,s),IR()},i.onmessage=c=>{try{const d=JSON.parse(c.data),f=nx(d);console.log("[AgentDebugger] RECEIVED - type:",d.type,"agentId:",f,"payload:",d.payload),f&&ps.captureReceived(f,c.data),zR(d)}catch(d){const f=c.data.substring(0,200);console.error("[WS] Failed to parse message:",d),console.error("[WS] Raw data (first 200 chars):",f),console.error("[WS] Full data length:",c.data.length),c.data.length<5e3&&console.error("[WS] Full malformed message:",c.data)}},i.onclose=()=>{var d,f;Rc(!1),Ck(null),H.setConnected(!1),H.stopStatusPolling();const c=hb();c<Ak?((d=Oe.onToast)==null||d.call(Oe,"warning","Disconnected",`Connection lost. Reconnecting... (attempt ${c+1}/${Ak})`),Ek()):(f=Oe.onToast)==null||f.call(Oe,"error","Connection Failed",`Could not connect to server. Please check if the backend is running on port ${a}.`)},i.onerror=()=>{Rc(!1)},H.setSendMessage(sx)}function Ek(){const t=hb(),e=Math.min(1e3*Math.pow(2,t-1),3e4);oj(setTimeout(vu,e))}function UR(t,e){const n={position:t,target:e};wa(pt.CAMERA_STATE,n)}function WR(){return ea(pt.CAMERA_STATE,null)}function Dq(t,e,n){const s={posX:t,posZ:e,zoom:n};wa(pt.CAMERA_STATE_2D,s)}function Rq(){return ea(pt.CAMERA_STATE_2D,null)}function El(){return{Authorization:`Bearer ${ji()}`,"Content-Type":"application/json"}}async function qR(){const t=await fetch(`${Aa()}/api/workspaces`,{headers:El()});if(!t.ok)throw new Error(`Failed to fetch workspaces: ${t.statusText}`);return t.json()}async function VR(t,e){const n=await fetch(`${Aa()}/api/workspaces`,{method:"POST",headers:El(),body:JSON.stringify({name:t,areaIds:e})});if(!n.ok)throw new Error(`Failed to create workspace: ${n.statusText}`);return n.json()}async function Mk(t,e){const n=await fetch(`${Aa()}/api/workspaces/${t}`,{method:"PUT",headers:El(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to update workspace: ${n.statusText}`);return n.json()}async function GR(t){const e=await fetch(`${Aa()}/api/workspaces/${t}`,{method:"DELETE",headers:El()});if(!e.ok)throw new Error(`Failed to delete workspace: ${e.statusText}`)}async function YR(){const t=await fetch(`${Aa()}/api/workspaces/active`,{headers:El()});if(!t.ok)throw new Error(`Failed to get active workspace: ${t.statusText}`);return(await t.json()).activeWorkspaceId??null}async function Dk(t){const e=await fetch(`${Aa()}/api/workspaces/active`,{method:"PUT",headers:El(),body:JSON.stringify({workspaceId:t})});if(!e.ok)throw new Error(`Failed to set active workspace: ${e.statusText}`)}const wu=new Set;let Ka=null,Xi=[],mj=!1;const xb=new Set;function Qm(t){mj=t,xb.forEach(e=>e(t))}const gj="tide-commander-active-workspace";function Rk(){return typeof window>"u"?null:localStorage.getItem(gj)||null}function Xm(t){typeof window>"u"||localStorage.setItem(gj,t||"")}function Lc(){wu.forEach(t=>t())}function KR(){return Ka}function ax(t){return Ka?t?Ka.areaIds.includes(t):!1:!0}function Oq(t){return Ka?Ka.areaIds.includes(t):!0}function bj(){const[,t]=b.useState(0);return b.useEffect(()=>{const e=()=>t(n=>n+1);return wu.add(e),()=>{wu.delete(e)}},[]),[Ka,Xi]}function QR(t){return wu.add(t),()=>{wu.delete(t)}}function XR(){const[t,e]=b.useState(mj);return b.useEffect(()=>{const n=s=>e(s);return xb.add(n),()=>{xb.delete(n)}},[]),t}const Jm=new Map,xj=je.memo(function(){const{t:e}=ht("common"),n=sr(),[s,a]=b.useState([]),[r,i]=b.useState(()=>Rk()),[c,d]=b.useState(!1),[f,h]=b.useState(!1),[m,x]=b.useState(!0),[y,v]=b.useState(null),[S,A]=b.useState(""),[k,N]=b.useState([]),[j,E]=b.useState(!1),D=b.useRef(null);b.useEffect(()=>{let L=!1;return(async()=>{try{const z=Rk(),[W,V]=await Promise.all([qR(),YR()]);if(L)return;const Y=z&&W.some(P=>P.id===z)?z:V&&W.some(P=>P.id===V)?V:null;a(W),Xi=W,i(Y),Xm(Y),Ka=W.find(P=>P.id===Y)??null,Lc()}catch(z){console.error("workspace error:",z)}finally{L||x(!1)}})(),()=>{L=!0}},[]),b.useEffect(()=>{if(!c&&!f)return;const L=z=>{D.current&&!D.current.contains(z.target)&&(d(!1),h(!1))};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[c,f]);const _=b.useMemo(()=>s.find(L=>L.id===r)??null,[s,r]),B=b.useCallback(async L=>{Qm(!0);const z=Date.now();if(r){const P=WR();P&&(Jm.set(r,P),Mk(r,{cameraState:P}).then(K=>{a(Q=>{const q=Q.map(be=>be.id===r?K:be);return Xi=q,q})}).catch(K=>console.error("workspace error:",K)))}i(L),Xm(L),d(!1);const W=L?s.find(P=>P.id===L)??null:null;if(Ka=W,Xi=s,Lc(),L){const K=(W==null?void 0:W.cameraState)??Jm.get(L);K&&(UR(K.position,K.target),Jm.set(L,K))}Dk(L).catch(P=>console.error("workspace error:",P));const V=Date.now()-z,Y=400;V<Y?setTimeout(()=>Qm(!1),Y-V):Qm(!1)},[r,s]),O=b.useMemo(()=>Array.from(n.values()).filter(L=>!L.archived),[n]),T=b.useCallback(async()=>{if(S.trim())try{const L=await VR(S.trim(),k),z=[...s,L];a(z),Xi=z,Lc(),A(""),N([]),E(!1)}catch(L){console.error("workspace error:",L)}},[S,k,s]),M=b.useCallback(async()=>{if(!(!y||!S.trim()))try{const L=await Mk(y,{name:S.trim(),areaIds:k}),z=s.map(W=>W.id===y?L:W);a(z),Xi=z,y===r&&(Ka=L),Lc(),v(null),A(""),N([])}catch(L){console.error("workspace error:",L)}},[y,S,k,s,r]),R=b.useCallback(async L=>{try{await GR(L);const z=s.filter(W=>W.id!==L);a(z),Xi=z,r===L&&(i(null),Xm(null),Ka=null,await Dk(null).catch(W=>console.error("workspace error:",W))),Lc()}catch(z){console.error("workspace error:",z)}},[s,r]),F=b.useCallback(L=>{v(L.id),A(L.name),N([...L.areaIds]),E(!1)},[]),$=b.useCallback(()=>{v(null),A(""),N([]),E(!0)},[]),U=b.useCallback(L=>{N(z=>z.includes(L)?z.filter(W=>W!==L):[...z,L])},[]);return m?null:o.jsxs("div",{className:"workspace-switcher",ref:D,children:[o.jsxs("button",{className:"workspace-switcher-trigger",onClick:()=>{d(!c),h(!1)},title:"Workspaces",children:[o.jsx("span",{className:"workspace-switcher-icon",children:"📂"}),o.jsx("span",{className:"workspace-switcher-label",children:_?_.name:e("agentBar.allWorkspaces",{defaultValue:"All"})}),o.jsx("span",{className:"workspace-switcher-arrow",children:c?"▲":"▼"})]}),c&&!f&&o.jsxs("div",{className:"workspace-switcher-dropdown",children:[o.jsx("button",{className:`workspace-switcher-option ${r?"":"active"}`,onClick:()=>B(null),children:e("agentBar.allWorkspaces",{defaultValue:"All"})}),s.map(L=>o.jsxs("button",{className:`workspace-switcher-option ${L.id===r?"active":""}`,onClick:()=>B(L.id),children:[L.name,o.jsx("span",{className:"workspace-switcher-option-count",children:L.areaIds.length})]},L.id)),o.jsx("div",{className:"workspace-switcher-divider"}),o.jsxs("button",{className:"workspace-switcher-option workspace-switcher-manage",onClick:()=>h(!0),children:["⚙ ",e("agentBar.manageWorkspaces",{defaultValue:"Manage"})]})]}),f&&o.jsxs("div",{className:"workspace-switcher-dropdown workspace-switcher-manager",children:[o.jsxs("div",{className:"workspace-switcher-manager-header",children:[o.jsx("span",{children:e("agentBar.workspaces",{defaultValue:"Workspaces"})}),o.jsx("button",{className:"workspace-switcher-close",onClick:()=>h(!1),children:"×"})]}),o.jsx("div",{className:"workspace-switcher-manager-list",children:s.map(L=>o.jsx("div",{className:"workspace-switcher-manager-item",children:y===L.id?o.jsxs("div",{className:"workspace-switcher-editor",children:[o.jsx("input",{type:"text",value:S,onChange:z=>A(z.target.value),className:"workspace-switcher-input",placeholder:"Workspace name",autoFocus:!0,onKeyDown:z=>{z.key==="Enter"&&M(),z.key==="Escape"&&v(null)}}),o.jsxs("div",{className:"workspace-switcher-area-list",children:[O.map(z=>o.jsxs("label",{className:"workspace-switcher-area-check",children:[o.jsx("input",{type:"checkbox",checked:k.includes(z.id),onChange:()=>U(z.id)}),o.jsx("span",{style:{color:z.color},children:z.name})]},z.id)),O.length===0&&o.jsx("span",{className:"workspace-switcher-empty",children:"No areas"})]}),o.jsxs("div",{className:"workspace-switcher-editor-actions",children:[o.jsx("button",{className:"workspace-switcher-btn-save",onClick:M,children:"Save"}),o.jsx("button",{className:"workspace-switcher-btn-cancel",onClick:()=>v(null),children:"Cancel"})]})]}):o.jsxs("div",{className:"workspace-switcher-manager-row",children:[o.jsx("span",{className:"workspace-switcher-manager-name",children:L.name}),o.jsxs("span",{className:"workspace-switcher-manager-count",children:[L.areaIds.length," areas"]}),o.jsx("button",{className:"workspace-switcher-btn-edit",onClick:()=>F(L),title:"Edit",children:"✏"}),o.jsx("button",{className:"workspace-switcher-btn-delete",onClick:()=>R(L.id),title:"Delete",children:"🗑"})]})},L.id))}),j?o.jsxs("div",{className:"workspace-switcher-editor workspace-switcher-create-form",children:[o.jsx("input",{type:"text",value:S,onChange:L=>A(L.target.value),className:"workspace-switcher-input",placeholder:"New workspace name",autoFocus:!0,onKeyDown:L=>{L.key==="Enter"&&T(),L.key==="Escape"&&E(!1)}}),o.jsxs("div",{className:"workspace-switcher-area-list",children:[O.map(L=>o.jsxs("label",{className:"workspace-switcher-area-check",children:[o.jsx("input",{type:"checkbox",checked:k.includes(L.id),onChange:()=>U(L.id)}),o.jsx("span",{style:{color:L.color},children:L.name})]},L.id)),O.length===0&&o.jsx("span",{className:"workspace-switcher-empty",children:"No areas"})]}),o.jsxs("div",{className:"workspace-switcher-editor-actions",children:[o.jsx("button",{className:"workspace-switcher-btn-save",onClick:T,children:"Create"}),o.jsx("button",{className:"workspace-switcher-btn-cancel",onClick:()=>E(!1),children:"Cancel"})]})]}):o.jsxs("button",{className:"workspace-switcher-option workspace-switcher-add",onClick:$,children:["+ ",e("agentBar.newWorkspace",{defaultValue:"New Workspace"})]})]})]})}),Uf="tide_webgl_active";typeof window<"u"&&(window.__tidePersistedScene===void 0&&(window.__tidePersistedScene=null),window.__tidePersistedCanvas===void 0&&(window.__tidePersistedCanvas=null),window.__tideWsConnected===void 0&&(window.__tideWsConnected=!1),window.__tideIsPageUnloading===void 0&&(window.__tideIsPageUnloading=!1));function bp(){return typeof window<"u"?window.__tidePersistedScene??null:null}function yj(){return typeof window<"u"?window.__tidePersistedCanvas??null:null}function JR(){return typeof window<"u"?window.__tideWsConnected??!1:!1}function ku(t){typeof window<"u"&&(window.__tidePersistedScene=t)}function ou(t){typeof window<"u"&&(window.__tidePersistedCanvas=t)}function vj(t){typeof window<"u"&&(window.__tideWsConnected=t)}function ZR(t){typeof window<"u"&&(window.__tideIsPageUnloading=t)}function eO(){sessionStorage.setItem(Uf,"true")}function Xd(t){ZR(!0),sessionStorage.removeItem(Uf),hj(),MR(),window.__tideScene&&(window.__tideScene=null);const e=bp();e?(console.log("[App] Calling persistedScene.dispose()"),e.dispose(),ku(null)):console.log("[App] No persistedScene to dispose"),ou(null),vj(!1);const n=document.getElementById("battlefield");n&&n.remove();const s=document.getElementById("app");s&&(s.innerHTML="")}function tO(){var a,r;if(window.__tideAppInitialized)return;if(window.__tideAppInitialized=!0,sessionStorage.getItem(Uf)==="true"&&console.log("[App] Detected unclean shutdown from previous session - forcing cleanup"),window.__tideScene){console.log("[App] Cleaning up stale __tideScene reference");try{(r=(a=window.__tideScene).dispose)==null||r.call(a)}catch{}window.__tideScene=null}const e=bp();if(e){console.log("[App] Cleaning up stale persistedScene");try{e.dispose()}catch{}ku(null)}const n=document.getElementById("battlefield"),s=yj();n&&n!==s&&n.remove(),sessionStorage.removeItem(Uf)}function nO(){typeof window>"u"||(tO(),window.addEventListener("pageshow",t=>{t.persisted&&(console.log("[App] Page restored from bfcache - cleaning up"),Xd(),window.location.reload())}),window.onunload=()=>Xd(),window.onbeforeunload=t=>{Xd()},window.addEventListener("pagehide",t=>{Xd(`pagehide (persisted=${t.persisted})`)}))}nO();const Ok={showTrees:!0,showBushes:!0,showHouse:!0,showLamps:!0,showGrass:!0,showClouds:!0,fogDensity:1,floorStyle:"metal",brightness:1,skyColor:null,battlefieldSize:50},Lk={saturation:2,roughness:.5,metalness:-1,emissiveBoost:0,envMapIntensity:1,wireframe:!1,colorMode:"normal"},Pk={idleAnimation:"sit",workingAnimation:"sprint"},sO=0;function wj(){const t={characterScale:2,scale2d:.7,scale3d:.7,show2DTaskLabels:!0,gridVisible:!1,timeMode:"day",terrain:Ok,modelStyle:Lk,animations:Pk,fpsLimit:sO},e=ea(pt.CONFIG,null);if(e){const n=e.indicatorScale;return{characterScale:e.characterScale??t.characterScale,scale2d:e.scale2d??n??t.scale2d,scale3d:e.scale3d??n??t.scale3d,show2DTaskLabels:e.show2DTaskLabels??t.show2DTaskLabels,gridVisible:e.gridVisible??t.gridVisible,timeMode:e.timeMode??t.timeMode,terrain:{...Ok,...e.terrain},modelStyle:{...Lk,...e.modelStyle},animations:{...Pk,...e.animations},fpsLimit:e.fpsLimit??t.fpsLimit}}return t}function aO(t){wa(pt.CONFIG,t)}function rO(){return typeof window>"u"?!0:window.matchMedia("(max-width: 768px)").matches}typeof window<"u"&&!window.__tideHmrRefreshListeners&&(window.__tideHmrRefreshListeners=new Set);function kj(){console.log("[Tide HMR] Manual scene refresh triggered");const t=bp();if(t){try{t.dispose()}catch(n){console.warn("[Tide HMR] Error disposing scene:",n)}ku(null)}ou(null),window.__tideScene&&(window.__tideScene=null);const e=document.getElementById("battlefield");if(e){const n=e.getContext("webgl2")||e.getContext("webgl");if(n){const s=n.getExtension("WEBGL_lose_context");s&&s.loseContext()}}window.__tideHmrPendingSceneChanges=!1,window.location.reload()}typeof window<"u"&&(window.__tideHmrSceneRefresh=kj);function iO({canvasRef:t,selectionBoxRef:e,viewMode:n,sceneMountKey:s=0,showToast:a,showAgentNotification:r,toolboxModal:i,contextMenu:c,setHoveredAgentPopup:d,setBuildingPopup:f,getBuildingPopup:h,openBuildingModal:m,openPM2LogsModal:x,openBossLogsModal:y,openDatabasePanel:v,onSceneLoadingChange:S}){const A=b.useRef(null),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),E=b.useRef(null);return b.useEffect(()=>{if(n!=="3d"){S==null||S(!1);return}if(!t.current||!e.current)return;let D=!1;S==null||S(!0);const _=bp(),O=yj()===t.current;function T(){var R,F,$,U,L,z,W,V;(R=A.current)==null||R.setOnToast(a),(F=A.current)==null||F.setOnBuildingClick((Y,P)=>{H.selectBuilding(Y);const K=H.getState().buildings.get(Y);(K==null?void 0:K.type)==="folder"&&K.folderPath?H.openFileExplorer(K.folderPath):(K==null?void 0:K.type)==="server"||(K==null?void 0:K.type)==="boss"||(K==null?void 0:K.type)==="database"?(k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{f({buildingId:Y,screenPos:P,fromClick:!0}),k.current=null},150)):m(Y)}),($=A.current)==null||$.setOnContextMenu((Y,P,K)=>{c.open(Y,P,K)}),(U=A.current)==null||U.setOnAgentHover(()=>{}),(L=A.current)==null||L.setOnBuildingHover((Y,P)=>{const K=h();if(Y&&P){const Q=H.getState().buildings.get(Y);((Q==null?void 0:Q.type)==="server"||(Q==null?void 0:Q.type)==="boss"||(Q==null?void 0:Q.type)==="database")&&!(K!=null&&K.fromClick)&&f({buildingId:Y,screenPos:P,fromClick:!1})}else K!=null&&K.fromClick||f(null)}),(z=A.current)==null||z.setOnGroundClick(()=>{f(null)}),(W=A.current)==null||W.setOnAreaDoubleClick(Y=>{H.selectArea(Y),i.open()}),(V=A.current)==null||V.setOnBuildingDoubleClick(Y=>{var K;k.current&&(clearTimeout(k.current),k.current=null),f(null);const P=H.getState().buildings.get(Y);(P==null?void 0:P.type)==="server"&&((K=P.pm2)!=null&&K.enabled)?x==null||x(Y):(P==null?void 0:P.type)==="boss"?y==null||y(Y):(P==null?void 0:P.type)==="database"?v==null||v(Y):(P==null?void 0:P.type)==="folder"&&P.folderPath?H.openFileExplorer(P.folderPath):m(Y)})}if(_)try{A.current=_,O?(console.log("[Tide] Reusing existing scene (StrictMode remount)"),_.ensureRenderLoopRunning()):(console.log("[Tide] Reattaching persisted scene to new canvas"),_.reattach(t.current,e.current),ou(t.current));const R=H.getState();_.syncAreas(),_.syncBuildings(),R.agents.size>0&&(console.log("[Tide] Re-syncing agents from store after remount:",R.agents.size),_.syncAgents(Array.from(R.agents.values()))),T()}catch(R){console.error("[Tide] Failed to reattach persisted 3D scene:",R),S==null||S(!1)}finally{j.current=requestAnimationFrame(()=>{E.current=requestAnimationFrame(()=>{S==null||S(!1),E.current=null}),j.current=null})}else{const R=t.current,F=e.current,$=async()=>{if(D){console.log("[Tide] Effect cleaned up before scene init, skipping"),S==null||S(!1);return}if(!R.isConnected||!F.isConnected){console.warn("[Tide] Canvas disconnected before initialization"),S==null||S(!1);return}(!R.clientWidth||!R.clientHeight)&&(console.log("[Tide] Canvas has no CSS dimensions, using window fallback"),R.style.width="100%",R.style.height="100%",R.offsetHeight),(!R.clientWidth||!R.clientHeight)&&(R.width=window.innerWidth,R.height=window.innerHeight),eO();try{const{SceneManager:U}=await vt(async()=>{const{SceneManager:W}=await import("./SceneManager-BivL9Mu6.js");return{SceneManager:W}},__vite__mapDeps([6,4,3,1]));if(D){S==null||S(!1);return}const L=new U(R,F);A.current=L,ku(L),ou(R);const z=wj();L.setCharacterScale(z.characterScale),L.setScale3D(z.scale3d),L.setTimeMode(z.timeMode),L.setTerrainConfig(z.terrain),L.setFloorStyle(z.terrain.floorStyle,!0),L.setGridVisible(z.gridVisible),L.setAgentModelStyle(z.modelStyle),L.setIdleAnimation(z.animations.idleAnimation),L.setWorkingAnimation(z.animations.workingAnimation),L.setFpsLimit(z.fpsLimit),L.syncAreas(),L.syncBuildings(),L.loadCharacterModels().then(()=>{console.log("[Tide] Character models ready");const W=H.getState();W.customAgentClasses.size>0&&(console.log("[Tide] Applying custom classes from store:",W.customAgentClasses.size),L.setCustomAgentClasses(W.customAgentClasses)),W.agents.size>0&&(console.log("[Tide] Syncing agents from store:",W.agents.size),L.syncAgents(Array.from(W.agents.values()))),L.upgradeAgentModels()}).catch(W=>{console.warn("[Tide] Some models failed to load, using fallback:",W)}).finally(()=>{S==null||S(!1)}),T()}catch(U){console.error("[Tide] Failed to initialize 3D scene:",U),S==null||S(!1)}};N.current=requestAnimationFrame(()=>void $())}cj({onAgentCreated:R=>{var F,$,U;(F=A.current)==null||F.addAgent(R),($=A.current)==null||$.refreshSelectionVisuals(),(U=window.__spawnModalSuccess)==null||U.call(window)},onAgentUpdated:(R,F)=>{var U;const $=H.getState().agents.get(R.id)||R;(U=A.current)==null||U.updateAgent($,F)},onAgentDeleted:R=>{var F;(F=A.current)==null||F.removeAgent(R)},onAgentsSync:R=>{var $;const F=Array.from(H.getState().agents.values());($=A.current)==null||$.syncAgents(F)},onAreasSync:()=>{var F,$;(F=A.current)==null||F.syncAreas();const R=Array.from(H.getState().agents.values());($=A.current)==null||$.syncAgents(R)},onSpawnError:()=>{var R;(R=window.__spawnModalError)==null||R.call(window)},onSpawnSuccess:()=>{var R;(R=window.__spawnModalSuccess)==null||R.call(window)},onDirectoryNotFound:R=>{var F;(F=window.__spawnModalDirNotFound)==null||F.call(window,R)},onToolUse:(R,F,$)=>{var U;(U=A.current)==null||U.showToolBubble(R,F,$)},onDelegation:(R,F)=>{var $;($=A.current)==null||$.showDelegationEffect(R,F)},onCustomClassesSync:R=>{var F,$;(F=A.current)==null||F.setCustomAgentClasses(R),($=A.current)==null||$.upgradeAgentModels()},onBuildingUpdated:R=>{var F;(F=A.current)==null||F.updateBuilding(R)},onSubagentStarted:R=>{var F;(F=A.current)==null||F.addSubagentEffect(R.id,R.parentAgentId,R.name,R.subagentType)},onSubagentCompleted:R=>{var U;const F=H.getSubagent(R)||H.getSubagentByToolUseId(R),$=(F==null?void 0:F.id)||R;(U=A.current)==null||U.completeSubagentEffect($),setTimeout(()=>{var L;(L=A.current)==null||L.removeSubagentEffect($)},3e4)}});const M=QR(()=>{if(A.current){A.current.syncAreas(),A.current.syncBuildings();const R=Array.from(H.getState().agents.values());A.current.syncAgents(R)}});return()=>{M(),D=!0,N.current!==null&&(cancelAnimationFrame(N.current),N.current=null),j.current!==null&&(cancelAnimationFrame(j.current),j.current=null),E.current!==null&&(cancelAnimationFrame(E.current),E.current=null),H.getState().viewMode!=="3d"&&rO()&&A.current&&(console.log("[Tide] 3D canvas unmounted - disposing scene to free memory"),DR(),A.current.dispose(),A.current=null,ku(null),ou(null))}},[n,s]),A}function oO({showToast:t,showAgentNotification:e}){b.useEffect(()=>{cj({onToast:t,onReconnect:()=>{H.triggerReconnect()},onAgentNotification:a=>{e(a)}}),JR()||(vu(),vj(!0)),SR();let n;AR(a=>{a.type==="agent_notification"&&typeof a.agentId=="string"&&rj(a.agentId)}).then(a=>{n=a});const s=()=>{console.log("[Tide] App resumed from background, reconnecting..."),setTimeout(()=>vu(),100)};return window.addEventListener("tideAppResume",s),()=>{window.removeEventListener("tideAppResume",s),n==null||n()}},[t,e])}function lO(t){b.useEffect(()=>{let e="",n="",s=new Map;const a=r=>{var d;let i=!1;const c=new Map;for(const[f,h]of r){const x=`${h.position.x.toFixed(2)},${h.position.z.toFixed(2)},${h.status},${h.class},${h.isBoss},${((d=h.subordinateIds)==null?void 0:d.length)??0}`.split("").reduce((y,v)=>(y<<5)-y+v.charCodeAt(0),0);c.set(f,x),s.get(f)!==x&&(i=!0)}return c.size!==s.size&&(i=!0),{newVersion:c,changed:i}};return H.subscribe(()=>{var x;const r=H.getState(),i=Array.from(r.selectedAgentIds).sort().join(","),c=Array.from(r.selectedBuildingIds).sort().join(","),d=i!==e,f=c!==n,{newVersion:h,changed:m}=a(r.agents);(d||f||m)&&(e=i,n=c,s=h,(x=t.current)==null||x.refreshSelectionVisuals())})},[t])}function cO(t){b.useEffect(()=>{var s;(s=t.current)==null||s.syncAreas();let e=0,n=0;return H.subscribe(()=>{var c,d;const r=H.getState().areas;if(r.size!==e){e=r.size,n=Date.now(),(c=t.current)==null||c.syncAreas();return}let i=0;for(const[f,h]of r){let m=f.charCodeAt(0);m+=(h.width??0)+(h.height??0)+(h.radius??0),m+=Math.floor(h.center.x*100)+Math.floor(h.center.z*100),m+=(h.zIndex??0)*1e3;for(let x=0;x<h.name.length;x++)m+=h.name.charCodeAt(x);for(let x=0;x<h.color.length;x++)m+=h.color.charCodeAt(x);if(h.directoryGitCounts)for(const x of h.directoryGitCounts)m+=(x+1)*7;if(h.logo){m+=Math.floor((h.logo.opacity??.8)*1e3),m+=Math.floor(h.logo.width*100)+Math.floor(h.logo.height*100);for(let x=0;x<h.logo.position.length;x++)m+=h.logo.position.charCodeAt(x);if(h.logo.filename)for(let x=0;x<h.logo.filename.length;x++)m+=h.logo.filename.charCodeAt(x)}i^=m|0}i!==n&&(n=i,(d=t.current)==null||d.syncAreas())})},[t])}function uO(t){b.useEffect(()=>{var s;(s=t.current)==null||s.syncBuildings();let e=0,n=0;return H.subscribe(()=>{var c,d;const r=H.getState().buildings;if(r.size!==e){e=r.size,n=Date.now(),(c=t.current)==null||c.syncBuildings();return}let i=0;for(const[f,h]of r){i^=h.position.x*1e3+h.position.z|0,i^=(h.scale||1)*1e4|0;const m=`${h.style||""}${h.name}${h.status}${h.gitChangesCount||0}`;for(let x=0;x<m.length;x++)i=(i<<5)-i+m.charCodeAt(x)|0}i!==n&&(n=i,(d=t.current)==null||d.syncBuildings())})},[t])}function dO(t,e){b.useEffect(()=>{var n;(n=t.current)==null||n.highlightArea(e)},[t,e])}function fO(t,e){b.useEffect(()=>{var n;(n=t.current)==null||n.setPowerSaving(e)},[t,e])}function Lt(t,e,n,s,a={},r="global"){return{id:t,name:e,description:n,key:s,modifiers:a,enabled:!0,context:r}}const Zm=[Lt("toggle-commander","Toggle Commander","Open/close Commander View","k",{ctrl:!0}),Lt("toggle-commander-tab","Toggle Commander (Tab)","Open/close Commander View with Tab","Tab",{}),Lt("spawn-agent","Spawn Agent","Open new agent spawn modal","n",{alt:!0}),Lt("select-agent-1","Select Agent 1","Select first agent","1",{ctrl:!0}),Lt("select-agent-2","Select Agent 2","Select second agent","2",{ctrl:!0}),Lt("select-agent-3","Select Agent 3","Select third agent","3",{ctrl:!0}),Lt("select-agent-4","Select Agent 4","Select fourth agent","4",{ctrl:!0}),Lt("select-agent-5","Select Agent 5","Select fifth agent","5",{ctrl:!0}),Lt("select-agent-6","Select Agent 6","Select sixth agent","6",{ctrl:!0}),Lt("select-agent-7","Select Agent 7","Select seventh agent","7",{ctrl:!0}),Lt("select-agent-8","Select Agent 8","Select eighth agent","8",{ctrl:!0}),Lt("select-agent-9","Select Agent 9","Select ninth agent","9",{ctrl:!0}),Lt("delete-selected","Delete Selected","Remove selected agents","Delete",{}),Lt("delete-selected-backspace","Delete Selected (Backspace)","Remove selected agents","Backspace",{}),Lt("deselect-all","Deselect All","Clear agent selection","Escape",{}),Lt("open-terminal","Open Terminal","Open terminal for selected agent","Space",{}),Lt("dashboard-selector-toggle","Dashboard Selector","Enable dashboard card selector",",",{}),Lt("dashboard-vim-left","Dashboard Left","Move dashboard selector left","h",{}),Lt("dashboard-vim-down","Dashboard Down","Move dashboard selector down","j",{}),Lt("dashboard-vim-up","Dashboard Up","Move dashboard selector up","k",{}),Lt("dashboard-vim-right","Dashboard Right","Move dashboard selector right","l",{}),Lt("next-agent","Next Agent","Select next agent on battlefield","l",{alt:!0}),Lt("prev-agent","Previous Agent","Select previous agent on battlefield","h",{alt:!0}),Lt("next-working-agent","Next Working Agent","Select next working agent on battlefield","l",{alt:!0,shift:!0}),Lt("prev-working-agent","Previous Working Agent","Select previous working agent on battlefield","h",{alt:!0,shift:!0}),Lt("next-message","Next Message","Navigate to next message in terminal","j",{alt:!0}),Lt("prev-message","Previous Message","Navigate to previous message in terminal","k",{alt:!0}),Lt("page-down-messages","Page Down Messages","Jump down 10 messages in terminal","d",{alt:!0,shift:!0}),Lt("page-up-messages","Page Up Messages","Jump up 10 messages in terminal","u",{alt:!0}),Lt("next-agent-terminal","Next Agent (Terminal)","Switch to next agent in terminal","l",{alt:!0}),Lt("prev-agent-terminal","Previous Agent (Terminal)","Switch to previous agent in terminal","h",{alt:!0}),Lt("activate-message","Activate Message","Click on interactive element in selected message","Space",{}),Lt("toggle-file-explorer","Toggle File Explorer","Open/close file explorer","e",{alt:!0}),Lt("file-explorer-close-tab","Close File Tab","Close active file tab in explorer","w",{alt:!0}),Lt("toggle-spotlight","Toggle Spotlight","Open/close global search","p",{alt:!0}),Lt("open-database","Open Database","Open last used database query builder","d",{alt:!0}),Lt("toggle-2d-view","Cycle View Mode","Cycle between 3D, 2D, and Dashboard views","2",{alt:!0}),Lt("clear-context","Clear Context","Clear context of the selected agent","c",{alt:!0,shift:!0}),Lt("commander-close","Close Commander","Close Commander View","Escape",{},"commander"),Lt("commander-vim-left","Navigate Left","Move focus left (Vim H)","h",{alt:!0},"commander"),Lt("commander-vim-down","Navigate Down","Move focus down (Vim J)","j",{alt:!0},"commander"),Lt("commander-vim-up","Navigate Up","Move focus up (Vim K)","k",{alt:!0},"commander"),Lt("commander-vim-right","Navigate Right","Move focus right (Vim L)","l",{alt:!0},"commander"),Lt("commander-expand","Expand/Collapse","Toggle agent expansion","o",{alt:!0},"commander"),Lt("commander-new-agent","New Agent","Open spawn form in commander","n",{alt:!0},"commander"),Lt("commander-next-tab","Next Tab","Switch to next area tab","Tab",{},"commander"),Lt("commander-prev-tab","Previous Tab","Switch to previous area tab","Tab",{shift:!0},"commander"),Lt("toolbox-close","Close Toolbox","Close Settings panel","Escape",{},"toolbox")];function Cn(t,e){if(!e||!e.enabled)return!1;const{ctrl:n,alt:s,shift:a}=e.modifiers,r=n?t.ctrlKey||t.metaKey:!t.ctrlKey&&!t.metaKey,i=s?t.altKey:!t.altKey,c=a?t.shiftKey:!t.shiftKey;let d;if(n?d=(t.ctrlKey||t.metaKey)&&i&&c:d=r&&i&&c,!d)return!1;const f=e.key;if(f.length===1&&/^[a-zA-Z]$/.test(f)){const m=`Key${f.toUpperCase()}`;return t.code===m}if(f.length===1&&/^[0-9]$/.test(f)){const m=`Digit${f}`;return t.code===m}return f==="Space"||f===" "?t.code==="Space":t.key===f}function Lq(t){const e=[];if(t.modifiers.ctrl){const s=navigator.platform.toUpperCase().indexOf("MAC")>=0;e.push(s?"⌘":"Ctrl")}if(t.modifiers.alt){const s=navigator.platform.toUpperCase().indexOf("MAC")>=0;e.push(s?"⌥":"Alt")}t.modifiers.shift&&e.push("Shift"),t.modifiers.meta&&e.push("⌘");let n=t.key;return n===" "?n="Space":n.length===1&&(n=n.toUpperCase()),e.push(n),e.join("+")}function Pq(t,e,n,s){return t.filter(a=>{if(a.id===n||!a.enabled||s&&a.context!=="global"&&a.context!==s)return!1;const r=h=>h===" "||h==="Space"?"Space":h.length===1?h.toLowerCase():h,i=r(a.key),c=r(e.key);if(i!==c)return!1;const d=a.modifiers,f=e.modifiers;return(d.ctrl||!1)===(f.ctrl||!1)&&(d.alt||!1)===(f.alt||!1)&&(d.shift||!1)===(f.shift||!1)&&(d.meta||!1)===(f.meta||!1)})}function pO({sceneRef:t,spawnModal:e,commanderModal:n,explorerModal:s,spotlightModal:a,deleteConfirmModal:r,onRequestBuildingDelete:i,onOpenDatabasePanel:c,onCloseDatabasePanel:d,databasePanelOpen:f}){b.useEffect(()=>{const h=m=>{var R,F,$,U;const x=H.getShortcuts(),y=m.target,v=y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.getAttribute("contenteditable")==="true"||!!y.closest(".cm-editor"),S=x.find(L=>L.id==="deselect-all");if(Cn(m,S)){if(y.closest(".guake-bottom-terminal-embed"))return;if(Sf()){m.preventDefault();return}const L=H.getState();if(L.activeTool==="rectangle"||L.activeTool==="circle"){(R=t.current)==null||R.setDrawingTool(null),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(null);return}e.isOpen?e.close():L.terminalOpen?(H.setTerminalOpen(!1),document.activeElement instanceof HTMLElement&&document.activeElement.blur()):(H.deselectAll(),(F=t.current)==null||F.refreshSelectionVisuals())}for(let L=1;L<=9;L++){const z=x.find(W=>W.id===`select-agent-${L}`);if(Cn(m,z)){m.preventDefault();const W=H.getState(),V=L-1,Y=Array.from(W.agents.keys());V<Y.length&&(H.selectAgent(Y[V]),($=t.current)==null||$.refreshSelectionVisuals());return}}const A=x.find(L=>L.id==="spawn-agent");if(Cn(m,A)){m.preventDefault(),e.open();return}const k=x.find(L=>L.id==="toggle-commander-tab");if(Cn(m,k)&&!v){m.preventDefault(),n.toggle();return}const N=x.find(L=>L.id==="toggle-commander");if(Cn(m,N)){m.preventDefault(),n.toggle();return}const j=x.find(L=>L.id==="toggle-file-explorer");if(Cn(m,j)){m.preventDefault();const L=H.getState();if(s.isOpen||L.explorerFolderPath!==null||L.explorerAreaId!==null)s.close(),H.closeFileExplorer();else{const W=H.getLastExplorerState();if((W==null?void 0:W.type)==="folder")H.openFileExplorer(W.path);else if((W==null?void 0:W.type)==="area")if(L.areas.has(W.areaId))s.open(W.areaId);else{const V=Array.from(L.areas.values()).filter(Y=>Y.directories&&Y.directories.length>0);V.length>0&&s.open(V[0].id)}else{const V=Array.from(L.areas.values()).filter(Y=>Y.directories&&Y.directories.length>0);V.length>0&&s.open(V[0].id)}}return}if(m.altKey&&!m.ctrlKey&&!m.shiftKey&&!m.metaKey&&m.code==="KeyD"){if(m.preventDefault(),m.stopPropagation(),f){d();return}const L=localStorage.getItem("tide-commander-last-database-building"),z=H.getState();if(L){const W=z.buildings.get(L);if((W==null?void 0:W.type)==="database"){c(L);return}}for(const[W,V]of z.buildings)if(V.type==="database"){c(W);return}return}const E=x.find(L=>L.id==="toggle-spotlight");if(Cn(m,E)||m.altKey&&!m.ctrlKey&&!m.metaKey&&m.code==="KeyP"){console.log("[useKeyboardShortcuts] Spotlight shortcut matched!",{spotlightShortcut:E,altKey:m.altKey,code:m.code}),m.preventDefault(),a.toggle();return}const D=x.find(L=>L.id==="toggle-2d-view");if(Cn(m,D)){m.preventDefault();const L=H.getState().viewMode,z=L==="3d"?"2d":L==="2d"?"dashboard":"3d";H.setViewMode(z);return}const _=x.find(L=>L.id==="clear-context");if(Cn(m,_)){m.preventDefault();const L=H.getState(),z=L.selectedAgentIds.size===1?Array.from(L.selectedAgentIds)[0]:null;z&&H.clearContext(z);return}const B=x.find(L=>L.id==="next-working-agent"),O=x.find(L=>L.id==="prev-working-agent");if((Cn(m,B)||Cn(m,O))&&!v){const L=H.getState();if(L.terminalOpen)return;const z=Array.from(L.agents.values());let W=z.filter(K=>L.agentsWithUnseenOutput.has(K.id));if(W.length===0&&(W=z.filter(K=>K.status==="working")),W.length===0)return;m.preventDefault();const V=L.selectedAgentIds.size===1?Array.from(L.selectedAgentIds)[0]:null,Y=V?W.findIndex(K=>K.id===V):-1;let P;Cn(m,B)?P=Y===-1?0:(Y+1)%W.length:P=Y===-1?W.length-1:(Y-1+W.length)%W.length,H.selectAgent(W[P].id),(U=t.current)==null||U.refreshSelectionVisuals();return}const T=x.find(L=>L.id==="delete-selected"),M=x.find(L=>L.id==="delete-selected-backspace");if((Cn(m,T)||Cn(m,M))&&!v){const L=H.getState();if(L.selectedAgentIds.size>0){m.preventDefault(),r.open();return}if(L.selectedBuildingIds.size>0){m.preventDefault(),i();return}return}};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[t,e,n,s,a,r,i,c,d,f])}function hO(){const[t,e]=b.useState(!1);return window.__tideSetBackNavModal=e,b.useEffect(()=>{if(window.__tideBackNavSetup){window.location.hash.includes("app")||(window.location.hash="#app");return}window.__tideBackNavSetup=!0,window.location.hash.includes("app")||(window.location.hash="#app");const s=()=>window.innerWidth<=768;let a=0;const r=()=>{var c;Date.now()-a<200||window.location.hash.includes("app")||(window.location.hash="#app",s()&&(Sf()||(c=window.__tideSetBackNavModal)==null||c.call(window,!0)))},i=()=>{var c;window.location.hash.includes("app")||(window.location.hash="#app"),window.location.hash==="#app"&&setTimeout(()=>{window.location.hash==="#app"&&!window.location.hash.includes("app2")&&(window.history.pushState(null,"","#app2"),window.history.pushState(null,"","#app"))},50),s()?Sf()?a=Date.now():(c=window.__tideSetBackNavModal)==null||c.call(window,!0):(Sf(),a=Date.now())};window.history.pushState(null,"","#app1"),window.history.pushState(null,"","#app2"),window.history.pushState(null,"","#app"),window.addEventListener("hashchange",r),window.addEventListener("popstate",i)},[]),{showBackNavModal:t,setShowBackNavModal:e,handleLeave:()=>{e(!1);const s=window.__tideHistoryDepth??2;window.history.go(-(s+1))}}}const eg="agent-order-change";function mO(t){const e=b.useMemo(()=>new Set(t.map(d=>d.id)),[t]),[n,s]=b.useState(()=>ea(pt.AGENT_ORDER,[]));b.useEffect(()=>{const d=f=>{s(f.detail)};return window.addEventListener(eg,d),()=>{window.removeEventListener(eg,d)}},[]);const a=b.useMemo(()=>{const d=n.filter(x=>e.has(x)),f=t.filter(x=>!d.includes(x.id)).map(x=>x.id),h=[...d,...f],m=new Map(t.map(x=>[x.id,x]));return h.map(x=>m.get(x)).filter(x=>x!==void 0)},[t,n,e]),r=b.useCallback(d=>{s(d),wa(pt.AGENT_ORDER,d),window.dispatchEvent(new CustomEvent(eg,{detail:d}))},[]),i=b.useCallback((d,f)=>{const h=a.map(x=>x.id),[m]=h.splice(d,1);h.splice(f,0,m),r(h)},[a,r]),c=b.useCallback(()=>{s([]),wa(pt.AGENT_ORDER,[])},[]);return b.useEffect(()=>{if(e.size===0)return;const d=n.filter(f=>e.has(f));d.length!==n.length&&r(d)},[e,n,r]),{orderedAgents:a,moveAgent:i,resetOrder:c}}function Sa(t){const e=b.useRef(null),n=b.useCallback(a=>{e.current=a.target,a.target===a.currentTarget&&a.stopPropagation()},[]),s=b.useCallback(a=>{a.target===a.currentTarget&&e.current===a.currentTarget&&(a.stopPropagation(),t()),e.current=null},[t]);return{handleMouseDown:n,handleClick:s}}const gO=3e4;function bO(){const t=b.useRef(null);b.useEffect(()=>{const e=async()=>{var i,c;const n=H.getState(),s=new Map,a=new Map;for(const[d,f]of n.buildings){const h=f.folderPath||f.cwd;h&&(a.has(h)||a.set(h,[]),a.get(h).push(d))}for(const[d,f]of a)try{const h=await Pt(Ot(`/api/files/git-status?path=${encodeURIComponent(d)}`));if(!h.ok)continue;const x=((i=(await h.json()).files)==null?void 0:i.length)||0;s.set(d,x);for(const y of f){const v=H.getState().buildings.get(y);v&&v.gitChangesCount!==x&&H.updateBuildingLocal(y,{gitChangesCount:x})}}catch{}const r=new Map;for(const[d,f]of n.areas)f.archived||!f.directories||f.directories.forEach((h,m)=>{h&&(r.has(h)||r.set(h,[]),r.get(h).push({areaId:d,dirIndex:m}))});if(r.size!==0)for(const[d,f]of r)try{let h;if(s.has(d))h=s.get(d);else{const x=await Pt(Ot(`/api/files/git-status?path=${encodeURIComponent(d)}`));if(!x.ok)continue;h=((c=(await x.json()).files)==null?void 0:c.length)||0,s.set(d,h)}const m=new Map;for(const x of f)m.has(x.areaId)||m.set(x.areaId,[]),m.get(x.areaId).push({dirIndex:x.dirIndex,count:h});for(const[x,y]of m){const v=H.getState().areas.get(x);if(!v)continue;const S=v.directoryGitCounts?[...v.directoryGitCounts]:new Array(v.directories.length).fill(0);let A=!1;for(const{dirIndex:k,count:N}of y)S[k]!==N&&(S[k]=N,A=!0);A&&H.updateAreaLocal(x,{directoryGitCounts:S})}}catch{}};return e(),t.current=setInterval(e,gO),()=>{t.current&&(clearInterval(t.current),t.current=null)}},[])}const tg={historyLimit:500,hideCost:!0,showFPS:!1,powerSaving:!1,customAgentNames:[],experimental2DView:!1,experimentalVoiceAssistant:!1,experimentalTTS:!1,experimentalEchoPrompt:!1,externalEditorCommand:"",vibrationIntensity:1,tabTitle:"",tmuxMode:!1},Ik=90,ng=["simple","chat","advanced"],Bk=55,Fk=20,zk=95,xO=200,yO=12e4,vO=5,Zs=new Map;function wO(t){const e=Zs.get(t);e&&(Zs.delete(t),Zs.set(t,e))}function kO(){for(;Zs.size>vO;){const t=Zs.keys().next().value;if(t!==void 0)Zs.delete(t);else break}}function SO(t){Zs.delete(t)}function CO(t){return t.trim().replace(/\r\n/g,`
|
|
43
|
+
`)}function yb(t,e){return`${t}:${CO(e)}`}function $k(t,e,n,s){if(t.uuid&&e.has(t.uuid))return!1;const a=t.isUserPrompt?"user":"assistant",r=yb(a,t.text),i=t.timestamp||0,c=n.get(r);return c!==void 0&&Math.abs(i-c)<=yO?!1:i>s}function Sj({selectedAgentId:t,hasSessionId:e,reconnectCount:n,historyRefreshTrigger:s,lastPrompts:a,outputScrollRef:r}){const[i,c]=b.useState([]),[d,f]=b.useState(!1),[h,m]=b.useState(!1),[x,y]=b.useState(0),[v,S]=b.useState(!1),[A,k]=b.useState(!1),[N,j]=b.useState(0),E=b.useRef(!0),D=b.useRef(0),_=b.useRef(0),B=b.useRef(!1),O=b.useRef(!1),T=b.useRef(null),M=b.useRef(!1),R=b.useRef(null),F=b.useRef(null);b.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]),b.useEffect(()=>{if(!t||!e){c([]),_.current=0,k(!1),O.current=!1,j(0),f(!1),m(!1),y(ue=>ue+1),M.current=!1,R.current=null;return}const V=`${t}:${n}:${s}`;if(R.current===V)return;const Y=T.current!==null&&T.current!==t,P=n>0,K=Y||P,Q=!Y&&!M.current&&e;T.current=t,M.current=e,R.current=V;let q;if(P){const ue=H.getOutputs(t);ue.length>0&&(q=ue.map(Z=>({...Z})))}F.current&&(clearTimeout(F.current),F.current=null),P&&Zs.delete(t),D.current+=1;const be=D.current;if(m(!0),!P){const ue=Zs.get(t);ue?(wO(t),c(ue.messages),_.current=ue.messages.length,k(ue.hasMore),O.current=ue.hasMore,j(ue.totalCount)):(c([]),_.current=0,k(!1),O.current=!1,j(0))}!Q&&!P&&(F.current=setTimeout(()=>{f(!0)},150)),Pt(Ot(`/api/agents/${t}/history?limit=${Ik}&offset=0`)).then(ue=>{if(!ue.ok)throw new Error(`HTTP ${ue.status}: ${ue.statusText}`);return ue.json()}).then(ue=>{if(be!==D.current)return;const Z=Array.isArray(ue.messages)?ue.messages:[],de=Array.isArray(ue.subagents)?ue.subagents:[];c(Z),_.current=Z.length;const Ce=ue.hasMore||!1;if(k(Ce),O.current=Ce,j(ue.totalCount||0),de.length>0&&H.hydrateSubagentsFromHistory(t,de),Zs.set(t,{messages:Z,hasMore:Ce,totalCount:ue.totalCount||0}),kO(),q&&q.length>0){const xe=Z.length>0?Math.max(...Z.map(X=>X.timestamp?new Date(X.timestamp).getTime():0)):0,Ne=new Set(Z.map(X=>X.uuid).filter(X=>typeof X=="string"&&X.length>0)),qe=new Map;for(const X of Z){if(X.type!=="user"&&X.type!=="assistant")continue;const se=yb(X.type,X.content),Ee=X.timestamp?new Date(X.timestamp).getTime():0,Ve=qe.get(se)??0;Ee>Ve&&qe.set(se,Ee)}const Ge=q.filter(X=>$k(X,Ne,qe,xe));H.clearOutputs(t);for(const X of Ge)H.addOutput(t,X)}else if(Z.length>0){const xe=Math.max(...Z.map(se=>se.timestamp?new Date(se.timestamp).getTime():0)),Ne=new Set(Z.map(se=>se.uuid).filter(se=>typeof se=="string"&&se.length>0)),qe=new Map;for(const se of Z){if(se.type!=="user"&&se.type!=="assistant")continue;const Ee=yb(se.type,se.content),Ve=se.timestamp?new Date(se.timestamp).getTime():0,at=qe.get(Ee)??0;Ve>at&&qe.set(Ee,Ve)}const Ge=H.getOutputs(t),X=Ge.filter(se=>{const Ee=$k(se,Ne,qe,xe);return Ee||console.warn(`[HISTORY-DEDUP] Removing live output: uuid=${se.uuid||"none"} ts=${se.timestamp} lastHistTs=${xe} text="${se.text.slice(0,80)}"`),Ee});if(Ge.length!==X.length){console.warn(`[HISTORY-DEDUP] Cleared ${Ge.length-X.length}/${Ge.length} overlapping outputs for agent ${t}`),H.clearOutputs(t);for(const se of X)H.addOutput(t,se)}}if(!a.get(t)){for(let xe=Z.length-1;xe>=0;xe--)if(Z[xe].type==="user"){H.setLastPrompt(t,Z[xe].content);break}}}).catch(ue=>{if(console.error("Failed to load history:",ue),c([]),_.current=0,k(!1),O.current=!1,j(0),K&&q&&q.length>0){H.clearOutputs(t);for(const Z of q)H.addOutput(t,Z)}}).finally(()=>{E.current&&be===D.current&&(F.current&&(clearTimeout(F.current),F.current=null),f(!1),m(!1),y(ue=>ue+1))})},[t,e,n,s]);const $=b.useCallback(async()=>{if(!t||B.current||!O.current)return;const V=r.current;if(!V){console.warn("loadMoreHistory: outputScrollRef not connected");return}const Y=V.scrollHeight-V.scrollTop;B.current=!0,S(!0);const P=_.current;try{const Q=await(await Pt(Ot(`/api/agents/${t}/history?limit=${Ik}&offset=${P}`))).json(),q=Array.isArray(Q.subagents)?Q.subagents:[];if(q.length>0&&H.hydrateSubagentsFromHistory(t,q),Q.messages&&Q.messages.length>0){if(!E.current)return;c(ue=>{const Z=[...Q.messages,...ue];return _.current=Z.length,Z});const be=Q.hasMore||!1;O.current=be,k(be),requestAnimationFrame(()=>{requestAnimationFrame(()=>{E.current&&(r.current&&(r.current.scrollTop=r.current.scrollHeight-Y),B.current=!1,S(!1))})})}else{if(!E.current)return;B.current=!1,S(!1)}}catch(K){if(console.error("Failed to load more history:",K),!E.current)return;B.current=!1,S(!1)}},[t,r]),U=b.useCallback(V=>{if(!r.current||V.current)return;const{scrollTop:Y}=r.current;!B.current&&O.current&&Y<xO&&$()},[$,r]),L=b.useCallback(()=>{c([]),_.current=0,t&&Zs.delete(t)},[t]),z=b.useRef(!1),W=b.useCallback(async()=>{var V,Y;if(!(!t||!O.current)&&!(B.current||z.current)){z.current=!0,B.current=!0,S(!0);try{const K=await(await Pt(Ot(`/api/agents/${t}/history?limit=100000&offset=0`))).json();if(!E.current)return;const Q=Array.isArray(K.subagents)?K.subagents:[];Q.length>0&&H.hydrateSubagentsFromHistory(t,Q),K.messages&&K.messages.length>0&&(c(K.messages),_.current=K.messages.length),O.current=!1,k(!1),j(K.totalCount||((V=K.messages)==null?void 0:V.length)||0),Zs.set(t,{messages:K.messages||[],hasMore:!1,totalCount:K.totalCount||((Y=K.messages)==null?void 0:Y.length)||0})}catch(P){console.error("Failed to load all history:",P)}finally{E.current&&(B.current=!1,z.current=!1,S(!1))}}},[t]);return{history:i,loadingHistory:d,fetchingHistory:h,historyLoadVersion:x,loadingMore:v,hasMore:A,totalCount:N,isMountedRef:E,loadMoreHistory:$,loadAllHistory:W,allLoaded:!A,handleScroll:U,clearHistory:L,hasCachedHistory:b.useCallback(V=>Zs.has(V),[])}}function Pc(...t){}function AO(t){return(t.tokensUsed??0)===0&&(t.contextUsed??0)===0&&!t.contextStats&&!t.sessionId&&!t.currentTask&&!t.lastAssignedTask}function Hk(t,e){var r,i;if(!t||AO(e))return e;const n=((r=t.contextStats)==null?void 0:r.lastUpdated)??0,s=((i=e.contextStats)==null?void 0:i.lastUpdated)??0;return n>0&&n>s?{...e,contextUsed:t.contextUsed,contextLimit:t.contextLimit,contextStats:t.contextStats}:e}function jO(t,e,n,s,a){return{setAgents(r){const i=new Map,c=t().agents;for(const f of r){const h=c.get(f.id);i.set(f.id,Hk(h,f)),(f.class==="boss"||f.isBoss)&&Pc("[Store.setAgents] Boss agent:",f.name,"subordinateIds:",f.subordinateIds)}const d=r.find(f=>f.status==="working");e(f=>{f.agents=i,d&&f.selectedAgentIds.size===0&&(f.selectedAgentIds=new Set([d.id]),f.terminalOpen=!0)}),n()},addAgent(r){e(i=>{const c=new Map(i.agents);c.set(r.id,r),i.agents=c}),n()},updateAgent(r){var h;const c=t().agents.get(r.id),d=(c==null?void 0:c.status)!==r.status;d&&Pc(`[Store] Agent ${r.name} status update: ${c==null?void 0:c.status} → ${r.status}`);let f=!1;e(m=>{const x=new Map(m.agents);x.set(r.id,Hk(c,r)),m.agents=x,d&&(c==null?void 0:c.status)==="working"&&r.status==="idle"&&(m.terminalOpen&&m.selectedAgentIds.has(r.id)||(m.agentsWithUnseenOutput=new Set(m.agentsWithUnseenOutput),m.agentsWithUnseenOutput.add(r.id),Pc(`[Store] Agent ${r.name} completed work - marked as unseen`),f=!0))}),f&&a&&a(),n(),d&&Pc(`[Store] Agent ${r.name} status now in store: ${(h=t().agents.get(r.id))==null?void 0:h.status}`)},updateAgentContextStats(r,i){const d=t().agents.get(r);d&&(e(f=>{const h=new Map(f.agents);h.set(r,{...d,contextStats:i,contextUsed:i.totalTokens,contextLimit:i.contextWindow}),f.agents=h}),n())},updateAgentContext(r,i,c){const f=t().agents.get(r);if(f){const h=Math.max(1,c||2e5),m=Math.max(0,Math.min(100,Number((i/h*100).toFixed(1))));e(x=>{const y=new Map(x.agents),v=f.contextStats?{...f.contextStats,totalTokens:i,contextWindow:h,usedPercent:m,lastUpdated:Date.now()}:void 0;y.set(r,{...f,contextUsed:i,contextLimit:h,contextStats:v}),x.agents=y}),n()}},removeAgent(r){const i=t().agentsWithUnseenOutput.has(r);e(c=>{const d=new Map(c.agents);d.delete(r),c.agents=d;const f=new Set(c.selectedAgentIds);f.delete(r),c.selectedAgentIds=f,c.agentOutputs.delete(r),c.lastPrompts.delete(r),c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r)),c.delegationHistories.delete(r),c.lastDelegationReceived.delete(r),c.agentTaskProgress.delete(r),c.supervisor.narratives.delete(r),c.supervisor.agentHistories.delete(r),c.supervisor.historyFetchedForAgents.delete(r),c.subagents.delete(r)}),SO(r),i&&a&&a(),n()},selectAgent(r){let i=!1;e(c=>{c.selectedAgentIds=new Set(r?[r]:[]),r&&(c.lastSelectedAgentId=r,c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r),i=!0)),c.currentSnapshot=null}),i&&a&&a(),n()},addToSelection(r){let i=!1;e(c=>{const d=new Set(c.selectedAgentIds);d.has(r)?d.delete(r):(d.add(r),c.agentsWithUnseenOutput.has(r)&&(c.agentsWithUnseenOutput=new Set(c.agentsWithUnseenOutput),c.agentsWithUnseenOutput.delete(r),i=!0)),c.selectedAgentIds=d}),i&&a&&a(),n()},selectMultiple(r){e(i=>{i.selectedAgentIds=new Set(r)}),n()},deselectAll(){e(r=>{r.selectedAgentIds=new Set}),n()},spawnAgent(r,i,c,d,f,h,m,x,y,v,S,A,k,N,j){Pc("[Store] spawnAgent called with:",{name:r,agentClass:i,cwd:c,position:d,sessionId:f,useChrome:h,permissionMode:m,initialSkillIds:x,provider:y,codexConfig:v,codexModel:S,model:A,effort:N,opencodeModel:j,customInstructions:k?`${k.length} chars`:void 0});const E=d?{x:d.x,y:0,z:d.z}:void 0,D={type:"spawn_agent",payload:{name:r,class:i,cwd:c,position:E,sessionId:f,useChrome:h,permissionMode:m,initialSkillIds:x,provider:y,codexConfig:v,codexModel:S,opencodeModel:j,model:A,effort:N,customInstructions:k}},_=s();if(!_){console.error("[Store] sendMessage is not defined! WebSocket may not be connected");return}_(D)},createDirectoryAndSpawn(r,i,c){var d;(d=s())==null||d({type:"create_directory",payload:{path:r,name:i,class:c}})},sendCommand(r,i){var c;e(d=>{d.lastPrompts.set(r,{text:i,timestamp:Date.now()})}),n(),(c=s())==null||c({type:"send_command",payload:{agentId:r,command:i}})},refreshAgentContext(r){var i;(i=s())==null||i({type:"request_context_stats",payload:{agentId:r}})},moveAgentLocal(r,i){const d=t().agents.get(r);d&&(e(f=>{const h={...d,position:i},m=new Map(f.agents);m.set(r,h),f.agents=m}),n())},moveAgent(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d,position:i},x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"move_agent",payload:{agentId:r,position:i}})},killAgent(r){var i;(i=s())==null||i({type:"kill_agent",payload:{agentId:r}})},stopAgent(r){var i;(i=s())==null||i({type:"stop_agent",payload:{agentId:r}})},clearContext(r){var i;(i=s())==null||i({type:"clear_context",payload:{agentId:r}}),e(c=>{const d=c.agents.get(r);if(d){const y={...d,status:"idle",currentTask:void 0,taskLabel:void 0,currentTool:void 0,lastAssignedTask:void 0,lastAssignedTaskTime:void 0,sessionId:void 0,tokensUsed:0,contextUsed:0,contextStats:void 0},v=new Map(c.agents);v.set(r,y),c.agents=v}const f=new Map(c.agentOutputs);f.delete(r),c.agentOutputs=f;const h=new Map(c.lastPrompts);h.delete(r),c.lastPrompts=h;const m=new Map(c.subagents);let x=!1;for(const[y,v]of m)v.parentAgentId===r&&(m.delete(y),x=!0);x&&(c.subagents=m)}),n()},collapseContext(r){var i;(i=s())==null||i({type:"collapse_context",payload:{agentId:r}})},removeAgentFromServer(r){var i;(i=s())==null||i({type:"remove_agent",payload:{agentId:r}})},renameAgent(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d,name:i},x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"rename_agent",payload:{agentId:r,name:i}})},updateAgentProperties(r,i){var f;const d=t().agents.get(r);d&&(e(h=>{const m={...d};i.class!==void 0&&(m.class=i.class),i.permissionMode!==void 0&&(m.permissionMode=i.permissionMode),i.model!==void 0&&(m.model=i.model),i.effort!==void 0&&(m.effort=i.effort),i.provider!==void 0&&(m.provider=i.provider),i.codexConfig!==void 0&&(m.codexConfig=i.codexConfig),i.codexModel!==void 0&&(m.codexModel=i.codexModel),i.opencodeModel!==void 0&&(m.opencodeModel=i.opencodeModel),i.useChrome!==void 0&&(m.useChrome=i.useChrome),i.cwd!==void 0&&(m.cwd=i.cwd);const x=new Map(h.agents);x.set(r,m),h.agents=x}),n()),(f=s())==null||f({type:"update_agent_properties",payload:{agentId:r,updates:i}})},getTotalTokens(){let r=0;for(const i of t().agents.values())r+=i.tokensUsed;return r},getSelectedAgents(){const r=t(),i=[];for(const c of r.selectedAgentIds){const d=r.agents.get(c);d&&i.push(d)}return i},addActivity(r){e(i=>{i.activities.unshift(r),i.activities.length>100&&i.activities.pop()}),n()},addToolExecution(r,i,c){const f=t().agents.get(r);e(h=>{h.toolExecutions.unshift({agentId:r,agentName:(f==null?void 0:f.name)||"Unknown",toolName:i,toolInput:c,timestamp:Date.now()}),h.toolExecutions.length>200&&h.toolExecutions.pop()}),n()},addFileChange(r,i,c){const f=t().agents.get(r);e(h=>{h.fileChanges.unshift({agentId:r,agentName:(f==null?void 0:f.name)||"Unknown",action:i,filePath:c,timestamp:Date.now()}),h.fileChanges.length>200&&h.fileChanges.pop()}),n()},async loadToolHistory(){try{const i=await(await Pt(Ot("/api/agents/tool-history?limit=100"))).json();e(c=>{i.toolExecutions&&(c.toolExecutions=i.toolExecutions),i.fileChanges&&(c.fileChanges=i.fileChanges)}),n()}catch(r){console.error("[Store] Failed to load tool history:",r)}}}}const Uk=200;function Wk(t){return t.length<=Uk?t:t.slice(-Uk)}function NO(t,e,n,s){return{addOutput(a,r){const i=s();e(c=>{const d=c.agentOutputs.get(a)||[];if(r.uuid&&d.some(x=>x.uuid===r.uuid))return;const f=Wk([...d,r]);yu.info(`Store: ${d.length} -> ${f.length}`,{agentId:a,text:r.text.slice(0,60),isStreaming:r.isStreaming,listeners:i},"store:addOutput");const h=new Map(c.agentOutputs);h.set(a,f),c.agentOutputs=h}),n()},clearOutputs(a){e(r=>{const i=new Map(r.agentOutputs);i.delete(a),r.agentOutputs=i}),n()},getOutputs(a){return t().agentOutputs.get(a)||[]},addUserPromptToOutput(a,r){this.addOutput(a,{text:r,isStreaming:!1,timestamp:Date.now(),isUserPrompt:!0})},getLastPrompt(a){return t().lastPrompts.get(a)},setLastPrompt(a,r){e(i=>{i.lastPrompts.set(a,{text:r,timestamp:Date.now()})}),n()},preserveOutputs(){const a=t(),r=new Map;for(const[i,c]of a.agentOutputs)r.set(i,c.map(d=>({...d})));return r},mergeOutputsWithHistory(a,r,i){let c=[...r,...i];return c.sort((d,f)=>d.timestamp-f.timestamp),c=Wk(c),e(d=>{const f=new Map(d.agentOutputs);f.set(a,c),d.agentOutputs=f}),n(),c}}}function TO(t,e,n,s){return{setSupervisorReport(a){e(r=>{r.supervisor.lastReport=a,r.supervisor.lastReportTime=a.timestamp;const i=new Map(r.supervisor.agentHistories);for(const c of a.agentSummaries){const d=i.get(c.agentId)||[],f={id:`${a.id}-${c.agentId}`,timestamp:a.timestamp,reportId:a.id,analysis:c};if(!d.some(h=>h.reportId===a.id)){const h=[f,...d];h.length>50&&h.pop(),i.set(c.agentId,h)}}r.supervisor.agentHistories=i,r.supervisor.generatingReport=!1}),n()},addNarrative(a,r){e(i=>{const c=i.supervisor.narratives.get(a)||[];c.unshift(r),c.length>50&&c.pop();const d=new Map(i.supervisor.narratives);d.set(a,c),i.supervisor.narratives=d}),n()},getNarratives(a){return t().supervisor.narratives.get(a)||[]},setSupervisorStatus(a){e(r=>{r.supervisor.enabled=a.enabled,a.autoReportOnComplete!==void 0&&(r.supervisor.autoReportOnComplete=a.autoReportOnComplete),r.supervisor.lastReportTime=a.lastReportTime,r.supervisor.nextReportTime=a.nextReportTime}),n()},setSupervisorConfig(a){var r;(r=s())==null||r({type:"set_supervisor_config",payload:a})},requestSupervisorReport(){var a;e(r=>{r.supervisor.generatingReport=!0}),n(),(a=s())==null||a({type:"request_supervisor_report",payload:{}})},requestAgentSupervisorHistory(a){var r;e(i=>{i.supervisor.loadingHistoryForAgent=a}),n(),(r=s())==null||r({type:"request_agent_supervisor_history",payload:{agentId:a}})},setAgentSupervisorHistory(a){e(r=>{const i=new Map(r.supervisor.agentHistories);i.set(a.agentId,a.entries),r.supervisor.agentHistories=i,r.supervisor.historyFetchedForAgents.add(a.agentId),r.supervisor.loadingHistoryForAgent===a.agentId&&(r.supervisor.loadingHistoryForAgent=null)}),n()},getAgentSupervisorHistory(a){return t().supervisor.agentHistories.get(a)||[]},addAgentAnalysis(a,r){e(i=>{const c=new Map(i.supervisor.agentHistories),d=c.get(a)||[],f={id:`single-${Date.now()}-${a}`,timestamp:Date.now(),reportId:`single-${Date.now()}`,analysis:r};if(!d.some(m=>Math.abs(m.timestamp-f.timestamp)<5e3&&m.analysis.statusDescription===r.statusDescription)){const m=[f,...d];m.length>50&&m.pop(),c.set(a,m),i.supervisor.agentHistories=c}}),n()},isLoadingHistoryForAgent(a){return t().supervisor.loadingHistoryForAgent===a},hasHistoryBeenFetched(a){return t().supervisor.historyFetchedForAgents.has(a)},setGlobalUsage(a){console.log("[Supervisor] setGlobalUsage called with:",a),e(r=>{r.supervisor.globalUsage=a,r.supervisor.refreshingUsage=!1}),n()},requestGlobalUsage(){console.log("[Supervisor] requestGlobalUsage called"),e(r=>{r.supervisor.refreshingUsage=!0}),n();const a=s();console.log("[Supervisor] sendMessage function:",a?"available":"null"),a?(console.log("[Supervisor] Sending request_global_usage message"),a({type:"request_global_usage",payload:{}})):console.warn("[Supervisor] Cannot send request_global_usage - no sendMessage function")},getGlobalUsage(){return t().supervisor.globalUsage}}}function _O(t,e,n,s){const a=()=>{var c;const i=Array.from(t().areas.values());(c=s())==null||c({type:"sync_areas",payload:i})},r=()=>{e(i=>{i.areas=new Map(i.areas)})};return{setActiveTool(i){e(c=>{c.activeTool=i,i!=="select"&&(c.selectedAreaId=null)}),n()},selectArea(i){e(c=>{c.selectedAreaId=i}),n()},addArea(i){if(i.zIndex===void 0||i.zIndex===null){const c=Array.from(t().areas.values()),d=c.length===0?-1:Math.max(...c.map(f=>f.zIndex??0));i.zIndex=d+1}e(c=>{c.areas.set(i.id,i)}),r(),a(),n()},updateArea(i,c){t().areas.get(i)&&(e(h=>{Object.assign(h.areas.get(i),c)}),r(),a(),n())},updateAreaLocal(i,c){t().areas.get(i)&&(e(h=>{Object.assign(h.areas.get(i),c)}),r(),n())},deleteArea(i){e(c=>{c.areas.delete(i),c.selectedAreaId===i&&(c.selectedAreaId=null)}),r(),a(),n()},assignAgentToArea(i,c){const f=t().areas.get(c);f&&!f.assignedAgentIds.includes(i)&&(e(h=>{for(const m of h.areas.values()){const x=m.assignedAgentIds.indexOf(i);x!==-1&&m.assignedAgentIds.splice(x,1)}h.areas.get(c).assignedAgentIds.push(i)}),r(),a(),n())},unassignAgentFromArea(i,c){const f=t().areas.get(c);if(f){const h=f.assignedAgentIds.indexOf(i);h!==-1&&(e(m=>{m.areas.get(c).assignedAgentIds.splice(h,1)}),r(),a(),n())}},addDirectoryToArea(i,c){const f=t().areas.get(i);f&&!f.directories.includes(c)&&(e(h=>{h.areas.get(i).directories.push(c)}),r(),a(),n())},removeDirectoryFromArea(i,c){const f=t().areas.get(i);if(f){const h=f.directories.indexOf(c);h!==-1&&(e(m=>{m.areas.get(i).directories.splice(h,1)}),r(),a(),n())}},getAreaDirectories(i){const c=t().areas.get(i);return(c==null?void 0:c.directories)||[]},isPositionInArea(i,c){if(c.type==="rectangle"&&c.width&&c.height){const d=c.width/2,f=c.height/2;return i.x>=c.center.x-d&&i.x<=c.center.x+d&&i.z>=c.center.z-f&&i.z<=c.center.z+f}else if(c.type==="circle"&&c.radius){const d=i.x-c.center.x,f=i.z-c.center.z;return d*d+f*f<=c.radius*c.radius}return!1},getAreaForAgent(i){const c=t(),d=c.agents.get(i);if(!d)return null;for(const f of c.areas.values())if(this.isPositionInArea({x:d.position.x,z:d.position.z},f))return f;return null},setAreasFromServer(i){e(c=>{const d=new Map;for(let f=0;f<i.length;f++){const h=i[f];if(!h.center||typeof h.center.x!="number"||typeof h.center.z!="number"||!h.type){console.error(`[Areas] Skipping malformed area "${(h==null?void 0:h.id)??(h==null?void 0:h.name)??"unknown"}": missing center or type`);continue}h.directories||(h.directories=[]),(h.zIndex===void 0||h.zIndex===null)&&(h.zIndex=f),h.archived===void 0&&(h.archived=!1),d.set(h.id,h)}c.areas=d}),n()},getAreasInZOrder(){return Array.from(t().areas.values()).sort((c,d)=>(c.zIndex??0)-(d.zIndex??0))},getNextZIndex(){const i=Array.from(t().areas.values());return i.length===0?0:Math.max(...i.map(d=>d.zIndex??0))+1},bringAreaToFront(i){const c=t(),d=c.areas.get(i);if(!d)return;const f=Array.from(c.areas.values()),h=f.length===0?-1:Math.max(...f.map(v=>v.zIndex??0)),m=h+1,x=d.zIndex??0,y=f.filter(v=>(v.zIndex??0)===h);x===h&&y.length===1||(e(v=>{v.areas.get(i).zIndex=m}),r(),a(),n())},sendAreaToBack(i){const c=t(),d=c.areas.get(i);if(!d)return;const f=Array.from(c.areas.values()),h=Math.min(...f.map(y=>y.zIndex??0)),m=d.zIndex??0,x=f.filter(y=>(y.zIndex??0)===h);m===h&&x.length===1||(e(y=>{for(const v of y.areas.values())v.id!==i&&(v.zIndex=(v.zIndex??0)+1);y.areas.get(i).zIndex=0}),r(),a(),n())},setAreaZIndex(i,c){t().areas.get(i)&&(e(h=>{h.areas.get(i).zIndex=c}),r(),a(),n())},archiveArea(i,c){const f=t().areas.get(i);if(!(!f||f.archived)){if(c)for(const h of f.assignedAgentIds)c(h);e(h=>{const m=h.areas.get(i);m.archived=!0,m.archivedAt=Date.now(),m.originalCenter={...m.center},h.selectedAreaId===i&&(h.selectedAreaId=null)}),r(),a(),n()}},restoreArchivedArea(i,c){const d=t(),f=d.areas.get(i);if(!f||!f.archived)return;const h=f.center,m=c||f.originalCenter||f.center,x=m.x-h.x,y=m.z-h.z,v=Array.from(d.areas.values()),A=(v.length===0?-1:Math.max(...v.map(k=>k.zIndex??0)))+1;e(k=>{const N=k.areas.get(i);if(N.archived=!1,N.archivedAt=void 0,N.center=m,N.zIndex=A,x!==0||y!==0)for(const j of N.assignedAgentIds){const E=k.agents.get(j);E&&(E.position={x:E.position.x+x,y:E.position.y,z:E.position.z+y})}}),r(),a(),n()},getArchivedAreas(){return Array.from(t().areas.values()).filter(i=>i.archived===!0)},getVisibleAreas(){return Array.from(t().areas.values()).filter(i=>!i.archived)},isAgentInArchivedArea(i){const c=t();for(const d of c.areas.values())if(d.archived&&d.assignedAgentIds.includes(i))return!0;return!1}}}const Cj="tide:bottom-pm2-log-retention",sg=5e3,EO=[1e3,2500,5e3,1e4,null];function Aj(){if(typeof window>"u")return sg;try{const t=window.localStorage.getItem(Cj);if(!t)return sg;if(t==="unlimited")return null;const e=Number(t);if(Number.isFinite(e)&&e>0)return Math.floor(e)}catch{}return sg}function MO(t){if(!(typeof window>"u"))try{window.localStorage.setItem(Cj,t===null?"unlimited":String(t))}catch{}}function jj(t,e){if(!t||e===null)return t;const n=t.split(`
|
|
44
|
+
`);return n.length<=e?t:n.slice(-e).join(`
|
|
45
|
+
`)}function DO(t,e,n,s){const a=()=>{var c;const i=Array.from(t().buildings.values());(c=s())==null||c({type:"sync_buildings",payload:i})},r={selectBuilding(i){e(c=>{c.selectedBuildingIds.clear(),i&&c.selectedBuildingIds.add(i)}),n()},selectMultipleBuildings(i){e(c=>{c.selectedBuildingIds.clear();for(const d of i)c.selectedBuildingIds.add(d)}),n()},toggleBuildingSelection(i){e(c=>{c.selectedBuildingIds.has(i)?c.selectedBuildingIds.delete(i):c.selectedBuildingIds.add(i)}),n()},isBuildingSelected(i){return t().selectedBuildingIds.has(i)},getSelectedBuildingIds(){return Array.from(t().selectedBuildingIds)},deleteSelectedBuildings(){var c,d,f;const i=t();for(const h of i.selectedBuildingIds){const m=i.buildings.get(h);((c=m==null?void 0:m.pm2)!=null&&c.enabled||(d=m==null?void 0:m.docker)!=null&&d.enabled)&&((f=s())==null||f({type:"building_command",payload:{buildingId:h,command:"delete"}}))}e(h=>{const m=new Map(h.buildings);for(const x of h.selectedBuildingIds)m.delete(x);h.buildings=m,h.selectedBuildingIds.clear()}),a(),n()},addBuilding(i){e(c=>{const d=new Map(c.buildings);d.set(i.id,i),c.buildings=d}),a(),n()},updateBuilding(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,...c}),h.buildings=m}),a(),n())},updateBuildingLocal(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,...c}),h.buildings=m}),n())},deleteBuilding(i){var f,h,m;const d=t().buildings.get(i);((f=d==null?void 0:d.pm2)!=null&&f.enabled||(h=d==null?void 0:d.docker)!=null&&h.enabled)&&((m=s())==null||m({type:"building_command",payload:{buildingId:i,command:"delete"}})),e(x=>{const y=new Map(x.buildings);y.delete(i),x.buildings=y,x.selectedBuildingIds.delete(i)}),a(),n()},moveBuilding(i,c){const f=t().buildings.get(i);f&&(e(h=>{const m=new Map(h.buildings);m.set(i,{...f,position:c}),h.buildings=m}),a(),n())},updateBuildingPosition(i,c){r.moveBuilding(i,c)},createBuilding(i){const c={...i,id:`building_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,status:"stopped",createdAt:Date.now()};r.addBuilding(c)},sendBuildingCommand(i,c){var d;(d=s())==null||d({type:"building_command",payload:{buildingId:i,command:c}})},addBuildingLogs(i,c){e(d=>{const h=[...d.buildingLogs.get(i)||[],c];h.length>500&&h.splice(0,h.length-500);const m=new Map(d.buildingLogs);m.set(i,h),d.buildingLogs=m}),n()},getBuildingLogs(i){return t().buildingLogs.get(i)||[]},clearBuildingLogs(i){e(c=>{const d=new Map(c.buildingLogs);d.delete(i),c.buildingLogs=d}),n()},setBuildingsFromServer(i){e(c=>{const d=new Map;for(const f of i)d.set(f.id,f);c.buildings=d}),n()},updateBuildingFromServer(i){e(c=>{const d=new Map(c.buildings);d.set(i.id,i),c.buildings=d}),n()},removeBuildingFromServer(i){e(c=>{const d=new Map(c.buildings);d.delete(i),c.buildings=d,c.selectedBuildingIds.delete(i)}),n()},startLogStreaming(i,c=100){var f,h,m;const d=t().buildings.get(i);e(x=>{const y=new Map(x.streamingBuildingLogs);y.set(i,""),x.streamingBuildingLogs=y}),(f=d==null?void 0:d.docker)!=null&&f.enabled?(h=s())==null||h({type:"docker_logs_start",payload:{buildingId:i,lines:c}}):(m=s())==null||m({type:"pm2_logs_start",payload:{buildingId:i,lines:c}})},stopLogStreaming(i){var d,f,h;const c=t().buildings.get(i);(d=c==null?void 0:c.docker)!=null&&d.enabled?(f=s())==null||f({type:"docker_logs_stop",payload:{buildingId:i}}):(h=s())==null||h({type:"pm2_logs_stop",payload:{buildingId:i}})},appendStreamingLogChunk(i,c){e(d=>{const f=d.streamingBuildingLogs.get(i)||"",h=Aj(),m=jj(f+c,h),x=new Map(d.streamingBuildingLogs);x.set(i,m),d.streamingBuildingLogs=x}),n()},setStreamingStatus(i,c){e(d=>{const f=new Set(d.streamingBuildingIds);c?f.add(i):f.delete(i),d.streamingBuildingIds=f}),n()},getStreamingLogs(i){return t().streamingBuildingLogs.get(i)||""},clearStreamingLogs(i){e(c=>{const d=new Map(c.streamingBuildingLogs);d.delete(i),c.streamingBuildingLogs=d}),n()},isLogStreaming(i){return t().streamingBuildingIds.has(i)},sendBossBuildingCommand(i,c){var d;(d=s())==null||d({type:"boss_building_command",payload:{buildingId:i,command:c}})},assignBuildingsToBoSS(i,c){var h;const f=t().buildings.get(i);f&&(e(m=>{const x=new Map(m.buildings);x.set(i,{...f,subordinateBuildingIds:c}),m.buildings=x}),a(),n()),(h=s())==null||h({type:"assign_buildings",payload:{bossBuildingId:i,subordinateBuildingIds:c}})},startBossLogStreaming(i,c=50){var d;e(f=>{const h=new Map(f.bossStreamingLogs);h.set(i,[]),f.bossStreamingLogs=h}),(d=s())==null||d({type:"boss_building_logs_start",payload:{buildingId:i,lines:c}})},stopBossLogStreaming(i){var c;(c=s())==null||c({type:"boss_building_logs_stop",payload:{buildingId:i}})},appendBossStreamingLogChunk(i,c,d,f,h){e(m=>{const x=m.bossStreamingLogs.get(i)||[],y={subordinateId:c,subordinateName:d,chunk:f,timestamp:Date.now(),isError:h},v=[...x,y];v.length>1e3&&v.splice(0,v.length-1e3);const S=new Map(m.bossStreamingLogs);S.set(i,v),m.bossStreamingLogs=S}),n()},getBossStreamingLogs(i){return t().bossStreamingLogs.get(i)||[]},clearBossStreamingLogs(i){e(c=>{const d=new Map(c.bossStreamingLogs);d.delete(i),c.bossStreamingLogs=d}),n()},requestDockerContainersList(){var i;(i=s())==null||i({type:"docker_list_containers",payload:{}})},setDockerContainersList(i,c){e(d=>{d.dockerContainersList=i,d.dockerComposeProjectsList=c}),n()},getDockerContainersList(){return t().dockerContainersList},getDockerComposeProjectsList(){return t().dockerComposeProjectsList}};return r}function RO(t,e,n,s){return{addPermissionRequest(a){e(r=>{const i=new Map(r.permissionRequests);i.set(a.id,a),r.permissionRequests=i}),n()},resolvePermissionRequest(a,r){const c=t().permissionRequests.get(a);c&&(e(d=>{const f=new Map(d.permissionRequests);f.set(a,{...c,status:r?"approved":"denied"}),d.permissionRequests=f}),n(),setTimeout(()=>{e(d=>{const f=new Map(d.permissionRequests);f.delete(a),d.permissionRequests=f}),n()},2e3))},respondToPermissionRequest(a,r,i,c){var d;(d=s())==null||d({type:"permission_response",payload:{requestId:a,approved:r,reason:i,remember:c}})},getPendingPermissionsForAgent(a){return Array.from(t().permissionRequests.values()).filter(r=>r.agentId===a&&r.status==="pending")},clearAllPermissions(){e(a=>{a.permissionRequests=new Map}),n()}}}function OO(t,e,n,s){return{spawnBossAgent(a,r,i,c,d,f,h,m,x,y,v,S,A){var N;const k=c?{x:c.x,y:0,z:c.z}:void 0;(N=s())==null||N({type:"spawn_boss_agent",payload:{name:a,class:r,cwd:i,position:k,subordinateIds:d,useChrome:f,permissionMode:h,provider:m,codexConfig:x,codexModel:y,model:v,customInstructions:S,initialSkillIds:A}})},assignSubordinates(a,r){var i;(i=s())==null||i({type:"assign_subordinates",payload:{bossId:a,subordinateIds:r}})},removeSubordinate(a,r){var i;(i=s())==null||i({type:"remove_subordinate",payload:{bossId:a,subordinateId:r}})},sendBossCommand(a,r){var i;e(c=>{c.pendingDelegation={bossId:a,command:r}}),n(),(i=s())==null||i({type:"send_boss_command",payload:{bossId:a,command:r}})},requestDelegationHistory(a){var r;(r=s())==null||r({type:"request_delegation_history",payload:{bossId:a}})},handleDelegationDecision(a){e(r=>{var f;const i=new Map(r.delegationHistories),c=i.get(a.bossId)||[],d=c.findIndex(h=>h.id===a.id);if(d!==-1?c[d]=a:(c.unshift(a),c.length>100&&c.pop()),i.set(a.bossId,c),r.delegationHistories=i,a.status==="sent"&&a.selectedAgentId){const h=r.agents.get(a.bossId),m=new Map(r.lastDelegationReceived);m.set(a.selectedAgentId,{bossName:(h==null?void 0:h.name)||"Boss",taskCommand:a.userCommand,timestamp:Date.now()}),r.lastDelegationReceived=m}((f=r.pendingDelegation)==null?void 0:f.bossId)===a.bossId&&a.status!=="pending"&&(r.pendingDelegation=null)}),n()},setDelegationHistory(a,r){e(i=>{const c=new Map(i.delegationHistories);c.set(a,r),i.delegationHistories=c}),n()},getDelegationHistory(a){return t().delegationHistories.get(a)||[]},getLastDelegationReceived(a){return t().lastDelegationReceived.get(a)||null},clearLastDelegationReceived(a){t().lastDelegationReceived.has(a)&&(e(i=>{const c=new Map(i.lastDelegationReceived);c.delete(a),i.lastDelegationReceived=c}),n())},updateBossSubordinates(a,r){const c=t().agents.get(a);c&&(e(d=>{const f={...c,subordinateIds:r},h=new Map(d.agents);h.set(a,f),d.agents=h}),n())},getSubordinates(a){const r=t(),i=r.agents.get(a),c=(i==null?void 0:i.isBoss)===!0||(i==null?void 0:i.class)==="boss";return!i||!c||!i.subordinateIds?[]:i.subordinateIds.map(d=>r.agents.get(d)).filter(d=>d!==void 0)},isBossAgent(a){const r=t().agents.get(a);return(r==null?void 0:r.isBoss)===!0||(r==null?void 0:r.class)==="boss"},getBossForAgent(a){const r=t(),i=r.agents.get(a);return i!=null&&i.bossId&&r.agents.get(i.bossId)||null},getAvailableSubordinates(){return Array.from(t().agents.values()).filter(a=>a.class!=="boss")},handleAgentTaskStarted(a,r,i,c){e(d=>{const f=new Map(d.agentTaskProgress);let h=f.get(a);h||(h=new Map,f.set(a,h)),h.set(r,{agentId:r,agentName:i,taskDescription:c,status:"working",output:[],startedAt:Date.now()}),d.agentTaskProgress=f}),n()},handleAgentTaskOutput(a,r,i){e(c=>{const d=c.agentTaskProgress.get(a);if(!d)return;const f=d.get(r);if(!f)return;const h=200;let m=[...f.output,i];m.length>h&&(m=m.slice(-h));const x=new Map(c.agentTaskProgress),y=new Map(d);y.set(r,{...f,output:m}),x.set(a,y),c.agentTaskProgress=x}),n()},handleAgentTaskCompleted(a,r,i){e(c=>{const d=c.agentTaskProgress.get(a);if(!d)return;const f=d.get(r);if(!f)return;const h=f.output.length>20?f.output.slice(-20):f.output,m=new Map(c.agentTaskProgress),x=new Map(d);x.set(r,{...f,status:i?"completed":"failed",completedAt:Date.now(),output:h}),m.set(a,x),c.agentTaskProgress=m}),n()},getAgentTaskProgress(a){return t().agentTaskProgress.get(a)||new Map},clearAgentTaskProgress(a,r){e(i=>{if(r){const c=i.agentTaskProgress.get(a);if(c){const d=new Map(i.agentTaskProgress),f=new Map(c);f.delete(r),d.set(a,f),i.agentTaskProgress=d}}else{const c=new Map(i.agentTaskProgress);c.delete(a),i.agentTaskProgress=c}}),n()},clearAllSubordinatesContext(a){const i=t().agents.get(a),c=(i==null?void 0:i.isBoss)===!0||(i==null?void 0:i.class)==="boss";if(console.log("[Store] clearAllSubordinatesContext called:",{bossId:a,bossName:i==null?void 0:i.name,isBoss:c,subordinateIds:i==null?void 0:i.subordinateIds}),!i||!c||!i.subordinateIds||i.subordinateIds.length===0){console.log("[Store] clearAllSubordinatesContext: No boss or subordinates found, returning early");return}const d=s();console.log("[Store] clearAllSubordinatesContext: sendMessage available:",!!d);for(const f of i.subordinateIds)console.log("[Store] clearAllSubordinatesContext: Sending clear_context for subordinate:",f),d==null||d({type:"clear_context",payload:{agentId:f}});e(f=>{const h=new Map(f.agentOutputs);for(const m of i.subordinateIds||[])h.delete(m);f.agentOutputs=h}),n(),console.log("[Store] clearAllSubordinatesContext: Completed")}}}function LO(t,e,n,s){return{setSkillsFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.skills=i}),n()},addSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.set(a.id,a),r.skills=i}),n()},updateSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.set(a.id,a),r.skills=i}),n()},removeSkillFromServer(a){e(r=>{const i=new Map(r.skills);i.delete(a),r.skills=i}),n()},getSkill(a){return t().skills.get(a)},getAllSkills(){return Array.from(t().skills.values())},getSkillsForAgent(a){const r=t(),i=r.agents.get(a);return i?Array.from(r.skills.values()).filter(c=>c.enabled?!!(c.assignedAgentIds.includes(a)||c.assignedAgentClasses.includes(i.class)):!1):[]},createSkill(a){var r;(r=s())==null||r({type:"create_skill",payload:a})},updateSkill(a,r){var i;(i=s())==null||i({type:"update_skill",payload:{id:a,updates:r}})},deleteSkill(a){var r;(r=s())==null||r({type:"delete_skill",payload:{id:a}})},assignSkillToAgent(a,r){var i;(i=s())==null||i({type:"assign_skill",payload:{skillId:a,agentId:r}})},unassignSkillFromAgent(a,r){var i;(i=s())==null||i({type:"unassign_skill",payload:{skillId:a,agentId:r}})},requestAgentSkills(a){var r;(r=s())==null||r({type:"request_agent_skills",payload:{agentId:a}})},setCustomAgentClassesFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.customAgentClasses=i}),n()},addCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.set(a.id,a),r.customAgentClasses=i}),n()},updateCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.set(a.id,a),r.customAgentClasses=i}),n()},removeCustomAgentClassFromServer(a){e(r=>{const i=new Map(r.customAgentClasses);i.delete(a),r.customAgentClasses=i}),n()},getCustomAgentClass(a){return t().customAgentClasses.get(a)},getAllCustomAgentClasses(){return Array.from(t().customAgentClasses.values())},createCustomAgentClass(a){var r;(r=s())==null||r({type:"create_custom_agent_class",payload:a})},updateCustomAgentClass(a,r){var i;(i=s())==null||i({type:"update_custom_agent_class",payload:{id:a,updates:r}})},deleteCustomAgentClass(a){var r;(r=s())==null||r({type:"delete_custom_agent_class",payload:{id:a}})}}}function PO(t,e,n){return{handleExecTaskStarted(s,a,r,i,c){e(d=>{const f={taskId:s,agentId:a,agentName:r,command:i,cwd:c,status:"running",output:[],startedAt:Date.now()};d.execTasks||(d.execTasks=new Map),d.execTasks.set(s,f)}),n()},handleExecTaskOutput(s,a,r,i){e(c=>{var m;const d=(m=c.execTasks)==null?void 0:m.get(s);if(!d)return;const f=r.split(`
|
|
46
|
+
`),h=[...d.output];for(const x of f)x.length>0&&h.push(i?`[stderr] ${x}`:x);h.length>500&&h.splice(0,h.length-500),c.execTasks.set(s,{...d,output:h})}),n()},handleExecTaskCompleted(s,a,r,i){e(c=>{var f;const d=(f=c.execTasks)==null?void 0:f.get(s);d&&(d.status=i?"completed":"failed",d.exitCode=r,d.completedAt=Date.now())}),n()},async stopExecTask(s){try{return(await fetch(`/api/exec/tasks/${s}`,{method:"DELETE"})).ok?(e(r=>{var c;const i=(c=r.execTasks)==null?void 0:c.get(s);i&&i.status==="running"&&(i.status="failed",i.exitCode=-15,i.completedAt=Date.now(),i.output.push("[Task stopped by user]"))}),n(),!0):!1}catch(a){return console.error("Failed to stop exec task:",a),!1}},getExecTasks(s){const a=t();return a.execTasks?Array.from(a.execTasks.values()).filter(r=>r.agentId===s):[]},getAllExecTasks(){const s=t();return s.execTasks?Array.from(s.execTasks.values()):[]},getExecTask(s){var r;return(r=t().execTasks)==null?void 0:r.get(s)},clearCompletedExecTasks(s){e(a=>{if(a.execTasks)for(const[r,i]of a.execTasks.entries())i.agentId===s&&i.status!=="running"&&a.execTasks.delete(r)}),n()},clearAllExecTasks(s){e(a=>{if(a.execTasks)for(const[r,i]of a.execTasks.entries())i.agentId===s&&a.execTasks.delete(r)}),n()},removeExecTask(s){e(a=>{a.execTasks&&a.execTasks.delete(s)}),n()}}}function IO(t,e,n,s){return{setSecretsFromServer(a){e(r=>{const i=new Map;for(const c of a)i.set(c.id,c);r.secrets=i}),n()},addSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.set(a.id,a),r.secrets=i}),n()},updateSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.set(a.id,a),r.secrets=i}),n()},removeSecretFromServer(a){e(r=>{const i=new Map(r.secrets);i.delete(a),r.secrets=i}),n()},getSecret(a){return t().secrets.get(a)},getSecretByKey(a){return Array.from(t().secrets.values()).find(r=>r.key===a)},getAllSecrets(){return Array.from(t().secrets.values())},createSecret(a){var r;(r=s())==null||r({type:"create_secret",payload:a})},updateSecret(a,r){var i;(i=s())==null||i({type:"update_secret",payload:{id:a,updates:r}})},deleteSecret(a){var r;(r=s())==null||r({type:"delete_secret",payload:{id:a}})}}}function qk(){return{connectionStatus:new Map,databases:new Map,tables:new Map,tableSchemas:new Map,queryResults:[],queryHistory:[],executingQuery:!1,activeConnectionId:null,activeDatabase:null,lastSilentQueryResult:null}}function BO(t,e,n,s){const a=i=>{t().databaseState.has(i)||e(d=>{const f=new Map(d.databaseState);f.set(i,qk()),d.databaseState=f})};return{testDatabaseConnection(i,c){var d;(d=s())==null||d({type:"test_database_connection",payload:{buildingId:i,connectionId:c}})},setConnectionStatus(i,c,d){a(i),e(f=>{const h=f.databaseState.get(i);if(h){const m=new Map(h.connectionStatus);m.set(c,d);const x={...h,connectionStatus:m},y=new Map(f.databaseState);y.set(i,x),f.databaseState=y}}),n()},listDatabases(i,c){var d;(d=s())==null||d({type:"list_databases",payload:{buildingId:i,connectionId:c}})},setDatabases(i,c,d){a(i),e(f=>{const h=f.databaseState.get(i);if(h){const m=new Map(h.databases);m.set(c,d);const x={...h,databases:m},y=new Map(f.databaseState);y.set(i,x),f.databaseState=y}}),n()},listTables(i,c,d){var f;(f=s())==null||f({type:"list_tables",payload:{buildingId:i,connectionId:c,database:d}})},setTables(i,c,d,f){a(i);const h=`${c}:${d}`;e(m=>{const x=m.databaseState.get(i);if(x){const y=new Map(x.tables);y.set(h,f);const v={...x,tables:y},S=new Map(m.databaseState);S.set(i,v),m.databaseState=S}}),n()},getTableSchema(i,c,d,f){var h;(h=s())==null||h({type:"get_table_schema",payload:{buildingId:i,connectionId:c,database:d,table:f}})},setTableSchema(i,c,d,f,h){a(i);const m=`${c}:${d}:${f}`;e(x=>{const y=x.databaseState.get(i);if(y){const v=new Map(y.tableSchemas);v.set(m,h);const S={...y,tableSchemas:v},A=new Map(x.databaseState);A.set(i,S),x.databaseState=A}}),n()},executeQuery(i,c,d,f,h=1e3){var m;a(i),e(x=>{const y=x.databaseState.get(i);if(y){const v={...y,executingQuery:!0},S=new Map(x.databaseState);S.set(i,v),x.databaseState=S}}),n(),(m=s())==null||m({type:"execute_query",payload:{buildingId:i,connectionId:c,database:d,query:f,limit:h}})},executeSilentQuery(i,c,d,f,h){var m;(m=s())==null||m({type:"execute_query",payload:{buildingId:i,connectionId:c,database:d,query:f,limit:0,silent:!0,requestId:h}})},setSilentQueryResult(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,lastSilentQueryResult:{...c,timestamp:Date.now()}},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},setQueryResult(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h=[c,...f.queryResults].slice(0,20),m={...f,queryResults:h,executingQuery:!1},x=new Map(d.databaseState);x.set(i,m),d.databaseState=x}}),n()},setExecutingQuery(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,executingQuery:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},requestQueryHistory(i,c=100){var d;(d=s())==null||d({type:"request_query_history",payload:{buildingId:i,limit:c}})},setQueryHistory(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,queryHistory:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},toggleQueryFavorite(i,c){var d;(d=s())==null||d({type:"toggle_query_favorite",payload:{buildingId:i,queryId:c}})},deleteQueryFromHistory(i,c){var d;(d=s())==null||d({type:"delete_query_history",payload:{buildingId:i,queryId:c}})},clearQueryHistory(i){var c;(c=s())==null||c({type:"clear_query_history",payload:{buildingId:i}})},setActiveConnection(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,activeConnectionId:c,activeDatabase:null},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},setActiveDatabase(i,c){a(i),e(d=>{const f=d.databaseState.get(i);if(f){const h={...f,activeDatabase:c},m=new Map(d.databaseState);m.set(i,h),d.databaseState=m}}),n()},getDatabaseState(i){return t().databaseState.get(i)||qk()},clearDatabaseState(i){e(c=>{const d=new Map(c.databaseState);d.delete(i),c.databaseState=d}),n()}}}function FO(t,e,n){return{async fetchSnapshots(){e(s=>{s.snapshotsLoading=!0,s.snapshotsError=null}),n();try{const s=await Pt(Ot("/api/snapshots"));if(!s.ok)throw new Error(`Failed to fetch snapshots: ${s.statusText}`);const a=await s.json(),r=Array.isArray(a)?a:a.snapshots||[];this.setSnapshots(r)}catch(s){const a=s instanceof Error?s.message:"Failed to fetch snapshots";this.setError(a),console.error("Snapshot fetch error:",s)}finally{e(s=>{s.snapshotsLoading=!1}),n()}},setSnapshots(s){e(a=>{const r=new Map;s.forEach(i=>{r.set(i.id,i)}),a.snapshots=r}),n()},async createSnapshot(s,a,r,i,c,d){e(f=>{f.snapshotsLoading=!0,f.snapshotsError=null}),n();try{const f={agentId:s,agentName:a,title:r,description:i,outputs:c||[],files:d||[]},h=await Pt(Ot("/api/snapshots"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok)throw new Error(`Failed to create snapshot: ${h.statusText}`);const m=await h.json();return await this.fetchSnapshots(),m}catch(f){const h=f instanceof Error?f.message:"Failed to create snapshot";throw this.setError(h),console.error("Snapshot creation error:",f),f}finally{e(f=>{f.snapshotsLoading=!1}),n()}},async loadSnapshot(s){e(a=>{a.snapshotsLoading=!0,a.snapshotsError=null}),n();try{const a=await Pt(Ot(`/api/snapshots/${s}`));if(!a.ok)throw new Error(`Failed to load snapshot: ${a.statusText}`);const r=await a.json();this.setCurrentSnapshot(r)}catch(a){const r=a instanceof Error?a.message:"Failed to load snapshot";this.setError(r),console.error("Snapshot load error:",a)}finally{e(a=>{a.snapshotsLoading=!1}),n()}},setCurrentSnapshot(s){e(a=>{a.currentSnapshot=s}),n()},async deleteSnapshot(s){var a;e(r=>{r.snapshotsLoading=!0,r.snapshotsError=null}),n();try{const r=await Pt(Ot(`/api/snapshots/${s}`),{method:"DELETE"});if(!r.ok)throw new Error(`Failed to delete snapshot: ${r.statusText}`);await this.fetchSnapshots(),((a=t().currentSnapshot)==null?void 0:a.id)===s&&this.setCurrentSnapshot(null)}catch(r){const i=r instanceof Error?r.message:"Failed to delete snapshot";throw this.setError(i),console.error("Snapshot deletion error:",r),r}finally{e(r=>{r.snapshotsLoading=!1}),n()}},async restoreFiles(s,a){e(r=>{r.snapshotsLoading=!0,r.snapshotsError=null}),n();try{const r=a?{filePaths:a}:{},i=await Pt(Ot(`/api/snapshots/${s}/restore`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to restore files: ${i.statusText}`)}catch(r){const i=r instanceof Error?r.message:"Failed to restore files";throw this.setError(i),console.error("File restoration error:",r),r}finally{e(r=>{r.snapshotsLoading=!1}),n()}},setLoading(s){e(a=>{a.snapshotsLoading=s}),n()},setError(s){e(a=>{a.snapshotsError=s}),n()},clearError(){this.setError(null)},reset(){e(s=>{s.snapshots=new Map,s.currentSnapshot=null,s.snapshotsLoading=!1,s.snapshotsError=null}),n()}}}const zO=3e4,ag=new Map;function Jd(t,e,n){let s=t.get(e);if(!s){for(const[,a]of t)if(a.toolUseId===e&&a.parentAgentId===n){s=a;break}}return s}function Vk(t,e,n){const s=ag.get(t);s&&clearTimeout(s),ag.set(t,setTimeout(()=>{ag.delete(t),e(a=>{const r=a.subagents.get(t);if(r&&(r.status==="completed"||r.status==="failed")){const i=new Map(a.subagents);i.delete(t),a.subagents=i}}),n()},zO))}function $O(t,e,n){return{addSubagent(s){e(a=>{const r=new Map(a.subagents);r.set(s.id,s),a.subagents=r}),n(),console.log(`[Subagent] Added: ${s.name} (${s.id}) for agent ${s.parentAgentId}`)},completeSubagent(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=new Map(i.subagents);d.set(c.id,{...c,status:r?"completed":"failed",completedAt:Date.now()}),i.subagents=d,console.log(`[Subagent] Completed: ${c.name} (${c.id}) success=${r}`),Vk(c.id,e,n)}}),n()},addSubagentActivity(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=[...c.activities||[],r].slice(-50),f=new Map(i.subagents);f.set(c.id,{...c,activities:d}),i.subagents=f}}),n()},updateSubagentStats(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const d=new Map(i.subagents);d.set(c.id,{...c,stats:r}),i.subagents=d}}),n()},getSubagentsForAgent(s){const a=t();return Array.from(a.subagents.values()).filter(r=>r.parentAgentId===s)},getSubagent(s){return t().subagents.get(s)},removeSubagent(s){e(a=>{const r=new Map(a.subagents);r.delete(s),a.subagents=r}),n()},addSubagentStreamEntries(s,a,r){e(i=>{const c=Jd(i.subagents,s,a);if(c){const f=[...c.streamEntries||[],...r].slice(-200),h=new Map(i.subagents);h.set(c.id,{...c,streamEntries:f}),i.subagents=h,(c.status==="completed"||c.status==="failed")&&Vk(c.id,e,n)}}),n()},getSubagentByToolUseId(s){const a=t();for(const[,r]of a.subagents)if(r.toolUseId===s)return r},hydrateSubagentsFromHistory(s,a){!a||a.length===0||(e(r=>{const i=new Map(r.subagents);for(const c of a){let d=!1;for(const[,m]of i)if(m.toolUseId===c.toolUseId&&m.parentAgentId===s){d=!0;break}if(d)continue;const f=`hist_${c.toolUseId}`,h={id:f,parentAgentId:s,toolUseId:c.toolUseId,name:c.name||"Subagent",description:c.description||"",subagentType:c.subagentType||"general-purpose",model:c.model,status:"completed",startedAt:c.startedAt||0,completedAt:c.completedAt,streamEntries:c.streamEntries.slice(-200),stats:c.stats};i.set(f,h)}r.subagents=i}),n())}}}const HO={workflowDefinitions:new Map,workflowInstances:new Map,selectedWorkflowId:null,workflowDetailOpen:!1,workflowDetailLevel:{level:"overview"},workflowChatMessages:[],workflowChatScope:{level:"workflow"},workflowChatLoading:!1};function UO(t,e,n,s){const a=()=>{const i=t();return{workflowDefinitions:i.workflowDefinitions??new Map,workflowInstances:i.workflowInstances??new Map,selectedWorkflowId:i.selectedWorkflowId??null,workflowDetailOpen:i.workflowDetailOpen??!1,workflowDetailLevel:i.workflowDetailLevel??{level:"overview"},workflowChatMessages:i.workflowChatMessages??[],workflowChatScope:i.workflowChatScope??{level:"workflow"},workflowChatLoading:i.workflowChatLoading??!1}};return{setWorkflowDefinitionsFromServer(i){e(c=>{const d=new Map;for(const f of i)d.set(f.id,f);c.workflowDefinitions=d}),n()},addWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.set(i.id,i),d.workflowDefinitions=f}),n()},updateWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.set(i.id,i),d.workflowDefinitions=f}),n()},removeWorkflowDefinitionFromServer(i){e(c=>{const d=c,f=new Map(d.workflowDefinitions??new Map);f.delete(i),d.workflowDefinitions=f,d.selectedWorkflowId===i&&(d.selectedWorkflowId=null,d.workflowDetailOpen=!1)}),n()},createWorkflowDefinition(i){var c;(c=s())==null||c({type:"create_workflow_def",payload:i})},updateWorkflowDefinition(i,c){var d;(d=s())==null||d({type:"update_workflow_def",payload:{id:i,updates:c}})},deleteWorkflowDefinition(i){var c;(c=s())==null||c({type:"delete_workflow_def",payload:{id:i}})},moveWorkflow(i,c){var d;e(f=>{const h=f,m=new Map(h.workflowDefinitions??new Map),x=m.get(i);x&&(m.set(i,{...x,position:c}),h.workflowDefinitions=m)}),(d=s())==null||d({type:"update_workflow_def",payload:{id:i,updates:{position:c}}}),n()},setWorkflowInstancesFromServer(i){e(c=>{const d=c,f=new Map;for(const h of i)f.set(h.id,h);d.workflowInstances=f}),n()},updateWorkflowInstanceFromServer(i){e(c=>{const d=c,f=new Map(d.workflowInstances??new Map);f.set(i.id,i),d.workflowInstances=f}),n()},removeWorkflowInstanceFromServer(i){e(c=>{const d=c,f=new Map(d.workflowInstances??new Map);f.delete(i),d.workflowInstances=f}),n()},startWorkflow(i,c){var d;(d=s())==null||d({type:"start_workflow",payload:{workflowDefId:i,initialVariables:c}})},pauseWorkflow(i){var c;(c=s())==null||c({type:"pause_workflow",payload:{instanceId:i}})},resumeWorkflow(i){var c;(c=s())==null||c({type:"resume_workflow",payload:{instanceId:i}})},cancelWorkflow(i){var c;(c=s())==null||c({type:"cancel_workflow",payload:{instanceId:i}})},manualTransition(i,c){var d;(d=s())==null||d({type:"manual_transition",payload:{instanceId:i,transitionId:c}})},selectWorkflow(i){e(c=>{c.selectedWorkflowId=i}),n()},openWorkflowDetail(i){e(c=>{const d=c;d.selectedWorkflowId=i,d.workflowDetailOpen=!0,d.workflowDetailLevel={level:"overview"},d.workflowChatMessages=[],d.workflowChatScope={level:"workflow"}}),n()},closeWorkflowDetail(){e(i=>{const c=i;c.workflowDetailOpen=!1,c.workflowDetailLevel={level:"overview"},c.workflowChatMessages=[]}),n()},navigateToExecution(i){e(c=>{const d=c;d.workflowDetailLevel={level:"execution",instanceId:i},d.workflowChatScope={level:"instance",instanceId:i}}),n()},navigateToStep(i,c){e(d=>{const f=d;f.workflowDetailLevel={level:"step",instanceId:i,stepId:c},f.workflowChatScope={level:"step",instanceId:i,stepId:c}}),n()},navigateBack(){const c=a().workflowDetailLevel;e(d=>{const f=d;c.level==="step"?(f.workflowDetailLevel={level:"execution",instanceId:c.instanceId},f.workflowChatScope={level:"instance",instanceId:c.instanceId}):c.level==="execution"&&(f.workflowDetailLevel={level:"overview"},f.workflowChatScope={level:"workflow"})}),n()},getWorkflowModelStatus(i){const c=a(),d=Array.from(c.workflowInstances.values()).filter(m=>m.workflowDefId===i);if(d.length===0)return"idle";if(d.some(m=>m.status==="failed"))return"error";if(d.some(m=>m.status==="running"||m.status==="paused"))return"running";const f=Date.now()-300*1e3;return d.filter(m=>m.status==="completed"&&m.completedAt&&m.completedAt>f).length>0?"completed":"idle"},addWorkflowChatMessage(i){e(c=>{const d=c;d.workflowChatMessages=[...d.workflowChatMessages??[],i]}),n()},setWorkflowChatScope(i){e(c=>{c.workflowChatScope=i}),n()},setWorkflowChatLoading(i){e(c=>{c.workflowChatLoading=i}),n()},clearWorkflowChat(){e(i=>{const c=i;c.workflowChatMessages=[]}),n()},getWorkflowDefinition(i){return a().workflowDefinitions.get(i)},getWorkflowInstances(i){return Array.from(a().workflowInstances.values()).filter(c=>c.workflowDefId===i)},getAllWorkflowDefinitions(){return Array.from(a().workflowDefinitions.values())}}}const rg={panSpeed:1,orbitSpeed:1,zoomSpeed:1,smoothing:.3,invertPanX:!1,invertPanY:!1,invertOrbitX:!1,invertOrbitY:!1},Zd={enabled:!0,pinchToZoom:!0,twoFingerPan:!0,shiftTwoFingerOrbit:!0,sensitivity:{zoom:1,pan:1,orbit:1}};function Vi(t,e,n,s,a,r,i){return{id:t,name:e,description:n,button:s,modifiers:a,action:r,enabled:!0,sensitivity:i}}const ig=[Vi("left-click-select","Select/Click","Select agents, click on buildings/areas","left",{},"primary-action"),Vi("left-drag-selection","Selection Box","Drag to select multiple agents","left",{},"selection-box"),Vi("right-click-context","Context Menu / Move","Show context menu or move selected agents","right",{},"context-menu"),Vi("alt-right-drag-pan","Camera Pan","Pan camera with Alt+Right-drag","right",{alt:!0},"camera-pan",1),Vi("middle-drag-orbit","Camera Orbit","Orbit camera with middle-drag","middle",{},"camera-orbit",1),Vi("shift-middle-drag-pan","Camera Pan (Alt)","Alternative pan with Shift+Middle-drag","middle",{shift:!0},"camera-pan",1),Vi("wheel-zoom","Zoom","Zoom camera with scroll wheel","middle",{},"camera-zoom",1)],Iq={0:"left",1:"middle",2:"right",3:"back",4:"forward"},WO={left:"Left Click",right:"Right Click",middle:"Middle Click",back:"Back Button",forward:"Forward Button"};function Bq(t,e){const n=[];if(t.modifiers.ctrl){const s=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");n.push(s?"⌘":"Ctrl")}if(t.modifiers.alt){const s=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC");n.push(s?"⌥":"Alt")}return t.modifiers.shift&&n.push("Shift"),n.push(e?e(t.button):WO[t.button]),n.join("+")}function Fq(t,e){const n=e.ctrl?t.ctrlKey||t.metaKey:!t.ctrlKey&&!t.metaKey,s=e.alt?t.altKey:!t.altKey,a=e.shift?t.shiftKey:!t.shiftKey;return n&&s&&a}function zq(t,e,n){return t.filter(s=>{if(s.id===n||!s.enabled||s.button!==e.button)return!1;const a=s.modifiers,r=e.modifiers;return(a.ctrl||!1)===(r.ctrl||!1)&&(a.alt||!1)===(r.alt||!1)&&(a.shift||!1)===(r.shift||!1)})}function Bs(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function Pa(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const[n,s]of t)if(e.get(n)!==s)return!1;return!0}function rx(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function wt(t,e=Object.is){const[n,s]=b.useState(()=>t(H.getState())),a=b.useRef(n);return b.useEffect(()=>{a.current=n},[n]),b.useEffect(()=>{const r=()=>{const i=t(H.getState());e(a.current,i)||(a.current=i,s(i))};return r(),H.subscribe(r)},[t,e]),n}function Ts(){const[,t]=b.useState({});return b.useEffect(()=>H.subscribe(()=>t({})),[]),H.getState()}function Ml(){return wt(b.useCallback(t=>t.agents,[]),Pa)}function Nj(){return wt(b.useCallback(t=>t.agents.size,[]))}function xp(){const t=Ml(),e=b.useRef([]),n=Array.from(t.values());return Bs(e.current,n)||(e.current=n),e.current}function ix(t){return wt(b.useCallback(e=>t?e.agents.get(t):void 0,[t]))}function ox(){return wt(b.useCallback(t=>t.selectedAgentIds,[]),rx)}function qO(){return wt(b.useCallback(t=>t.lastSelectedAgentId,[]))}function Tj(t){const e=b.useRef([]),n=b.useRef(0),s=wt(b.useCallback(a=>t&&a.agentOutputs.get(t)||e.current,[t]),Bs);return s.length!==n.current&&(yu.info(`Selector: ${n.current} -> ${s.length}`,{agentId:t,lastText:s.length>0?s[s.length-1].text.slice(0,40):null},"useAgentOutputs"),n.current=s.length),s}function VO(t){return wt(b.useCallback(e=>t?e.compactingAgents.has(t):!1,[t]))}function _j(t){return wt(b.useCallback(e=>t?e.lastPrompts.get(t):void 0,[t]))}function lx(){return wt(b.useCallback(t=>t.lastPrompts,[]),Pa)}function Ej(){return wt(b.useCallback(t=>t.isConnected,[]))}function sr(){return wt(b.useCallback(t=>t.areas,[]),Pa)}function GO(){return wt(b.useCallback(t=>t.activeTool,[]))}function YO(){return wt(b.useCallback(t=>t.selectedAreaId,[]))}function cx(){return wt(b.useCallback(t=>t.buildings,[]),Pa)}function KO(){return wt(b.useCallback(t=>t.selectedBuildingIds,[]),rx)}function QO(){return wt(b.useCallback(t=>t.supervisor,[]))}function $q(){return wt(b.useCallback(t=>t.supervisor.lastReport,[]))}function XO(){return wt(b.useCallback(t=>t.supervisor.generatingReport,[]))}function JO(){return wt(b.useCallback(t=>t.permissionRequests,[]),Pa)}function Ir(){return wt(b.useCallback(t=>t.settings,[]))}function Mj(){return wt(b.useCallback(t=>t.settings.hideCost,[]))}function Hq(){return wt(b.useCallback(t=>t.settings.customAgentNames,[]),Bs)}function Uq(){return wt(b.useCallback(t=>t.shortcuts,[]),Bs)}function Wq(){return wt(b.useCallback(t=>t.mouseControls,[]))}function qq(){return wt(b.useCallback(t=>t.mouseControls.trackpad,[]))}function Dj(){return wt(b.useCallback(t=>t.terminalOpen,[]))}function Rj(){return wt(b.useCallback(t=>t.mobileView,[]))}function ux(){return wt(b.useCallback(t=>t.fileViewerPath,[]))}function ZO(){return wt(b.useCallback(t=>t.fileViewerEditData,[]))}function eL(){return wt(b.useCallback(t=>t.fileViewerSearchRoot,[]))}function tL(){return wt(b.useCallback(t=>t.explorerFolderPath,[]))}function dx(){return wt(b.useCallback(t=>t.contextModalAgentId,[]))}function Vq(){return wt(b.useCallback(t=>t.commanderExpandRequest,[]))}function fx(){return wt(b.useCallback(t=>t.toolExecutions,[]),Bs)}function Oj(){return wt(b.useCallback(t=>t.fileChanges,[]),Bs)}function Lj(){return wt(b.useCallback(t=>t.skills,[]),Pa)}function nL(){const t=Lj(),e=b.useRef([]),n=Array.from(t.values());return Bs(e.current,n)||(e.current=n),e.current}function Gq(t){return wt(b.useCallback(e=>t?e.skills.get(t):void 0,[t]))}function sL(t){const e=b.useRef([]),n=Ml(),s=Lj();if(!t)return e.current;const a=n.get(t);return a?Array.from(s.values()).filter(i=>i.enabled?!!(i.assignedAgentIds.includes(t)||i.assignedAgentClasses.includes(a.class)):!1):e.current}function aL(){return wt(b.useCallback(t=>t.customAgentClasses,[]),Pa)}function ar(){const t=aL(),e=b.useRef([]),n=Array.from(t.values());return Bs(e.current,n)||(e.current=n),e.current}function Pj(t){return wt(b.useCallback(e=>t?e.customAgentClasses.get(t):void 0,[t]))}function Ij(){return wt(b.useCallback(t=>t.reconnectCount,[]))}function Bj(){return wt(b.useCallback(t=>t.historyRefreshTrigger,[]))}function Yq(){return wt(b.useCallback(t=>t.supervisor.globalUsage,[]))}function Kq(){return wt(b.useCallback(t=>t.supervisor.refreshingUsage,[]))}function rL(t){const e=b.useRef(new Map);return wt(b.useCallback(n=>t&&n.agentTaskProgress.get(t)||e.current,[t]),Pa)}function iL(t){return wt(b.useCallback(e=>!t||!e.execTasks?[]:Array.from(e.execTasks.values()).filter(n=>n.agentId===t),[t]),Bs)}function oL(){return wt(b.useCallback(t=>t.secrets,[]),Pa)}function Qq(){const t=oL(),e=b.useRef([]),n=Array.from(t.values());return Bs(e.current,n)||(e.current=n),e.current}const lL={connectionStatus:new Map,databases:new Map,tables:new Map,tableSchemas:new Map,queryResults:[],queryHistory:[],executingQuery:!1,activeConnectionId:null,activeDatabase:null,lastSilentQueryResult:null};function px(t){return wt(b.useCallback(e=>(t?e.databaseState.get(t):void 0)??lL,[t]))}function cL(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryResults)??[]},[t]),Bs)}function Xq(t){return wt(b.useCallback(e=>{if(!t)return[];const n=e.databaseState.get(t);return(n==null?void 0:n.queryHistory)??[]},[t]),Bs)}function uL(t){return wt(b.useCallback(e=>{if(!t)return!1;const n=e.databaseState.get(t);return(n==null?void 0:n.executingQuery)??!1},[t]))}function Jq(){return wt(t=>t.dockerContainersList,Bs)}function dL(){return wt(t=>t.currentSnapshot)}function fL(){return wt(t=>t.snapshotsLoading)}function pL(){return wt(t=>t.snapshotsError)}function hL(){return wt(t=>t.subagents,Pa)}function mL(t){return wt(b.useCallback(e=>t?Array.from(e.subagents.values()).filter(n=>n.parentAgentId===t):[],[t]),Bs)}function gL(t){const e=b.useRef(new Map);return wt(b.useCallback(n=>{if(!t)return e.current;const s=new Map;for(const[a,r]of n.subagents)r.parentAgentId===t&&s.set(a,r);return s.size===0?e.current:s},[t]),Pa)}function Fj(){return wt(t=>t.viewMode)}function bL(){return wt(b.useCallback(t=>t.overviewPanelOpen,[]))}function xL(){return wt(b.useCallback(t=>t.splitPaneAgentIds,[]))}function yL(){return wt(b.useCallback(t=>t.splitOrientation,[]))}function zj(){return wt(b.useCallback(t=>t.agentsWithUnseenOutput,[]),rx)}class Gk{constructor(){Je(this,"state");Je(this,"listeners",new Set);Je(this,"sendMessage",null);Je(this,"agentActions");Je(this,"outputActions");Je(this,"supervisorActions");Je(this,"areaActions");Je(this,"buildingActions");Je(this,"permissionActions");Je(this,"delegationActions");Je(this,"skillActions");Je(this,"execTaskActions");Je(this,"secretActions");Je(this,"databaseActions");Je(this,"snapshotActions");Je(this,"subagentActions");Je(this,"workflowActions");Je(this,"statusPollInterval",null);this.state={agents:new Map,selectedAgentIds:new Set,lastSelectedAgentId:null,activities:[],isConnected:!1,areas:new Map,activeTool:null,selectedAreaId:null,buildings:new Map,selectedBuildingIds:new Set,buildingLogs:new Map,streamingBuildingLogs:new Map,streamingBuildingIds:new Set,bossStreamingLogs:new Map,agentOutputs:new Map,compactingAgents:new Set,lastPrompts:new Map,toolExecutions:[],fileChanges:[],terminalOpen:!1,terminalResizing:!1,mobileView:this.loadMobileView(),settings:this.loadSettings(),shortcuts:this.loadShortcuts(),mouseControls:this.loadMouseControls(),fileViewerPath:null,fileViewerSearchRoot:null,fileViewerEditData:null,explorerFolderPath:null,explorerAreaId:null,contextModalAgentId:null,supervisor:{enabled:!0,autoReportOnComplete:!1,lastReport:null,narratives:new Map,lastReportTime:null,nextReportTime:null,agentHistories:new Map,loadingHistoryForAgent:null,historyFetchedForAgents:new Set,generatingReport:!1,globalUsage:null,refreshingUsage:!1},permissionRequests:new Map,delegationHistories:new Map,pendingDelegation:null,lastDelegationReceived:new Map,agentTaskProgress:new Map,skills:new Map,customAgentClasses:new Map,reconnectCount:0,historyRefreshTrigger:0,execTasks:new Map,secrets:new Map,databaseState:new Map,dockerContainersList:[],dockerComposeProjectsList:[],snapshots:new Map,currentSnapshot:null,snapshotsLoading:!1,snapshotsError:null,lastSelectionViaSwipe:!1,lastSelectionViaDirectClickAt:null,subagents:new Map,viewMode:(()=>{const i=ka(pt.SCENE_VIEW_MODE,"3d");return i==="2d"||i==="3d"||i==="dashboard"?i:"3d"})(),overviewPanelOpen:bi(pt.AOP_OPEN,!1),splitPaneAgentIds:this.loadSplitPaneAgentIds(),splitOrientation:this.loadSplitOrientation(),agentsWithUnseenOutput:this.loadUnseenAgents(),commanderExpandRequest:null,latestNotificationAgentId:null,...HO};const e=()=>this.state,n=i=>{i(this.state)},s=()=>this.notify(),a=()=>this.sendMessage,r=()=>this.listeners.size;this.agentActions=jO(e,n,s,a,()=>this.saveUnseenAgents()),this.outputActions=NO(e,n,s,r),this.supervisorActions=TO(e,n,s,a),this.areaActions=_O(e,n,s,a),this.buildingActions=DO(e,n,s,a),this.permissionActions=RO(e,n,s,a),this.delegationActions=OO(e,n,s,a),this.skillActions=LO(e,n,s,a),this.execTaskActions=PO(e,n,s),this.secretActions=IO(e,n,s,a),this.databaseActions=BO(e,n,s,a),this.snapshotActions=FO(e,n,s),this.subagentActions=$O(e,n,s),this.workflowActions=UO(e,n,s,a)}loadSettings(){const e=ea(pt.SETTINGS,null);if(e){const n={...tg,...e},s=Number(n.vibrationIntensity);return n.vibrationIntensity=Number.isFinite(s)?Math.max(0,Math.min(xu,Math.round(s))):tg.vibrationIntensity,n}return{...tg}}loadShortcuts(){const e=ea(pt.SHORTCUTS,null);return e?Zm.map(s=>{const a=e.find(r=>r.id===s.id);return a?{...s,...a}:s}):[...Zm]}loadMouseControls(){var n;const e=ea(pt.MOUSE_CONTROLS,null);return e?{bindings:ig.map(a=>{var i;const r=(i=e.bindings)==null?void 0:i.find(c=>c.id===a.id);return r?{...a,...r}:a}),sensitivity:{...rg,...e.sensitivity},trackpad:{...Zd,...e.trackpad,sensitivity:{...Zd.sensitivity,...(n=e.trackpad)==null?void 0:n.sensitivity}}}:{bindings:[...ig],sensitivity:{...rg},trackpad:{...Zd}}}loadMobileView(){const e=ka(pt.MOBILE_VIEW,"");return e==="terminal"||e==="3d"?e:typeof window<"u"&&window.innerWidth<=768&&"ontouchstart"in window?"3d":"terminal"}loadUnseenAgents(){const e=ea(pt.UNSEEN_AGENTS,[]);return new Set(e)}saveUnseenAgents(){const e=Array.from(this.state.agentsWithUnseenOutput);wa(pt.UNSEEN_AGENTS,e)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(){this.listeners.forEach(e=>e())}getState(){return this.state}setSendMessage(e){this.sendMessage=e}setConnected(e){this.state.isConnected=e,this.notify()}triggerReconnect(){this.state.reconnectCount++,this.notify()}triggerHistoryRefresh(e){this.state.selectedAgentIds.has(e)&&(this.state.historyRefreshTrigger++,this.notify())}toggleTerminal(e){e&&!this.state.selectedAgentIds.has(e)&&(this.state.selectedAgentIds=new Set([e])),this.state.terminalOpen=!this.state.terminalOpen,this.notify()}setTerminalOpen(e){if(this.state.terminalOpen=e,e){if(this.state.mobileView="terminal",this.state.selectedAgentIds.size===0&&this.state.agents.size>0&&!this.state.currentSnapshot){const s=Array.from(this.state.agents.keys())[0];this.state.selectedAgentIds=new Set([s])}let n=!1;for(const s of this.state.selectedAgentIds)this.state.agentsWithUnseenOutput.has(s)&&(n||(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),n=!0),this.state.agentsWithUnseenOutput.delete(s));n&&this.saveUnseenAgents()}else window.innerWidth<=768&&(this.state.mobileView="3d");this.notify()}setOverviewPanelOpen(e){this.state.overviewPanelOpen=e,xi(pt.AOP_OPEN,e),this.notify()}loadSplitPaneAgentIds(){const e=ea(pt.SPLIT_PANE_AGENT_IDS,[]);return Array.isArray(e)?e:[]}saveSplitPaneAgentIds(){wa(pt.SPLIT_PANE_AGENT_IDS,this.state.splitPaneAgentIds)}loadSplitOrientation(){return ka(pt.SPLIT_PANE_ORIENTATION,"horizontal")==="vertical"?"vertical":"horizontal"}addSplitPane(e){this.state.splitPaneAgentIds.includes(e)||this.state.splitPaneAgentIds.length>=4||(this.state.splitPaneAgentIds=[...this.state.splitPaneAgentIds,e],this.saveSplitPaneAgentIds(),this.notify())}removeSplitPane(e){this.state.splitPaneAgentIds.includes(e)&&(this.state.splitPaneAgentIds=this.state.splitPaneAgentIds.filter(n=>n!==e),this.saveSplitPaneAgentIds(),this.notify())}clearSplitPanes(){this.state.splitPaneAgentIds.length!==0&&(this.state.splitPaneAgentIds=[],this.saveSplitPaneAgentIds(),this.notify())}toggleSplitOrientation(){this.state.splitOrientation=this.state.splitOrientation==="horizontal"?"vertical":"horizontal",Ja(pt.SPLIT_PANE_ORIENTATION,this.state.splitOrientation),this.notify()}setMobileView(e){if(this.state.mobileView=e,Ja(pt.MOBILE_VIEW,e),e==="terminal"&&this.state.selectedAgentIds.size===0&&this.state.agents.size>0&&!this.state.currentSnapshot){const n=Array.from(this.state.agents.keys())[0];this.state.selectedAgentIds=new Set([n]),this.state.terminalOpen=!0}this.notify()}setViewMode(e){this.state.viewMode=e,Ja(pt.SCENE_VIEW_MODE,e),this.state.settings.experimental2DView=e==="2d",this.notify()}openTerminalOnMobile(e){eR("terminal"),this.state.selectedAgentIds=new Set([e]),this.state.terminalOpen=!0,this.state.mobileView="terminal",this.state.agentsWithUnseenOutput.has(e)&&(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),this.state.agentsWithUnseenOutput.delete(e),this.saveUnseenAgents()),this.notify()}clearUnseenForAgent(e){this.state.agentsWithUnseenOutput.has(e)&&(this.state.agentsWithUnseenOutput=new Set(this.state.agentsWithUnseenOutput),this.state.agentsWithUnseenOutput.delete(e),this.saveUnseenAgents(),this.notify())}setTerminalResizing(e){this.state.terminalResizing=e,this.notify()}setLastSelectionViaSwipe(e){this.state.lastSelectionViaSwipe=e}consumeSwipeSelectionFlag(){const e=this.state.lastSelectionViaSwipe;return this.state.lastSelectionViaSwipe=!1,e}setLastSelectionViaDirectClick(e){this.state.lastSelectionViaDirectClickAt=e?Date.now():null}consumeDirectClickSelectionFlag(){const e=this.state.lastSelectionViaDirectClickAt;return this.state.lastSelectionViaDirectClickAt=null,e===null?!1:Date.now()-e<=1500}setFileViewerPath(e,n,s){this.state.fileViewerPath=e,this.state.fileViewerEditData=n||null,this.state.fileViewerSearchRoot=s||null,this.notify()}clearFileViewerPath(){this.state.fileViewerPath=null,this.state.fileViewerEditData=null,this.state.fileViewerSearchRoot=null,this.notify()}requestCommanderExpand(e){this.state.commanderExpandRequest=e,this.notify()}clearCommanderExpandRequest(){this.state.commanderExpandRequest=null,this.notify()}setLatestNotificationAgentId(e){this.state.latestNotificationAgentId=e,this.notify()}getLastExplorerState(){try{const e=localStorage.getItem("file-explorer-last-opened");return e?JSON.parse(e):null}catch{return null}}setExplorerFolderPath(e){this.state.explorerFolderPath=e,this.notify()}openFileExplorer(e){this.state.explorerFolderPath=e,this.state.explorerAreaId=null,this.notify()}closeFileExplorer(){this.state.explorerFolderPath=null,this.state.explorerAreaId=null,this.notify()}openFileExplorerForArea(e){this.state.explorerFolderPath=null,this.state.explorerAreaId=e,this.notify()}openFileExplorerForAreaFolder(e,n){this.state.explorerAreaId=e,this.state.explorerFolderPath=n,this.notify()}setContextModalAgentId(e){this.state.contextModalAgentId=e,this.notify()}closeContextModal(){this.state.contextModalAgentId=null,this.notify()}updateSettings(e){const n={...e};if(n.vibrationIntensity!==void 0){const s=Number(n.vibrationIntensity);n.vibrationIntensity=Number.isFinite(s)?Math.max(0,Math.min(xu,Math.round(s))):this.state.settings.vibrationIntensity}this.state.settings={...this.state.settings,...n},wa(pt.SETTINGS,this.state.settings),this.notify()}getSettings(){return this.state.settings}getShortcuts(){return this.state.shortcuts}getShortcut(e){return this.state.shortcuts.find(n=>n.id===e)}updateShortcut(e,n){const s=this.state.shortcuts.findIndex(a=>a.id===e);s!==-1&&(this.state.shortcuts=[...this.state.shortcuts.slice(0,s),{...this.state.shortcuts[s],...n},...this.state.shortcuts.slice(s+1)],this.saveShortcuts(),this.notify())}resetShortcuts(){this.state.shortcuts=[...Zm],this.saveShortcuts(),this.notify()}saveShortcuts(){wa(pt.SHORTCUTS,this.state.shortcuts)}getMouseControls(){return this.state.mouseControls}getMouseBinding(e){return this.state.mouseControls.bindings.find(n=>n.id===e)}updateMouseBinding(e,n){const s=this.state.mouseControls.bindings.findIndex(a=>a.id===e);s!==-1&&(this.state.mouseControls.bindings=[...this.state.mouseControls.bindings.slice(0,s),{...this.state.mouseControls.bindings[s],...n},...this.state.mouseControls.bindings.slice(s+1)],this.saveMouseControls(),this.notify())}updateCameraSensitivity(e){this.state.mouseControls.sensitivity={...this.state.mouseControls.sensitivity,...e},this.saveMouseControls(),this.notify()}resetMouseControls(){this.state.mouseControls={bindings:[...ig],sensitivity:{...rg},trackpad:{...Zd}},this.saveMouseControls(),this.notify()}getTrackpadConfig(){return this.state.mouseControls.trackpad}updateTrackpadConfig(e){this.state.mouseControls.trackpad={...this.state.mouseControls.trackpad,...e,sensitivity:{...this.state.mouseControls.trackpad.sensitivity,...e.sensitivity||{}}},this.saveMouseControls(),this.notify()}saveMouseControls(){wa(pt.MOUSE_CONTROLS,this.state.mouseControls)}startStatusPolling(){}stopStatusPolling(){this.statusPollInterval&&(clearInterval(this.statusPollInterval),this.statusPollInterval=null)}setAgents(...e){return this.agentActions.setAgents(...e)}addAgent(...e){return this.agentActions.addAgent(...e)}updateAgent(...e){return this.agentActions.updateAgent(...e)}updateAgentContextStats(...e){return this.agentActions.updateAgentContextStats(...e)}updateAgentContext(...e){return this.agentActions.updateAgentContext(...e)}setAgentCompacting(e,n){const s=new Set(this.state.compactingAgents);n?s.add(e):s.delete(e),this.state.compactingAgents=s,this.notify()}removeAgent(...e){return this.agentActions.removeAgent(...e)}selectAgent(...e){return this.agentActions.selectAgent(...e)}addToSelection(...e){return this.agentActions.addToSelection(...e)}selectMultiple(...e){return this.agentActions.selectMultiple(...e)}deselectAll(...e){return this.agentActions.deselectAll(...e)}spawnAgent(...e){return this.agentActions.spawnAgent(...e)}createDirectoryAndSpawn(...e){return this.agentActions.createDirectoryAndSpawn(...e)}sendCommand(...e){return this.agentActions.sendCommand(...e)}refreshAgentContext(...e){return this.agentActions.refreshAgentContext(...e)}moveAgentLocal(...e){return this.agentActions.moveAgentLocal(...e)}moveAgent(...e){return this.agentActions.moveAgent(...e)}killAgent(...e){return this.agentActions.killAgent(...e)}stopAgent(...e){return this.agentActions.stopAgent(...e)}clearContext(...e){return this.agentActions.clearContext(...e)}collapseContext(...e){return this.agentActions.collapseContext(...e)}removeAgentFromServer(...e){return this.agentActions.removeAgentFromServer(...e)}renameAgent(...e){return this.agentActions.renameAgent(...e)}updateAgentProperties(...e){return this.agentActions.updateAgentProperties(...e)}getTotalTokens(){return this.agentActions.getTotalTokens()}getSelectedAgents(){return this.agentActions.getSelectedAgents()}addActivity(...e){return this.agentActions.addActivity(...e)}addToolExecution(...e){return this.agentActions.addToolExecution(...e)}addFileChange(...e){return this.agentActions.addFileChange(...e)}loadToolHistory(){return this.agentActions.loadToolHistory()}addOutput(...e){return this.outputActions.addOutput(...e)}clearOutputs(...e){return this.outputActions.clearOutputs(...e)}getOutputs(...e){return this.outputActions.getOutputs(...e)}addUserPromptToOutput(...e){return this.outputActions.addUserPromptToOutput(...e)}getLastPrompt(...e){return this.outputActions.getLastPrompt(...e)}setLastPrompt(...e){return this.outputActions.setLastPrompt(...e)}preserveOutputs(){return this.outputActions.preserveOutputs()}mergeOutputsWithHistory(...e){return this.outputActions.mergeOutputsWithHistory(...e)}setSupervisorReport(...e){return this.supervisorActions.setSupervisorReport(...e)}addNarrative(...e){return this.supervisorActions.addNarrative(...e)}getNarratives(...e){return this.supervisorActions.getNarratives(...e)}setSupervisorStatus(...e){return this.supervisorActions.setSupervisorStatus(...e)}setSupervisorConfig(...e){return this.supervisorActions.setSupervisorConfig(...e)}requestSupervisorReport(){return this.supervisorActions.requestSupervisorReport()}requestAgentSupervisorHistory(...e){return this.supervisorActions.requestAgentSupervisorHistory(...e)}setAgentSupervisorHistory(...e){return this.supervisorActions.setAgentSupervisorHistory(...e)}getAgentSupervisorHistory(...e){return this.supervisorActions.getAgentSupervisorHistory(...e)}addAgentAnalysis(...e){return this.supervisorActions.addAgentAnalysis(...e)}isLoadingHistoryForAgent(...e){return this.supervisorActions.isLoadingHistoryForAgent(...e)}hasHistoryBeenFetched(...e){return this.supervisorActions.hasHistoryBeenFetched(...e)}setGlobalUsage(...e){return this.supervisorActions.setGlobalUsage(...e)}requestGlobalUsage(){return this.supervisorActions.requestGlobalUsage()}getGlobalUsage(){return this.supervisorActions.getGlobalUsage()}setActiveTool(...e){return this.areaActions.setActiveTool(...e)}selectArea(...e){return this.areaActions.selectArea(...e)}addArea(...e){return this.areaActions.addArea(...e)}updateArea(...e){return this.areaActions.updateArea(...e)}updateAreaLocal(...e){return this.areaActions.updateAreaLocal(...e)}deleteArea(...e){return this.areaActions.deleteArea(...e)}assignAgentToArea(...e){return this.areaActions.assignAgentToArea(...e)}unassignAgentFromArea(...e){return this.areaActions.unassignAgentFromArea(...e)}addDirectoryToArea(...e){return this.areaActions.addDirectoryToArea(...e)}removeDirectoryFromArea(...e){return this.areaActions.removeDirectoryFromArea(...e)}getAreaDirectories(...e){return this.areaActions.getAreaDirectories(...e)}isPositionInArea(...e){return this.areaActions.isPositionInArea(...e)}getAreaForAgent(...e){return this.areaActions.getAreaForAgent(...e)}setAreasFromServer(...e){return this.areaActions.setAreasFromServer(...e)}getAreasInZOrder(...e){return this.areaActions.getAreasInZOrder(...e)}getNextZIndex(...e){return this.areaActions.getNextZIndex(...e)}bringAreaToFront(...e){return this.areaActions.bringAreaToFront(...e)}sendAreaToBack(...e){return this.areaActions.sendAreaToBack(...e)}setAreaZIndex(...e){return this.areaActions.setAreaZIndex(...e)}archiveArea(...e){return this.areaActions.archiveArea(...e)}restoreArchivedArea(...e){return this.areaActions.restoreArchivedArea(...e)}getArchivedAreas(...e){return this.areaActions.getArchivedAreas(...e)}getVisibleAreas(...e){return this.areaActions.getVisibleAreas(...e)}isAgentInArchivedArea(...e){return this.areaActions.isAgentInArchivedArea(...e)}selectBuilding(...e){return this.buildingActions.selectBuilding(...e)}selectMultipleBuildings(...e){return this.buildingActions.selectMultipleBuildings(...e)}toggleBuildingSelection(...e){return this.buildingActions.toggleBuildingSelection(...e)}isBuildingSelected(...e){return this.buildingActions.isBuildingSelected(...e)}getSelectedBuildingIds(){return this.buildingActions.getSelectedBuildingIds()}deleteSelectedBuildings(){return this.buildingActions.deleteSelectedBuildings()}addBuilding(...e){return this.buildingActions.addBuilding(...e)}updateBuilding(...e){return this.buildingActions.updateBuilding(...e)}updateBuildingLocal(...e){return this.buildingActions.updateBuildingLocal(...e)}deleteBuilding(...e){return this.buildingActions.deleteBuilding(...e)}moveBuilding(...e){return this.buildingActions.moveBuilding(...e)}updateBuildingPosition(...e){return this.buildingActions.updateBuildingPosition(...e)}createBuilding(...e){return this.buildingActions.createBuilding(...e)}sendBuildingCommand(...e){return this.buildingActions.sendBuildingCommand(...e)}addBuildingLogs(...e){return this.buildingActions.addBuildingLogs(...e)}getBuildingLogs(...e){return this.buildingActions.getBuildingLogs(...e)}clearBuildingLogs(...e){return this.buildingActions.clearBuildingLogs(...e)}setBuildingsFromServer(...e){return this.buildingActions.setBuildingsFromServer(...e)}updateBuildingFromServer(...e){return this.buildingActions.updateBuildingFromServer(...e)}removeBuildingFromServer(...e){return this.buildingActions.removeBuildingFromServer(...e)}startLogStreaming(...e){return this.buildingActions.startLogStreaming(...e)}stopLogStreaming(...e){return this.buildingActions.stopLogStreaming(...e)}appendStreamingLogChunk(...e){return this.buildingActions.appendStreamingLogChunk(...e)}setStreamingStatus(...e){return this.buildingActions.setStreamingStatus(...e)}getStreamingLogs(...e){return this.buildingActions.getStreamingLogs(...e)}clearStreamingLogs(...e){return this.buildingActions.clearStreamingLogs(...e)}isLogStreaming(...e){return this.buildingActions.isLogStreaming(...e)}sendBossBuildingCommand(...e){return this.buildingActions.sendBossBuildingCommand(...e)}assignBuildingsToBoSS(...e){return this.buildingActions.assignBuildingsToBoSS(...e)}startBossLogStreaming(...e){return this.buildingActions.startBossLogStreaming(...e)}stopBossLogStreaming(...e){return this.buildingActions.stopBossLogStreaming(...e)}appendBossStreamingLogChunk(...e){return this.buildingActions.appendBossStreamingLogChunk(...e)}getBossStreamingLogs(...e){return this.buildingActions.getBossStreamingLogs(...e)}clearBossStreamingLogs(...e){return this.buildingActions.clearBossStreamingLogs(...e)}requestDockerContainersList(){return this.buildingActions.requestDockerContainersList()}setDockerContainersList(...e){return this.buildingActions.setDockerContainersList(...e)}getDockerContainersList(){return this.buildingActions.getDockerContainersList()}getDockerComposeProjectsList(){return this.buildingActions.getDockerComposeProjectsList()}setWorkflowDefinitionsFromServer(...e){return this.workflowActions.setWorkflowDefinitionsFromServer(...e)}addWorkflowDefinitionFromServer(...e){return this.workflowActions.addWorkflowDefinitionFromServer(...e)}updateWorkflowDefinitionFromServer(...e){return this.workflowActions.updateWorkflowDefinitionFromServer(...e)}removeWorkflowDefinitionFromServer(...e){return this.workflowActions.removeWorkflowDefinitionFromServer(...e)}createWorkflowDefinition(...e){return this.workflowActions.createWorkflowDefinition(...e)}updateWorkflowDefinition(...e){return this.workflowActions.updateWorkflowDefinition(...e)}deleteWorkflowDefinition(...e){return this.workflowActions.deleteWorkflowDefinition(...e)}moveWorkflow(...e){return this.workflowActions.moveWorkflow(...e)}setWorkflowInstancesFromServer(...e){return this.workflowActions.setWorkflowInstancesFromServer(...e)}updateWorkflowInstanceFromServer(...e){return this.workflowActions.updateWorkflowInstanceFromServer(...e)}removeWorkflowInstanceFromServer(...e){return this.workflowActions.removeWorkflowInstanceFromServer(...e)}startWorkflow(...e){return this.workflowActions.startWorkflow(...e)}pauseWorkflow(...e){return this.workflowActions.pauseWorkflow(...e)}resumeWorkflow(...e){return this.workflowActions.resumeWorkflow(...e)}cancelWorkflow(...e){return this.workflowActions.cancelWorkflow(...e)}manualTransition(...e){return this.workflowActions.manualTransition(...e)}selectWorkflow(...e){return this.workflowActions.selectWorkflow(...e)}openWorkflowDetail(...e){return this.workflowActions.openWorkflowDetail(...e)}closeWorkflowDetail(){return this.workflowActions.closeWorkflowDetail()}navigateToExecution(...e){return this.workflowActions.navigateToExecution(...e)}navigateToStep(...e){return this.workflowActions.navigateToStep(...e)}navigateBack(){return this.workflowActions.navigateBack()}getWorkflowModelStatus(...e){return this.workflowActions.getWorkflowModelStatus(...e)}addWorkflowChatMessage(...e){return this.workflowActions.addWorkflowChatMessage(...e)}setWorkflowChatScope(...e){return this.workflowActions.setWorkflowChatScope(...e)}setWorkflowChatLoading(...e){return this.workflowActions.setWorkflowChatLoading(...e)}clearWorkflowChat(){return this.workflowActions.clearWorkflowChat()}getWorkflowDefinition(...e){return this.workflowActions.getWorkflowDefinition(...e)}getWorkflowInstances(...e){return this.workflowActions.getWorkflowInstances(...e)}getAllWorkflowDefinitions(){return this.workflowActions.getAllWorkflowDefinitions()}addPermissionRequest(...e){return this.permissionActions.addPermissionRequest(...e)}resolvePermissionRequest(...e){return this.permissionActions.resolvePermissionRequest(...e)}respondToPermissionRequest(...e){return this.permissionActions.respondToPermissionRequest(...e)}getPendingPermissionsForAgent(...e){return this.permissionActions.getPendingPermissionsForAgent(...e)}clearAllPermissions(...e){return this.permissionActions.clearAllPermissions(...e)}spawnBossAgent(...e){return this.delegationActions.spawnBossAgent(...e)}assignSubordinates(...e){return this.delegationActions.assignSubordinates(...e)}removeSubordinate(...e){return this.delegationActions.removeSubordinate(...e)}sendBossCommand(...e){return this.delegationActions.sendBossCommand(...e)}requestDelegationHistory(...e){return this.delegationActions.requestDelegationHistory(...e)}handleDelegationDecision(...e){return this.delegationActions.handleDelegationDecision(...e)}setDelegationHistory(...e){return this.delegationActions.setDelegationHistory(...e)}getDelegationHistory(...e){return this.delegationActions.getDelegationHistory(...e)}getLastDelegationReceived(...e){return this.delegationActions.getLastDelegationReceived(...e)}clearLastDelegationReceived(...e){return this.delegationActions.clearLastDelegationReceived(...e)}updateBossSubordinates(...e){return this.delegationActions.updateBossSubordinates(...e)}getSubordinates(...e){return this.delegationActions.getSubordinates(...e)}isBossAgent(...e){return this.delegationActions.isBossAgent(...e)}getBossForAgent(...e){return this.delegationActions.getBossForAgent(...e)}getAvailableSubordinates(){return this.delegationActions.getAvailableSubordinates()}handleAgentTaskStarted(...e){return this.delegationActions.handleAgentTaskStarted(...e)}handleAgentTaskOutput(...e){return this.delegationActions.handleAgentTaskOutput(...e)}handleAgentTaskCompleted(...e){return this.delegationActions.handleAgentTaskCompleted(...e)}getAgentTaskProgress(...e){return this.delegationActions.getAgentTaskProgress(...e)}clearAgentTaskProgress(...e){return this.delegationActions.clearAgentTaskProgress(...e)}clearAllSubordinatesContext(...e){return this.delegationActions.clearAllSubordinatesContext(...e)}setSkillsFromServer(...e){return this.skillActions.setSkillsFromServer(...e)}addSkillFromServer(...e){return this.skillActions.addSkillFromServer(...e)}updateSkillFromServer(...e){return this.skillActions.updateSkillFromServer(...e)}removeSkillFromServer(...e){return this.skillActions.removeSkillFromServer(...e)}getSkill(...e){return this.skillActions.getSkill(...e)}getAllSkills(){return this.skillActions.getAllSkills()}getSkillsForAgent(...e){return this.skillActions.getSkillsForAgent(...e)}createSkill(...e){return this.skillActions.createSkill(...e)}updateSkill(...e){return this.skillActions.updateSkill(...e)}deleteSkill(...e){return this.skillActions.deleteSkill(...e)}assignSkillToAgent(...e){return this.skillActions.assignSkillToAgent(...e)}unassignSkillFromAgent(...e){return this.skillActions.unassignSkillFromAgent(...e)}requestAgentSkills(...e){return this.skillActions.requestAgentSkills(...e)}setCustomAgentClassesFromServer(...e){return this.skillActions.setCustomAgentClassesFromServer(...e)}addCustomAgentClassFromServer(...e){return this.skillActions.addCustomAgentClassFromServer(...e)}updateCustomAgentClassFromServer(...e){return this.skillActions.updateCustomAgentClassFromServer(...e)}removeCustomAgentClassFromServer(...e){return this.skillActions.removeCustomAgentClassFromServer(...e)}getCustomAgentClass(...e){return this.skillActions.getCustomAgentClass(...e)}getAllCustomAgentClasses(){return this.skillActions.getAllCustomAgentClasses()}createCustomAgentClass(...e){return this.skillActions.createCustomAgentClass(...e)}updateCustomAgentClass(...e){return this.skillActions.updateCustomAgentClass(...e)}deleteCustomAgentClass(...e){return this.skillActions.deleteCustomAgentClass(...e)}handleExecTaskStarted(...e){return this.execTaskActions.handleExecTaskStarted(...e)}handleExecTaskOutput(...e){return this.execTaskActions.handleExecTaskOutput(...e)}handleExecTaskCompleted(...e){return this.execTaskActions.handleExecTaskCompleted(...e)}stopExecTask(...e){return this.execTaskActions.stopExecTask(...e)}getExecTasks(...e){return this.execTaskActions.getExecTasks(...e)}getAllExecTasks(){return this.execTaskActions.getAllExecTasks()}getExecTask(...e){return this.execTaskActions.getExecTask(...e)}clearCompletedExecTasks(...e){return this.execTaskActions.clearCompletedExecTasks(...e)}clearAllExecTasks(...e){return this.execTaskActions.clearAllExecTasks(...e)}removeExecTask(...e){return this.execTaskActions.removeExecTask(...e)}setSecretsFromServer(...e){return this.secretActions.setSecretsFromServer(...e)}addSecretFromServer(...e){return this.secretActions.addSecretFromServer(...e)}updateSecretFromServer(...e){return this.secretActions.updateSecretFromServer(...e)}removeSecretFromServer(...e){return this.secretActions.removeSecretFromServer(...e)}getSecret(...e){return this.secretActions.getSecret(...e)}getSecretByKey(...e){return this.secretActions.getSecretByKey(...e)}getAllSecrets(){return this.secretActions.getAllSecrets()}createSecret(...e){return this.secretActions.createSecret(...e)}updateSecret(...e){return this.secretActions.updateSecret(...e)}deleteSecret(...e){return this.secretActions.deleteSecret(...e)}testDatabaseConnection(...e){return this.databaseActions.testDatabaseConnection(...e)}setConnectionStatus(...e){return this.databaseActions.setConnectionStatus(...e)}listDatabases(...e){return this.databaseActions.listDatabases(...e)}setDatabases(...e){return this.databaseActions.setDatabases(...e)}listTables(...e){return this.databaseActions.listTables(...e)}setTables(...e){return this.databaseActions.setTables(...e)}getTableSchema(...e){return this.databaseActions.getTableSchema(...e)}setTableSchema(...e){return this.databaseActions.setTableSchema(...e)}executeQuery(...e){return this.databaseActions.executeQuery(...e)}executeSilentQuery(...e){return this.databaseActions.executeSilentQuery(...e)}setSilentQueryResult(...e){return this.databaseActions.setSilentQueryResult(...e)}setQueryResult(...e){return this.databaseActions.setQueryResult(...e)}setExecutingQuery(...e){return this.databaseActions.setExecutingQuery(...e)}requestQueryHistory(...e){return this.databaseActions.requestQueryHistory(...e)}setQueryHistory(...e){return this.databaseActions.setQueryHistory(...e)}toggleQueryFavorite(...e){return this.databaseActions.toggleQueryFavorite(...e)}deleteQueryFromHistory(...e){return this.databaseActions.deleteQueryFromHistory(...e)}clearQueryHistory(...e){return this.databaseActions.clearQueryHistory(...e)}setActiveConnection(...e){return this.databaseActions.setActiveConnection(...e)}setActiveDatabase(...e){return this.databaseActions.setActiveDatabase(...e)}getDatabaseState(...e){return this.databaseActions.getDatabaseState(...e)}clearDatabaseState(...e){return this.databaseActions.clearDatabaseState(...e)}fetchSnapshots(...e){return this.snapshotActions.fetchSnapshots(...e)}setSnapshots(...e){return this.snapshotActions.setSnapshots(...e)}createSnapshot(...e){return this.snapshotActions.createSnapshot(...e)}loadSnapshot(...e){return this.snapshotActions.loadSnapshot(...e)}setCurrentSnapshot(...e){return this.snapshotActions.setCurrentSnapshot(...e)}deleteSnapshot(...e){return this.snapshotActions.deleteSnapshot(...e)}restoreFiles(...e){return this.snapshotActions.restoreFiles(...e)}setLoading(...e){return this.snapshotActions.setLoading(...e)}setError(...e){return this.snapshotActions.setError(...e)}clearError(...e){return this.snapshotActions.clearError(...e)}reset(...e){return this.snapshotActions.reset(...e)}addSubagent(...e){return this.subagentActions.addSubagent(...e)}completeSubagent(...e){return this.subagentActions.completeSubagent(...e)}getSubagentsForAgent(...e){return this.subagentActions.getSubagentsForAgent(...e)}getSubagent(...e){return this.subagentActions.getSubagent(...e)}removeSubagent(...e){return this.subagentActions.removeSubagent(...e)}getSubagentByToolUseId(...e){return this.subagentActions.getSubagentByToolUseId(...e)}addSubagentActivity(...e){return this.subagentActions.addSubagentActivity(...e)}updateSubagentStats(...e){return this.subagentActions.updateSubagentStats(...e)}addSubagentStreamEntries(...e){return this.subagentActions.addSubagentStreamEntries(...e)}hydrateSubagentsFromHistory(...e){return this.subagentActions.hydrateSubagentsFromHistory(...e)}}const Yk=1;function vL(){return typeof window<"u"?(window.__tideStore&&window.__tideStoreVersion===Yk||(window.__tideStore=new Gk,window.__tideStoreVersion=Yk),window.__tideStore):new Gk}const H=vL(),$j=b.createContext(null),wL={error:"❌",success:"✅",warning:"⚠️",info:"ℹ️"};let kL=0;function SL({children:t}){const[e,n]=b.useState(null),s=b.useRef([]),a=b.useRef(null),r=b.useCallback(()=>{if(s.current.length>0&&!e){const d=s.current.shift();n(d)}},[e]);b.useEffect(()=>{e||r()},[e,r]),b.useEffect(()=>{if(e&&e.duration>0)return a.current=window.setTimeout(()=>{n(null)},e.duration),()=>{a.current&&clearTimeout(a.current)}},[e]);const i=b.useCallback((d,f,h,m=5e3)=>{const y={id:++kL,type:d,title:f,message:h,duration:m};if(s.current.push(y),!e){const v=s.current.shift();n(v)}},[e]),c=b.useCallback(()=>{a.current&&clearTimeout(a.current),n(null)},[]);return o.jsxs($j.Provider,{value:{showToast:i},children:[t,o.jsx("div",{id:"toast-container",children:e&&o.jsxs("div",{className:`toast ${e.type}`,children:[o.jsx("span",{className:"toast-icon",children:wL[e.type]}),o.jsxs("div",{className:"toast-content",children:[o.jsx("div",{className:"toast-title",children:e.title}),o.jsx("div",{className:"toast-message",children:e.message})]}),o.jsx("button",{className:"toast-close",onClick:c,children:"×"})]},e.id)})]})}function Hj(){const t=b.useContext($j);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const lo={scout:{icon:"🔍",color:"#4a9eff",description:"Codebase exploration, file discovery"},builder:{icon:"🔨",color:"#ff9e4a",description:"Feature implementation, writing code"},debugger:{icon:"🐛",color:"#ff4a4a",description:"Bug hunting, fixing issues"},architect:{icon:"📐",color:"#9e4aff",description:"Planning, design decisions"},warrior:{icon:"⚔️",color:"#ff4a9e",description:"Aggressive refactoring, migrations"},support:{icon:"💚",color:"#4aff9e",description:"Documentation, tests, cleanup"},boss:{icon:"👑",color:"#ffd700",description:"Team leader, delegates tasks to subordinates"}},yp=lo,lu={bypass:{label:"Permissionless",description:"Skip all permission prompts (less safe, faster)"},interactive:{label:"Interactive",description:"Ask for approval before sensitive operations"}},ef={"gpt-5.4":{label:"GPT-5.4",description:"Latest frontier model with advanced reasoning and coding",icon:"🌟"},"gpt-5.3-codex":{label:"GPT-5.3 Codex",description:"Latest frontier agentic coding model",icon:"⚙️"},"gpt-5.2-codex":{label:"GPT-5.2 Codex",description:"Frontier agentic coding model",icon:"🧠"},"gpt-5.1-codex-max":{label:"GPT-5.1 Codex Max",description:"Codex-optimized flagship for deep and fast reasoning",icon:"🚀"},"gpt-5.1-codex-mini":{label:"GPT-5.1 Codex Mini",description:"Optimized for codex, cheaper and faster",icon:"⚡"},"gpt-5.2":{label:"GPT-5.2",description:"General frontier model with strong reasoning and coding",icon:"🧩"}},tf={sonnet:{label:"Sonnet",description:"Balanced performance and cost (recommended)",icon:"⚡"},opus:{label:"Opus",description:"Most capable, higher cost",icon:"🧠"},haiku:{label:"Haiku",description:"Fast and economical",icon:"🚀"}},og={low:{label:"Low",description:"Minimal reasoning, fastest responses",icon:"🏃"},medium:{label:"Medium",description:"Balanced reasoning effort",icon:"⚖️"},high:{label:"High",description:"Deep reasoning for complex tasks (default)",icon:"🔬"},max:{label:"Max",description:"Maximum reasoning, most thorough",icon:"🧠"}},vb="<<<BOSS_CONTEXT_START>>>",Kk="<<<BOSS_CONTEXT_END>>>",CL={server:{icon:"🖥️",color:"#4aff9e",description:"Service with start/stop commands and logs"},link:{icon:"🔗",color:"#4a9eff",description:"Quick links to URLs"},database:{icon:"🗄️",color:"#ff9e4a",description:"Database connection and queries"},docker:{icon:"🐳",color:"#4ac1ff",description:"Docker container management"},monitor:{icon:"📊",color:"#ff4a9e",description:"System metrics and monitoring"},folder:{icon:"📁",color:"#ffd700",description:"Folder shortcut - opens file explorer on click"},boss:{icon:"👑",color:"#ffd700",description:"Boss building - manages multiple buildings with unified controls"},terminal:{icon:"💻",color:"#a855f7",description:"Interactive web terminal via ttyd"}},Zq={"server-rack":{label:"Server Rack",description:"Classic server rack with blinking LEDs"},tower:{label:"Control Tower",description:"Tall tower with rotating antenna"},dome:{label:"Data Dome",description:"Futuristic dome with energy ring"},pyramid:{label:"Power Pyramid",description:"Egyptian-style pyramid with glowing core"},desktop:{label:"Desktop PC",description:"Retro computer with monitor and keyboard"},"filing-cabinet":{label:"Filing Cabinet",description:"Office cabinet with sliding drawers"},satellite:{label:"Satellite Dish",description:"Communication dish with rotating receiver"},crystal:{label:"Data Crystal",description:"Floating crystal with energy particles"},factory:{label:"Mini Factory",description:"Industrial building with smoking chimney"},"command-center":{label:"Command Center",description:"Grand central hub for boss buildings with holographic rings"}},eV={"":{label:"Auto-detect",description:"Let PM2 detect the interpreter"},node:{label:"Node.js",description:"JavaScript/TypeScript runtime"},bun:{label:"Bun",description:"Bun JavaScript runtime"},python3:{label:"Python 3",description:"Python 3 interpreter"},python:{label:"Python 2",description:"Python 2 interpreter (legacy)"},java:{label:"Java",description:"Java runtime (use with -jar args)"},php:{label:"PHP",description:"PHP interpreter"},bash:{label:"Bash",description:"Bash shell script"},none:{label:"None (Binary)",description:"Direct execution (compiled binaries)"}},tV={no:{label:"No",description:"Do not automatically restart"},always:{label:"Always",description:"Always restart when stopped"},"unless-stopped":{label:"Unless Stopped",description:"Restart unless manually stopped"},"on-failure":{label:"On Failure",description:"Restart only on failure"}},nV={always:{label:"Always",description:"Always pull the image"},missing:{label:"If Missing",description:"Pull only if image not present"},never:{label:"Never",description:"Never pull, use local only"}},AL={mysql:{label:"MySQL",icon:"🐬",defaultPort:3306},postgresql:{label:"PostgreSQL",icon:"🐘",defaultPort:5432},oracle:{label:"Oracle",icon:"🔶",defaultPort:1521},sqlite:{label:"SQLite",icon:"🪶",defaultPort:0},mssql:{label:"SQL Server",icon:"🔷",defaultPort:1433}},Uj=b.createContext(null);function Wj(t){const e=lo[t];if(e)return e.icon;const s=H.getState().customAgentClasses.get(t);return s?s.icon:"🤖"}function jL(t){const e=lo[t];if(e)return e.color;const s=H.getState().customAgentClasses.get(t);return s?s.color:"#888888"}const NL=3,Qk=80;function TL({notification:t,onDismiss:e,onClick:n}){const s=b.useRef({startX:0,startY:0,locked:!1}),[a,r]=b.useState(0),[i,c]=b.useState(!1),d=b.useRef(!1),f="ontouchstart"in window||navigator.maxTouchPoints>0,h=Wj(t.agentClass),m=jL(t.agentClass),x=b.useCallback(E=>{s.current={startX:E.touches[0].clientX,startY:E.touches[0].clientY,locked:!1},d.current=!1},[]),y=b.useCallback(E=>{const D=E.touches[0].clientX-s.current.startX,_=E.touches[0].clientY-s.current.startY;!s.current.locked&&(Math.abs(D)<10&&Math.abs(_)<10||(s.current.locked=!0,Math.abs(_)>Math.abs(D)))||D<0&&(d.current=!0,r(D))},[]),v=b.useCallback(()=>{a<-Qk?(c(!0),$f(2),setTimeout(()=>e(t.id),200)):r(0),setTimeout(()=>{d.current=!1},50)},[a,e,t.id]),S=b.useCallback(()=>{d.current||n(t)},[n,t]),A=Math.min(Math.abs(a)/(Qk*1.5),1),k=i?0:1-A*.6,N=i?"-120%":`${a}px`,j=d.current&&!i?"none":"transform 0.2s ease-out, opacity 0.2s ease-out";return o.jsxs("div",{className:`agent-notification${i?" is-dismissing":""}`,onClick:f?void 0:S,onTouchStart:x,onTouchMove:y,onTouchEnd:v,style:{"--agent-color":m,transform:`translateX(${N})`,opacity:k,transition:j},children:[o.jsxs("div",{className:"agent-notification-content",children:[o.jsxs("div",{className:"agent-notification-header",children:[o.jsx("span",{className:"agent-notification-icon",children:h}),o.jsx("span",{className:"agent-notification-name",children:t.agentName}),o.jsx("span",{className:"agent-notification-separator",children:"·"}),o.jsx("span",{className:"agent-notification-title",children:t.title})]}),o.jsx("div",{className:"agent-notification-message",children:t.message})]}),o.jsx("button",{className:"agent-notification-close",onClick:E=>{E.stopPropagation(),e(t.id)},children:"×"})]})}function _L({children:t}){const{t:e}=ht(["notifications"]),[n,s]=b.useState([]),a=b.useRef(new Map);b.useEffect(()=>()=>{a.current.forEach(d=>clearTimeout(d))},[]);const r=b.useCallback(d=>{s(h=>h.filter(m=>m.id!==d));const f=a.current.get(d);f&&(clearTimeout(f),a.current.delete(d))},[]),i=b.useCallback(d=>{H.setLatestNotificationAgentId(d.agentId),s(h=>{const m=[...h,d];if(m.length>NL){const x=m.shift();if(x){const y=a.current.get(x.id);y&&(clearTimeout(y),a.current.delete(x.id))}}return m});const f=window.setTimeout(()=>{r(d.id)},8e3);if(a.current.set(d.id,f),!Eu()){const h=Wj(d.agentClass);CR({title:`${h} ${d.agentName}: ${d.title}`,body:d.message,data:{type:"agent_notification",agentId:d.agentId,notificationId:d.id}})}},[r]),c=b.useCallback(d=>{rj(d.agentId),r(d.id)},[r]);return o.jsxs(Uj.Provider,{value:{showAgentNotification:i},children:[t,o.jsx("div",{id:"agent-notification-container",children:n.map(d=>o.jsx(TL,{notification:d,onDismiss:r,onClick:c},d.id))})]})}function EL(){const t=b.useContext(Uj);if(!t)throw new Error("useAgentNotification must be used within AgentNotificationProvider");return t}const ML={scout:{icon:"🔍",color:4890367,description:"Explores and searches codebase"},builder:{icon:"🔨",color:16752202,description:"Creates and builds features"},debugger:{icon:"🐛",color:16730698,description:"Finds and fixes bugs"},architect:{icon:"📐",color:10373887,description:"Plans and designs systems"},warrior:{icon:"⚔️",color:16730782,description:"Tackles tough problems"},support:{icon:"💚",color:4915102,description:"Helps and assists others"},boss:{icon:"👑",color:16766720,description:"Manages and delegates to subordinates"}},DL=["Alex","Sam","Jordan","Taylor","Casey","Morgan","Riley","Quinn","Avery","Blake","Cameron","Drew","Emery","Finley","Harper","Jamie","Kai","Logan","Max","Nico","Parker","Reese","Sage","Sky"],sV=DL,RL={scout:"character-male-a.glb",builder:"character-male-b.glb",debugger:"character-female-a.glb",architect:"character-male-c.glb",warrior:"character-female-b.glb",support:"character-female-c.glb",boss:"character-male-c.glb"},aV=[{id:"scout",model:"character-male-a.glb",name:"Explorer",gender:"Male"},{id:"builder",model:"character-male-b.glb",name:"Crafter",gender:"Male"},{id:"architect",model:"character-male-c.glb",name:"Planner",gender:"Male"},{id:"debugger",model:"character-female-a.glb",name:"Analyst",gender:"Female"},{id:"warrior",model:"character-female-b.glb",name:"Fighter",gender:"Female"},{id:"support",model:"character-female-c.glb",name:"Healer",gender:"Female"}],rV=[{file:"character-male-a.glb",name:"Male A (Explorer)",gender:"Male"},{file:"character-male-b.glb",name:"Male B (Crafter)",gender:"Male"},{file:"character-male-c.glb",name:"Male C (Planner)",gender:"Male"},{file:"character-male-d.glb",name:"Male D",gender:"Male"},{file:"character-male-e.glb",name:"Male E",gender:"Male"},{file:"character-male-f.glb",name:"Male F",gender:"Male"},{file:"character-female-a.glb",name:"Female A (Analyst)",gender:"Female"},{file:"character-female-b.glb",name:"Female B (Fighter)",gender:"Female"},{file:"character-female-c.glb",name:"Female C (Healer)",gender:"Female"},{file:"character-female-d.glb",name:"Female D",gender:"Female"},{file:"character-female-e.glb",name:"Female E",gender:"Female"},{file:"character-female-f.glb",name:"Female F",gender:"Female"}],iV=3,oV=5,lV=1e3,cV=50,uV=1.2;function OL(t){return typeof t=="string"?t:"#"+t.toString(16).padStart(6,"0")}function rr(t,e){const n=ML[t];if(n)return{icon:n.icon,color:OL(n.color),description:n.description};const s=e.find(a=>a.id===t);return s?{icon:s.icon,color:s.color,description:s.description}:{icon:"🤖",color:"#888888"}}const LL=2e5,PL=258400;function Ic(t){return Math.max(0,Math.min(100,t))}function Xk(t){const e=t.provider==="codex"||t.provider==="opencode"?PL:LL,n=Math.max(1,Math.round(t.contextLimit||e)),s=Math.max(0,Math.min(Math.round(t.contextUsed||0),n)),a=Ic(Number((s/n*100).toFixed(1))),r=t.contextStats;if(!r)return{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Ic(Number((100-a).toFixed(1)))};const i=Math.max(1,Math.round(r.contextWindow||n)),c=Math.max(0,Math.min(Math.round(r.totalTokens||0),i)),d=Ic(Number((r.usedPercent??c/i*100).toFixed(1)));return n!==i||s!==c?{totalTokens:s,contextWindow:n,usedPercent:a,freePercent:Ic(Number((100-a).toFixed(1)))}:{totalTokens:c,contextWindow:i,usedPercent:d,freePercent:Ic(Number((100-d).toFixed(1)))}}function IL(t){const e=Math.floor((Date.now()-t)/1e3);if(e<60)return`${e}s`;const n=Math.floor(e/60);if(n<60)return`${n}m`;const s=Math.floor(n/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Wf(t){const e=Math.floor((Date.now()-t)/1e3);if(e<60)return"just now";const n=Math.floor(e/60);if(n<60)return`${n}m ago`;const s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function vp(t){if(t.contextStats){const n=Xk(t);return{remainingPercent:n.freePercent,usedPercent:n.usedPercent,hasData:!0,totalTokens:n.totalTokens,contextWindow:n.contextWindow,freeTokens:n.contextWindow-n.totalTokens}}const e=Xk(t);return{remainingPercent:e.freePercent,usedPercent:e.usedPercent,hasData:!1,totalTokens:e.totalTokens,contextWindow:e.contextWindow,freeTokens:e.contextWindow-e.totalTokens}}function qj(t){return t<20?"#c85858":t<50?"#c89858":"#6a9a78"}const Jk={working:0,waiting_permission:1,waiting:2,error:3,orphaned:4,idle:5,offline:6};function BL(t){return[...t].sort((e,n)=>{const s=Jk[e.status]??5,a=Jk[n.status]??5;return s!==a?s-a:(n.lastActivity||0)-(e.lastActivity||0)})}function FL(t,e){const n=new Map;for(const s of t){const a=e(s.id),r=(a==null?void 0:a.id)||null;n.has(r)||n.set(r,[]),n.get(r).push(s)}return n}function zL(t,e){return[...t].sort((n,s)=>{if(n===null)return 1;if(s===null)return-1;const a=n?e(n):void 0,r=s?e(s):void 0;return((a==null?void 0:a.name)||"").localeCompare((r==null?void 0:r.name)||"")})}function Zk(t,e){if(e===DE)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Zg||e===OA){let n=t.getIndex();if(n===null){const i=[],c=t.getAttribute("position");if(c!==void 0){for(let d=0;d<c.count;d++)i.push(d);t.setIndex(i),n=t.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t}const s=n.count-2,a=[];if(e===Zg)for(let i=1;i<=s;i++)a.push(n.getX(0)),a.push(n.getX(i)),a.push(n.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(a.push(n.getX(i)),a.push(n.getX(i+1)),a.push(n.getX(i+2))):(a.push(n.getX(i+2)),a.push(n.getX(i+1)),a.push(n.getX(i)));a.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=t.clone();return r.setIndex(a),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}class $L extends LA{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(n){return new VL(n)}),this.register(function(n){return new GL(n)}),this.register(function(n){return new n2(n)}),this.register(function(n){return new s2(n)}),this.register(function(n){return new a2(n)}),this.register(function(n){return new KL(n)}),this.register(function(n){return new QL(n)}),this.register(function(n){return new XL(n)}),this.register(function(n){return new JL(n)}),this.register(function(n){return new qL(n)}),this.register(function(n){return new ZL(n)}),this.register(function(n){return new YL(n)}),this.register(function(n){return new t2(n)}),this.register(function(n){return new e2(n)}),this.register(function(n){return new UL(n)}),this.register(function(n){return new r2(n)}),this.register(function(n){return new i2(n)})}load(e,n,s,a){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const f=tu.extractUrlBase(e);i=tu.resolveURL(f,this.path)}else i=tu.extractUrlBase(e);this.manager.itemStart(e);const c=function(f){a?a(f):console.error(f),r.manager.itemError(e),r.manager.itemEnd(e)},d=new Rf(this.manager);d.setPath(this.path),d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setWithCredentials(this.withCredentials),d.load(e,function(f){try{r.parse(f,i,function(h){n(h),r.manager.itemEnd(e)},c)}catch(h){c(h)}},s,c)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,s,a){let r;const i={},c={},d=new TextDecoder;if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(d.decode(new Uint8Array(e,0,4))===Vj){try{i[Xt.KHR_BINARY_GLTF]=new o2(e)}catch(m){a&&a(m);return}r=JSON.parse(i[Xt.KHR_BINARY_GLTF].content)}else r=JSON.parse(d.decode(e));else r=e;if(r.asset===void 0||r.asset.version[0]<2){a&&a(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const f=new v2(r,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const m=this.pluginCallbacks[h](f);m.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[m.name]=m,i[m.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const m=r.extensionsUsed[h],x=r.extensionsRequired||[];switch(m){case Xt.KHR_MATERIALS_UNLIT:i[m]=new WL;break;case Xt.KHR_DRACO_MESH_COMPRESSION:i[m]=new l2(r,this.dracoLoader);break;case Xt.KHR_TEXTURE_TRANSFORM:i[m]=new c2;break;case Xt.KHR_MESH_QUANTIZATION:i[m]=new u2;break;default:x.indexOf(m)>=0&&c[m]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+m+'".')}}f.setExtensions(i),f.setPlugins(c),f.parse(s,a)}parseAsync(e,n){const s=this;return new Promise(function(a,r){s.parse(e,n,a,r)})}}function HL(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const Xt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class UL{constructor(e){this.parser=e,this.name=Xt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let s=0,a=n.length;s<a;s++){const r=n[s];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const n=this.parser,s="light:"+e;let a=n.cache.get(s);if(a)return a;const r=n.json,d=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let f;const h=new Lr(16777215);d.color!==void 0&&h.setRGB(d.color[0],d.color[1],d.color[2],tr);const m=d.range!==void 0?d.range:0;switch(d.type){case"directional":f=new eb(h),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new OE(h),f.distance=m;break;case"spot":f=new RE(h),f.distance=m,d.spot=d.spot||{},d.spot.innerConeAngle=d.spot.innerConeAngle!==void 0?d.spot.innerConeAngle:0,d.spot.outerConeAngle=d.spot.outerConeAngle!==void 0?d.spot.outerConeAngle:Math.PI/4,f.angle=d.spot.outerConeAngle,f.penumbra=1-d.spot.innerConeAngle/d.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+d.type)}return f.position.set(0,0,0),f.decay=2,Tr(f,d),d.intensity!==void 0&&(f.intensity=d.intensity),f.name=n.createUniqueName(d.name||"light_"+e),a=Promise.resolve(f),n.cache.add(s,a),a}getDependency(e,n){if(e==="light")return this._loadLight(n)}createNodeAttachment(e){const n=this,s=this.parser,r=s.json.nodes[e],c=(r.extensions&&r.extensions[this.name]||{}).light;return c===void 0?null:this._loadLight(c).then(function(d){return s._getNodeRef(n.cache,c,d)})}}class WL{constructor(){this.name=Xt.KHR_MATERIALS_UNLIT}getMaterialType(){return fl}extendParams(e,n,s){const a=[];e.color=new Lr(1,1,1),e.opacity=1;const r=n.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],tr),e.opacity=i[3]}r.baseColorTexture!==void 0&&a.push(s.assignTexture(e,"map",r.baseColorTexture,Er))}return Promise.all(a)}}class qL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name].emissiveStrength;return r!==void 0&&(n.emissiveIntensity=r),Promise.resolve()}}class VL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];if(i.clearcoatFactor!==void 0&&(n.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(s.assignTexture(n,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(n.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(s.assignTexture(n,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(s.assignTexture(n,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const c=i.clearcoatNormalTexture.scale;n.clearcoatNormalScale=new PA(c,c)}return Promise.all(r)}}class GL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name];return n.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class YL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.iridescenceFactor!==void 0&&(n.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(s.assignTexture(n,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(n.iridescenceIOR=i.iridescenceIor),n.iridescenceThicknessRange===void 0&&(n.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(s.assignTexture(n,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}}class KL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[];n.sheenColor=new Lr(0,0,0),n.sheenRoughness=0,n.sheen=1;const i=a.extensions[this.name];if(i.sheenColorFactor!==void 0){const c=i.sheenColorFactor;n.sheenColor.setRGB(c[0],c[1],c[2],tr)}return i.sheenRoughnessFactor!==void 0&&(n.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(s.assignTexture(n,"sheenColorMap",i.sheenColorTexture,Er)),i.sheenRoughnessTexture!==void 0&&r.push(s.assignTexture(n,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class QL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.transmissionFactor!==void 0&&(n.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(s.assignTexture(n,"transmissionMap",i.transmissionTexture)),Promise.all(r)}}class XL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];n.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(s.assignTexture(n,"thicknessMap",i.thicknessTexture)),n.attenuationDistance=i.attenuationDistance||1/0;const c=i.attenuationColor||[1,1,1];return n.attenuationColor=new Lr().setRGB(c[0],c[1],c[2],tr),Promise.all(r)}}class JL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const a=this.parser.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=a.extensions[this.name];return n.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class ZL{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];n.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(s.assignTexture(n,"specularIntensityMap",i.specularTexture));const c=i.specularColorFactor||[1,1,1];return n.specularColor=new Lr().setRGB(c[0],c[1],c[2],tr),i.specularColorTexture!==void 0&&r.push(s.assignTexture(n,"specularColorMap",i.specularColorTexture,Er)),Promise.all(r)}}class e2{constructor(e){this.parser=e,this.name=Xt.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return n.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(s.assignTexture(n,"bumpMap",i.bumpTexture)),Promise.all(r)}}class t2{constructor(e){this.parser=e,this.name=Xt.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:nr}extendMaterialParams(e,n){const s=this.parser,a=s.json.materials[e];if(!a.extensions||!a.extensions[this.name])return Promise.resolve();const r=[],i=a.extensions[this.name];return i.anisotropyStrength!==void 0&&(n.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(n.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(s.assignTexture(n,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}}class n2{constructor(e){this.parser=e,this.name=Xt.KHR_TEXTURE_BASISU}loadTexture(e){const n=this.parser,s=n.json,a=s.textures[e];if(!a.extensions||!a.extensions[this.name])return null;const r=a.extensions[this.name],i=n.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,r.source,i)}}class s2{constructor(e){this.parser=e,this.name=Xt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,s=this.parser,a=s.json,r=a.textures[e];if(!r.extensions||!r.extensions[n])return null;const i=r.extensions[n],c=a.images[i.source];let d=s.textureLoader;if(c.uri){const f=s.options.manager.getHandler(c.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return s.loadTextureImage(e,i.source,d);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class a2{constructor(e){this.parser=e,this.name=Xt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,s=this.parser,a=s.json,r=a.textures[e];if(!r.extensions||!r.extensions[n])return null;const i=r.extensions[n],c=a.images[i.source];let d=s.textureLoader;if(c.uri){const f=s.options.manager.getHandler(c.uri);f!==null&&(d=f)}return this.detectSupport().then(function(f){if(f)return s.loadTextureImage(e,i.source,d);if(a.extensionsRequired&&a.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class r2{constructor(e){this.name=Xt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,s=n.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const a=s.extensions[this.name],r=this.parser.getDependency("buffer",a.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(c){const d=a.byteOffset||0,f=a.byteLength||0,h=a.count,m=a.byteStride,x=new Uint8Array(c,d,f);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(h,m,x,a.mode,a.filter).then(function(y){return y.buffer}):i.ready.then(function(){const y=new ArrayBuffer(h*m);return i.decodeGltfBuffer(new Uint8Array(y),h,m,x,a.mode,a.filter),y})})}else return null}}class i2{constructor(e){this.name=Xt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,s=n.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const a=n.meshes[s.mesh];for(const f of a.primitives)if(f.mode!==xa.TRIANGLES&&f.mode!==xa.TRIANGLE_STRIP&&f.mode!==xa.TRIANGLE_FAN&&f.mode!==void 0)return null;const i=s.extensions[this.name].attributes,c=[],d={};for(const f in i)c.push(this.parser.getDependency("accessor",i[f]).then(h=>(d[f]=h,d[f])));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then(f=>{const h=f.pop(),m=h.isGroup?h.children:[h],x=f[0].count,y=[];for(const v of m){const S=new Of,A=new eo,k=new IA,N=new eo(1,1,1),j=new LE(v.geometry,v.material,x);for(let E=0;E<x;E++)d.TRANSLATION&&A.fromBufferAttribute(d.TRANSLATION,E),d.ROTATION&&k.fromBufferAttribute(d.ROTATION,E),d.SCALE&&N.fromBufferAttribute(d.SCALE,E),j.setMatrixAt(E,S.compose(A,k,N));for(const E in d)if(E==="_COLOR_0"){const D=d[E];j.instanceColor=new PE(D.array,D.itemSize,D.normalized)}else E!=="TRANSLATION"&&E!=="ROTATION"&&E!=="SCALE"&&v.geometry.setAttribute(E,d[E]);BA.prototype.copy.call(j,v),this.parser.assignFinalMaterial(j),y.push(j)}return h.isGroup?(h.clear(),h.add(...y),h):y[0]}))}}const Vj="glTF",Bc=12,eS={JSON:1313821514,BIN:5130562};class o2{constructor(e){this.name=Xt.KHR_BINARY_GLTF,this.content=null,this.body=null;const n=new DataView(e,0,Bc),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Vj)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const a=this.header.length-Bc,r=new DataView(e,Bc);let i=0;for(;i<a;){const c=r.getUint32(i,!0);i+=4;const d=r.getUint32(i,!0);if(i+=4,d===eS.JSON){const f=new Uint8Array(e,Bc+i,c);this.content=s.decode(f)}else if(d===eS.BIN){const f=Bc+i;this.body=e.slice(f,f+c)}i+=c}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class l2{constructor(e,n){if(!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Xt.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=n,this.dracoLoader.preload()}decodePrimitive(e,n){const s=this.json,a=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,c={},d={},f={};for(const h in i){const m=wb[h]||h.toLowerCase();c[m]=i[h]}for(const h in e.attributes){const m=wb[h]||h.toLowerCase();if(i[h]!==void 0){const x=s.accessors[e.attributes[h]],y=ml[x.componentType];f[m]=y.name,d[m]=x.normalized===!0}}return n.getDependency("bufferView",r).then(function(h){return new Promise(function(m,x){a.decodeDracoFile(h,function(y){for(const v in y.attributes){const S=y.attributes[v],A=d[v];A!==void 0&&(S.normalized=A)}m(y)},c,f,tr,x)})})}}class c2{constructor(){this.name=Xt.KHR_TEXTURE_TRANSFORM}extendTexture(e,n){return(n.texCoord===void 0||n.texCoord===e.channel)&&n.offset===void 0&&n.rotation===void 0&&n.scale===void 0||(e=e.clone(),n.texCoord!==void 0&&(e.channel=n.texCoord),n.offset!==void 0&&e.offset.fromArray(n.offset),n.rotation!==void 0&&(e.rotation=n.rotation),n.scale!==void 0&&e.repeat.fromArray(n.scale),e.needsUpdate=!0),e}}class u2{constructor(){this.name=Xt.KHR_MESH_QUANTIZATION}}class Gj extends oM{constructor(e,n,s,a){super(e,n,s,a)}copySampleValue_(e){const n=this.resultBuffer,s=this.sampleValues,a=this.valueSize,r=e*a*3+a;for(let i=0;i!==a;i++)n[i]=s[r+i];return n}interpolate_(e,n,s,a){const r=this.resultBuffer,i=this.sampleValues,c=this.valueSize,d=c*2,f=c*3,h=a-n,m=(s-n)/h,x=m*m,y=x*m,v=e*f,S=v-f,A=-2*y+3*x,k=y-x,N=1-A,j=k-x+m;for(let E=0;E!==c;E++){const D=i[S+E+c],_=i[S+E+d]*h,B=i[v+E+c],O=i[v+E]*h;r[E]=N*D+j*_+A*B+k*O}return r}}const d2=new IA;class f2 extends Gj{interpolate_(e,n,s,a){const r=super.interpolate_(e,n,s,a);return d2.fromArray(r).normalize().toArray(r),r}}const xa={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ml={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},tS={9728:zA,9729:tb,9984:HE,9985:$E,9986:zE,9987:FA},nS={33071:WE,33648:UE,10497:nb},lg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wb={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},hi={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},p2={CUBICSPLINE:void 0,LINEAR:WA,STEP:aM},cg={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function h2(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new Vb({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:iM})),t.DefaultMaterial}function Gi(t,e,n){for(const s in n.extensions)t[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=n.extensions[s])}function Tr(t,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function m2(t,e,n){let s=!1,a=!1,r=!1;for(let f=0,h=e.length;f<h;f++){const m=e[f];if(m.POSITION!==void 0&&(s=!0),m.NORMAL!==void 0&&(a=!0),m.COLOR_0!==void 0&&(r=!0),s&&a&&r)break}if(!s&&!a&&!r)return Promise.resolve(t);const i=[],c=[],d=[];for(let f=0,h=e.length;f<h;f++){const m=e[f];if(s){const x=m.POSITION!==void 0?n.getDependency("accessor",m.POSITION):t.attributes.position;i.push(x)}if(a){const x=m.NORMAL!==void 0?n.getDependency("accessor",m.NORMAL):t.attributes.normal;c.push(x)}if(r){const x=m.COLOR_0!==void 0?n.getDependency("accessor",m.COLOR_0):t.attributes.color;d.push(x)}}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(d)]).then(function(f){const h=f[0],m=f[1],x=f[2];return s&&(t.morphAttributes.position=h),a&&(t.morphAttributes.normal=m),r&&(t.morphAttributes.color=x),t.morphTargetsRelative=!0,t})}function g2(t,e){if(t.updateMorphTargets(),e.weights!==void 0)for(let n=0,s=e.weights.length;n<s;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let s=0,a=n.length;s<a;s++)t.morphTargetDictionary[n[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function b2(t){let e;const n=t.extensions&&t.extensions[Xt.KHR_DRACO_MESH_COMPRESSION];if(n?e="draco:"+n.bufferView+":"+n.indices+":"+ug(n.attributes):e=t.indices+":"+ug(t.attributes)+":"+t.mode,t.targets!==void 0)for(let s=0,a=t.targets.length;s<a;s++)e+=":"+ug(t.targets[s]);return e}function ug(t){let e="";const n=Object.keys(t).sort();for(let s=0,a=n.length;s<a;s++)e+=n[s]+":"+t[n[s]]+";";return e}function kb(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function x2(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const y2=new Of;class v2{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new HL,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,a=-1,r=!1,i=-1;if(typeof navigator<"u"){const c=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(c)===!0;const d=c.match(/Version\/(\d+)/);a=s&&d?parseInt(d[1],10):-1,r=c.indexOf("Firefox")>-1,i=r?c.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&a<17||r&&i<98?this.textureLoader=new IE(this.options.manager):this.textureLoader=new BE(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Rf(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const s=this,a=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(i){const c={scene:i[0][a.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:a.asset,parser:s,userData:{}};return Gi(r,c,a),Tr(c,a),Promise.all(s._invokeAll(function(d){return d.afterRoot&&d.afterRoot(c)})).then(function(){for(const d of c.scenes)d.updateMatrixWorld();e(c)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],s=this.json.meshes||[];for(let a=0,r=n.length;a<r;a++){const i=n[a].joints;for(let c=0,d=i.length;c<d;c++)e[i[c]].isBone=!0}for(let a=0,r=e.length;a<r;a++){const i=e[a];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,n){n!==void 0&&(e.refs[n]===void 0&&(e.refs[n]=e.uses[n]=0),e.refs[n]++)}_getNodeRef(e,n,s){if(e.refs[n]<=1)return s;const a=s.clone(),r=(i,c)=>{const d=this.associations.get(i);d!=null&&this.associations.set(c,d);for(const[f,h]of i.children.entries())r(h,c.children[f])};return r(s,a),a.name+="_instance_"+e.uses[n]++,a}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let s=0;s<n.length;s++){const a=e(n[s]);if(a)return a}return null}_invokeAll(e){const n=Object.values(this.plugins);n.unshift(this);const s=[];for(let a=0;a<n.length;a++){const r=e(n[a]);r&&s.push(r)}return s}getDependency(e,n){const s=e+":"+n;let a=this.cache.get(s);if(!a){switch(e){case"scene":a=this.loadScene(n);break;case"node":a=this._invokeOne(function(r){return r.loadNode&&r.loadNode(n)});break;case"mesh":a=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(n)});break;case"accessor":a=this.loadAccessor(n);break;case"bufferView":a=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(n)});break;case"buffer":a=this.loadBuffer(n);break;case"material":a=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(n)});break;case"texture":a=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(n)});break;case"skin":a=this.loadSkin(n);break;case"animation":a=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(n)});break;case"camera":a=this.loadCamera(n);break;default:if(a=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,n)}),!a)throw new Error("Unknown type: "+e);break}this.cache.add(s,a)}return a}getDependencies(e){let n=this.cache.get(e);if(!n){const s=this,a=this.json[e+(e==="mesh"?"es":"s")]||[];n=Promise.all(a.map(function(r,i){return s.getDependency(e,i)})),this.cache.add(e,n)}return n}loadBuffer(e){const n=this.json.buffers[e],s=this.fileLoader;if(n.type&&n.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");if(n.uri===void 0&&e===0)return Promise.resolve(this.extensions[Xt.KHR_BINARY_GLTF].body);const a=this.options;return new Promise(function(r,i){s.load(tu.resolveURL(n.uri,a.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))})})}loadBufferView(e){const n=this.json.bufferViews[e];return this.getDependency("buffer",n.buffer).then(function(s){const a=n.byteLength||0,r=n.byteOffset||0;return s.slice(r,r+a)})}loadAccessor(e){const n=this,s=this.json,a=this.json.accessors[e];if(a.bufferView===void 0&&a.sparse===void 0){const i=lg[a.type],c=ml[a.componentType],d=a.normalized===!0,f=new c(a.count*i);return Promise.resolve(new nu(f,i,d))}const r=[];return a.bufferView!==void 0?r.push(this.getDependency("bufferView",a.bufferView)):r.push(null),a.sparse!==void 0&&(r.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(r).then(function(i){const c=i[0],d=lg[a.type],f=ml[a.componentType],h=f.BYTES_PER_ELEMENT,m=h*d,x=a.byteOffset||0,y=a.bufferView!==void 0?s.bufferViews[a.bufferView].byteStride:void 0,v=a.normalized===!0;let S,A;if(y&&y!==m){const k=Math.floor(x/y),N="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+k+":"+a.count;let j=n.cache.get(N);j||(S=new f(c,k*y,a.count*y/h),j=new FE(S,y/h),n.cache.add(N,j)),A=new rM(j,d,x%y/h,v)}else c===null?S=new f(a.count*d):S=new f(c,x,a.count*d),A=new nu(S,d,v);if(a.sparse!==void 0){const k=lg.SCALAR,N=ml[a.sparse.indices.componentType],j=a.sparse.indices.byteOffset||0,E=a.sparse.values.byteOffset||0,D=new N(i[1],j,a.sparse.count*k),_=new f(i[2],E,a.sparse.count*d);c!==null&&(A=new nu(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let B=0,O=D.length;B<O;B++){const T=D[B];if(A.setX(T,_[B*d]),d>=2&&A.setY(T,_[B*d+1]),d>=3&&A.setZ(T,_[B*d+2]),d>=4&&A.setW(T,_[B*d+3]),d>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=v}return A})}loadTexture(e){const n=this.json,s=this.options,r=n.textures[e].source,i=n.images[r];let c=this.textureLoader;if(i.uri){const d=s.manager.getHandler(i.uri);d!==null&&(c=d)}return this.loadTextureImage(e,r,c)}loadTextureImage(e,n,s){const a=this,r=this.json,i=r.textures[e],c=r.images[n],d=(c.uri||c.bufferView)+":"+i.sampler;if(this.textureCache[d])return this.textureCache[d];const f=this.loadImageSource(n,s).then(function(h){h.flipY=!1,h.name=i.name||c.name||"",h.name===""&&typeof c.uri=="string"&&c.uri.startsWith("data:image/")===!1&&(h.name=c.uri);const x=(r.samplers||{})[i.sampler]||{};return h.magFilter=tS[x.magFilter]||tb,h.minFilter=tS[x.minFilter]||FA,h.wrapS=nS[x.wrapS]||nb,h.wrapT=nS[x.wrapT]||nb,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==zA&&h.minFilter!==tb,a.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[d]=f,f}loadImageSource(e,n){const s=this,a=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(m=>m.clone());const i=a.images[e],c=self.URL||self.webkitURL;let d=i.uri||"",f=!1;if(i.bufferView!==void 0)d=s.getDependency("bufferView",i.bufferView).then(function(m){f=!0;const x=new Blob([m],{type:i.mimeType});return d=c.createObjectURL(x),d});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(d).then(function(m){return new Promise(function(x,y){let v=x;n.isImageBitmapLoader===!0&&(v=function(S){const A=new M0(S);A.needsUpdate=!0,x(A)}),n.load(tu.resolveURL(m,r.path),v,void 0,y)})}).then(function(m){return f===!0&&c.revokeObjectURL(d),Tr(m,i),m.userData.mimeType=i.mimeType||x2(i.uri),m}).catch(function(m){throw console.error("THREE.GLTFLoader: Couldn't load texture",d),m});return this.sourceCache[e]=h,h}assignTexture(e,n,s,a){const r=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(i=i.clone(),i.channel=s.texCoord),r.extensions[Xt.KHR_TEXTURE_TRANSFORM]){const c=s.extensions!==void 0?s.extensions[Xt.KHR_TEXTURE_TRANSFORM]:void 0;if(c){const d=r.associations.get(i);i=r.extensions[Xt.KHR_TEXTURE_TRANSFORM].extendTexture(i,c),r.associations.set(i,d)}}return a!==void 0&&(i.colorSpace=a),e[n]=i,i})}assignFinalMaterial(e){const n=e.geometry;let s=e.material;const a=n.attributes.tangent===void 0,r=n.attributes.color!==void 0,i=n.attributes.normal===void 0;if(e.isPoints){const c="PointsMaterial:"+s.uuid;let d=this.cache.get(c);d||(d=new qE,wf.prototype.copy.call(d,s),d.color.copy(s.color),d.map=s.map,d.sizeAttenuation=!1,this.cache.add(c,d)),s=d}else if(e.isLine){const c="LineBasicMaterial:"+s.uuid;let d=this.cache.get(c);d||(d=new VE,wf.prototype.copy.call(d,s),d.color.copy(s.color),d.map=s.map,this.cache.add(c,d)),s=d}if(a||r||i){let c="ClonedMaterial:"+s.uuid+":";a&&(c+="derivative-tangents:"),r&&(c+="vertex-colors:"),i&&(c+="flat-shading:");let d=this.cache.get(c);d||(d=s.clone(),r&&(d.vertexColors=!0),i&&(d.flatShading=!0),a&&(d.normalScale&&(d.normalScale.y*=-1),d.clearcoatNormalScale&&(d.clearcoatNormalScale.y*=-1)),this.cache.add(c,d),this.associations.set(d,this.associations.get(s))),s=d}e.material=s}getMaterialType(){return Vb}loadMaterial(e){const n=this,s=this.json,a=this.extensions,r=s.materials[e];let i;const c={},d=r.extensions||{},f=[];if(d[Xt.KHR_MATERIALS_UNLIT]){const m=a[Xt.KHR_MATERIALS_UNLIT];i=m.getMaterialType(),f.push(m.extendParams(c,r,n))}else{const m=r.pbrMetallicRoughness||{};if(c.color=new Lr(1,1,1),c.opacity=1,Array.isArray(m.baseColorFactor)){const x=m.baseColorFactor;c.color.setRGB(x[0],x[1],x[2],tr),c.opacity=x[3]}m.baseColorTexture!==void 0&&f.push(n.assignTexture(c,"map",m.baseColorTexture,Er)),c.metalness=m.metallicFactor!==void 0?m.metallicFactor:1,c.roughness=m.roughnessFactor!==void 0?m.roughnessFactor:1,m.metallicRoughnessTexture!==void 0&&(f.push(n.assignTexture(c,"metalnessMap",m.metallicRoughnessTexture)),f.push(n.assignTexture(c,"roughnessMap",m.metallicRoughnessTexture))),i=this._invokeOne(function(x){return x.getMaterialType&&x.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(x){return x.extendMaterialParams&&x.extendMaterialParams(e,c)})))}r.doubleSided===!0&&(c.side=$A);const h=r.alphaMode||cg.OPAQUE;if(h===cg.BLEND?(c.transparent=!0,c.depthWrite=!1):(c.transparent=!1,h===cg.MASK&&(c.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==fl&&(f.push(n.assignTexture(c,"normalMap",r.normalTexture)),c.normalScale=new PA(1,1),r.normalTexture.scale!==void 0)){const m=r.normalTexture.scale;c.normalScale.set(m,m)}if(r.occlusionTexture!==void 0&&i!==fl&&(f.push(n.assignTexture(c,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(c.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==fl){const m=r.emissiveFactor;c.emissive=new Lr().setRGB(m[0],m[1],m[2],tr)}return r.emissiveTexture!==void 0&&i!==fl&&f.push(n.assignTexture(c,"emissiveMap",r.emissiveTexture,Er)),Promise.all(f).then(function(){const m=new i(c);return r.name&&(m.name=r.name),Tr(m,r),n.associations.set(m,{materials:e}),r.extensions&&Gi(a,m,r),m})}createUniqueName(e){const n=GE.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,s=this.extensions,a=this.primitiveCache;function r(c){return s[Xt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(c,n).then(function(d){return sS(d,c,n)})}const i=[];for(let c=0,d=e.length;c<d;c++){const f=e[c],h=b2(f),m=a[h];if(m)i.push(m.promise);else{let x;f.extensions&&f.extensions[Xt.KHR_DRACO_MESH_COMPRESSION]?x=r(f):x=sS(new HA,f,n),a[h]={primitive:f,promise:x},i.push(x)}}return Promise.all(i)}loadMesh(e){const n=this,s=this.json,a=this.extensions,r=s.meshes[e],i=r.primitives,c=[];for(let d=0,f=i.length;d<f;d++){const h=i[d].material===void 0?h2(this.cache):this.getDependency("material",i[d].material);c.push(h)}return c.push(n.loadGeometries(i)),Promise.all(c).then(function(d){const f=d.slice(0,d.length-1),h=d[d.length-1],m=[];for(let y=0,v=h.length;y<v;y++){const S=h[y],A=i[y];let k;const N=f[y];if(A.mode===xa.TRIANGLES||A.mode===xa.TRIANGLE_STRIP||A.mode===xa.TRIANGLE_FAN||A.mode===void 0)k=r.isSkinnedMesh===!0?new YE(S,N):new cl(S,N),k.isSkinnedMesh===!0&&k.normalizeSkinWeights(),A.mode===xa.TRIANGLE_STRIP?k.geometry=Zk(k.geometry,OA):A.mode===xa.TRIANGLE_FAN&&(k.geometry=Zk(k.geometry,Zg));else if(A.mode===xa.LINES)k=new KE(S,N);else if(A.mode===xa.LINE_STRIP)k=new QE(S,N);else if(A.mode===xa.LINE_LOOP)k=new XE(S,N);else if(A.mode===xa.POINTS)k=new JE(S,N);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(k.geometry.morphAttributes).length>0&&g2(k,r),k.name=n.createUniqueName(r.name||"mesh_"+e),Tr(k,r),A.extensions&&Gi(a,k,A),n.assignFinalMaterial(k),m.push(k)}for(let y=0,v=m.length;y<v;y++)n.associations.set(m[y],{meshes:e,primitives:y});if(m.length===1)return r.extensions&&Gi(a,m[0],r),m[0];const x=new Pm;r.extensions&&Gi(a,x,r),n.associations.set(x,{meshes:e});for(let y=0,v=m.length;y<v;y++)x.add(m[y]);return x})}loadCamera(e){let n;const s=this.json.cameras[e],a=s[s.type];if(!a){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?n=new UA(ZE.radToDeg(a.yfov),a.aspectRatio||1,a.znear||1,a.zfar||2e6):s.type==="orthographic"&&(n=new eM(-a.xmag,a.xmag,a.ymag,-a.ymag,a.znear,a.zfar)),s.name&&(n.name=this.createUniqueName(s.name)),Tr(n,s),Promise.resolve(n)}loadSkin(e){const n=this.json.skins[e],s=[];for(let a=0,r=n.joints.length;a<r;a++)s.push(this._loadNodeShallow(n.joints[a]));return n.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",n.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(a){const r=a.pop(),i=a,c=[],d=[];for(let f=0,h=i.length;f<h;f++){const m=i[f];if(m){c.push(m);const x=new Of;r!==null&&x.fromArray(r.array,f*16),d.push(x)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',n.joints[f])}return new tM(c,d)})}loadAnimation(e){const n=this.json,s=this,a=n.animations[e],r=a.name?a.name:"animation_"+e,i=[],c=[],d=[],f=[],h=[];for(let m=0,x=a.channels.length;m<x;m++){const y=a.channels[m],v=a.samplers[y.sampler],S=y.target,A=S.node,k=a.parameters!==void 0?a.parameters[v.input]:v.input,N=a.parameters!==void 0?a.parameters[v.output]:v.output;S.node!==void 0&&(i.push(this.getDependency("node",A)),c.push(this.getDependency("accessor",k)),d.push(this.getDependency("accessor",N)),f.push(v),h.push(S))}return Promise.all([Promise.all(i),Promise.all(c),Promise.all(d),Promise.all(f),Promise.all(h)]).then(function(m){const x=m[0],y=m[1],v=m[2],S=m[3],A=m[4],k=[];for(let N=0,j=x.length;N<j;N++){const E=x[N],D=y[N],_=v[N],B=S[N],O=A[N];if(E===void 0)continue;E.updateMatrix&&E.updateMatrix();const T=s._createAnimationTracks(E,D,_,B,O);if(T)for(let M=0;M<T.length;M++)k.push(T[M])}return new nM(r,void 0,k)})}createNodeMesh(e){const n=this.json,s=this,a=n.nodes[e];return a.mesh===void 0?null:s.getDependency("mesh",a.mesh).then(function(r){const i=s._getNodeRef(s.meshCache,a.mesh,r);return a.weights!==void 0&&i.traverse(function(c){if(c.isMesh)for(let d=0,f=a.weights.length;d<f;d++)c.morphTargetInfluences[d]=a.weights[d]}),i})}loadNode(e){const n=this.json,s=this,a=n.nodes[e],r=s._loadNodeShallow(e),i=[],c=a.children||[];for(let f=0,h=c.length;f<h;f++)i.push(s.getDependency("node",c[f]));const d=a.skin===void 0?Promise.resolve(null):s.getDependency("skin",a.skin);return Promise.all([r,Promise.all(i),d]).then(function(f){const h=f[0],m=f[1],x=f[2];x!==null&&h.traverse(function(y){y.isSkinnedMesh&&y.bind(x,y2)});for(let y=0,v=m.length;y<v;y++)h.add(m[y]);return h})}_loadNodeShallow(e){const n=this.json,s=this.extensions,a=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=n.nodes[e],i=r.name?a.createUniqueName(r.name):"",c=[],d=a._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return d&&c.push(d),r.camera!==void 0&&c.push(a.getDependency("camera",r.camera).then(function(f){return a._getNodeRef(a.cameraCache,r.camera,f)})),a._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){c.push(f)}),this.nodeCache[e]=Promise.all(c).then(function(f){let h;if(r.isBone===!0?h=new sM:f.length>1?h=new Pm:f.length===1?h=f[0]:h=new BA,h!==f[0])for(let m=0,x=f.length;m<x;m++)h.add(f[m]);if(r.name&&(h.userData.name=r.name,h.name=i),Tr(h,r),r.extensions&&Gi(s,h,r),r.matrix!==void 0){const m=new Of;m.fromArray(r.matrix),h.applyMatrix4(m)}else r.translation!==void 0&&h.position.fromArray(r.translation),r.rotation!==void 0&&h.quaternion.fromArray(r.rotation),r.scale!==void 0&&h.scale.fromArray(r.scale);return a.associations.has(h)||a.associations.set(h,{}),a.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const n=this.extensions,s=this.json.scenes[e],a=this,r=new Pm;s.name&&(r.name=a.createUniqueName(s.name)),Tr(r,s),s.extensions&&Gi(n,r,s);const i=s.nodes||[],c=[];for(let d=0,f=i.length;d<f;d++)c.push(a.getDependency("node",i[d]));return Promise.all(c).then(function(d){for(let h=0,m=d.length;h<m;h++)r.add(d[h]);const f=h=>{const m=new Map;for(const[x,y]of a.associations)(x instanceof wf||x instanceof M0)&&m.set(x,y);return h.traverse(x=>{const y=a.associations.get(x);y!=null&&m.set(x,y)}),m};return a.associations=f(r),r})}_createAnimationTracks(e,n,s,a,r){const i=[],c=e.name?e.name:e.uuid,d=[];hi[r.path]===hi.weights?e.traverse(function(x){x.morphTargetInfluences&&d.push(x.name?x.name:x.uuid)}):d.push(c);let f;switch(hi[r.path]){case hi.weights:f=R0;break;case hi.rotation:f=O0;break;case hi.position:case hi.scale:f=D0;break;default:switch(s.itemSize){case 1:f=R0;break;case 2:case 3:default:f=D0;break}break}const h=a.interpolation!==void 0?p2[a.interpolation]:WA,m=this._getArrayFromAccessor(s);for(let x=0,y=d.length;x<y;x++){const v=new f(d[x]+"."+hi[r.path],n.array,m,h);a.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(v),i.push(v)}return i}_getArrayFromAccessor(e){let n=e.array;if(e.normalized){const s=kb(n.constructor),a=new Float32Array(n.length);for(let r=0,i=n.length;r<i;r++)a[r]=n[r]*s;n=a}return n}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const a=this instanceof O0?f2:Gj;return new a(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function w2(t,e,n){const s=e.attributes,a=new lM;if(s.POSITION!==void 0){const c=n.json.accessors[s.POSITION],d=c.min,f=c.max;if(d!==void 0&&f!==void 0){if(a.set(new eo(d[0],d[1],d[2]),new eo(f[0],f[1],f[2])),c.normalized){const h=kb(ml[c.componentType]);a.min.multiplyScalar(h),a.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const c=new eo,d=new eo;for(let f=0,h=r.length;f<h;f++){const m=r[f];if(m.POSITION!==void 0){const x=n.json.accessors[m.POSITION],y=x.min,v=x.max;if(y!==void 0&&v!==void 0){if(d.setX(Math.max(Math.abs(y[0]),Math.abs(v[0]))),d.setY(Math.max(Math.abs(y[1]),Math.abs(v[1]))),d.setZ(Math.max(Math.abs(y[2]),Math.abs(v[2]))),x.normalized){const S=kb(ml[x.componentType]);d.multiplyScalar(S)}c.max(d)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(c)}t.boundingBox=a;const i=new cM;a.getCenter(i.center),i.radius=a.min.distanceTo(a.max)/2,t.boundingSphere=i}function sS(t,e,n){const s=e.attributes,a=[];function r(i,c){return n.getDependency("accessor",i).then(function(d){t.setAttribute(c,d)})}for(const i in s){const c=wb[i]||i.toLowerCase();c in t.attributes||a.push(r(s[i],c))}if(e.indices!==void 0&&!t.index){const i=n.getDependency("accessor",e.indices).then(function(c){t.setIndex(c)});a.push(i)}return sb.workingColorSpace!==tr&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${sb.workingColorSpace}" not supported.`),Tr(t,e),w2(t,e,n),Promise.all(a).then(function(){return e.targets!==void 0?m2(t,e.targets,n):t})}const dg=new WeakMap;class k2 extends LA{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,n,s,a){const r=new Rf(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{this.parse(i,n,a)},s,a)}parse(e,n,s=()=>{}){this.decodeDracoFile(e,n,null,null,Er,s).catch(s)}decodeDracoFile(e,n,s,a,r=tr,i=()=>{}){const c={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:a||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:r};return this.decodeGeometry(e,c).then(n).catch(i)}decodeGeometry(e,n){const s=JSON.stringify(n);if(dg.has(e)){const d=dg.get(e);if(d.key===s)return d.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let a;const r=this.workerNextTaskID++,i=e.byteLength,c=this._getWorker(r,i).then(d=>(a=d,new Promise((f,h)=>{a._callbacks[r]={resolve:f,reject:h},a.postMessage({type:"decode",id:r,taskConfig:n,buffer:e},[e])}))).then(d=>this._createGeometry(d.geometry));return c.catch(()=>!0).then(()=>{a&&r&&this._releaseTask(a,r)}),dg.set(e,{key:s,promise:c}),c}_createGeometry(e){const n=new HA;e.index&&n.setIndex(new nu(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const a=e.attributes[s],r=a.name,i=a.array,c=a.itemSize,d=new nu(i,c);r==="color"&&(this._assignVertexColorSpace(d,a.vertexColorSpace),d.normalized=!(i instanceof Float32Array)),n.setAttribute(r,d)}return n}_assignVertexColorSpace(e,n){if(n!==Er)return;const s=new Lr;for(let a=0,r=e.count;a<r;a++)s.fromBufferAttribute(e,a),sb.toWorkingColorSpace(s,Er),e.setXYZ(a,s.r,s.g,s.b)}_loadLibrary(e,n){const s=new Rf(this.manager);return s.setPath(this.decoderPath),s.setResponseType(n),s.setWithCredentials(this.withCredentials),new Promise((a,r)=>{s.load(e,a,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",n=[];return e?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then(s=>{const a=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const r=S2.toString(),i=["/* draco decoder */",a,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
47
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,n){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const a=new Worker(this.workerSourceURL);a._callbacks={},a._taskCosts={},a._taskLoad=0,a.postMessage({type:"init",decoderConfig:this.decoderConfig}),a.onmessage=function(r){const i=r.data;switch(i.type){case"decode":a._callbacks[i.id].resolve(i);break;case"error":a._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(a)}else this.workerPool.sort(function(a,r){return a._taskLoad>r._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=n,s._taskLoad+=n,s})}_releaseTask(e,n){e._taskLoad-=e._taskCosts[n],delete e._callbacks[n],delete e._taskCosts[n]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function S2(){let t,e;onmessage=function(i){const c=i.data;switch(c.type){case"init":t=c.decoderConfig,e=new Promise(function(h){t.onModuleLoaded=function(m){h({draco:m})},DracoDecoderModule(t)});break;case"decode":const d=c.buffer,f=c.taskConfig;e.then(h=>{const m=h.draco,x=new m.Decoder;try{const y=n(m,x,new Int8Array(d),f),v=y.attributes.map(S=>S.array.buffer);y.index&&v.push(y.index.array.buffer),self.postMessage({type:"decode",id:c.id,geometry:y},v)}catch(y){console.error(y),self.postMessage({type:"error",id:c.id,error:y.message})}finally{m.destroy(x)}});break}};function n(i,c,d,f){const h=f.attributeIDs,m=f.attributeTypes;let x,y;const v=c.GetEncodedGeometryType(d);if(v===i.TRIANGULAR_MESH)x=new i.Mesh,y=c.DecodeArrayToMesh(d,d.byteLength,x);else if(v===i.POINT_CLOUD)x=new i.PointCloud,y=c.DecodeArrayToPointCloud(d,d.byteLength,x);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!y.ok()||x.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());const S={index:null,attributes:[]};for(const A in h){const k=self[m[A]];let N,j;if(f.useUniqueIDs)j=h[A],N=c.GetAttributeByUniqueId(x,j);else{if(j=c.GetAttributeId(x,i[h[A]]),j===-1)continue;N=c.GetAttribute(x,j)}const E=a(i,c,x,A,k,N);A==="color"&&(E.vertexColorSpace=f.vertexColorSpace),S.attributes.push(E)}return v===i.TRIANGULAR_MESH&&(S.index=s(i,c,x)),i.destroy(x),S}function s(i,c,d){const h=d.num_faces()*3,m=h*4,x=i._malloc(m);c.GetTrianglesUInt32Array(d,m,x);const y=new Uint32Array(i.HEAPF32.buffer,x,h).slice();return i._free(x),{array:y,itemSize:1}}function a(i,c,d,f,h,m){const x=m.num_components(),v=d.num_points()*x,S=v*h.BYTES_PER_ELEMENT,A=r(i,h),k=i._malloc(S);c.GetAttributeDataArrayForAllPoints(d,m,A,S,k);const N=new h(i.HEAPF32.buffer,k,v).slice();return i._free(k),{name:f,array:N,itemSize:x}}function r(i,c){switch(c){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}var C2=(function(){var t="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),s=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var a=WebAssembly.validate(n)?e:t,r,i=WebAssembly.instantiate(c(a),{}).then(function(k){r=k.instance,r.exports.__wasm_call_ctors()});function c(k){for(var N=new Uint8Array(k.length),j=0;j<k.length;++j){var E=k.charCodeAt(j);N[j]=E>96?E-97:E>64?E-39:E+4}for(var D=0,j=0;j<k.length;++j)N[D++]=N[j]<60?s[N[j]]:(N[j]-60)*64+N[++j];return N.buffer.slice(0,D)}function d(k,N,j,E,D,_){var B=r.exports.sbrk,O=j+3&-4,T=B(O*E),M=B(D.length),R=new Uint8Array(r.exports.memory.buffer);R.set(D,M);var F=k(T,j,E,M,D.length);if(F==0&&_&&_(T,O,E),N.set(R.subarray(T,T+j*E)),B(T-B(0)),F!=0)throw new Error("Malformed buffer data: "+F)}var f={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},m=[],x=0;function y(k){var N={object:new Worker(k),pending:0,requests:{}};return N.object.onmessage=function(j){var E=j.data;N.pending-=E.count,N.requests[E.id][E.action](E.value),delete N.requests[E.id]},N}function v(k){for(var N="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(c(a))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+d.toString()+A.toString(),j=new Blob([N],{type:"text/javascript"}),E=URL.createObjectURL(j),D=0;D<k;++D)m[D]=y(E);URL.revokeObjectURL(E)}function S(k,N,j,E,D){for(var _=m[0],B=1;B<m.length;++B)m[B].pending<_.pending&&(_=m[B]);return new Promise(function(O,T){var M=new Uint8Array(j),R=x++;_.pending+=k,_.requests[R]={resolve:O,reject:T},_.object.postMessage({id:R,count:k,size:N,source:M,mode:E,filter:D},[M.buffer])})}function A(k){i.then(function(){var N=k.data;try{var j=new Uint8Array(N.count*N.size);d(r.exports[N.mode],j,N.count,N.size,N.source,r.exports[N.filter]),self.postMessage({id:N.id,count:N.count,action:"resolve",value:j},[j.buffer])}catch(E){self.postMessage({id:N.id,count:N.count,action:"reject",value:E})}})}return{ready:i,supported:!0,useWorkers:function(k){v(k)},decodeVertexBuffer:function(k,N,j,E,D){d(r.exports.meshopt_decodeVertexBuffer,k,N,j,E,r.exports[f[D]])},decodeIndexBuffer:function(k,N,j,E){d(r.exports.meshopt_decodeIndexBuffer,k,N,j,E)},decodeIndexSequence:function(k,N,j,E){d(r.exports.meshopt_decodeIndexSequence,k,N,j,E)},decodeGltfBuffer:function(k,N,j,E,D,_){d(r.exports[h[D]],k,N,j,E,r.exports[f[_]])},decodeGltfBufferAsync:function(k,N,j,E,D){return m.length>0?S(k,N,j,h[E],f[D]):i.then(function(){var _=new Uint8Array(k*N);return d(r.exports[h[E]],_,k,N,j,r.exports[f[D]]),_})}}})();const A2={idle:"idle",working:"walk",waiting:"sit",waiting_permission:"idle",error:"emote-no",offline:"static",orphaned:"idle"},aS={idle:4915102,working:4890367,waiting:16752202,waiting_permission:16763904,error:16730698,offline:8947848,orphaned:16752202};function Yj({agentClass:t,modelFile:e,customModelFile:n,customModelUrl:s,modelScale:a=1,modelOffset:r,idleAnimation:i,status:c="idle",width:d=150,height:f=200}){const h=b.useRef(null),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),v=b.useRef(null),S=b.useRef(null),A=b.useRef(new Map),k=b.useRef(null),N=b.useRef(null),j=b.useRef(0),E=b.useRef(new uM),[D,_]=b.useState(!1),[B,O]=b.useState(!1),T=b.useRef(!1),M=b.useRef(0),R=b.useRef(new eo),F=b.useRef(!1),$=b.useRef({x:0,y:0}),U=b.useRef({x:0,y:0});b.useEffect(()=>{const z=h.current;if(!z)return;O(!1);const W=new dM;W.background=new Lr(1710628),x.current=W;const V=new UA(45,d/f,.1,100);V.position.set(0,1.2,1.4),V.lookAt(0,.4,0),y.current=V;let Y;try{Y=new fM({antialias:!0,alpha:!0})}catch{console.warn("[ModelPreview] WebGL context creation failed — too many active contexts"),O(!0);return}Y.setSize(d,f),Y.setPixelRatio(Math.min(window.devicePixelRatio,2)),Y.setClearColor(1710628,1),z.appendChild(Y.domElement),m.current=Y;const P=new pM(16777215,1);W.add(P);const K=new eb(16777215,1.5);K.position.set(2,3,2),W.add(K);const Q=new eb(4890367,.6);Q.position.set(-2,1,-1),W.add(Q);const q=new hM(1,32),be=new Vb({color:2763322,roughness:.8}),ue=new cl(q,be);ue.rotation.x=-Math.PI/2,ue.position.y=0,W.add(ue);const Z=new mM(.35,.42,32),de=new fl({color:aS.idle,side:$A,transparent:!0,opacity:.8}),Ce=new cl(Z,de);Ce.rotation.x=-Math.PI/2,Ce.position.y=.01,W.add(Ce),N.current=Ce,_(!0);const xe=se=>{F.current=!0,$.current={x:se.clientX,y:se.clientY},z.style.cursor="grabbing"},Ne=se=>{if(!F.current||!v.current)return;const Ee=se.clientX-$.current.x,Ve=se.clientY-$.current.y;U.current.y+=Ee*.01,U.current.x+=Ve*.01,U.current.x=Math.max(-Math.PI/4,Math.min(Math.PI/4,U.current.x)),v.current.rotation.y=U.current.y,v.current.rotation.x=U.current.x,$.current={x:se.clientX,y:se.clientY}},qe=()=>{F.current=!1,z.style.cursor="grab"},Ge=()=>{F.current=!1,z.style.cursor="grab"};z.addEventListener("mousedown",xe),window.addEventListener("mousemove",Ne),window.addEventListener("mouseup",qe),z.addEventListener("mouseleave",Ge),z.style.cursor="grab";const X=()=>{j.current=requestAnimationFrame(X);const se=E.current.getDelta();if(S.current)S.current.update(se);else if(v.current&&!T.current){M.current+=se;const Ee=M.current,we=Math.sin(Ee*1.5)*.02,fe=Math.sin(Ee*.8)*.01;v.current.position.set(R.current.x+fe,R.current.y+we,R.current.z)}m.current&&x.current&&y.current&&m.current.render(x.current,y.current)};return X(),()=>{if(cancelAnimationFrame(j.current),z.removeEventListener("mousedown",xe),window.removeEventListener("mousemove",Ne),window.removeEventListener("mouseup",qe),z.removeEventListener("mouseleave",Ge),v.current&&x.current&&(x.current.remove(v.current),v.current.traverse(se=>{var Ee,Ve;se instanceof cl&&((Ee=se.geometry)==null||Ee.dispose(),Array.isArray(se.material)?se.material.forEach(at=>{at.map&&at.map.dispose(),at.dispose()}):se.material&&(se.material.map&&((Ve=se.material.map)==null||Ve.dispose()),se.material.dispose()))}),v.current=null),N.current&&x.current&&(x.current.remove(N.current),N.current.geometry.dispose(),N.current.material.dispose(),N.current=null),x.current&&(x.current.traverse(se=>{var Ee;se instanceof cl&&((Ee=se.geometry)==null||Ee.dispose(),se.material instanceof wf&&se.material.dispose())}),x.current.clear()),S.current=null,k.current=null,A.current.clear(),m.current){try{const Ee=m.current.getContext().getExtension("WEBGL_lose_context");Ee&&Ee.loseContext()}catch{}m.current.dispose(),z.contains(m.current.domElement)&&z.removeChild(m.current.domElement),m.current=null}x.current=null,y.current=null,_(!1)}},[d,f]),b.useEffect(()=>{if(!D||!x.current)return;const z=new $L,W=new k2;W.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.7/"),z.setDRACOLoader(W),z.setMeshoptDecoder(C2);let V=null;const Y=P=>{v.current&&x.current&&(x.current.remove(v.current),v.current=null,S.current=null,k.current=null);const K=P.scene;K.scale.setScalar(a);const Q=(r==null?void 0:r.x)??0,q=(r==null?void 0:r.y)??0,be=(r==null?void 0:r.z)??0;if(K.position.set(Q,be,q),K.visible=!0,U.current={x:0,y:0},K.rotation.set(0,0,0),K.traverse(ue=>{if(ue instanceof cl&&(ue.castShadow=!0,ue.receiveShadow=!0,ue.material)){const Z=ue.material;Z.map&&(Z.map.colorSpace=Er)}}),x.current)if(x.current.add(K),v.current=K,R.current.copy(K.position),P.animations.length>0){T.current=!0;const ue=new gM(K);S.current=ue,A.current.clear();for(const Z of P.animations)A.current.set(Z.name.toLowerCase(),Z);if(i!==""){const Z=i?A.current.get(i.toLowerCase())||P.animations[0]:A.current.get("idle")||P.animations[0];if(Z){const de=ue.clipAction(Z);de.reset().play(),k.current=de}}}else T.current=!1,S.current=null,A.current.clear()};if(n)V=URL.createObjectURL(n),console.log("[ModelPreview] Loading custom model from file:",n.name,"blob URL:",V),z.load(V,P=>{console.log("[ModelPreview] Successfully loaded custom model file, animations:",P.animations.length),Y(P)},void 0,P=>{console.error("[ModelPreview] Failed to load custom model file:",P)});else if(s){const P=fb(s);console.log("[ModelPreview] Loading custom model from URL:",s),z.load(P,K=>{console.log("[ModelPreview] Successfully loaded custom model URL, animations:",K.animations.length),Y(K)},void 0,K=>{console.error("[ModelPreview] Failed to load custom model URL:",s,K)})}else{const P=e||(t?RL[t]:void 0)||"character-male-a.glb";z.load(`/assets/characters/${P}`,Y,void 0,K=>{console.error("[ModelPreview] Failed to load model:",P,K)})}return()=>{V&&URL.revokeObjectURL(V),W.dispose()}},[t,e,n,s,a,r,D]);const L=z=>{if(!S.current)return;const W=A2[z],V=A.current.get(W);if(!V){const P=A.current.get("idle");if(P){const K=S.current.clipAction(P);K.reset().play(),k.current=K}return}const Y=S.current.clipAction(V);z==="working"?Y.timeScale=1.5:z==="error"&&(Y.setLoop(bM,1),Y.clampWhenFinished=!0),k.current&&k.current!==Y?(k.current.fadeOut(.3),Y.reset().fadeIn(.3).play()):Y.reset().play(),k.current=Y};return b.useEffect(()=>{if(D){if(N.current){const z=N.current.material;z.color.setHex(aS[c]),c==="working"?z.opacity=.6+Math.sin(Date.now()*.005)*.4:z.opacity=.8}L(c)}},[c,D]),b.useEffect(()=>{if(!D||!S.current||c!=="idle")return;if(i===""){k.current&&(k.current.stop(),k.current=null);return}const z=i?i.toLowerCase():"idle",W=A.current.get(z);if(W){const V=S.current.clipAction(W);k.current&&k.current!==V?(k.current.fadeOut(.3),V.reset().fadeIn(.3).play()):V.reset().play(),k.current=V}else k.current&&(k.current.stop(),k.current=null)},[i,D,c]),B?o.jsx("div",{className:"model-preview",style:{width:d,height:f,borderRadius:8,overflow:"hidden",background:"#1a1a24",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",fontSize:12,textAlign:"center",padding:8},children:"3D preview unavailable"}):o.jsx("div",{ref:h,className:"model-preview",style:{width:d,height:f,borderRadius:8,overflow:"hidden",background:"#1a1a24"}})}function j2({value:t,onChange:e,onSubmit:n,placeholder:s="/path/to/folder",className:a="",directoriesOnly:r=!0,autoFocus:i=!1,hasError:c=!1,disabled:d=!1}){const[f,h]=b.useState([]),[m,x]=b.useState(-1),[y,v]=b.useState(!1),[S,A]=b.useState(!1),k=b.useRef(null),N=b.useRef(null),j=b.useRef(null),E=b.useCallback(async R=>{if(!R){h([]);return}A(!0);try{const F=new URLSearchParams({path:R,dirs:r?"true":"false",limit:"15"}),$=await Pt(Ot(`/api/files/autocomplete?${F}`));if($.ok){const U=await $.json();h(U.suggestions||[]),x(-1)}}catch(F){console.error("Failed to fetch path suggestions:",F)}finally{A(!1)}},[r]);b.useEffect(()=>(j.current&&clearTimeout(j.current),t&&y?j.current=setTimeout(()=>{E(t)},150):h([]),()=>{j.current&&clearTimeout(j.current)}),[t,y,E]);const D=R=>{e(R.target.value),v(!0)},_=b.useCallback(R=>{var $;const F=R.isDirectory?R.path+"/":R.path;e(F),v(R.isDirectory),x(-1),($=k.current)==null||$.focus(),R.isDirectory&&E(F)},[e,E]),B=R=>{if(!y||f.length===0){R.key==="Enter"&&n&&(R.preventDefault(),n()),R.key==="Escape"&&v(!1);return}switch(R.key){case"ArrowDown":R.preventDefault(),x(F=>F<f.length-1?F+1:F);break;case"ArrowUp":R.preventDefault(),x(F=>F>0?F-1:-1);break;case"Tab":if(R.preventDefault(),f.length>0){const F=m>=0?m:0;_(f[F])}break;case"Enter":R.preventDefault(),m>=0&&f[m]?_(f[m]):n&&(v(!1),n());break;case"Escape":R.preventDefault(),v(!1),x(-1);break}},O=()=>{v(!0),t&&E(t)},T=()=>{setTimeout(()=>{v(!1),x(-1)},200)};b.useEffect(()=>{if(m>=0&&N.current){const F=N.current.querySelectorAll(".folder-input-suggestion")[m];F&&F.scrollIntoView({block:"nearest"})}},[m]);const M=["folder-input",a,c?"error":""].filter(Boolean).join(" ");return o.jsxs("div",{className:"folder-input-container",children:[o.jsx("input",{ref:k,type:"text",className:M,value:t,onChange:D,onKeyDown:B,onFocus:O,onBlur:T,placeholder:s,autoFocus:i,disabled:d,autoComplete:"off",spellCheck:!1}),y&&(f.length>0||S)&&o.jsx("div",{ref:N,className:"folder-input-suggestions",children:S&&f.length===0?o.jsx("div",{className:"folder-input-loading",children:"Loading..."}):f.map((R,F)=>o.jsxs("div",{className:`folder-input-suggestion ${F===m?"selected":""}`,onClick:()=>_(R),onMouseEnter:()=>x(F),children:[o.jsx("span",{className:"folder-input-suggestion-icon",children:R.isDirectory?"📁":"📄"}),o.jsx("span",{className:"folder-input-suggestion-name",children:R.name}),R.isDirectory&&o.jsx("span",{className:"folder-input-suggestion-hint",children:"/"})]},R.path))})]})}function Kj({agent:t,isOpen:e,onClose:n}){const{t:s}=ht(["terminal","common","tools"]),a=nL(),r=ar(),[i,c]=b.useState(t.name),[d,f]=b.useState(t.class),[h,m]=b.useState(t.permissionMode),[x,y]=b.useState(t.provider||"claude"),[v,S]=b.useState(t.codexConfig||{fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),[A,k]=b.useState(t.model||"sonnet"),[N,j]=b.useState(t.effort),[E,D]=b.useState(t.codexModel||"gpt-5.3-codex"),[_,B]=b.useState(t.opencodeModel||"minimax/MiniMax-M1-80k"),[O,T]=b.useState(t.useChrome||!1),[M,R]=b.useState(t.cwd),[F,$]=b.useState(new Set),[U,L]=b.useState(""),[z,W]=b.useState(!1),[V,Y]=b.useState("");b.useMemo(()=>a.filter(X=>X.enabled&&(X.assignedAgentIds.includes(t.id)||X.assignedAgentClasses.includes(t.class))),[a,t.id,t.class]),b.useEffect(()=>{const X=a.filter(se=>se.assignedAgentIds.includes(t.id)).map(se=>se.id);$(new Set(X))},[a,t.id]),b.useEffect(()=>{if(e){c(t.name),f(t.class),m(t.permissionMode),y(t.provider||"claude"),S(t.codexConfig||{fullAuto:!0,sandbox:"workspace-write",approvalMode:"on-request",search:!1}),k(t.model||"sonnet"),j(t.effort),D(t.codexModel||"gpt-5.3-codex"),B(t.opencodeModel||"minimax/MiniMax-M1-80k"),T(t.useChrome||!1),R(t.cwd);const X=a.filter(se=>se.assignedAgentIds.includes(t.id)).map(se=>se.id);$(new Set(X))}},[e,t,a]);const P=b.useMemo(()=>a.filter(X=>X.enabled),[a]),K=b.useMemo(()=>{if(!U.trim())return P;const X=U.toLowerCase();return P.filter(se=>se.name.toLowerCase().includes(X)||se.description.toLowerCase().includes(X)||se.slug.toLowerCase().includes(X))},[P,U]),Q=b.useMemo(()=>P.filter(X=>X.assignedAgentClasses.includes(d)),[P,d]),q=b.useCallback(X=>{$(se=>{const Ee=new Set(se);return Ee.has(X)?Ee.delete(X):Ee.add(X),Ee})},[]),be=b.useMemo(()=>{const X=r.find(se=>se.id===d);if(X!=null&&X.model)return X.model},[r,d]),ue=b.useMemo(()=>{const X=r.find(se=>se.id===d);if(X!=null&&X.customModelPath)return Ot(`/api/custom-models/${X.id}`)},[r,d]),Z=b.useMemo(()=>{const X=r.find(se=>se.id===d);return X==null?void 0:X.modelScale},[r,d]),de=b.useMemo(()=>r.find(X=>X.id===d),[r,d]);b.useEffect(()=>{de&&(Y(de.instructions||""),W(!1))},[de==null?void 0:de.id]);const Ce=b.useMemo(()=>r.find(se=>se.id===d)?"scout":d,[r,d]),xe=b.useMemo(()=>{const X=i.trim();if(X&&X!==t.name||d!==t.class||h!==t.permissionMode||x!==(t.provider||"claude")||x==="claude"&&A!==(t.model||"sonnet")||x==="claude"&&N!==(t.effort||void 0)||x==="codex"&&E!==(t.codexModel||"gpt-5.3-codex")||x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})||x==="opencode"&&_!==(t.opencodeModel||"minimax/MiniMax-M1-80k")||O!==(t.useChrome||!1)||M!==t.cwd)return!0;const se=a.filter(Ve=>Ve.assignedAgentIds.includes(t.id)).map(Ve=>Ve.id).sort().join(","),Ee=Array.from(F).sort().join(",");return se!==Ee},[i,d,h,x,A,N,E,v,_,O,M,F,t,a]),Ne=()=>{const X=i.trim(),se={};X&&X!==t.name&&H.renameAgent(t.id,X),d!==t.class&&(se.class=d),h!==t.permissionMode&&(se.permissionMode=h),x!==(t.provider||"claude")&&(se.provider=x),x==="codex"&&JSON.stringify(v||{})!==JSON.stringify(t.codexConfig||{})&&(se.codexConfig=v),x==="codex"&&E!==(t.codexModel||"gpt-5.3-codex")&&(se.codexModel=E),x==="opencode"&&_!==(t.opencodeModel||"minimax/MiniMax-M1-80k")&&(se.opencodeModel=_),x==="claude"&&A!==(t.model||"sonnet")&&(se.model=A),x==="claude"&&N!==(t.effort||void 0)&&(se.effort=N),O!==(t.useChrome||!1)&&(se.useChrome=O),M!==t.cwd&&(se.cwd=M);const Ee=a.filter(at=>at.assignedAgentIds.includes(t.id)).map(at=>at.id).sort().join(","),Ve=Array.from(F).sort().join(",");Ee!==Ve&&(se.skillIds=Array.from(F)),Object.keys(se).length>0&&H.updateAgentProperties(t.id,se),n()},{handleMouseDown:qe,handleClick:Ge}=Sa(n);return e?o.jsx("div",{className:"modal-overlay visible",onMouseDown:qe,onClick:Ge,children:o.jsxs("div",{className:"modal agent-edit-modal",children:[o.jsxs("div",{className:"modal-header",children:[s("terminal:spawn.editAgentTitle"),": ",i.trim()||t.name]}),o.jsxs("div",{className:"modal-body spawn-modal-body",children:[o.jsxs("div",{className:"spawn-top-section",children:[o.jsx("div",{className:"spawn-preview-compact",children:o.jsx(Yj,{agentClass:Ce,modelFile:be,customModelUrl:ue,modelScale:Z,width:100,height:120})}),o.jsxs("div",{className:"spawn-class-section",children:[o.jsx("div",{className:"spawn-class-label",children:s("terminal:spawn.agentClass")}),o.jsxs("div",{className:"class-selector-inline",children:[r.map(X=>o.jsxs("button",{className:`class-chip ${d===X.id?"selected":""}`,onClick:()=>f(X.id),title:X.description,children:[o.jsx("span",{className:"class-chip-icon",children:X.icon}),o.jsx("span",{className:"class-chip-name",children:X.name})]},X.id)),Object.entries(lo).filter(([X])=>X!=="boss").map(([X,se])=>o.jsxs("button",{className:`class-chip ${d===X?"selected":""}`,onClick:()=>f(X),title:se.description,children:[o.jsx("span",{className:"class-chip-icon",children:se.icon}),o.jsx("span",{className:"class-chip-name",children:X.charAt(0).toUpperCase()+X.slice(1)})]},X))]})]})]}),de&&o.jsxs("div",{className:"custom-class-notice",children:[o.jsxs("div",{className:"custom-class-notice-header",onClick:()=>W(!z),style:{cursor:"pointer"},children:[o.jsx("span",{children:"📋"}),o.jsx("span",{children:de.instructions?s("terminal:spawn.hasCustomInstructions"):"Add custom instructions"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:11,opacity:.6},children:z?"▲":"▼"})]}),!z&&de.instructions&&o.jsx("div",{className:"custom-class-notice-info",children:s("terminal:spawn.instructionsInjected",{count:de.instructions.length})}),z&&o.jsxs("div",{className:"custom-class-instructions-editor",children:[o.jsx("textarea",{value:V,onChange:X=>Y(X.target.value),placeholder:"CLAUDE.md instructions for this agent class...",rows:6,style:{width:"100%",resize:"vertical",fontFamily:"monospace",fontSize:12,background:"rgba(0,0,0,0.3)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:4,color:"var(--text-primary)",padding:"6px 8px",outline:"none"}}),o.jsxs("div",{style:{display:"flex",gap:6,marginTop:4,justifyContent:"flex-end"},children:[o.jsx("button",{onClick:()=>{H.updateCustomAgentClass(de.id,{instructions:V}),W(!1)},style:{padding:"2px 10px",borderRadius:4,fontSize:11,cursor:"pointer",background:"rgba(0,200,200,0.2)",color:"var(--accent-cyan)",border:"1px solid rgba(0,200,200,0.3)"},children:"Save"}),o.jsx("button",{onClick:()=>{Y(de.instructions||""),W(!1)},style:{padding:"2px 10px",borderRadius:4,fontSize:11,cursor:"pointer",background:"transparent",color:"var(--text-secondary)",border:"1px solid rgba(255,255,255,0.1)"},children:"Cancel"})]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4},children:"These instructions are injected as system prompt for all agents of this class."})]})]}),o.jsxs("div",{className:"spawn-form-section",children:[o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.name")}),o.jsx("input",{type:"text",className:"spawn-input",value:i,onChange:X=>c(X.target.value),placeholder:s("terminal:spawn.agentNamePlaceholder")})]})}),o.jsxs("div",{className:"spawn-form-row",children:[o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.runtime")}),o.jsxs("div",{className:"spawn-select-row",children:[o.jsxs("button",{className:`spawn-select-btn ${x==="claude"?"selected":""}`,onClick:()=>y("claude"),children:[o.jsx("span",{children:"🧠"}),o.jsx("span",{children:"Claude"})]}),o.jsxs("button",{className:`spawn-select-btn ${x==="codex"?"selected":""}`,onClick:()=>y("codex"),children:[o.jsx("span",{children:"⚙️"}),o.jsx("span",{children:"Codex"})]}),o.jsxs("button",{className:`spawn-select-btn spawn-select-btn--opencode ${x==="opencode"?"selected":""}`,onClick:()=>y("opencode"),children:[o.jsx("span",{children:"🟢"}),o.jsx("span",{children:"OpenCode"})]})]})]}),o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.permissions")}),o.jsx("div",{className:"spawn-select-row",children:Object.keys(lu).map(X=>o.jsxs("button",{className:`spawn-select-btn ${h===X?"selected":""}`,onClick:()=>m(X),title:lu[X].description,children:[o.jsx("span",{children:X==="bypass"?"⚡":"🔐"}),o.jsx("span",{children:lu[X].label})]},X))})]})]}),o.jsxs("div",{className:"spawn-form-row",children:[o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("common:labels.model")}),x==="claude"?o.jsx("div",{className:"spawn-select-row",children:Object.keys(tf).map(X=>o.jsxs("button",{className:`spawn-select-btn ${A===X?"selected":""}`,onClick:()=>k(X),title:tf[X].description,children:[o.jsx("span",{children:tf[X].icon}),o.jsx("span",{children:tf[X].label})]},X))}):x==="codex"?o.jsx("div",{className:"spawn-select-row spawn-select-row--codex-models",children:Object.keys(ef).map(X=>o.jsxs("button",{className:`spawn-select-btn ${E===X?"selected":""}`,onClick:()=>D(X),title:ef[X].description,children:[o.jsx("span",{children:ef[X].icon}),o.jsx("span",{children:ef[X].label})]},X))}):x==="opencode"?o.jsx("input",{type:"text",className:"spawn-input",value:_,onChange:X=>B(X.target.value),placeholder:"provider/model (e.g., minimax/MiniMax-M1-80k)"}):o.jsx("div",{className:"spawn-inline-hint",children:s("terminal:spawn.codex.configuration")})]}),x==="claude"&&o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:"Effort"}),o.jsxs("div",{className:"spawn-select-row spawn-select-row--effort",children:[o.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${N===void 0?"selected":""}`,onClick:()=>j(void 0),title:"Use default effort level",children:o.jsx("span",{children:"Default"})}),Object.keys(og).map(X=>o.jsx("button",{className:`spawn-select-btn spawn-select-btn--compact ${N===X?"selected":""}`,onClick:()=>j(X),title:og[X].description,children:o.jsx("span",{children:og[X].label})},X))]})]})]}),x==="codex"&&o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("terminal:spawn.codex.config")}),o.jsxs("div",{className:"spawn-options-row",style:{display:"flex",flexDirection:"column",gap:8},children:[o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:v.fullAuto!==!1,onChange:X=>S(se=>({...se,fullAuto:X.target.checked}))}),o.jsx("span",{children:s("terminal:spawn.codex.useFullAuto")})]}),o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:!!v.search,onChange:X=>S(se=>({...se,search:X.target.checked}))}),o.jsx("span",{children:s("terminal:spawn.codex.enableSearch")})]}),v.fullAuto===!1&&o.jsxs(o.Fragment,{children:[o.jsxs("select",{className:"spawn-input",value:v.sandbox||"workspace-write",onChange:X=>S(se=>({...se,sandbox:X.target.value})),children:[o.jsx("option",{value:"read-only",children:s("terminal:spawn.codex.sandboxReadOnly")}),o.jsx("option",{value:"workspace-write",children:s("terminal:spawn.codex.sandboxWorkspaceWrite")}),o.jsx("option",{value:"danger-full-access",children:s("terminal:spawn.codex.sandboxDangerFullAccess")})]}),o.jsxs("select",{className:"spawn-input",value:v.approvalMode||"on-request",onChange:X=>S(se=>({...se,approvalMode:X.target.value})),children:[o.jsx("option",{value:"untrusted",children:s("terminal:spawn.codex.approvalsUntrusted")}),o.jsx("option",{value:"on-failure",children:s("terminal:spawn.codex.approvalsOnFailure")}),o.jsx("option",{value:"on-request",children:s("terminal:spawn.codex.approvalsOnRequest")}),o.jsx("option",{value:"never",children:s("terminal:spawn.codex.approvalsNever")})]})]}),o.jsx("input",{type:"text",className:"spawn-input",placeholder:s("terminal:spawn.codex.profileOptional"),value:v.profile||"",onChange:X=>S(se=>({...se,profile:X.target.value||void 0}))})]})]})}),x==="claude"&&(A!==(t.model||"sonnet")||N!==(t.effort||void 0))&&o.jsx("div",{className:"model-change-notice",children:s("terminal:spawn.contextPreserved")}),o.jsx("div",{className:"spawn-form-row spawn-options-row",children:o.jsxs("label",{className:"spawn-checkbox",children:[o.jsx("input",{type:"checkbox",checked:O,onChange:X=>T(X.target.checked),disabled:x!=="claude"}),o.jsx("span",{children:s("terminal:spawn.chromeBrowser")})]})}),o.jsx("div",{className:"spawn-form-row",children:o.jsxs("div",{className:"spawn-field",children:[o.jsx("label",{className:"spawn-label",children:s("terminal:spawn.workingDir")}),o.jsx(j2,{value:M,onChange:R,placeholder:s("terminal:spawn.workingDirPlaceholder"),className:"spawn-input",directoriesOnly:!0})]})}),M!==t.cwd&&o.jsx("div",{className:"model-change-notice warning",children:s("terminal:spawn.newSessionWarning")}),o.jsxs("div",{className:"spawn-skills-section",children:[o.jsxs("label",{className:"spawn-label",children:[s("terminal:spawn.skills")," ",o.jsxs("span",{className:"spawn-label-hint",children:["(",s("terminal:spawn.clickToToggle"),")"]})]}),P.length>6&&o.jsx("input",{type:"text",className:"spawn-input skill-search-input",placeholder:s("terminal:spawn.filterSkills"),value:U,onChange:X=>L(X.target.value)}),o.jsx("div",{className:"skills-chips-compact",children:P.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noEnabledSkills")}):K.length===0?o.jsx("div",{className:"skills-empty",children:s("terminal:spawn.noSkillsMatch",{query:U})}):K.map(X=>{const se=Q.includes(X),Ve=F.has(X.id)||se;return o.jsxs("button",{className:`skill-chip ${Ve?"selected":""} ${se?"class-based":""}`,onClick:()=>!se&&q(X.id),title:se?s("terminal:spawn.assignedViaClass"):X.name,children:[Ve&&o.jsx("span",{className:"skill-check",children:"✓"}),o.jsx("span",{className:"skill-chip-name",children:X.name}),X.builtin&&o.jsx("span",{className:"skill-chip-badge builtin",children:"TC"}),se&&o.jsx("span",{className:"skill-chip-badge",children:"class"})]},X.id)})})]})]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:n,children:s("common:buttons.cancel")}),o.jsx("button",{className:"btn btn-primary",onClick:Ne,disabled:!xe,children:s("common:buttons2.saveChanges")})]})]})}):null}const N2=Object.freeze(Object.defineProperty({__proto__:null,AgentEditModal:Kj},Symbol.toStringTag,{value:"Module"}));var Dl=RA();const T2=Tu(Dl);function ir({children:t}){return typeof document>"u"?null:Dl.createPortal(t,document.body)}function Fc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function rS(t){return`${t.toFixed(1)}%`}function _2(t){return t>=80?"#ff4a4a":t>=60?"#ff9e4a":t>=40?"#ffd700":"#4aff9e"}const E2={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},M2={systemPrompt:"terminal:context.systemPrompt",systemTools:"terminal:context.systemTools",messages:"terminal:context.messagesCategory",freeSpace:"terminal:context.freeSpace",autocompactBuffer:"terminal:context.autocompactBuffer"},D2={systemPrompt:"terminal:context.systemPromptDesc",systemTools:"terminal:context.systemToolsDesc",messages:"terminal:context.messagesDesc",freeSpace:"terminal:context.freeSpaceDesc",autocompactBuffer:"terminal:context.autocompactBufferDesc"};function Qj({agent:t,isOpen:e,onClose:n,onRefresh:s}){const{t:a}=ht(["terminal","common"]),r=t.contextStats,[i,c]=b.useState(!1),d=()=>{s&&!i&&(c(!0),s(),setTimeout(()=>c(!1),3e3))},f=["systemPrompt","systemTools","messages","autocompactBuffer","freeSpace"],h=b.useMemo(()=>r?f.map(v=>({key:v,...r.categories[v],label:a(M2[v]),description:a(D2[v]),color:E2[v]})):[],[r]),m=b.useMemo(()=>h.filter(v=>v.key!=="freeSpace"),[h]),{handleMouseDown:x,handleClick:y}=Sa(n);return e?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onMouseDown:x,onClick:y,children:o.jsxs("div",{className:"modal context-view-modal",style:{maxWidth:"520px"},children:[o.jsxs("div",{className:"modal-header",style:{display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("span",{style:{flex:1},children:a("terminal:context.contextWindow",{name:t.name})}),s&&o.jsxs("button",{className:"btn btn-primary",onClick:d,disabled:i||t.status!=="idle",style:{padding:"6px 12px",fontSize:"12px",display:"flex",alignItems:"center",gap:"6px"},title:t.status!=="idle"?a("terminal:context.agentMustBeIdle"):a("terminal:context.fetchContextStats"),children:[o.jsx("span",{style:{display:"inline-block",animation:i?"spin 1s linear infinite":"none"},children:i?"⟳":"↻"}),a(i?"common:status.loading":"common:buttons.refresh")]})]}),o.jsx("div",{className:"modal-body",style:{padding:"16px"},children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px",padding:"8px 12px",background:"var(--bg-secondary)",borderRadius:"6px"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:a("terminal:context.model")}),o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:r.model})]}),o.jsxs("div",{style:{textAlign:"right"},children:[o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:a("terminal:context.contextWindowLabel")}),o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:Fc(r.contextWindow)})]})]}),o.jsxs("div",{style:{marginBottom:"24px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px",fontSize:"13px"},children:[o.jsx("span",{children:a("terminal:context.contextUsage")}),o.jsxs("span",{style:{color:_2(r.usedPercent)},children:[Fc(r.totalTokens)," / ",Fc(r.contextWindow)," (",r.usedPercent,"%)"]})]}),o.jsx("div",{style:{height:"28px",background:"var(--bg-tertiary)",borderRadius:"6px",overflow:"hidden",display:"flex"},children:m.map(v=>v.percent>0&&o.jsx("div",{style:{width:`${v.percent}%`,background:v.color,height:"100%",minWidth:v.percent>.5?"2px":"0",transition:"width 0.3s ease"},title:`${v.label}: ${Fc(v.tokens)} (${rS(v.percent)})`},v.key))})]}),o.jsxs("div",{style:{marginBottom:"16px"},children:[o.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"8px",textTransform:"uppercase",letterSpacing:"0.5px"},children:a("terminal:context.tokenBreakdown")}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:h.map(v=>o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 12px",background:v.key==="freeSpace"?"transparent":"var(--bg-secondary)",borderRadius:"6px",borderLeft:v.key==="freeSpace"?"3px dashed rgba(255,255,255,0.2)":`3px solid ${v.color}`,opacity:v.key==="freeSpace"?.7:1},children:[o.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"3px",background:v.color,flexShrink:0,border:v.key==="freeSpace"?"1px dashed rgba(255,255,255,0.3)":"none"}}),o.jsxs("div",{style:{flex:1},children:[o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:v.label}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:v.description})]}),o.jsxs("div",{style:{textAlign:"right"},children:[o.jsx("div",{style:{fontSize:"13px",fontWeight:500},children:Fc(v.tokens)}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:rS(v.percent)})]})]},v.key))})]}),o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",textAlign:"center"},children:a("terminal:context.lastUpdated",{time:new Date(r.lastUpdated).toLocaleTimeString()})})]}):o.jsxs("div",{style:{textAlign:"center",color:"var(--text-secondary)",padding:"32px"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px",opacity:.5},children:"📊"}),o.jsx("div",{style:{fontSize:"14px",marginBottom:"8px"},children:a("terminal:context.noContextData")}),o.jsx("div",{style:{fontSize:"12px",marginBottom:"20px",opacity:.7},children:a("terminal:context.clickRefresh")}),s&&o.jsxs("button",{className:"btn btn-primary",onClick:d,disabled:i||t.status!=="idle",style:{padding:"10px 24px",fontSize:"14px",display:"inline-flex",alignItems:"center",gap:"8px"},children:[o.jsx("span",{style:{display:"inline-block",animation:i?"spin 1s linear infinite":"none"},children:i?"⟳":"↻"}),a(i?"terminal:context.fetchingStats":"terminal:context.fetchContextStats")]}),t.status!=="idle"&&o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",marginTop:"12px"},children:a("terminal:context.agentMustBeIdle")})]})}),o.jsx("div",{className:"modal-footer",style:{display:"flex",justifyContent:"flex-end",padding:"12px 16px",borderTop:"1px solid var(--border-color)"},children:o.jsx("button",{className:"btn btn-secondary",onClick:n,children:a("common:buttons.close")})})]})})}):null}const R2=b.memo(function({tokensUsed:e,createdAt:n}){const{t:s}=ht(["common"]);return o.jsxs("div",{className:"unit-stats",children:[o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:s("labels.tokens")}),o.jsx("div",{className:"unit-stat-value",children:qD(e)})]}),o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:s("labels.uptime")}),o.jsx("div",{className:"unit-stat-value",children:VD(n)})]})]})}),Xj=b.memo(function({contextInfo:e,onClick:n}){const{t:s}=ht(["common"]),{remainingPercent:a,hasData:r}=e;return o.jsxs("div",{className:"unit-context unit-context-clickable",onClick:n,title:s(r?"unitPanel.remainingContext":"unitPanel.notRetrievedYet"),style:{cursor:"pointer"},children:[o.jsxs("div",{className:"unit-stat-label",style:{display:"flex",alignItems:"center",gap:"4px"},children:[o.jsx("span",{children:s("unitPanel.remainingContext")}),r?o.jsx("span",{style:{fontSize:"10px",opacity:.6},children:"📊"}):o.jsx("span",{style:{fontSize:"9px",color:"#ff9e4a",opacity:.8},title:s("unitPanel.notRetrievedYet"),children:"⚠️"})]}),r?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"unit-context-bar",children:o.jsx("div",{className:"unit-context-fill",style:{width:`${a}%`,background:qj(a)}})}),o.jsxs("span",{className:"unit-context-value",children:[Math.round(a),"%"]})]}):o.jsx("div",{style:{fontSize:"11px",color:"var(--text-muted)",fontStyle:"italic"},children:s("unitPanel.notRetrievedYet")})]})}),O2=b.memo(function({lastActivity:e}){const{t:n}=ht(["common"]);return o.jsxs("div",{className:"unit-idle-timer",title:n("unitPanel.timeSinceActivity"),style:{color:Gb(e)},children:["⏱ ",Kb(e)]})}),L2=b.memo(function({task:e}){const{t:n}=ht(["common"]);return o.jsxs("div",{className:"unit-task",children:[o.jsx("div",{className:"unit-stat-label",children:n("labels.task")}),o.jsx("div",{className:"unit-task-text",children:e})]})}),P2=b.memo(function({cwd:e}){const{t:n}=ht(["common"]);return o.jsxs("div",{className:"unit-cwd",children:[o.jsx("div",{className:"unit-stat-label",children:n("labels.cwd")}),o.jsx("div",{className:"unit-cwd-path",title:e,children:e})]})}),I2=b.memo(function({text:e,maxLength:n=150}){const{t:s}=ht(["common"]);return o.jsxs("div",{className:"unit-last-prompt",children:[o.jsx("div",{className:"unit-stat-label",children:s("unitPanel.lastPrompt")}),o.jsx("div",{className:"unit-last-prompt-text",children:e.length>n?e.slice(0,n)+"...":e})]})}),B2=b.memo(function({text:e,maxLength:n=200}){const{t:s}=ht(["common"]);return o.jsxs("div",{className:"unit-last-message",children:[o.jsx("div",{className:"unit-stat-label",children:s("unitPanel.lastResponse")}),o.jsx("div",{className:"unit-last-message-text",children:e.length>n?e.slice(0,n)+"...":e})]})});function F2({agent:t,onFocusAgent:e,onKillAgent:n,onCallSubordinates:s,onOpenAreaExplorer:a}){var xe,Ne;const{t:r}=ht(["common"]),i=Ts(),c=ar(),{showToast:d}=Hj(),f=i.agents.get(t.id)||t,h=rr(f.class,c),m=c.find(qe=>qe.id===f.class),x=m==null?void 0:m.model,y=m!=null&&m.customModelPath?Ot(`/api/custom-models/${m.id}`):void 0,v=m==null?void 0:m.modelScale,[S,A]=b.useState(!1),[k,N]=b.useState(f.name),j=b.useRef(null),[,E]=b.useState(0),[D,_]=b.useState(!0),[B,O]=b.useState(!1),[T,M]=b.useState([]),[R,F]=b.useState(null),[$,U]=b.useState(!1),[L,z]=b.useState(!1),W=H.getAgentSupervisorHistory(f.id),V=H.isLoadingHistoryForAgent(f.id);b.useEffect(()=>{!H.hasHistoryBeenFetched(f.id)&&!V&&H.requestAgentSupervisorHistory(f.id)},[f.id,V]),b.useEffect(()=>{N(f.name)},[f.name]),b.useEffect(()=>{S&&j.current&&(j.current.focus(),j.current.select())},[S]),b.useEffect(()=>{if(f.status==="idle"){const qe=setInterval(()=>{E(Ge=>Ge+1)},15e3);return()=>clearInterval(qe)}},[f.status]),b.useEffect(()=>{f.permissionMode==="interactive"&&Pt(Ot("/api/remembered-patterns")).then(qe=>qe.json()).then(M).catch(qe=>console.error("Failed to fetch remembered patterns:",qe))},[f.permissionMode]);const Y=b.useMemo(()=>vp(f),[f.contextStats,f.contextUsed,f.contextLimit]),P=H.getAreaForAgent(f.id),K=i.agentOutputs.get(f.id)||[],Q=K.length>0?K[K.length-1]:null,q=i.lastPrompts.get(f.id),be=async(qe,Ge)=>{try{(await Pt(Ot(`/api/remembered-patterns/${qe}/${encodeURIComponent(Ge)}`),{method:"DELETE"})).ok&&M(se=>se.filter(Ee=>!(Ee.tool===qe&&Ee.pattern===Ge)))}catch(X){console.error("Failed to remove pattern:",X)}},ue=async()=>{if(confirm(r("confirm.clearPatterns")))try{(await Pt(Ot("/api/remembered-patterns"),{method:"DELETE"})).ok&&M([])}catch(qe){console.error("Failed to clear patterns:",qe)}},Z=()=>{confirm(r("confirm.terminateAgent"))&&n(f.id)},de=()=>{const qe=k.trim();qe&&qe!==f.name?H.renameAgent(f.id,qe):N(f.name),A(!1)},Ce=qe=>{qe.key==="Enter"?de():qe.key==="Escape"&&(N(f.name),A(!1))};return o.jsxs("div",{className:"unit-panel",children:[o.jsx("div",{className:"unit-model-preview",children:o.jsx(Yj,{agentClass:f.class,modelFile:x,customModelUrl:y,modelScale:v,status:f.status,width:80,height:80})}),o.jsxs("div",{className:"unit-panel-header",children:[o.jsx("div",{className:"unit-class-icon",style:{background:`${h.color}20`},children:h.icon}),o.jsxs("div",{className:"unit-header-info",children:[S?o.jsx("input",{ref:j,type:"text",className:"unit-name-input",value:k,onChange:qe=>N(qe.target.value),onBlur:de,onKeyDown:Ce}):o.jsx("div",{className:"unit-name unit-name-editable",onClick:()=>A(!0),title:r("unitPanel.clickToRename"),children:f.name}),o.jsxs("div",{className:"unit-status",children:[o.jsx("span",{style:{color:Ff[f.status]||Ff.default},children:f.status}),o.jsxs("span",{children:[" • ",f.class," • ",f.provider]})]}),f.status==="idle"&&f.lastActivity>0&&o.jsx(O2,{lastActivity:f.lastActivity})]}),o.jsxs("div",{className:"unit-header-actions",children:[o.jsx("button",{className:"unit-action-icon",onClick:()=>e(f.id),title:r("unitPanel.focusOnAgent"),children:"🎯"}),o.jsx("button",{className:"unit-action-icon",onClick:()=>U(!0),title:r("unitPanel.editProperties"),children:"✏️"}),(f.isBoss||f.class==="boss")&&f.subordinateIds&&f.subordinateIds.length>0&&o.jsx("button",{className:"unit-action-icon",onClick:()=>s==null?void 0:s(f.id),title:r("unitPanel.callSubordinates"),children:"📢"}),o.jsx("button",{className:"unit-action-icon",onClick:()=>F("collapse"),title:r("unitPanel.collapseContext"),disabled:f.status!=="idle",children:"📦"}),o.jsx("button",{className:"unit-action-icon warning",onClick:()=>F("clear"),title:r("unitPanel.clearContext"),children:"🧹"}),o.jsx("button",{className:"unit-action-icon danger",onClick:Z,title:r("unitPanel.killAgent"),children:"☠️"})]})]}),P&&o.jsxs("div",{className:"unit-area",children:[o.jsx("span",{className:"unit-area-dot",style:{background:P.color}}),o.jsx("span",{className:"unit-area-name",children:P.name})]}),q&&o.jsx(I2,{text:q.text}),Q&&o.jsx(B2,{text:Q.text}),o.jsx(R2,{tokensUsed:f.tokensUsed,createdAt:f.createdAt}),o.jsx(Xj,{contextInfo:Y,onClick:()=>z(!0)}),f.taskLabel&&o.jsxs("div",{className:"unit-task-label",children:[o.jsx("div",{className:"unit-stat-label",children:"📋 Task"}),o.jsx("div",{className:"unit-task-label-value",children:f.taskLabel})]}),f.currentTask&&o.jsx(L2,{task:f.currentTask}),o.jsx(P2,{cwd:f.cwd}),o.jsx(z2,{currentAgentId:f.id}),o.jsxs("div",{className:"unit-permission-mode",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.permissions")}),o.jsxs("div",{className:"unit-permission-mode-value",title:(xe=lu[f.permissionMode])==null?void 0:xe.description,children:[o.jsx("span",{className:"unit-permission-mode-icon",children:f.permissionMode==="bypass"?"⚡":"🔐"}),o.jsx("span",{className:"unit-permission-mode-label",children:((Ne=lu[f.permissionMode])==null?void 0:Ne.label)||f.permissionMode})]})]}),f.permissionMode==="interactive"&&o.jsx($2,{patterns:T,showPatterns:B,onToggle:()=>O(!B),onRemovePattern:be,onClearAll:ue}),f.sessionId?o.jsxs("div",{className:"unit-resume-cmd",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.resumeSession")}),o.jsxs("div",{className:"unit-resume-cmd-text",title:r("unitPanel.clickToCopy"),onClick:async()=>{const qe=f.provider==="codex"?`codex resume ${f.sessionId}`:f.provider==="opencode"?`opencode resume ${f.sessionId}`:`claude --resume ${f.sessionId}`;try{await navigator.clipboard.writeText(qe),d("success",r("toast.copied"),r("toast.resumeCommandCopied"),2e3)}catch{d("error",r("toast.errorTitle"),r("toast.failedToCopy"),3e3)}},children:[f.provider==="codex"?"codex resume":f.provider==="opencode"?"opencode resume":"claude --resume"," ",f.sessionId]})]}):o.jsxs("div",{className:"unit-resume-cmd",children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.session")}),o.jsx("div",{className:"unit-new-session-indicator",children:r("unitPanel.newSession")})]}),o.jsxs("div",{className:"unit-supervisor-history",children:[o.jsxs("div",{className:"unit-supervisor-history-header",onClick:()=>_(!D),children:[o.jsx("div",{className:"unit-stat-label",children:r("unitPanel.supervisorHistory")}),o.jsxs("span",{className:"unit-supervisor-history-toggle",children:[W.length>0&&o.jsx("span",{className:"unit-supervisor-history-count",children:W.length}),D?"▼":"▶"]})]}),D&&o.jsx("div",{className:"unit-supervisor-history-list",children:V?o.jsx("div",{className:"unit-supervisor-history-loading",children:r("status.loading")}):W.length===0?o.jsx("div",{className:"unit-supervisor-history-empty",children:r("unitPanel.noSupervisorReports")}):W.slice(0,10).map((qe,Ge)=>o.jsx(Jj,{entry:qe,defaultExpanded:Ge===0},qe.id))})]}),(f.isBoss||f.class==="boss")&&o.jsx(U2,{agent:f}),f.bossId&&o.jsx(q2,{agentId:f.id,bossId:f.bossId}),f.class!=="boss"&&!f.isBoss&&!f.bossId&&o.jsx(V2,{agentId:f.id}),R&&o.jsx(H2,{action:R,agentName:f.name,onClose:()=>F(null),onConfirm:()=>{R==="collapse"?H.collapseContext(f.id):H.clearContext(f.id),F(null)}}),o.jsx(Kj,{agent:f,isOpen:$,onClose:()=>U(!1)}),o.jsx(Qj,{agent:f,isOpen:L,onClose:()=>z(!1),onRefresh:()=>{H.refreshAgentContext(f.id)}})]})}const z2=b.memo(function({currentAgentId:e}){const{t:n}=ht(["common"]),s=Ts(),a=ar(),[r,i]=b.useState(!1),c=b.useMemo(()=>[...Array.from(s.agents.values()).filter(f=>f.id!==e)].sort((f,h)=>(h.lastActivity||0)-(f.lastActivity||0)),[s.agents,e]);return c.length===0?null:o.jsxs("div",{className:"unit-other-agents",children:[o.jsxs("div",{className:"unit-other-agents-header",onClick:()=>i(!r),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("unitPanel.otherAgents")," (",c.length,")"]}),o.jsx("span",{className:"unit-other-agents-toggle",children:r?"▶":"▼"})]}),!r&&o.jsx("div",{className:"unit-other-agents-list",children:c.map(d=>{const f=rr(d.class,a);return o.jsxs("div",{className:`unit-other-agent-item ${d.status}`,onClick:()=>{H.selectAgent(d.id),H.setTerminalOpen(!0)},children:[o.jsx("span",{className:"unit-other-agent-icon",style:{background:`${f.color}20`},children:f.icon}),o.jsxs("div",{className:"unit-other-agent-info",children:[o.jsx("span",{className:"unit-other-agent-name",children:d.name}),d.taskLabel&&o.jsx("span",{className:"unit-other-agent-task",children:d.taskLabel})]}),o.jsx("div",{className:`agent-status-dot ${d.status}`})]},d.id)})})]})}),$2=b.memo(function({patterns:e,showPatterns:n,onToggle:s,onRemovePattern:a,onClearAll:r}){const{t:i}=ht(["common"]);return o.jsxs("div",{className:"unit-remembered-patterns",children:[o.jsxs("div",{className:"unit-remembered-patterns-header",onClick:s,children:[o.jsx("div",{className:"unit-stat-label",children:i("unitPanel.allowedPatterns")}),o.jsxs("span",{className:"unit-remembered-patterns-toggle",children:[e.length>0&&o.jsx("span",{className:"unit-remembered-patterns-count",children:e.length}),n?"▼":"▶"]})]}),n&&o.jsx("div",{className:"unit-remembered-patterns-list",children:e.length===0?o.jsx("div",{className:"unit-remembered-patterns-empty",children:i("unitPanel.noPatterns")}):o.jsxs(o.Fragment,{children:[e.map((c,d)=>o.jsxs("div",{className:"unit-remembered-pattern-item",children:[o.jsx("span",{className:"unit-pattern-tool",children:c.tool}),o.jsx("span",{className:"unit-pattern-desc",title:c.pattern,children:c.description}),o.jsx("button",{className:"unit-pattern-remove",onClick:()=>a(c.tool,c.pattern),title:i("unitPanel.removePattern"),children:"×"})]},d)),o.jsx("button",{className:"unit-patterns-clear-all",onClick:r,children:i("buttons.clearAll")})]})})]})}),H2=b.memo(function({action:e,agentName:n,onClose:s,onConfirm:a}){const{t:r}=ht(["common"]),{handleMouseDown:i,handleClick:c}=Sa(s);return o.jsx("div",{className:"modal-overlay visible",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal confirm-modal",children:[o.jsx("div",{className:"modal-header",children:r(e==="collapse"?"unitPanel.collapseContextTitle":"unitPanel.clearContextTitle")}),o.jsx("div",{className:"modal-body confirm-modal-body",children:e==="collapse"?o.jsxs(o.Fragment,{children:[o.jsx("p",{dangerouslySetInnerHTML:{__html:r("unitPanel.collapseContextMsg",{name:n})}}),o.jsx("p",{className:"confirm-modal-note",children:r("unitPanel.collapseContextNote")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{dangerouslySetInnerHTML:{__html:r("unitPanel.clearContextMsg",{name:n})}}),o.jsx("p",{className:"confirm-modal-note",children:r("unitPanel.clearContextNote")})]})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:s,children:r("buttons.cancel")}),o.jsx("button",{className:`btn ${e==="clear"?"btn-danger":"btn-primary"}`,onClick:a,autoFocus:!0,children:r(e==="collapse"?"unitPanel.collapseBtn":"unitPanel.clearContextBtn")})]})]})})}),Jj=b.memo(function({entry:e,defaultExpanded:n=!1,agent:s,onAgentClick:a}){var k;const{t:r}=ht(["common"]),[i,c]=b.useState(n),d=Ts(),f=ar(),{analysis:h}=e,m=d.settings.hideCost,x=ru(h.statusDescription,m),y=ru(h.recentWorkSummary,m),v=(k=h.concerns)==null?void 0:k.map(N=>ru(N,m)).filter(N=>N.length>0),S=s?rr(s.class,f):null,A=N=>{s&&a&&(N.stopPropagation(),a(s.id))};return o.jsxs("div",{className:"supervisor-history-item",children:[o.jsxs("div",{className:"supervisor-history-item-header",onClick:()=>c(!i),children:[o.jsx("span",{className:"supervisor-history-progress-dot",style:{background:HD[h.progress]||"#888"},title:h.progress}),o.jsxs("div",{className:"supervisor-history-item-content",children:[s&&S&&o.jsxs("div",{className:"supervisor-history-agent-line",onClick:A,children:[o.jsx("span",{className:"supervisor-history-agent-icon",children:S.icon}),o.jsx("span",{className:"supervisor-history-agent-name",children:s.name}),o.jsx("span",{className:"supervisor-history-time",children:Wf(e.timestamp)})]}),o.jsx("div",{className:"supervisor-history-status",children:x})]}),!s&&o.jsx("span",{className:"supervisor-history-time",children:Wf(e.timestamp)})]}),i&&o.jsxs("div",{className:"supervisor-history-item-details",children:[o.jsxs("div",{className:"supervisor-history-summary",children:[o.jsxs("strong",{children:[r("labels.summary"),":"]})," ",y]}),v&&v.length>0&&o.jsxs("div",{className:"supervisor-history-concerns",children:[o.jsxs("strong",{children:[r("labels.concerns"),":"]}),o.jsx("ul",{children:v.map((N,j)=>o.jsx("li",{children:N},j))})]})]})]})}),U2=b.memo(function({agent:e}){const{t:n}=ht(["common"]),s=Ts(),a=ar(),[r,i]=b.useState(!0),[c,d]=b.useState(!0),f=b.useMemo(()=>{const v=s.agents.get(e.id);return!v||!v.isBoss&&v.class!=="boss"||!v.subordinateIds?[]:v.subordinateIds.map(S=>s.agents.get(S)).filter(S=>S!==void 0)},[s.agents,e.id]),h=H.getDelegationHistory(e.id),m=s.pendingDelegation,x=(m==null?void 0:m.bossId)===e.id;b.useEffect(()=>{H.requestDelegationHistory(e.id)},[e.id]);const y=yp.boss;return o.jsxs("div",{className:"boss-section",children:[o.jsxs("div",{className:"boss-header",children:[o.jsx("span",{className:"boss-crown-icon",style:{color:y.color},children:y.icon}),o.jsx("span",{className:"boss-title",children:n("unitPanel.bossAgent")})]}),o.jsxs("div",{className:"boss-subordinates",children:[o.jsxs("div",{className:"boss-subordinates-header",onClick:()=>i(!r),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("labels.team")," (",f.length,")"]}),o.jsx("span",{className:"boss-toggle",children:r?"▼":"▶"})]}),r&&o.jsx("div",{className:"boss-subordinates-list",children:f.length===0?o.jsx("div",{className:"boss-subordinates-empty",children:n("unitPanel.noSubordinates")}):f.map(v=>{const S=rr(v.class,a),A=vp(v),k=Math.max(0,Math.min(100,Math.round(A.usedPercent))),N=Math.round((1-k/100)*120),j={width:`${k}%`,"--boss-context-hue":`${N}`};return o.jsxs("div",{className:"boss-subordinate-item",onClick:()=>{H.selectAgent(v.id),H.setTerminalOpen(!0)},children:[o.jsx("span",{className:"boss-subordinate-icon",style:{color:S.color},children:S.icon}),o.jsxs("div",{className:"boss-subordinate-meta",children:[o.jsx("span",{className:"boss-subordinate-name",children:v.name}),o.jsxs("div",{className:"boss-subordinate-context",title:`${k}% context used`,children:[o.jsx("div",{className:"boss-subordinate-context-track",children:o.jsx("div",{className:"boss-subordinate-context-fill",style:j})}),o.jsxs("span",{className:"boss-subordinate-context-value",children:[k,"%"]})]})]}),o.jsx("span",{className:`boss-subordinate-status status-${v.status}`,children:v.status}),o.jsx("button",{className:"boss-subordinate-unlink",onClick:E=>{E.stopPropagation(),H.removeSubordinate(e.id,v.id)},title:n("unitPanel.unlinkSubordinate"),children:"✕"})]},v.id)})})]}),o.jsxs("div",{className:"boss-delegation-history",children:[o.jsxs("div",{className:"boss-delegation-history-header",onClick:()=>d(!c),children:[o.jsxs("div",{className:"unit-stat-label",children:[n("unitPanel.delegationHistory")," (",h.length,")"]}),o.jsx("span",{className:"boss-toggle",children:c?"▼":"▶"})]}),c&&o.jsxs("div",{className:"boss-delegation-history-list",children:[x&&o.jsxs("div",{className:"boss-delegation-pending",children:[o.jsx("span",{className:"delegation-spinner",children:"⏳"}),n("unitPanel.analyzingRequest")]}),h.length===0&&!x?o.jsx("div",{className:"boss-delegation-empty",children:n("unitPanel.noDelegationHistory")}):h.slice(0,10).map(v=>o.jsx(W2,{decision:v},v.id))]})]})]})}),W2=b.memo(function({decision:e}){const{t:n}=ht(["common"]),[s,a]=b.useState(!1),i=Ts().agents.get(e.selectedAgentId),c=i?yp[i.class]:null,d={high:"#4aff9e",medium:"#ff9e4a",low:"#ff4a4a"};return o.jsxs("div",{className:"delegation-decision-item",children:[o.jsxs("div",{className:"delegation-decision-header",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegation-decision-arrow",children:s?"▼":"▶"}),c&&o.jsx("span",{className:"delegation-decision-icon",style:{color:c.color},children:c.icon}),o.jsxs("span",{className:"delegation-decision-agent",children:["→ ",e.selectedAgentName]}),o.jsx("span",{className:"delegation-decision-confidence",style:{color:d[e.confidence]},title:n("unitPanel.confidence",{level:e.confidence}),children:e.confidence==="high"?"●●●":e.confidence==="medium"?"●●○":"●○○"}),o.jsx("span",{className:"delegation-decision-time",children:Wf(e.timestamp)})]}),s&&o.jsxs("div",{className:"delegation-decision-details",children:[o.jsxs("div",{className:"delegation-decision-command",children:[o.jsxs("strong",{children:[n("labels.command"),":"]}),o.jsx("div",{className:"delegation-command-text",children:e.userCommand.length>200?e.userCommand.slice(0,200)+"...":e.userCommand})]}),o.jsxs("div",{className:"delegation-decision-reasoning",children:[o.jsxs("strong",{children:[n("labels.reasoning"),":"]})," ",e.reasoning]}),e.alternativeAgents.length>0&&o.jsxs("div",{className:"delegation-decision-alternatives",children:[o.jsxs("strong",{children:[n("labels.alternatives"),":"]})," ",e.alternativeAgents.join(", ")]})]})]})}),q2=b.memo(function({agentId:e,bossId:n}){const{t:s}=ht(["common"]),r=Ts().agents.get(n);if(!r)return null;const i=yp.boss,c=d=>{d.stopPropagation(),H.removeSubordinate(n,e)};return o.jsxs("div",{className:"subordinate-badge",children:[o.jsx("span",{className:"subordinate-badge-icon",style:{color:i.color},children:i.icon}),o.jsxs("span",{className:"subordinate-badge-text",children:[s("labels.reportsTo"),": ",o.jsx("strong",{children:r.name})]}),o.jsx("button",{className:"subordinate-badge-goto",onClick:()=>H.selectAgent(n),title:s("unitPanel.goToBoss"),children:"→"}),o.jsx("button",{className:"subordinate-badge-unlink",onClick:c,title:s("unitPanel.unlinkFromBoss"),children:"✕"})]})}),V2=b.memo(function({agentId:e}){const{t:n}=ht(["common"]),s=Ts(),[a,r]=b.useState(!1),i=Array.from(s.agents.values()).filter(f=>f.isBoss===!0||f.class==="boss");if(i.length===0)return null;const c=yp.boss,d=f=>{const h=s.agents.get(f);if(!h)return;const m=h.subordinateIds||[];H.assignSubordinates(f,[...m,e]),r(!1)};return o.jsx("div",{className:"link-to-boss-section",children:a?o.jsxs("div",{className:"link-to-boss-dropdown",children:[o.jsxs("div",{className:"link-to-boss-header",children:[o.jsx("span",{children:n("unitPanel.selectBoss")}),o.jsx("button",{className:"link-to-boss-close",onClick:()=>r(!1),children:"✕"})]}),o.jsx("div",{className:"link-to-boss-list",children:i.map(f=>{var h;return o.jsxs("div",{className:"link-to-boss-item",onClick:()=>d(f.id),children:[o.jsx("span",{className:"link-to-boss-item-icon",style:{color:c.color},children:c.icon}),o.jsx("span",{className:"link-to-boss-item-name",children:f.name}),o.jsx("span",{className:"link-to-boss-item-count",children:n("unitPanel.agentsCount",{count:((h=f.subordinateIds)==null?void 0:h.length)||0})})]},f.id)})})]}):o.jsxs("button",{className:"link-to-boss-btn",onClick:()=>r(!0),children:[o.jsx("span",{className:"link-to-boss-icon",style:{color:c.color},children:c.icon}),o.jsx("span",{children:n("unitPanel.linkToBoss")})]})})});function iS({onOpenAreaExplorer:t}){const{t:e}=ht(["common"]),n=Ts(),s=Array.from(n.agents.values()),a=Array.from(n.areas.values()),[r,i]=b.useState(""),[c,d]=b.useState(()=>{const B=ka(pt.COMMANDER_FILTERS,"all");return B==="working"?"active":B||"all"}),f=b.useRef(null),h=b.useMemo(()=>s.map(B=>B.id).sort().join(","),[s]),m=b.useRef(new Set);b.useEffect(()=>{for(const B of s){if(m.current.has(B.id))continue;H.getAgentSupervisorHistory(B.id).length===0&&!H.isLoadingHistoryForAgent(B.id)&&(m.current.add(B.id),H.requestAgentSupervisorHistory(B.id))}},[h]);const x=n.agentsWithUnseenOutput,y=b.useMemo(()=>{const B={all:0,active:0,idle:0,error:0,waiting:0};for(const O of s)B.all++,(O.status==="working"||x.has(O.id))&&B.active++,O.status==="idle"&&!x.has(O.id)&&B.idle++,(O.status==="error"||O.status==="orphaned"||O.status==="offline")&&B.error++,(O.status==="waiting"||O.status==="waiting_permission")&&B.waiting++;return B},[s,x]),v=b.useMemo(()=>{const B=r.toLowerCase().trim();return s.filter(O=>{var T,M;if(c!=="all"&&(c==="active"&&O.status!=="working"&&!x.has(O.id)||c==="idle"&&(O.status!=="idle"||x.has(O.id))||c==="error"&&O.status!=="error"&&O.status!=="orphaned"&&O.status!=="offline"||c==="waiting"&&O.status!=="waiting"&&O.status!=="waiting_permission"))return!1;if(B){const R=O.name.toLowerCase().includes(B),F=((T=O.taskLabel)==null?void 0:T.toLowerCase().includes(B))||!1,$=O.class.toLowerCase().includes(B),U=((M=O.currentTool)==null?void 0:M.toLowerCase().includes(B))||!1;return R||F||$||U}return!0})},[s,r,c,x]),S=b.useMemo(()=>BL(v),[v]),A=FL(S,B=>H.getAreaForAgent(B));if(!r&&c==="all")for(const B of a)A.has(B.id)||A.set(B.id,[]);const k=zL(Array.from(A.keys()),B=>n.areas.get(B)),N=b.useCallback(B=>{d(B),Ja(pt.COMMANDER_FILTERS,B)},[]),j=b.useCallback(()=>{var B;i(""),(B=f.current)==null||B.focus()},[]);if(s.length===0&&a.length===0)return o.jsxs("div",{className:"empty-state",children:[o.jsx("div",{className:"empty-state-icon",children:"⚔️"}),o.jsx("div",{className:"empty-state-title",children:e("agentsList.noAgentsDeployed")}),o.jsx("div",{className:"empty-state-desc",children:e("agentsList.clickNewAgent")})]});const E=r||c!=="all",D=v.length,_=s.length;return o.jsxs("div",{className:"agents-list",children:[o.jsxs("div",{className:"agents-stats-bar",children:[o.jsxs("div",{className:"agents-stats-item",children:[o.jsx("span",{className:"agents-stats-count",children:_}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.total")})]}),y.active>0&&o.jsxs("div",{className:"agents-stats-item working",children:[o.jsx("span",{className:"agents-stats-count",children:y.active}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusActive")})]}),y.idle>0&&o.jsxs("div",{className:"agents-stats-item idle",children:[o.jsx("span",{className:"agents-stats-count",children:y.idle}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusIdle")})]}),y.waiting>0&&o.jsxs("div",{className:"agents-stats-item waiting",children:[o.jsx("span",{className:"agents-stats-count",children:y.waiting}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusWaiting")})]}),y.error>0&&o.jsxs("div",{className:"agents-stats-item error",children:[o.jsx("span",{className:"agents-stats-count",children:y.error}),o.jsx("span",{className:"agents-stats-label",children:e("agentsList.statusError")})]})]}),o.jsxs("div",{className:"agents-search-bar",children:[o.jsx("span",{className:"agents-search-icon",children:"🔍"}),o.jsx("input",{ref:f,type:"text",className:"agents-search-input",placeholder:e("agentsList.searchPlaceholder"),value:r,onChange:B=>i(B.target.value)}),r&&o.jsx("button",{className:"agents-search-clear",onClick:j,children:"×"})]}),o.jsx("div",{className:"agents-filter-chips",children:["all","active","idle","waiting","error"].map(B=>{const O=y[B];return B!=="all"&&O===0?null:o.jsxs("button",{className:`agents-filter-chip ${B} ${c===B?"selected":""}`,onClick:()=>N(B),children:[e(`agentsList.filter_${B}`),o.jsx("span",{className:"agents-filter-chip-count",children:O})]},B)})}),E&&o.jsxs("div",{className:"agents-filter-info",children:[e("agentsList.showing",{count:D,total:_}),o.jsx("button",{className:"agents-filter-clear",onClick:()=>{i(""),N("all")},children:e("agentsList.clearFilters")})]}),o.jsxs("div",{className:"agents-list-scroll",children:[k.map(B=>{const O=A.get(B),T=B?n.areas.get(B):null;return E&&O.length===0?null:o.jsxs("div",{className:"agents-group",children:[o.jsxs("div",{className:"agents-group-header",style:T?{borderLeftColor:T.color,background:`${T.color}15`}:void 0,children:[T?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"agents-group-dot",style:{background:T.color}}),o.jsx("span",{className:"agents-group-name",children:T.name}),T.directories.length>0&&o.jsx("button",{className:"area-browse-btn",onClick:()=>t==null?void 0:t(T.id),title:e("agentsList.browseFiles"),children:"📂"})]}):o.jsx("span",{className:"agents-group-name unassigned",children:e("agentsList.unassigned")}),o.jsx("span",{className:"agents-group-count",children:O.length})]}),O.length>0&&o.jsx("div",{className:"agents-group-items",style:T?{background:`${T.color}08`}:void 0,children:O.map(M=>o.jsx(G2,{agent:M,area:T,searchQuery:r},M.id))})]},B||"unassigned")}),E&&D===0&&o.jsxs("div",{className:"agents-no-results",children:[o.jsx("span",{className:"agents-no-results-icon",children:"🔎"}),o.jsx("span",{children:e("agentsList.noResults")})]}),s.length>0&&o.jsx(Y2,{agents:s})]})]})}const G2=b.memo(function({agent:e,area:n,searchQuery:s=""}){const a=Ts(),r=ar(),i=rr(e.class,r),c=a.selectedAgentIds.has(e.id),d=a.agentsWithUnseenOutput.has(e.id),[,f]=b.useState(0);b.useEffect(()=>{if(e.status==="idle"){const N=setInterval(()=>{f(j=>j+1)},15e3);return()=>clearInterval(N)}},[e.status]);const h=()=>{H.selectAgent(e.id)},m=e.status==="idle"&&e.lastActivity>0,x=e.lastActivity>0?Gb(e.lastActivity):void 0,y=vp(e),v=qj(y.remainingPercent),S=e.provider==="codex"?"CX":e.provider==="opencode"?"OC":"CL",A=e.provider==="codex"?"OpenAI Codex":e.provider==="opencode"?"OpenCode":"Claude",k=N=>{if(!s.trim())return N;const j=s.trim(),E=N.toLowerCase().indexOf(j.toLowerCase());return E===-1?N:o.jsxs(o.Fragment,{children:[N.slice(0,E),o.jsx("span",{className:"agents-search-highlight",children:N.slice(E,E+j.length)}),N.slice(E+j.length)]})};return o.jsxs("div",{className:`agent-item ${c?"selected":""} ${d?"unread":""} ${e.status}`,onClick:h,children:[o.jsxs("div",{className:"agent-item-icon",style:{background:`${i.color}20`},children:[i.icon,d&&o.jsx("span",{className:"agent-item-unread-dot"})]}),o.jsxs("div",{className:"agent-item-info",children:[o.jsxs("div",{className:"agent-item-top-row",children:[o.jsx("span",{className:"agent-item-name",children:k(e.name)}),o.jsx("span",{className:`agent-item-provider ${e.provider}`,title:A,children:S})]}),e.taskLabel&&o.jsx("div",{className:"agent-item-task",children:k(e.taskLabel)}),o.jsxs("div",{className:"agent-item-status",children:[o.jsx("span",{className:`agent-item-status-badge ${e.status}`,children:e.status}),m&&o.jsxs("span",{className:"agent-item-idle",style:{color:x},title:Kb(e.lastActivity),children:["⏱ ",IL(e.lastActivity)]}),e.isBoss&&o.jsx("span",{className:"agent-item-boss-badge",title:"Boss agent",children:"B"})]}),o.jsx("div",{className:"agent-item-context-bar",title:`Context: ${Math.round(y.usedPercent)}% used`,children:o.jsx("div",{className:"agent-item-context-fill",style:{width:`${y.usedPercent}%`,background:v}})})]}),o.jsx("div",{className:`agent-status-dot ${e.status}`})]})}),Y2=b.memo(function({agents:e}){const{t:n}=ht(["common"]),s=Ts(),[a,r]=b.useState(()=>bi(pt.GLOBAL_SUPERVISOR_COLLAPSED)),i=()=>{const h=!a;r(h),xi(pt.GLOBAL_SUPERVISOR_COLLAPSED,h)},c=b.useMemo(()=>{const h=[];for(const m of e){const x=H.getAgentSupervisorHistory(m.id);for(const y of x)h.push({agent:m,entry:y})}return h.sort((m,x)=>x.entry.timestamp-m.entry.timestamp),h.slice(0,30)},[e,s.supervisor.agentHistories]),d=b.useCallback(h=>{H.selectAgent(h)},[]),f=c.length>0?c[0].entry.timestamp:Date.now();return o.jsxs("div",{className:"global-supervisor-status",children:[o.jsxs("div",{className:"global-supervisor-header",onClick:i,children:[o.jsx("span",{className:"global-supervisor-toggle",children:a?"▶":"▼"}),o.jsx("span",{className:"global-supervisor-title",children:n("agentsList.supervisorStatus")}),c.length>0&&o.jsx("span",{className:"global-supervisor-count",children:c.length}),c.length>0&&o.jsx("span",{className:"global-supervisor-time",children:Wf(f)})]}),!a&&o.jsx("div",{className:"global-supervisor-list global-supervisor-timeline",children:c.length===0?o.jsx("div",{className:"global-supervisor-empty",children:n("unitPanel.noSupervisorReports")}):c.map(({agent:h,entry:m})=>o.jsx(Jj,{entry:m,agent:h,onAgentClick:d,defaultExpanded:!1},m.id))})]})}),K2=b.memo(function({agents:e}){const{t:n}=ht(["common"]),s=ar(),a=e.reduce((i,c)=>i+c.tokensUsed,0),r=e.filter(i=>i.status==="working").length;return o.jsxs("div",{className:"unit-panel",children:[o.jsxs("div",{className:"unit-panel-header",children:[o.jsx("div",{className:"unit-class-icon",style:{background:"#4a9eff20"},children:"👥"}),o.jsxs("div",{children:[o.jsx("div",{className:"unit-name",children:n("multiAgent.agentsSelected",{count:e.length})}),o.jsx("div",{className:"unit-status",children:n("multiAgent.groupSelection")})]})]}),o.jsxs("div",{className:"unit-stats",children:[o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:n("multiAgent.totalTokens")}),o.jsx("div",{className:"unit-stat-value",children:WD(a)})]}),o.jsxs("div",{className:"unit-stat",children:[o.jsx("div",{className:"unit-stat-label",children:n("multiAgent.working")}),o.jsx("div",{className:"unit-stat-value",children:r})]})]}),o.jsx("div",{style:{padding:"8px 0",maxHeight:100,overflowY:"auto"},children:e.map(i=>o.jsx(Q2,{agent:i,customClasses:s},i.id))}),o.jsx("div",{className:"unit-actions",children:o.jsx("button",{className:"unit-action-btn",onClick:()=>H.deselectAll(),children:n("buttons.deselectAll")})})]})}),Q2=b.memo(function({agent:e,customClasses:n}){const s=rr(e.class,n);return o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",fontSize:12},children:[o.jsx("span",{children:s.icon}),o.jsx("span",{style:{flex:1},children:e.name}),o.jsx("span",{style:{color:"var(--text-secondary)"},children:e.status})]})});function oS({onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}){const a=Ts(),r=H.getSelectedAgents();if(a.selectedAgentIds.size===0)return o.jsx(iS,{onOpenAreaExplorer:s});if(a.selectedAgentIds.size===1){const i=r[0];return i?o.jsx(F2,{agent:i,onFocusAgent:t,onKillAgent:e,onCallSubordinates:n,onOpenAreaExplorer:s}):o.jsx(iS,{onOpenAreaExplorer:s})}return o.jsx(K2,{agents:r})}function X2(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const J2=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Z2=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eP={};function lS(t,e){return(eP.jsx?Z2:J2).test(t)}const tP=/[ \t\n\f\r]/g;function nP(t){return typeof t=="object"?t.type==="text"?cS(t.value):!1:cS(t)}function cS(t){return t.replace(tP,"")===""}class Mu{constructor(e,n,s){this.normal=n,this.property=e,s&&(this.space=s)}}Mu.prototype.normal={};Mu.prototype.property={};Mu.prototype.space=void 0;function Zj(t,e){const n={},s={};for(const a of t)Object.assign(n,a.property),Object.assign(s,a.normal);return new Mu(n,s,e)}function Sb(t){return t.toLowerCase()}class Fs{constructor(e,n){this.attribute=n,this.property=e}}Fs.prototype.attribute="";Fs.prototype.booleanish=!1;Fs.prototype.boolean=!1;Fs.prototype.commaOrSpaceSeparated=!1;Fs.prototype.commaSeparated=!1;Fs.prototype.defined=!1;Fs.prototype.mustUseProperty=!1;Fs.prototype.number=!1;Fs.prototype.overloadedBoolean=!1;Fs.prototype.property="";Fs.prototype.spaceSeparated=!1;Fs.prototype.space=void 0;let sP=0;const Wt=mo(),Xn=mo(),Cb=mo(),rt=mo(),Nn=mo(),gl=mo(),Qs=mo();function mo(){return 2**++sP}const Ab=Object.freeze(Object.defineProperty({__proto__:null,boolean:Wt,booleanish:Xn,commaOrSpaceSeparated:Qs,commaSeparated:gl,number:rt,overloadedBoolean:Cb,spaceSeparated:Nn},Symbol.toStringTag,{value:"Module"})),fg=Object.keys(Ab);class hx extends Fs{constructor(e,n,s,a){let r=-1;if(super(e,n),uS(this,"space",a),typeof s=="number")for(;++r<fg.length;){const i=fg[r];uS(this,fg[r],(s&Ab[i])===Ab[i])}}}hx.prototype.defined=!0;function uS(t,e,n){n&&(t[e]=n)}function Rl(t){const e={},n={};for(const[s,a]of Object.entries(t.properties)){const r=new hx(s,t.transform(t.attributes||{},s),a,t.space);t.mustUseProperty&&t.mustUseProperty.includes(s)&&(r.mustUseProperty=!0),e[s]=r,n[Sb(s)]=s,n[Sb(r.attribute)]=s}return new Mu(e,n,t.space)}const eN=Rl({properties:{ariaActiveDescendant:null,ariaAtomic:Xn,ariaAutoComplete:null,ariaBusy:Xn,ariaChecked:Xn,ariaColCount:rt,ariaColIndex:rt,ariaColSpan:rt,ariaControls:Nn,ariaCurrent:null,ariaDescribedBy:Nn,ariaDetails:null,ariaDisabled:Xn,ariaDropEffect:Nn,ariaErrorMessage:null,ariaExpanded:Xn,ariaFlowTo:Nn,ariaGrabbed:Xn,ariaHasPopup:null,ariaHidden:Xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nn,ariaLevel:rt,ariaLive:null,ariaModal:Xn,ariaMultiLine:Xn,ariaMultiSelectable:Xn,ariaOrientation:null,ariaOwns:Nn,ariaPlaceholder:null,ariaPosInSet:rt,ariaPressed:Xn,ariaReadOnly:Xn,ariaRelevant:null,ariaRequired:Xn,ariaRoleDescription:Nn,ariaRowCount:rt,ariaRowIndex:rt,ariaRowSpan:rt,ariaSelected:Xn,ariaSetSize:rt,ariaSort:null,ariaValueMax:rt,ariaValueMin:rt,ariaValueNow:rt,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function tN(t,e){return e in t?t[e]:e}function nN(t,e){return tN(t,e.toLowerCase())}const aP=Rl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gl,acceptCharset:Nn,accessKey:Nn,action:null,allow:null,allowFullScreen:Wt,allowPaymentRequest:Wt,allowUserMedia:Wt,alt:null,as:null,async:Wt,autoCapitalize:null,autoComplete:Nn,autoFocus:Wt,autoPlay:Wt,blocking:Nn,capture:null,charSet:null,checked:Wt,cite:null,className:Nn,cols:rt,colSpan:null,content:null,contentEditable:Xn,controls:Wt,controlsList:Nn,coords:rt|gl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Wt,defer:Wt,dir:null,dirName:null,disabled:Wt,download:Cb,draggable:Xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Wt,formTarget:null,headers:Nn,height:rt,hidden:Cb,high:rt,href:null,hrefLang:null,htmlFor:Nn,httpEquiv:Nn,id:null,imageSizes:null,imageSrcSet:null,inert:Wt,inputMode:null,integrity:null,is:null,isMap:Wt,itemId:null,itemProp:Nn,itemRef:Nn,itemScope:Wt,itemType:Nn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Wt,low:rt,manifest:null,max:null,maxLength:rt,media:null,method:null,min:null,minLength:rt,multiple:Wt,muted:Wt,name:null,nonce:null,noModule:Wt,noValidate:Wt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Wt,optimum:rt,pattern:null,ping:Nn,placeholder:null,playsInline:Wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Wt,referrerPolicy:null,rel:Nn,required:Wt,reversed:Wt,rows:rt,rowSpan:rt,sandbox:Nn,scope:null,scoped:Wt,seamless:Wt,selected:Wt,shadowRootClonable:Wt,shadowRootDelegatesFocus:Wt,shadowRootMode:null,shape:null,size:rt,sizes:null,slot:null,span:rt,spellCheck:Xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:rt,step:null,style:null,tabIndex:rt,target:null,title:null,translate:null,type:null,typeMustMatch:Wt,useMap:null,value:Xn,width:rt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nn,axis:null,background:null,bgColor:null,border:rt,borderColor:null,bottomMargin:rt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Wt,declare:Wt,event:null,face:null,frame:null,frameBorder:null,hSpace:rt,leftMargin:rt,link:null,longDesc:null,lowSrc:null,marginHeight:rt,marginWidth:rt,noResize:Wt,noHref:Wt,noShade:Wt,noWrap:Wt,object:null,profile:null,prompt:null,rev:null,rightMargin:rt,rules:null,scheme:null,scrolling:Xn,standby:null,summary:null,text:null,topMargin:rt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:rt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Wt,disableRemotePlayback:Wt,prefix:null,property:null,results:rt,security:null,unselectable:null},space:"html",transform:nN}),rP=Rl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qs,accentHeight:rt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:rt,amplitude:rt,arabicForm:null,ascent:rt,attributeName:null,attributeType:null,azimuth:rt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:rt,by:null,calcMode:null,capHeight:rt,className:Nn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:rt,diffuseConstant:rt,direction:null,display:null,dur:null,divisor:rt,dominantBaseline:null,download:Wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:rt,enableBackground:null,end:null,event:null,exponent:rt,externalResourcesRequired:null,fill:null,fillOpacity:rt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:gl,g2:gl,glyphName:gl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:rt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:rt,horizOriginX:rt,horizOriginY:rt,id:null,ideographic:rt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:rt,k:rt,k1:rt,k2:rt,k3:rt,k4:rt,kernelMatrix:Qs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:rt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:rt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:rt,overlineThickness:rt,paintOrder:null,panose1:null,path:null,pathLength:rt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:rt,pointsAtY:rt,pointsAtZ:rt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qs,rev:Qs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qs,requiredFeatures:Qs,requiredFonts:Qs,requiredFormats:Qs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:rt,specularExponent:rt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:rt,strikethroughThickness:rt,string:null,stroke:null,strokeDashArray:Qs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:rt,strokeOpacity:rt,strokeWidth:null,style:null,surfaceScale:rt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qs,tabIndex:rt,tableValues:null,target:null,targetX:rt,targetY:rt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:rt,underlineThickness:rt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:rt,values:null,vAlphabetic:rt,vMathematical:rt,vectorEffect:null,vHanging:rt,vIdeographic:rt,version:null,vertAdvY:rt,vertOriginX:rt,vertOriginY:rt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:rt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tN}),sN=Rl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),aN=Rl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nN}),rN=Rl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),iP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oP=/[A-Z]/g,dS=/-[a-z]/g,lP=/^data[-\w.:]+$/i;function cP(t,e){const n=Sb(e);let s=e,a=Fs;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&lP.test(e)){if(e.charAt(4)==="-"){const r=e.slice(5).replace(dS,dP);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=e.slice(4);if(!dS.test(r)){let i=r.replace(oP,uP);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}a=hx}return new a(s,e)}function uP(t){return"-"+t.toLowerCase()}function dP(t){return t.charAt(1).toUpperCase()}const fP=Zj([eN,aP,sN,aN,rN],"html"),mx=Zj([eN,rP,sN,aN,rN],"svg");function pP(t){return t.join(" ").trim()}var nl={},pg,fS;function hP(){if(fS)return pg;fS=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,r=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
48
|
+
`,f="/",h="*",m="",x="comment",y="declaration";function v(A,k){if(typeof A!="string")throw new TypeError("First argument must be a string");if(!A)return[];k=k||{};var N=1,j=1;function E(U){var L=U.match(e);L&&(N+=L.length);var z=U.lastIndexOf(d);j=~z?U.length-z:j+U.length}function D(){var U={line:N,column:j};return function(L){return L.position=new _(U),T(),L}}function _(U){this.start=U,this.end={line:N,column:j},this.source=k.source}_.prototype.content=A;function B(U){var L=new Error(k.source+":"+N+":"+j+": "+U);if(L.reason=U,L.filename=k.source,L.line=N,L.column=j,L.source=A,!k.silent)throw L}function O(U){var L=U.exec(A);if(L){var z=L[0];return E(z),A=A.slice(z.length),L}}function T(){O(n)}function M(U){var L;for(U=U||[];L=R();)L!==!1&&U.push(L);return U}function R(){var U=D();if(!(f!=A.charAt(0)||h!=A.charAt(1))){for(var L=2;m!=A.charAt(L)&&(h!=A.charAt(L)||f!=A.charAt(L+1));)++L;if(L+=2,m===A.charAt(L-1))return B("End of comment missing");var z=A.slice(2,L-2);return j+=2,E(z),A=A.slice(L),j+=2,U({type:x,comment:z})}}function F(){var U=D(),L=O(s);if(L){if(R(),!O(a))return B("property missing ':'");var z=O(r),W=U({type:y,property:S(L[0].replace(t,m)),value:z?S(z[0].replace(t,m)):m});return O(i),W}}function $(){var U=[];M(U);for(var L;L=F();)L!==!1&&(U.push(L),M(U));return U}return T(),$()}function S(A){return A?A.replace(c,m):m}return pg=v,pg}var pS;function mP(){if(pS)return nl;pS=1;var t=nl&&nl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(nl,"__esModule",{value:!0}),nl.default=n;const e=t(hP());function n(s,a){let r=null;if(!s||typeof s!="string")return r;const i=(0,e.default)(s),c=typeof a=="function";return i.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:h}=d;c?a(f,h,d):h&&(r=r||{},r[f]=h)}),r}return nl}var zc={},hS;function gP(){if(hS)return zc;hS=1,Object.defineProperty(zc,"__esModule",{value:!0}),zc.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,r=function(f){return!f||n.test(f)||t.test(f)},i=function(f,h){return h.toUpperCase()},c=function(f,h){return"".concat(h,"-")},d=function(f,h){return h===void 0&&(h={}),r(f)?f:(f=f.toLowerCase(),h.reactCompat?f=f.replace(a,c):f=f.replace(s,c),f.replace(e,i))};return zc.camelCase=d,zc}var $c,mS;function bP(){if(mS)return $c;mS=1;var t=$c&&$c.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},e=t(mP()),n=gP();function s(a,r){var i={};return!a||typeof a!="string"||(0,e.default)(a,function(c,d){c&&d&&(i[(0,n.camelCase)(c,r)]=d)}),i}return s.default=s,$c=s,$c}var xP=bP();const yP=Tu(xP),iN=oN("end"),gx=oN("start");function oN(t){return e;function e(n){const s=n&&n.position&&n.position[t]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function vP(t){const e=gx(t),n=iN(t);if(e&&n)return{start:e,end:n}}function cu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?gS(t.position):"start"in t||"end"in t?gS(t):"line"in t||"column"in t?jb(t):""}function jb(t){return bS(t&&t.line)+":"+bS(t&&t.column)}function gS(t){return jb(t&&t.start)+"-"+jb(t&&t.end)}function bS(t){return t&&typeof t=="number"?t:1}class vs extends Error{constructor(e,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",r={},i=!1;if(n&&("line"in n&&"column"in n?r={place:n}:"start"in n&&"end"in n?r={place:n}:"type"in n?r={ancestors:[n],place:n.position}:r={...n}),typeof e=="string"?a=e:!r.cause&&e&&(i=!0,a=e.message,r.cause=e),!r.ruleId&&!r.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?r.ruleId=s:(r.source=s.slice(0,d),r.ruleId=s.slice(d+1))}if(!r.place&&r.ancestors&&r.ancestors){const d=r.ancestors[r.ancestors.length-1];d&&(r.place=d.position)}const c=r.place&&"start"in r.place?r.place.start:r.place;this.ancestors=r.ancestors||void 0,this.cause=r.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=c?c.line:void 0,this.name=cu(r.place)||"1:1",this.place=r.place||void 0,this.reason=this.message,this.ruleId=r.ruleId||void 0,this.source=r.source||void 0,this.stack=i&&r.cause&&typeof r.cause.stack=="string"?r.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}vs.prototype.file="";vs.prototype.name="";vs.prototype.reason="";vs.prototype.message="";vs.prototype.stack="";vs.prototype.column=void 0;vs.prototype.line=void 0;vs.prototype.ancestors=void 0;vs.prototype.cause=void 0;vs.prototype.fatal=void 0;vs.prototype.place=void 0;vs.prototype.ruleId=void 0;vs.prototype.source=void 0;const bx={}.hasOwnProperty,wP=new Map,kP=/[A-Z]/g,SP=new Set(["table","tbody","thead","tfoot","tr"]),CP=new Set(["td","th"]),lN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function AP(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let s;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=RP(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=DP(n,e.jsx,e.jsxs)}const a={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:s,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?mx:fP,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},r=cN(a,t,void 0);return r&&typeof r!="string"?r:a.create(t,a.Fragment,{children:r||void 0},void 0)}function cN(t,e,n){if(e.type==="element")return jP(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return NP(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return _P(t,e,n);if(e.type==="mdxjsEsm")return TP(t,e);if(e.type==="root")return EP(t,e,n);if(e.type==="text")return MP(t,e)}function jP(t,e,n){const s=t.schema;let a=s;e.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=mx,t.schema=a),t.ancestors.push(e);const r=dN(t,e.tagName,!1),i=OP(t,e);let c=yx(t,e);return SP.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!nP(d):!0})),uN(t,i,r,e),xx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function NP(t,e){if(e.data&&e.data.estree&&t.evaluater){const s=e.data.estree.body[0];return s.type,t.evaluater.evaluateExpression(s.expression)}Su(t,e.position)}function TP(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Su(t,e.position)}function _P(t,e,n){const s=t.schema;let a=s;e.name==="svg"&&s.space==="html"&&(a=mx,t.schema=a),t.ancestors.push(e);const r=e.name===null?t.Fragment:dN(t,e.name,!0),i=LP(t,e),c=yx(t,e);return uN(t,i,r,e),xx(i,c),t.ancestors.pop(),t.schema=s,t.create(e,r,i,n)}function EP(t,e,n){const s={};return xx(s,yx(t,e)),t.create(e,t.Fragment,s,n)}function MP(t,e){return e.value}function uN(t,e,n,s){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=s)}function xx(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function DP(t,e,n){return s;function s(a,r,i,c){const f=Array.isArray(i.children)?n:e;return c?f(r,i,c):f(r,i)}}function RP(t,e){return n;function n(s,a,r,i){const c=Array.isArray(r.children),d=gx(s);return e(a,r,i,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function OP(t,e){const n={};let s,a;for(a in e.properties)if(a!=="children"&&bx.call(e.properties,a)){const r=PP(t,a,e.properties[a]);if(r){const[i,c]=r;t.tableCellAlignToStyle&&i==="align"&&typeof c=="string"&&CP.has(e.tagName)?s=c:n[i]=c}}if(s){const r=n.style||(n.style={});r[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function LP(t,e){const n={};for(const s of e.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&t.evaluater){const r=s.data.estree.body[0];r.type;const i=r.expression;i.type;const c=i.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else Su(t,e.position);else{const a=s.name;let r;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&t.evaluater){const c=s.value.data.estree.body[0];c.type,r=t.evaluater.evaluateExpression(c.expression)}else Su(t,e.position);else r=s.value===null?!0:s.value;n[a]=r}return n}function yx(t,e){const n=[];let s=-1;const a=t.passKeys?new Map:wP;for(;++s<e.children.length;){const r=e.children[s];let i;if(t.passKeys){const d=r.type==="element"?r.tagName:r.type==="mdxJsxFlowElement"||r.type==="mdxJsxTextElement"?r.name:void 0;if(d){const f=a.get(d)||0;i=d+"-"+f,a.set(d,f+1)}}const c=cN(t,r,i);c!==void 0&&n.push(c)}return n}function PP(t,e,n){const s=cP(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?X2(n):pP(n)),s.property==="style"){let a=typeof n=="object"?n:IP(t,String(n));return t.stylePropertyNameCase==="css"&&(a=BP(a)),["style",a]}return[t.elementAttributeNameCase==="react"&&s.space?iP[s.property]||s.property:s.attribute,n]}}function IP(t,e){try{return yP(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const s=n,a=new vs("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=t.filePath||void 0,a.url=lN+"#cannot-parse-style-attribute",a}}function dN(t,e,n){let s;if(!n)s={type:"Literal",value:e};else if(e.includes(".")){const a=e.split(".");let r=-1,i;for(;++r<a.length;){const c=lS(a[r])?{type:"Identifier",name:a[r]}:{type:"Literal",value:a[r]};i=i?{type:"MemberExpression",object:i,property:c,computed:!!(r&&c.type==="Literal"),optional:!1}:c}s=i}else s=lS(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(s.type==="Literal"){const a=s.value;return bx.call(t.components,a)?t.components[a]:a}if(t.evaluater)return t.evaluater.evaluateExpression(s);Su(t)}function Su(t,e){const n=new vs("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=lN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function BP(t){const e={};let n;for(n in t)bx.call(t,n)&&(e[FP(n)]=t[n]);return e}function FP(t){let e=t.replace(kP,zP);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function zP(t){return"-"+t.toLowerCase()}const hg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},$P={};function vx(t,e){const n=$P,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fN(t,s,a)}function fN(t,e,n){if(HP(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return xS(t.children,e,n)}return Array.isArray(t)?xS(t,e,n):""}function xS(t,e,n){const s=[];let a=-1;for(;++a<t.length;)s[a]=fN(t[a],e,n);return s.join("")}function HP(t){return!!(t&&typeof t=="object")}const yS=document.createElement("i");function wx(t){const e="&"+t+";";yS.innerHTML=e;const n=yS.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function na(t,e,n,s){const a=t.length;let r=0,i;if(e<0?e=-e>a?0:a+e:e=e>a?a:e,n=n>0?n:0,s.length<1e4)i=Array.from(s),i.unshift(e,n),t.splice(...i);else for(n&&t.splice(e,n);r<s.length;)i=s.slice(r,r+1e4),i.unshift(e,0),t.splice(...i),r+=1e4,e+=1e4}function ya(t,e){return t.length>0?(na(t,t.length,0,e),t):e}const vS={}.hasOwnProperty;function pN(t){const e={};let n=-1;for(;++n<t.length;)UP(e,t[n]);return e}function UP(t,e){let n;for(n in e){const a=(vS.call(t,n)?t[n]:void 0)||(t[n]={}),r=e[n];let i;if(r)for(i in r){vS.call(a,i)||(a[i]=[]);const c=r[i];WP(a[i],Array.isArray(c)?c:c?[c]:[])}}}function WP(t,e){let n=-1;const s=[];for(;++n<e.length;)(e[n].add==="after"?t:s).push(e[n]);na(t,0,0,s)}function hN(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Da(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const js=Ni(/[A-Za-z]/),ys=Ni(/[\dA-Za-z]/),qP=Ni(/[#-'*+\--9=?A-Z^-~]/);function qf(t){return t!==null&&(t<32||t===127)}const Nb=Ni(/\d/),VP=Ni(/[\dA-Fa-f]/),GP=Ni(/[!-/:-@[-`{-~]/);function Dt(t){return t!==null&&t<-2}function An(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const wp=Ni(new RegExp("\\p{P}|\\p{S}","u")),co=Ni(/\s/);function Ni(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ol(t){const e=[];let n=-1,s=0,a=0;for(;++n<t.length;){const r=t.charCodeAt(n);let i="";if(r===37&&ys(t.charCodeAt(n+1))&&ys(t.charCodeAt(n+2)))a=2;else if(r<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(r))||(i=String.fromCharCode(r));else if(r>55295&&r<57344){const c=t.charCodeAt(n+1);r<56320&&c>56319&&c<57344?(i=String.fromCharCode(r,c),a=1):i="�"}else i=String.fromCharCode(r);i&&(e.push(t.slice(s,n),encodeURIComponent(i)),s=n+a+1,i=""),a&&(n+=a,a=0)}return e.join("")+t.slice(s)}function on(t,e,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let r=0;return i;function i(d){return Zt(d)?(t.enter(n),c(d)):e(d)}function c(d){return Zt(d)&&r++<a?(t.consume(d),c):(t.exit(n),e(d))}}const YP={tokenize:KP};function KP(t){const e=t.attempt(this.parser.constructs.contentInitial,s,a);let n;return e;function s(c){if(c===null){t.consume(c);return}return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),on(t,e,"linePrefix")}function a(c){return t.enter("paragraph"),r(c)}function r(c){const d=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,i(c)}function i(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Dt(c)?(t.consume(c),t.exit("chunkText"),r):(t.consume(c),i)}}const QP={tokenize:XP},wS={tokenize:JP};function XP(t){const e=this,n=[];let s=0,a,r,i;return c;function c(j){if(s<n.length){const E=n[s];return e.containerState=E[1],t.attempt(E[0].continuation,d,f)(j)}return f(j)}function d(j){if(s++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,a&&N();const E=e.events.length;let D=E,_;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){_=e.events[D][1].end;break}k(s);let B=E;for(;B<e.events.length;)e.events[B][1].end={..._},B++;return na(e.events,D+1,0,e.events.slice(E)),e.events.length=B,f(j)}return c(j)}function f(j){if(s===n.length){if(!a)return x(j);if(a.currentConstruct&&a.currentConstruct.concrete)return v(j);e.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(wS,h,m)(j)}function h(j){return a&&N(),k(s),x(j)}function m(j){return e.parser.lazy[e.now().line]=s!==n.length,i=e.now().offset,v(j)}function x(j){return e.containerState={},t.attempt(wS,y,v)(j)}function y(j){return s++,n.push([e.currentConstruct,e.containerState]),x(j)}function v(j){if(j===null){a&&N(),k(0),t.consume(j);return}return a=a||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:r}),S(j)}function S(j){if(j===null){A(t.exit("chunkFlow"),!0),k(0),t.consume(j);return}return Dt(j)?(t.consume(j),A(t.exit("chunkFlow")),s=0,e.interrupt=void 0,c):(t.consume(j),S)}function A(j,E){const D=e.sliceStream(j);if(E&&D.push(null),j.previous=r,r&&(r.next=j),r=j,a.defineSkip(j.start),a.write(D),e.parser.lazy[j.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<i&&(!a.events[_][1].end||a.events[_][1].end.offset>i))return;const B=e.events.length;let O=B,T,M;for(;O--;)if(e.events[O][0]==="exit"&&e.events[O][1].type==="chunkFlow"){if(T){M=e.events[O][1].end;break}T=!0}for(k(s),_=B;_<e.events.length;)e.events[_][1].end={...M},_++;na(e.events,O+1,0,e.events.slice(B)),e.events.length=_}}function k(j){let E=n.length;for(;E-- >j;){const D=n[E];e.containerState=D[1],D[0].exit.call(e,t)}n.length=j}function N(){a.write([null]),r=void 0,a=void 0,e.containerState._closeFlow=void 0}}function JP(t,e,n){return on(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wl(t){if(t===null||An(t)||co(t))return 1;if(wp(t))return 2}function kp(t,e,n){const s=[];let a=-1;for(;++a<t.length;){const r=t[a].resolveAll;r&&!s.includes(r)&&(e=r(e,n),s.push(r))}return e}const Tb={name:"attention",resolveAll:ZP,tokenize:eI};function ZP(t,e){let n=-1,s,a,r,i,c,d,f,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(s=n;s--;)if(t[s][0]==="exit"&&t[s][1].type==="attentionSequence"&&t[s][1]._open&&e.sliceSerialize(t[s][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[s][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[s][1].end.offset-t[s][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;d=t[s][1].end.offset-t[s][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[s][1].end},x={...t[n][1].start};kS(m,-d),kS(x,d),i={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...t[s][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:x},r={type:d>1?"strongText":"emphasisText",start:{...t[s][1].end},end:{...t[n][1].start}},a={type:d>1?"strong":"emphasis",start:{...i.start},end:{...c.end}},t[s][1].end={...i.start},t[n][1].start={...c.end},f=[],t[s][1].end.offset-t[s][1].start.offset&&(f=ya(f,[["enter",t[s][1],e],["exit",t[s][1],e]])),f=ya(f,[["enter",a,e],["enter",i,e],["exit",i,e],["enter",r,e]]),f=ya(f,kp(e.parser.constructs.insideSpan.null,t.slice(s+1,n),e)),f=ya(f,[["exit",r,e],["enter",c,e],["exit",c,e],["exit",a,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,f=ya(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,na(t,s-1,n-s+3,f),n=s+f.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function eI(t,e){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=wl(s);let r;return i;function i(d){return r=d,t.enter("attentionSequence"),c(d)}function c(d){if(d===r)return t.consume(d),c;const f=t.exit("attentionSequence"),h=wl(d),m=!h||h===2&&a||n.includes(d),x=!a||a===2&&h||n.includes(s);return f._open=!!(r===42?m:m&&(a||!x)),f._close=!!(r===42?x:x&&(h||!m)),e(d)}}function kS(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const tI={name:"autolink",tokenize:nI};function nI(t,e,n){let s=0;return a;function a(y){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),r}function r(y){return js(y)?(t.consume(y),i):y===64?n(y):f(y)}function i(y){return y===43||y===45||y===46||ys(y)?(s=1,c(y)):f(y)}function c(y){return y===58?(t.consume(y),s=0,d):(y===43||y===45||y===46||ys(y))&&s++<32?(t.consume(y),c):(s=0,f(y))}function d(y){return y===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):y===null||y===32||y===60||qf(y)?n(y):(t.consume(y),d)}function f(y){return y===64?(t.consume(y),h):qP(y)?(t.consume(y),f):n(y)}function h(y){return ys(y)?m(y):n(y)}function m(y){return y===46?(t.consume(y),s=0,h):y===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):x(y)}function x(y){if((y===45||ys(y))&&s++<63){const v=y===45?x:m;return t.consume(y),v}return n(y)}}const Du={partial:!0,tokenize:sI};function sI(t,e,n){return s;function s(r){return Zt(r)?on(t,a,"linePrefix")(r):a(r)}function a(r){return r===null||Dt(r)?e(r):n(r)}}const mN={continuation:{tokenize:rI},exit:iI,name:"blockQuote",tokenize:aI};function aI(t,e,n){const s=this;return a;function a(i){if(i===62){const c=s.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(i),t.exit("blockQuoteMarker"),r}return n(i)}function r(i){return Zt(i)?(t.enter("blockQuotePrefixWhitespace"),t.consume(i),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(i))}}function rI(t,e,n){const s=this;return a;function a(i){return Zt(i)?on(t,r,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):r(i)}function r(i){return t.attempt(mN,e,n)(i)}}function iI(t){t.exit("blockQuote")}const gN={name:"characterEscape",tokenize:oI};function oI(t,e,n){return s;function s(r){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(r),t.exit("escapeMarker"),a}function a(r){return GP(r)?(t.enter("characterEscapeValue"),t.consume(r),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(r)}}const bN={name:"characterReference",tokenize:lI};function lI(t,e,n){const s=this;let a=0,r,i;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),d}function d(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),r=31,i=ys,h(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),r=6,i=VP,h):(t.enter("characterReferenceValue"),r=7,i=Nb,h(m))}function h(m){if(m===59&&a){const x=t.exit("characterReferenceValue");return i===ys&&!wx(s.sliceSerialize(x))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return i(m)&&a++<r?(t.consume(m),h):n(m)}}const SS={partial:!0,tokenize:uI},CS={concrete:!0,name:"codeFenced",tokenize:cI};function cI(t,e,n){const s=this,a={partial:!0,tokenize:D};let r=0,i=0,c;return d;function d(_){return f(_)}function f(_){const B=s.events[s.events.length-1];return r=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,c=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(_)}function h(_){return _===c?(i++,t.consume(_),h):i<3?n(_):(t.exit("codeFencedFenceSequence"),Zt(_)?on(t,m,"whitespace")(_):m(_))}function m(_){return _===null||Dt(_)?(t.exit("codeFencedFence"),s.interrupt?e(_):t.check(SS,S,E)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),x(_))}function x(_){return _===null||Dt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(_)):Zt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),on(t,y,"whitespace")(_)):_===96&&_===c?n(_):(t.consume(_),x)}function y(_){return _===null||Dt(_)?m(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||Dt(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(_)):_===96&&_===c?n(_):(t.consume(_),v)}function S(_){return t.attempt(a,E,A)(_)}function A(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),k}function k(_){return r>0&&Zt(_)?on(t,N,"linePrefix",r+1)(_):N(_)}function N(_){return _===null||Dt(_)?t.check(SS,S,E)(_):(t.enter("codeFlowValue"),j(_))}function j(_){return _===null||Dt(_)?(t.exit("codeFlowValue"),N(_)):(t.consume(_),j)}function E(_){return t.exit("codeFenced"),e(_)}function D(_,B,O){let T=0;return M;function M(L){return _.enter("lineEnding"),_.consume(L),_.exit("lineEnding"),R}function R(L){return _.enter("codeFencedFence"),Zt(L)?on(_,F,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):F(L)}function F(L){return L===c?(_.enter("codeFencedFenceSequence"),$(L)):O(L)}function $(L){return L===c?(T++,_.consume(L),$):T>=i?(_.exit("codeFencedFenceSequence"),Zt(L)?on(_,U,"whitespace")(L):U(L)):O(L)}function U(L){return L===null||Dt(L)?(_.exit("codeFencedFence"),B(L)):O(L)}}}function uI(t,e,n){const s=this;return a;function a(i){return i===null?n(i):(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r)}function r(i){return s.parser.lazy[s.now().line]?n(i):e(i)}}const mg={name:"codeIndented",tokenize:fI},dI={partial:!0,tokenize:pI};function fI(t,e,n){const s=this;return a;function a(f){return t.enter("codeIndented"),on(t,r,"linePrefix",5)(f)}function r(f){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(f):n(f)}function i(f){return f===null?d(f):Dt(f)?t.attempt(dI,i,d)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||Dt(f)?(t.exit("codeFlowValue"),i(f)):(t.consume(f),c)}function d(f){return t.exit("codeIndented"),e(f)}}function pI(t,e,n){const s=this;return a;function a(i){return s.parser.lazy[s.now().line]?n(i):Dt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),a):on(t,r,"linePrefix",5)(i)}function r(i){const c=s.events[s.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(i):Dt(i)?a(i):n(i)}}const hI={name:"codeText",previous:gI,resolve:mI,tokenize:bI};function mI(t){let e=t.length-4,n=3,s,a;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(s=n;++s<e;)if(t[s][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(s=n-1,e++;++s<=e;)a===void 0?s!==e&&t[s][1].type!=="lineEnding"&&(a=s):(s===e||t[s][1].type==="lineEnding")&&(t[a][1].type="codeTextData",s!==a+2&&(t[a][1].end=t[s-1][1].end,t.splice(a+2,s-a-2),e-=s-a-2,s=a+2),a=void 0);return t}function gI(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function bI(t,e,n){let s=0,a,r;return i;function i(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),s++,c):(t.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),d):m===96?(r=t.enter("codeTextSequence"),a=0,h(m)):Dt(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),d):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Dt(m)?(t.exit("codeTextData"),d(m)):(t.consume(m),f)}function h(m){return m===96?(t.consume(m),a++,h):a===s?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(r.type="codeTextData",f(m))}}class xI{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(e,s):e>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(e,n,s){const a=n||0;this.setCursor(Math.trunc(e));const r=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Hc(this.left,s),r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Hc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Hc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Hc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Hc(this.left,n.reverse())}}}function Hc(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function xN(t){const e={};let n=-1,s,a,r,i,c,d,f;const h=new xI(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,r=0,r<d.length&&d[r][1].type==="lineEndingBlank"&&(r+=2),r<d.length&&d[r][1].type==="content"))for(;++r<d.length&&d[r][1].type!=="content";)d[r][1].type==="chunkText"&&(d[r][1]._isInFirstContentOfListItem=!0,r++);if(s[0]==="enter")s[1].contentType&&(Object.assign(e,yI(h,n)),n=e[n],f=!0);else if(s[1]._container){for(r=n,a=void 0;r--;)if(i=h.get(r),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),i[1].type="lineEnding",a=r);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;a&&(s[1].end={...h.get(a)[1].start},c=h.slice(a,n),c.unshift(s),h.splice(a,n-a+1,c))}}return na(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function yI(t,e){const n=t.get(e)[1],s=t.get(e)[2];let a=e-1;const r=[];let i=n._tokenizer;i||(i=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const c=i.events,d=[],f={};let h,m,x=-1,y=n,v=0,S=0;const A=[S];for(;y;){for(;t.get(++a)[1]!==y;);r.push(a),y._tokenizer||(h=s.sliceStream(y),y.next||h.push(null),m&&i.defineSkip(y.start),y._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(h),y._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=n;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(S=x+1,A.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(i.events=[],y?(y._tokenizer=void 0,y.previous=void 0):A.pop(),x=A.length;x--;){const k=c.slice(A[x],A[x+1]),N=r.pop();d.push([N,N+k.length-1]),t.splice(N,2,k)}for(d.reverse(),x=-1;++x<d.length;)f[v+d[x][0]]=v+d[x][1],v+=d[x][1]-d[x][0]-1;return f}const vI={resolve:kI,tokenize:SI},wI={partial:!0,tokenize:CI};function kI(t){return xN(t),t}function SI(t,e){let n;return s;function s(c){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),a(c)}function a(c){return c===null?r(c):Dt(c)?t.check(wI,i,r)(c):(t.consume(c),a)}function r(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function i(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function CI(t,e,n){const s=this;return a;function a(i){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),on(t,r,"linePrefix")}function r(i){if(i===null||Dt(i))return n(i);const c=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(i):t.interrupt(s.parser.constructs.flow,n,e)(i)}}function yN(t,e,n,s,a,r,i,c,d){const f=d||Number.POSITIVE_INFINITY;let h=0;return m;function m(k){return k===60?(t.enter(s),t.enter(a),t.enter(r),t.consume(k),t.exit(r),x):k===null||k===32||k===41||qf(k)?n(k):(t.enter(s),t.enter(i),t.enter(c),t.enter("chunkString",{contentType:"string"}),S(k))}function x(k){return k===62?(t.enter(r),t.consume(k),t.exit(r),t.exit(a),t.exit(s),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(t.exit("chunkString"),t.exit(c),x(k)):k===null||k===60||Dt(k)?n(k):(t.consume(k),k===92?v:y)}function v(k){return k===60||k===62||k===92?(t.consume(k),y):y(k)}function S(k){return!h&&(k===null||k===41||An(k))?(t.exit("chunkString"),t.exit(c),t.exit(i),t.exit(s),e(k)):h<f&&k===40?(t.consume(k),h++,S):k===41?(t.consume(k),h--,S):k===null||k===32||k===40||qf(k)?n(k):(t.consume(k),k===92?A:S)}function A(k){return k===40||k===41||k===92?(t.consume(k),S):S(k)}}function vN(t,e,n,s,a,r){const i=this;let c=0,d;return f;function f(y){return t.enter(s),t.enter(a),t.consume(y),t.exit(a),t.enter(r),h}function h(y){return c>999||y===null||y===91||y===93&&!d||y===94&&!c&&"_hiddenFootnoteSupport"in i.parser.constructs?n(y):y===93?(t.exit(r),t.enter(a),t.consume(y),t.exit(a),t.exit(s),e):Dt(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||Dt(y)||c++>999?(t.exit("chunkString"),h(y)):(t.consume(y),d||(d=!Zt(y)),y===92?x:m)}function x(y){return y===91||y===92||y===93?(t.consume(y),c++,m):m(y)}}function wN(t,e,n,s,a,r){let i;return c;function c(x){return x===34||x===39||x===40?(t.enter(s),t.enter(a),t.consume(x),t.exit(a),i=x===40?41:x,d):n(x)}function d(x){return x===i?(t.enter(a),t.consume(x),t.exit(a),t.exit(s),e):(t.enter(r),f(x))}function f(x){return x===i?(t.exit(r),d(i)):x===null?n(x):Dt(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),on(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===i||x===null||Dt(x)?(t.exit("chunkString"),f(x)):(t.consume(x),x===92?m:h)}function m(x){return x===i||x===92?(t.consume(x),h):h(x)}}function uu(t,e){let n;return s;function s(a){return Dt(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),n=!0,s):Zt(a)?on(t,s,n?"linePrefix":"lineSuffix")(a):e(a)}}const AI={name:"definition",tokenize:NI},jI={partial:!0,tokenize:TI};function NI(t,e,n){const s=this;let a;return r;function r(y){return t.enter("definition"),i(y)}function i(y){return vN.call(s,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return a=Da(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),d):n(y)}function d(y){return An(y)?uu(t,f)(y):f(y)}function f(y){return yN(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return t.attempt(jI,m,m)(y)}function m(y){return Zt(y)?on(t,x,"whitespace")(y):x(y)}function x(y){return y===null||Dt(y)?(t.exit("definition"),s.parser.defined.push(a),e(y)):n(y)}}function TI(t,e,n){return s;function s(c){return An(c)?uu(t,a)(c):n(c)}function a(c){return wN(t,r,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function r(c){return Zt(c)?on(t,i,"whitespace")(c):i(c)}function i(c){return c===null||Dt(c)?e(c):n(c)}}const _I={name:"hardBreakEscape",tokenize:EI};function EI(t,e,n){return s;function s(r){return t.enter("hardBreakEscape"),t.consume(r),a}function a(r){return Dt(r)?(t.exit("hardBreakEscape"),e(r)):n(r)}}const MI={name:"headingAtx",resolve:DI,tokenize:RI};function DI(t,e){let n=t.length-2,s=3,a,r;return t[s][1].type==="whitespace"&&(s+=2),n-2>s&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&t[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:t[s][1].start,end:t[n][1].end},r={type:"chunkText",start:t[s][1].start,end:t[n][1].end,contentType:"text"},na(t,s,n-s+1,[["enter",a,e],["enter",r,e],["exit",r,e],["exit",a,e]])),t}function RI(t,e,n){let s=0;return a;function a(h){return t.enter("atxHeading"),r(h)}function r(h){return t.enter("atxHeadingSequence"),i(h)}function i(h){return h===35&&s++<6?(t.consume(h),i):h===null||An(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),d(h)):h===null||Dt(h)?(t.exit("atxHeading"),e(h)):Zt(h)?on(t,c,"whitespace")(h):(t.enter("atxHeadingText"),f(h))}function d(h){return h===35?(t.consume(h),d):(t.exit("atxHeadingSequence"),c(h))}function f(h){return h===null||h===35||An(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const OI=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],AS=["pre","script","style","textarea"],LI={concrete:!0,name:"htmlFlow",resolveTo:BI,tokenize:FI},PI={partial:!0,tokenize:$I},II={partial:!0,tokenize:zI};function BI(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function FI(t,e,n){const s=this;let a,r,i,c,d;return f;function f(q){return h(q)}function h(q){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(q),m}function m(q){return q===33?(t.consume(q),x):q===47?(t.consume(q),r=!0,S):q===63?(t.consume(q),a=3,s.interrupt?e:P):js(q)?(t.consume(q),i=String.fromCharCode(q),A):n(q)}function x(q){return q===45?(t.consume(q),a=2,y):q===91?(t.consume(q),a=5,c=0,v):js(q)?(t.consume(q),a=4,s.interrupt?e:P):n(q)}function y(q){return q===45?(t.consume(q),s.interrupt?e:P):n(q)}function v(q){const be="CDATA[";return q===be.charCodeAt(c++)?(t.consume(q),c===be.length?s.interrupt?e:F:v):n(q)}function S(q){return js(q)?(t.consume(q),i=String.fromCharCode(q),A):n(q)}function A(q){if(q===null||q===47||q===62||An(q)){const be=q===47,ue=i.toLowerCase();return!be&&!r&&AS.includes(ue)?(a=1,s.interrupt?e(q):F(q)):OI.includes(i.toLowerCase())?(a=6,be?(t.consume(q),k):s.interrupt?e(q):F(q)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(q):r?N(q):j(q))}return q===45||ys(q)?(t.consume(q),i+=String.fromCharCode(q),A):n(q)}function k(q){return q===62?(t.consume(q),s.interrupt?e:F):n(q)}function N(q){return Zt(q)?(t.consume(q),N):M(q)}function j(q){return q===47?(t.consume(q),M):q===58||q===95||js(q)?(t.consume(q),E):Zt(q)?(t.consume(q),j):M(q)}function E(q){return q===45||q===46||q===58||q===95||ys(q)?(t.consume(q),E):D(q)}function D(q){return q===61?(t.consume(q),_):Zt(q)?(t.consume(q),D):j(q)}function _(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(t.consume(q),d=q,B):Zt(q)?(t.consume(q),_):O(q)}function B(q){return q===d?(t.consume(q),d=null,T):q===null||Dt(q)?n(q):(t.consume(q),B)}function O(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||An(q)?D(q):(t.consume(q),O)}function T(q){return q===47||q===62||Zt(q)?j(q):n(q)}function M(q){return q===62?(t.consume(q),R):n(q)}function R(q){return q===null||Dt(q)?F(q):Zt(q)?(t.consume(q),R):n(q)}function F(q){return q===45&&a===2?(t.consume(q),z):q===60&&a===1?(t.consume(q),W):q===62&&a===4?(t.consume(q),K):q===63&&a===3?(t.consume(q),P):q===93&&a===5?(t.consume(q),Y):Dt(q)&&(a===6||a===7)?(t.exit("htmlFlowData"),t.check(PI,Q,$)(q)):q===null||Dt(q)?(t.exit("htmlFlowData"),$(q)):(t.consume(q),F)}function $(q){return t.check(II,U,Q)(q)}function U(q){return t.enter("lineEnding"),t.consume(q),t.exit("lineEnding"),L}function L(q){return q===null||Dt(q)?$(q):(t.enter("htmlFlowData"),F(q))}function z(q){return q===45?(t.consume(q),P):F(q)}function W(q){return q===47?(t.consume(q),i="",V):F(q)}function V(q){if(q===62){const be=i.toLowerCase();return AS.includes(be)?(t.consume(q),K):F(q)}return js(q)&&i.length<8?(t.consume(q),i+=String.fromCharCode(q),V):F(q)}function Y(q){return q===93?(t.consume(q),P):F(q)}function P(q){return q===62?(t.consume(q),K):q===45&&a===2?(t.consume(q),P):F(q)}function K(q){return q===null||Dt(q)?(t.exit("htmlFlowData"),Q(q)):(t.consume(q),K)}function Q(q){return t.exit("htmlFlow"),e(q)}}function zI(t,e,n){const s=this;return a;function a(i){return Dt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),r):n(i)}function r(i){return s.parser.lazy[s.now().line]?n(i):e(i)}}function $I(t,e,n){return s;function s(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),t.attempt(Du,e,n)}}const HI={name:"htmlText",tokenize:UI};function UI(t,e,n){const s=this;let a,r,i;return c;function c(P){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(P),d}function d(P){return P===33?(t.consume(P),f):P===47?(t.consume(P),D):P===63?(t.consume(P),j):js(P)?(t.consume(P),O):n(P)}function f(P){return P===45?(t.consume(P),h):P===91?(t.consume(P),r=0,v):js(P)?(t.consume(P),N):n(P)}function h(P){return P===45?(t.consume(P),y):n(P)}function m(P){return P===null?n(P):P===45?(t.consume(P),x):Dt(P)?(i=m,W(P)):(t.consume(P),m)}function x(P){return P===45?(t.consume(P),y):m(P)}function y(P){return P===62?z(P):P===45?x(P):m(P)}function v(P){const K="CDATA[";return P===K.charCodeAt(r++)?(t.consume(P),r===K.length?S:v):n(P)}function S(P){return P===null?n(P):P===93?(t.consume(P),A):Dt(P)?(i=S,W(P)):(t.consume(P),S)}function A(P){return P===93?(t.consume(P),k):S(P)}function k(P){return P===62?z(P):P===93?(t.consume(P),k):S(P)}function N(P){return P===null||P===62?z(P):Dt(P)?(i=N,W(P)):(t.consume(P),N)}function j(P){return P===null?n(P):P===63?(t.consume(P),E):Dt(P)?(i=j,W(P)):(t.consume(P),j)}function E(P){return P===62?z(P):j(P)}function D(P){return js(P)?(t.consume(P),_):n(P)}function _(P){return P===45||ys(P)?(t.consume(P),_):B(P)}function B(P){return Dt(P)?(i=B,W(P)):Zt(P)?(t.consume(P),B):z(P)}function O(P){return P===45||ys(P)?(t.consume(P),O):P===47||P===62||An(P)?T(P):n(P)}function T(P){return P===47?(t.consume(P),z):P===58||P===95||js(P)?(t.consume(P),M):Dt(P)?(i=T,W(P)):Zt(P)?(t.consume(P),T):z(P)}function M(P){return P===45||P===46||P===58||P===95||ys(P)?(t.consume(P),M):R(P)}function R(P){return P===61?(t.consume(P),F):Dt(P)?(i=R,W(P)):Zt(P)?(t.consume(P),R):T(P)}function F(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),a=P,$):Dt(P)?(i=F,W(P)):Zt(P)?(t.consume(P),F):(t.consume(P),U)}function $(P){return P===a?(t.consume(P),a=void 0,L):P===null?n(P):Dt(P)?(i=$,W(P)):(t.consume(P),$)}function U(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||An(P)?T(P):(t.consume(P),U)}function L(P){return P===47||P===62||An(P)?T(P):n(P)}function z(P){return P===62?(t.consume(P),t.exit("htmlTextData"),t.exit("htmlText"),e):n(P)}function W(P){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),V}function V(P){return Zt(P)?on(t,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):Y(P)}function Y(P){return t.enter("htmlTextData"),i(P)}}const kx={name:"labelEnd",resolveAll:GI,resolveTo:YI,tokenize:KI},WI={tokenize:QI},qI={tokenize:XI},VI={tokenize:JI};function GI(t){let e=-1;const n=[];for(;++e<t.length;){const s=t[e][1];if(n.push(t[e]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",e+=a}}return t.length!==n.length&&na(t,0,t.length,n),t}function YI(t,e){let n=t.length,s=0,a,r,i,c;for(;n--;)if(a=t[n][1],r){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;t[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(i){if(t[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(r=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(i=n);const d={type:t[r][1].type==="labelLink"?"link":"image",start:{...t[r][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[r][1].start},end:{...t[i][1].end}},h={type:"labelText",start:{...t[r+s+2][1].end},end:{...t[i-2][1].start}};return c=[["enter",d,e],["enter",f,e]],c=ya(c,t.slice(r+1,r+s+3)),c=ya(c,[["enter",h,e]]),c=ya(c,kp(e.parser.constructs.insideSpan.null,t.slice(r+s+4,i-3),e)),c=ya(c,[["exit",h,e],t[i-2],t[i-1],["exit",f,e]]),c=ya(c,t.slice(i+1)),c=ya(c,[["exit",d,e]]),na(t,r,t.length,c),t}function KI(t,e,n){const s=this;let a=s.events.length,r,i;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){r=s.events[a][1];break}return c;function c(x){return r?r._inactive?m(x):(i=s.parser.defined.includes(Da(s.sliceSerialize({start:r.end,end:s.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(x),t.exit("labelMarker"),t.exit("labelEnd"),d):n(x)}function d(x){return x===40?t.attempt(WI,h,i?h:m)(x):x===91?t.attempt(qI,h,i?f:m)(x):i?h(x):m(x)}function f(x){return t.attempt(VI,h,m)(x)}function h(x){return e(x)}function m(x){return r._balanced=!0,n(x)}}function QI(t,e,n){return s;function s(m){return t.enter("resource"),t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),a}function a(m){return An(m)?uu(t,r)(m):r(m)}function r(m){return m===41?h(m):yN(t,i,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function i(m){return An(m)?uu(t,d)(m):h(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?wN(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return An(m)?uu(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function XI(t,e,n){const s=this;return a;function a(c){return vN.call(s,t,r,i,"reference","referenceMarker","referenceString")(c)}function r(c){return s.parser.defined.includes(Da(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function i(c){return n(c)}}function JI(t,e,n){return s;function s(r){return t.enter("reference"),t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),a}function a(r){return r===93?(t.enter("referenceMarker"),t.consume(r),t.exit("referenceMarker"),t.exit("reference"),e):n(r)}}const ZI={name:"labelStartImage",resolveAll:kx.resolveAll,tokenize:eB};function eB(t,e,n){const s=this;return a;function a(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),r}function r(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),i):n(c)}function i(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):e(c)}}const tB={name:"labelStartLink",resolveAll:kx.resolveAll,tokenize:nB};function nB(t,e,n){const s=this;return a;function a(i){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(i),t.exit("labelMarker"),t.exit("labelLink"),r}function r(i){return i===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(i):e(i)}}const gg={name:"lineEnding",tokenize:sB};function sB(t,e){return n;function n(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),on(t,e,"linePrefix")}}const Cf={name:"thematicBreak",tokenize:aB};function aB(t,e,n){let s=0,a;return r;function r(f){return t.enter("thematicBreak"),i(f)}function i(f){return a=f,c(f)}function c(f){return f===a?(t.enter("thematicBreakSequence"),d(f)):s>=3&&(f===null||Dt(f))?(t.exit("thematicBreak"),e(f)):n(f)}function d(f){return f===a?(t.consume(f),s++,d):(t.exit("thematicBreakSequence"),Zt(f)?on(t,c,"whitespace")(f):c(f))}}const Os={continuation:{tokenize:lB},exit:uB,name:"list",tokenize:oB},rB={partial:!0,tokenize:dB},iB={partial:!0,tokenize:cB};function oB(t,e,n){const s=this,a=s.events[s.events.length-1];let r=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,i=0;return c;function c(y){const v=s.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!s.containerState.marker||y===s.containerState.marker:Nb(y)){if(s.containerState.type||(s.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),y===42||y===45?t.check(Cf,n,f)(y):f(y);if(!s.interrupt||y===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(y)}return n(y)}function d(y){return Nb(y)&&++i<10?(t.consume(y),d):(!s.interrupt||i<2)&&(s.containerState.marker?y===s.containerState.marker:y===41||y===46)?(t.exit("listItemValue"),f(y)):n(y)}function f(y){return t.enter("listItemMarker"),t.consume(y),t.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||y,t.check(Du,s.interrupt?n:h,t.attempt(rB,x,m))}function h(y){return s.containerState.initialBlankLine=!0,r++,x(y)}function m(y){return Zt(y)?(t.enter("listItemPrefixWhitespace"),t.consume(y),t.exit("listItemPrefixWhitespace"),x):n(y)}function x(y){return s.containerState.size=r+s.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(y)}}function lB(t,e,n){const s=this;return s.containerState._closeFlow=void 0,t.check(Du,a,r);function a(c){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,on(t,e,"listItemIndent",s.containerState.size+1)(c)}function r(c){return s.containerState.furtherBlankLines||!Zt(c)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,i(c)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,t.attempt(iB,e,i)(c))}function i(c){return s.containerState._closeFlow=!0,s.interrupt=void 0,on(t,t.attempt(Os,e,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function cB(t,e,n){const s=this;return on(t,a,"listItemIndent",s.containerState.size+1);function a(r){const i=s.events[s.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===s.containerState.size?e(r):n(r)}}function uB(t){t.exit(this.containerState.type)}function dB(t,e,n){const s=this;return on(t,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(r){const i=s.events[s.events.length-1];return!Zt(r)&&i&&i[1].type==="listItemPrefixWhitespace"?e(r):n(r)}}const jS={name:"setextUnderline",resolveTo:fB,tokenize:pB};function fB(t,e){let n=t.length,s,a,r;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){s=n;break}t[n][1].type==="paragraph"&&(a=n)}else t[n][1].type==="content"&&t.splice(n,1),!r&&t[n][1].type==="definition"&&(r=n);const i={type:"setextHeading",start:{...t[s][1].start},end:{...t[t.length-1][1].end}};return t[a][1].type="setextHeadingText",r?(t.splice(a,0,["enter",i,e]),t.splice(r+1,0,["exit",t[s][1],e]),t[s][1].end={...t[r][1].end}):t[s][1]=i,t.push(["exit",i,e]),t}function pB(t,e,n){const s=this;let a;return r;function r(f){let h=s.events.length,m;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){m=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||m)?(t.enter("setextHeadingLine"),a=f,i(f)):n(f)}function i(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===a?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),Zt(f)?on(t,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Dt(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const hB={tokenize:mB};function mB(t){const e=this,n=t.attempt(Du,s,t.attempt(this.parser.constructs.flowInitial,a,on(t,t.attempt(this.parser.constructs.flow,a,t.attempt(vI,a)),"linePrefix")));return n;function s(r){if(r===null){t.consume(r);return}return t.enter("lineEndingBlank"),t.consume(r),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function a(r){if(r===null){t.consume(r);return}return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const gB={resolveAll:SN()},bB=kN("string"),xB=kN("text");function kN(t){return{resolveAll:SN(t==="text"?yB:void 0),tokenize:e};function e(n){const s=this,a=this.parser.constructs[t],r=n.attempt(a,i,c);return i;function i(h){return f(h)?r(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),d}function d(h){return f(h)?(n.exit("data"),r(h)):(n.consume(h),d)}function f(h){if(h===null)return!0;const m=a[h];let x=-1;if(m)for(;++x<m.length;){const y=m[x];if(!y.previous||y.previous.call(s,s.previous))return!0}return!1}}}function SN(t){return e;function e(n,s){let a=-1,r;for(;++a<=n.length;)r===void 0?n[a]&&n[a][1].type==="data"&&(r=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==r+2&&(n[r][1].end=n[a-1][1].end,n.splice(r+2,a-r-2),a=r+2),r=void 0);return t?t(n,s):n}}function yB(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const s=t[n-1][1],a=e.sliceStream(s);let r=a.length,i=-1,c=0,d;for(;r--;){const f=a[r];if(typeof f=="string"){for(i=f.length;f.charCodeAt(i-1)===32;)c++,i--;if(i)break;i=-1}else if(f===-2)d=!0,c++;else if(f!==-1){r++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:r?i:s.start._bufferIndex+i,_index:s.start._index+r,line:s.end.line,column:s.end.column-c,offset:s.end.offset-c},end:{...s.end}};s.end={...f.start},s.start.offset===s.end.offset?Object.assign(s,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const vB={42:Os,43:Os,45:Os,48:Os,49:Os,50:Os,51:Os,52:Os,53:Os,54:Os,55:Os,56:Os,57:Os,62:mN},wB={91:AI},kB={[-2]:mg,[-1]:mg,32:mg},SB={35:MI,42:Cf,45:[jS,Cf],60:LI,61:jS,95:Cf,96:CS,126:CS},CB={38:bN,92:gN},AB={[-5]:gg,[-4]:gg,[-3]:gg,33:ZI,38:bN,42:Tb,60:[tI,HI],91:tB,92:[_I,gN],93:kx,95:Tb,96:hI},jB={null:[Tb,gB]},NB={null:[42,95]},TB={null:[]},_B=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:NB,contentInitial:wB,disable:TB,document:vB,flow:SB,flowInitial:kB,insideSpan:jB,string:CB,text:AB},Symbol.toStringTag,{value:"Module"}));function EB(t,e,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},r=[];let i=[],c=[];const d={attempt:B(D),check:B(_),consume:N,enter:j,exit:E,interrupt:B(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:t,previous:null,sliceSerialize:x,sliceStream:y,write:m};let h=e.tokenize.call(f,d);return e.resolveAll&&r.push(e),f;function m(R){return i=ya(i,R),A(),i[i.length-1]!==null?[]:(O(e,0),f.events=kp(r,f.events,f),f.events)}function x(R,F){return DB(y(R),F)}function y(R){return MB(i,R)}function v(){const{_bufferIndex:R,_index:F,line:$,column:U,offset:L}=s;return{_bufferIndex:R,_index:F,line:$,column:U,offset:L}}function S(R){a[R.line]=R.column,M()}function A(){let R;for(;s._index<i.length;){const F=i[s._index];if(typeof F=="string")for(R=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===R&&s._bufferIndex<F.length;)k(F.charCodeAt(s._bufferIndex));else k(F)}}function k(R){h=h(R)}function N(R){Dt(R)?(s.line++,s.column=1,s.offset+=R===-3?2:1,M()):R!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===i[s._index].length&&(s._bufferIndex=-1,s._index++)),f.previous=R}function j(R,F){const $=F||{};return $.type=R,$.start=v(),f.events.push(["enter",$,f]),c.push($),$}function E(R){const F=c.pop();return F.end=v(),f.events.push(["exit",F,f]),F}function D(R,F){O(R,F.from)}function _(R,F){F.restore()}function B(R,F){return $;function $(U,L,z){let W,V,Y,P;return Array.isArray(U)?Q(U):"tokenize"in U?Q([U]):K(U);function K(Z){return de;function de(Ce){const xe=Ce!==null&&Z[Ce],Ne=Ce!==null&&Z.null,qe=[...Array.isArray(xe)?xe:xe?[xe]:[],...Array.isArray(Ne)?Ne:Ne?[Ne]:[]];return Q(qe)(Ce)}}function Q(Z){return W=Z,V=0,Z.length===0?z:q(Z[V])}function q(Z){return de;function de(Ce){return P=T(),Y=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?ue():Z.tokenize.call(F?Object.assign(Object.create(f),F):f,d,be,ue)(Ce)}}function be(Z){return R(Y,P),L}function ue(Z){return P.restore(),++V<W.length?q(W[V]):z}}}function O(R,F){R.resolveAll&&!r.includes(R)&&r.push(R),R.resolve&&na(f.events,F,f.events.length-F,R.resolve(f.events.slice(F),f)),R.resolveTo&&(f.events=R.resolveTo(f.events,f))}function T(){const R=v(),F=f.previous,$=f.currentConstruct,U=f.events.length,L=Array.from(c);return{from:U,restore:z};function z(){s=R,f.previous=F,f.currentConstruct=$,f.events.length=U,c=L,M()}}function M(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function MB(t,e){const n=e.start._index,s=e.start._bufferIndex,a=e.end._index,r=e.end._bufferIndex;let i;if(n===a)i=[t[n].slice(s,r)];else{if(i=t.slice(n,a),s>-1){const c=i[0];typeof c=="string"?i[0]=c.slice(s):i.shift()}r>0&&i.push(t[a].slice(0,r))}return i}function DB(t,e){let n=-1;const s=[];let a;for(;++n<t.length;){const r=t[n];let i;if(typeof r=="string")i=r;else switch(r){case-5:{i="\r";break}case-4:{i=`
|
|
49
|
+
`;break}case-3:{i=`\r
|
|
50
|
+
`;break}case-2:{i=e?" ":" ";break}case-1:{if(!e&&a)continue;i=" ";break}default:i=String.fromCharCode(r)}a=r===-2,s.push(i)}return s.join("")}function RB(t){const s={constructs:pN([_B,...(t||{}).extensions||[]]),content:a(YP),defined:[],document:a(QP),flow:a(hB),lazy:{},string:a(bB),text:a(xB)};return s;function a(r){return i;function i(c){return EB(s,r,c)}}}function OB(t){for(;!xN(t););return t}const NS=/[\0\t\n\r]/g;function LB(){let t=1,e="",n=!0,s;return a;function a(r,i,c){const d=[];let f,h,m,x,y;for(r=e+(typeof r=="string"?r.toString():new TextDecoder(i||void 0).decode(r)),m=0,e="",n&&(r.charCodeAt(0)===65279&&m++,n=void 0);m<r.length;){if(NS.lastIndex=m,f=NS.exec(r),x=f&&f.index!==void 0?f.index:r.length,y=r.charCodeAt(x),!f){e=r.slice(m);break}if(y===10&&m===x&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),m<x&&(d.push(r.slice(m,x)),t+=x-m),y){case 0:{d.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,d.push(-2);t++<h;)d.push(-1);break}case 10:{d.push(-4),t=1;break}default:s=!0,t=1}m=x+1}return c&&(s&&d.push(-5),e&&d.push(e),d.push(null)),d}}const PB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IB(t){return t.replace(PB,BB)}function BB(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),r=a===120||a===88;return hN(n.slice(r?2:1),r?16:10)}return wx(n)||t}const CN={}.hasOwnProperty;function FB(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),zB(n)(OB(RB(n).document().write(LB()(t,e,!0))))}function zB(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r($e),autolinkProtocol:T,autolinkEmail:T,atxHeading:r(Ee),blockQuote:r(Ne),characterEscape:T,characterReference:T,codeFenced:r(qe),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(qe,i),codeText:r(Ge,i),codeTextData:T,data:T,codeFlowValue:T,definition:r(X),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(se),hardBreakEscape:r(Ve),hardBreakTrailing:r(Ve),htmlFlow:r(at,i),htmlFlowData:T,htmlText:r(at,i),htmlTextData:T,image:r(we),label:i,link:r($e),listItem:r(fe),listItemValue:x,listOrdered:r(ie,m),listUnordered:r(ie),paragraph:r(Ue),reference:q,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(Ee),strong:r(it),thematicBreak:r(ce)},exit:{atxHeading:d(),atxHeadingSequence:D,autolink:d(),autolinkEmail:xe,autolinkProtocol:Ce,blockQuote:d(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:Z,characterReference:de,codeFenced:d(A),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:M,codeIndented:d(k),codeText:d(L),codeTextData:M,data:M,definition:d(),definitionDestinationString:E,definitionLabelString:N,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(F),hardBreakTrailing:d(F),htmlFlow:d($),htmlFlowData:M,htmlText:d(U),htmlTextData:M,image:d(W),label:Y,labelText:V,lineEnding:R,link:d(z),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:be,resourceDestinationString:P,resourceTitleString:K,resource:Q,setextHeading:d(O),setextHeadingLineSequence:B,setextHeadingText:_,strong:d(),thematicBreak:d()}};AN(e,(t||{}).mdastExtensions||[]);const n={};return s;function s(J){let ae={type:"root",children:[]};const Se={stack:[ae],tokenStack:[],config:e,enter:c,exit:f,buffer:i,resume:h,data:n},ee=[];let ge=-1;for(;++ge<J.length;)if(J[ge][1].type==="listOrdered"||J[ge][1].type==="listUnordered")if(J[ge][0]==="enter")ee.push(ge);else{const Re=ee.pop();ge=a(J,Re,ge)}for(ge=-1;++ge<J.length;){const Re=e[J[ge][0]];CN.call(Re,J[ge][1].type)&&Re[J[ge][1].type].call(Object.assign({sliceSerialize:J[ge][2].sliceSerialize},Se),J[ge][1])}if(Se.tokenStack.length>0){const Re=Se.tokenStack[Se.tokenStack.length-1];(Re[1]||TS).call(Se,void 0,Re[0])}for(ae.position={start:mi(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:mi(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<e.transforms.length;)ae=e.transforms[ge](ae)||ae;return ae}function a(J,ae,Se){let ee=ae-1,ge=-1,Re=!1,Fe,oe,Le,te;for(;++ee<=Se;){const pe=J[ee];switch(pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pe[0]==="enter"?ge++:ge--,te=void 0;break}case"lineEndingBlank":{pe[0]==="enter"&&(Fe&&!te&&!ge&&!Le&&(Le=ee),te=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:te=void 0}if(!ge&&pe[0]==="enter"&&pe[1].type==="listItemPrefix"||ge===-1&&pe[0]==="exit"&&(pe[1].type==="listUnordered"||pe[1].type==="listOrdered")){if(Fe){let ke=ee;for(oe=void 0;ke--;){const Be=J[ke];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;oe&&(J[oe][1].type="lineEndingBlank",Re=!0),Be[1].type="lineEnding",oe=ke}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}Le&&(!oe||Le<oe)&&(Fe._spread=!0),Fe.end=Object.assign({},oe?J[oe][1].start:pe[1].end),J.splice(oe||ee,0,["exit",Fe,pe[2]]),ee++,Se++}if(pe[1].type==="listItemPrefix"){const ke={type:"listItem",_spread:!1,start:Object.assign({},pe[1].start),end:void 0};Fe=ke,J.splice(ee,0,["enter",ke,pe[2]]),ee++,Se++,Le=void 0,te=!0}}}return J[ae][1]._spread=Re,Se}function r(J,ae){return Se;function Se(ee){c.call(this,J(ee),ee),ae&&ae.call(this,ee)}}function i(){this.stack.push({type:"fragment",children:[]})}function c(J,ae,Se){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([ae,Se||void 0]),J.position={start:mi(ae.start),end:void 0}}function d(J){return ae;function ae(Se){J&&J.call(this,Se),f.call(this,Se)}}function f(J,ae){const Se=this.stack.pop(),ee=this.tokenStack.pop();if(ee)ee[0].type!==J.type&&(ae?ae.call(this,J,ee[0]):(ee[1]||TS).call(this,J,ee[0]));else throw new Error("Cannot close `"+J.type+"` ("+cu({start:J.start,end:J.end})+"): it’s not open");Se.position.end=mi(J.end)}function h(){return vx(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function x(J){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function y(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=J}function v(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=J}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function A(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.value=J.replace(/(\r?\n|\r)$/g,"")}function N(J){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ae,Se.identifier=Da(this.sliceSerialize(J)).toLowerCase()}function j(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.title=J}function E(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.url=J}function D(J){const ae=this.stack[this.stack.length-1];if(!ae.depth){const Se=this.sliceSerialize(J).length;ae.depth=Se}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function B(J){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function T(J){const Se=this.stack[this.stack.length-1].children;let ee=Se[Se.length-1];(!ee||ee.type!=="text")&&(ee=ot(),ee.position={start:mi(J.start),end:void 0},Se.push(ee)),this.stack.push(ee)}function M(J){const ae=this.stack.pop();ae.value+=this.sliceSerialize(J),ae.position.end=mi(J.end)}function R(J){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=ae.children[ae.children.length-1];Se.position.end=mi(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ae.type)&&(T.call(this,J),M.call(this,J))}function F(){this.data.atHardBreak=!0}function $(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.value=J}function U(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.value=J}function L(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.value=J}function z(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ae,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function W(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=ae,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function V(J){const ae=this.sliceSerialize(J),Se=this.stack[this.stack.length-2];Se.label=IB(ae),Se.identifier=Da(ae).toLowerCase()}function Y(){const J=this.stack[this.stack.length-1],ae=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const ee=J.children;Se.children=ee}else Se.alt=ae}function P(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.url=J}function K(){const J=this.resume(),ae=this.stack[this.stack.length-1];ae.title=J}function Q(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function be(J){const ae=this.resume(),Se=this.stack[this.stack.length-1];Se.label=ae,Se.identifier=Da(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function ue(J){this.data.characterReferenceType=J.type}function Z(J){const ae=this.sliceSerialize(J),Se=this.data.characterReferenceType;let ee;Se?(ee=hN(ae,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ee=wx(ae);const ge=this.stack[this.stack.length-1];ge.value+=ee}function de(J){const ae=this.stack.pop();ae.position.end=mi(J.end)}function Ce(J){M.call(this,J);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(J)}function xe(J){M.call(this,J);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(J)}function Ne(){return{type:"blockquote",children:[]}}function qe(){return{type:"code",lang:null,meta:null,value:""}}function Ge(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function se(){return{type:"emphasis",children:[]}}function Ee(){return{type:"heading",depth:0,children:[]}}function Ve(){return{type:"break"}}function at(){return{type:"html",value:""}}function we(){return{type:"image",title:null,url:"",alt:null}}function $e(){return{type:"link",title:null,url:"",children:[]}}function ie(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function fe(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function Ue(){return{type:"paragraph",children:[]}}function it(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function ce(){return{type:"thematicBreak"}}}function mi(t){return{line:t.line,column:t.column,offset:t.offset}}function AN(t,e){let n=-1;for(;++n<e.length;){const s=e[n];Array.isArray(s)?AN(t,s):$B(t,s)}}function $B(t,e){let n;for(n in e)if(CN.call(e,n))switch(n){case"canContainEols":{const s=e[n];s&&t[n].push(...s);break}case"transforms":{const s=e[n];s&&t[n].push(...s);break}case"enter":case"exit":{const s=e[n];s&&Object.assign(t[n],s);break}}}function TS(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+cu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+cu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+cu({start:e.start,end:e.end})+") is still open")}function HB(t){const e=this;e.parser=n;function n(s){return FB(s,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function UB(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function WB(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
51
|
+
`}]}function qB(t,e){const n=e.value?e.value+`
|
|
52
|
+
`:"",s={},a=e.lang?e.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let r={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return e.meta&&(r.data={meta:e.meta}),t.patch(e,r),r=t.applyData(e,r),r={type:"element",tagName:"pre",properties:{},children:[r]},t.patch(e,r),r}function VB(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function GB(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function YB(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",s=String(e.identifier).toUpperCase(),a=Ol(s.toLowerCase()),r=t.footnoteOrder.indexOf(s);let i,c=t.footnoteCounts.get(s);c===void 0?(c=0,t.footnoteOrder.push(s),i=t.footnoteOrder.length):i=r+1,c+=1,t.footnoteCounts.set(s,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,f),t.applyData(e,f)}function KB(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function QB(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function jN(t,e){const n=e.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+s}];const a=t.all(e),r=a[0];r&&r.type==="text"?r.value="["+r.value:a.unshift({type:"text",value:"["});const i=a[a.length-1];return i&&i.type==="text"?i.value+=s:a.push({type:"text",value:s}),a}function XB(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return jN(t,e);const a={src:Ol(s.url||""),alt:e.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"img",properties:a,children:[]};return t.patch(e,r),t.applyData(e,r)}function JB(t,e){const n={src:Ol(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,s),t.applyData(e,s)}function ZB(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,s),t.applyData(e,s)}function eF(t,e){const n=String(e.identifier).toUpperCase(),s=t.definitionById.get(n);if(!s)return jN(t,e);const a={href:Ol(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"a",properties:a,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function tF(t,e){const n={href:Ol(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const s={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function nF(t,e,n){const s=t.all(e),a=n?sF(n):NN(e),r={},i=[];if(typeof e.checked=="boolean"){const h=s[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},s.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),r.className=["task-list-item"]}let c=-1;for(;++c<s.length;){const h=s[c];(a||c!==0||h.type!=="element"||h.tagName!=="p")&&i.push({type:"text",value:`
|
|
53
|
+
`}),h.type==="element"&&h.tagName==="p"&&!a?i.push(...h.children):i.push(h)}const d=s[s.length-1];d&&(a||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
|
|
54
|
+
`});const f={type:"element",tagName:"li",properties:r,children:i};return t.patch(e,f),t.applyData(e,f)}function sF(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let s=-1;for(;!e&&++s<n.length;)e=NN(n[s])}return e}function NN(t){const e=t.spread;return e??t.children.length>1}function aF(t,e){const n={},s=t.all(e);let a=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++a<s.length;){const i=s[a];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const r={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(s,!0)};return t.patch(e,r),t.applyData(e,r)}function rF(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function iF(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function oF(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function lF(t,e){const n=t.all(e),s=n.shift(),a=[];if(s){const i={type:"element",tagName:"thead",properties:{},children:t.wrap([s],!0)};t.patch(e.children[0],i),a.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=gx(e.children[1]),d=iN(e.children[e.children.length-1]);c&&d&&(i.position={start:c,end:d}),a.push(i)}const r={type:"element",tagName:"table",properties:{},children:t.wrap(a,!0)};return t.patch(e,r),t.applyData(e,r)}function cF(t,e,n){const s=n?n.children:void 0,r=(s?s.indexOf(e):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,c=i?i.length:e.children.length;let d=-1;const f=[];for(;++d<c;){const m=e.children[d],x={},y=i?i[d]:void 0;y&&(x.align=y);let v={type:"element",tagName:r,properties:x,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,h),t.applyData(e,h)}function uF(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const _S=9,ES=32;function dF(t){const e=String(t),n=/\r?\n|\r/g;let s=n.exec(e),a=0;const r=[];for(;s;)r.push(MS(e.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(e);return r.push(MS(e.slice(a),a>0,!1)),r.join("")}function MS(t,e,n){let s=0,a=t.length;if(e){let r=t.codePointAt(s);for(;r===_S||r===ES;)s++,r=t.codePointAt(s)}if(n){let r=t.codePointAt(a-1);for(;r===_S||r===ES;)a--,r=t.codePointAt(a-1)}return a>s?t.slice(s,a):""}function fF(t,e){const n={type:"text",value:dF(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function pF(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const hF={blockquote:UB,break:WB,code:qB,delete:VB,emphasis:GB,footnoteReference:YB,heading:KB,html:QB,imageReference:XB,image:JB,inlineCode:ZB,linkReference:eF,link:tF,listItem:nF,list:aF,paragraph:rF,root:iF,strong:oF,table:lF,tableCell:uF,tableRow:cF,text:fF,thematicBreak:pF,toml:nf,yaml:nf,definition:nf,footnoteDefinition:nf};function nf(){}const TN=-1,Sp=0,du=1,Vf=2,Sx=3,Cx=4,Ax=5,jx=6,_N=7,EN=8,DS=typeof self=="object"?self:globalThis,mF=(t,e)=>{const n=(a,r)=>(t.set(r,a),a),s=a=>{if(t.has(a))return t.get(a);const[r,i]=e[a];switch(r){case Sp:case TN:return n(i,a);case du:{const c=n([],a);for(const d of i)c.push(s(d));return c}case Vf:{const c=n({},a);for(const[d,f]of i)c[s(d)]=s(f);return c}case Sx:return n(new Date(i),a);case Cx:{const{source:c,flags:d}=i;return n(new RegExp(c,d),a)}case Ax:{const c=n(new Map,a);for(const[d,f]of i)c.set(s(d),s(f));return c}case jx:{const c=n(new Set,a);for(const d of i)c.add(s(d));return c}case _N:{const{name:c,message:d}=i;return n(new DS[c](d),a)}case EN:return n(BigInt(i),a);case"BigInt":return n(Object(BigInt(i)),a);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:c}=new Uint8Array(i);return n(new DataView(c),i)}}return n(new DS[r](i),a)};return s},RS=t=>mF(new Map,t)(0),sl="",{toString:gF}={},{keys:bF}=Object,Uc=t=>{const e=typeof t;if(e!=="object"||!t)return[Sp,e];const n=gF.call(t).slice(8,-1);switch(n){case"Array":return[du,sl];case"Object":return[Vf,sl];case"Date":return[Sx,sl];case"RegExp":return[Cx,sl];case"Map":return[Ax,sl];case"Set":return[jx,sl];case"DataView":return[du,n]}return n.includes("Array")?[du,n]:n.includes("Error")?[_N,n]:[Vf,n]},sf=([t,e])=>t===Sp&&(e==="function"||e==="symbol"),xF=(t,e,n,s)=>{const a=(i,c)=>{const d=s.push(i)-1;return n.set(c,d),d},r=i=>{if(n.has(i))return n.get(i);let[c,d]=Uc(i);switch(c){case Sp:{let h=i;switch(d){case"bigint":c=EN,h=i.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return a([TN],i)}return a([c,h],i)}case du:{if(d){let x=i;return d==="DataView"?x=new Uint8Array(i.buffer):d==="ArrayBuffer"&&(x=new Uint8Array(i)),a([d,[...x]],i)}const h=[],m=a([c,h],i);for(const x of i)h.push(r(x));return m}case Vf:{if(d)switch(d){case"BigInt":return a([d,i.toString()],i);case"Boolean":case"Number":case"String":return a([d,i.valueOf()],i)}if(e&&"toJSON"in i)return r(i.toJSON());const h=[],m=a([c,h],i);for(const x of bF(i))(t||!sf(Uc(i[x])))&&h.push([r(x),r(i[x])]);return m}case Sx:return a([c,i.toISOString()],i);case Cx:{const{source:h,flags:m}=i;return a([c,{source:h,flags:m}],i)}case Ax:{const h=[],m=a([c,h],i);for(const[x,y]of i)(t||!(sf(Uc(x))||sf(Uc(y))))&&h.push([r(x),r(y)]);return m}case jx:{const h=[],m=a([c,h],i);for(const x of i)(t||!sf(Uc(x)))&&h.push(r(x));return m}}const{message:f}=i;return a([c,{name:d,message:f}],i)};return r},OS=(t,{json:e,lossy:n}={})=>{const s=[];return xF(!(e||n),!!e,new Map,s)(t),s},Gf=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?RS(OS(t,e)):structuredClone(t):(t,e)=>RS(OS(t,e));function yF(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function vF(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function wF(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||yF,s=t.options.footnoteBackLabel||vF,a=t.options.footnoteLabel||"Footnotes",r=t.options.footnoteLabelTagName||"h2",i=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[d]);if(!f)continue;const h=t.all(f),m=String(f.identifier).toUpperCase(),x=Ol(m.toLowerCase());let y=0;const v=[],S=t.footnoteCounts.get(m);for(;S!==void 0&&++y<=S;){v.length>0&&v.push({type:"text",value:" "});let N=typeof n=="string"?n:n(d,y);typeof N=="string"&&(N={type:"text",value:N}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const A=h[h.length-1];if(A&&A.type==="element"&&A.tagName==="p"){const N=A.children[A.children.length-1];N&&N.type==="text"?N.value+=" ":A.children.push({type:"text",value:" "}),A.children.push(...v)}else h.push(...v);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+x},children:t.wrap(h,!0)};t.patch(f,k),c.push(k)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:r,properties:{...Gf(i),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
55
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
56
|
+
`}]}}const Cp=(function(t){if(t==null)return AF;if(typeof t=="function")return Ap(t);if(typeof t=="object")return Array.isArray(t)?kF(t):SF(t);if(typeof t=="string")return CF(t);throw new Error("Expected function, string, or object as test")});function kF(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Cp(t[n]);return Ap(s);function s(...a){let r=-1;for(;++r<e.length;)if(e[r].apply(this,a))return!0;return!1}}function SF(t){const e=t;return Ap(n);function n(s){const a=s;let r;for(r in t)if(a[r]!==e[r])return!1;return!0}}function CF(t){return Ap(e);function e(n){return n&&n.type===t}}function Ap(t){return e;function e(n,s,a){return!!(jF(n)&&t.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function AF(){return!0}function jF(t){return t!==null&&typeof t=="object"&&"type"in t}const MN=[],NF=!0,_b=!1,TF="skip";function DN(t,e,n,s){let a;typeof e=="function"&&typeof n!="function"?(s=n,n=e):a=e;const r=Cp(a),i=s?-1:1;c(t,void 0,[])();function c(d,f,h){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(d.type+(y?"<"+y+">":""))+")"})}return x;function x(){let y=MN,v,S,A;if((!e||r(d,f,h[h.length-1]||void 0))&&(y=_F(n(d,h)),y[0]===_b))return y;if("children"in d&&d.children){const k=d;if(k.children&&y[0]!==TF)for(S=(s?k.children.length:-1)+i,A=h.concat(k);S>-1&&S<k.children.length;){const N=k.children[S];if(v=c(N,S,A)(),v[0]===_b)return v;S=typeof v[1]=="number"?v[1]:S+i}}return y}}}function _F(t){return Array.isArray(t)?t:typeof t=="number"?[NF,t]:t==null?MN:[t]}function Nx(t,e,n,s){let a,r,i;typeof e=="function"&&typeof n!="function"?(r=void 0,i=e,a=n):(r=e,i=n,a=s),DN(t,r,c,a);function c(d,f){const h=f[f.length-1],m=h?h.children.indexOf(d):void 0;return i(d,m,h)}}const Eb={}.hasOwnProperty,EF={};function MF(t,e){const n=e||EF,s=new Map,a=new Map,r=new Map,i={...hF,...n.handlers},c={all:f,applyData:RF,definitionById:s,footnoteById:a,footnoteCounts:r,footnoteOrder:[],handlers:i,one:d,options:n,patch:DF,wrap:LF};return Nx(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?s:a,x=String(h.identifier).toUpperCase();m.has(x)||m.set(x,h)}}),c;function d(h,m){const x=h.type,y=c.handlers[x];if(Eb.call(c.handlers,x)&&y)return y(c,h,m);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in h){const{children:S,...A}=h,k=Gf(A);return k.children=c.all(h),k}return Gf(h)}return(c.options.unknownHandler||OF)(c,h,m)}function f(h){const m=[];if("children"in h){const x=h.children;let y=-1;for(;++y<x.length;){const v=c.one(x[y],h);if(v){if(y&&x[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=LS(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=LS(S.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function DF(t,e){t.position&&(e.position=vP(t))}function RF(t,e){let n=e;if(t&&t.data){const s=t.data.hName,a=t.data.hChildren,r=t.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const i="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:i}}n.type==="element"&&r&&Object.assign(n.properties,Gf(r)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function OF(t,e){const n=e.data||{},s="value"in e&&!(Eb.call(n,"hProperties")||Eb.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function LF(t,e){const n=[];let s=-1;for(e&&n.push({type:"text",value:`
|
|
57
|
+
`});++s<t.length;)s&&n.push({type:"text",value:`
|
|
58
|
+
`}),n.push(t[s]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
59
|
+
`}),n}function LS(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function PS(t,e){const n=MF(t,e),s=n.one(t,void 0),a=wF(n),r=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&r.children.push({type:"text",value:`
|
|
60
|
+
`},a),r}function PF(t,e){return t&&"run"in t?async function(n,s){const a=PS(n,{file:s,...e});await t.run(a,s)}:function(n,s){return PS(n,{file:s,...t||e})}}function IS(t){if(t)throw t}var bg,BS;function IF(){if(BS)return bg;BS=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},r=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var h=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!m)return!1;var x;for(x in f);return typeof x>"u"||t.call(f,x)},i=function(f,h){n&&h.name==="__proto__"?n(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):f[h.name]=h.newValue},c=function(f,h){if(h==="__proto__")if(t.call(f,h)){if(s)return s(f,h).value}else return;return f[h]};return bg=function d(){var f,h,m,x,y,v,S=arguments[0],A=1,k=arguments.length,N=!1;for(typeof S=="boolean"&&(N=S,S=arguments[1]||{},A=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});A<k;++A)if(f=arguments[A],f!=null)for(h in f)m=c(S,h),x=c(f,h),S!==x&&(N&&x&&(r(x)||(y=a(x)))?(y?(y=!1,v=m&&a(m)?m:[]):v=m&&r(m)?m:{},i(S,{name:h,newValue:d(N,v,x)})):typeof x<"u"&&i(S,{name:h,newValue:x}));return S},bg}var BF=IF();const xg=Tu(BF);function Mb(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function FF(){const t=[],e={run:n,use:s};return e;function n(...a){let r=-1;const i=a.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);c(null,...a);function c(d,...f){const h=t[++r];let m=-1;if(d){i(d);return}for(;++m<a.length;)(f[m]===null||f[m]===void 0)&&(f[m]=a[m]);a=f,h?zF(h,c)(...f):i(null,...f)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return t.push(a),e}}function zF(t,e){let n;return s;function s(...i){const c=t.length>i.length;let d;c&&i.push(a);try{d=t.apply(this,i)}catch(f){const h=f;if(c&&n)throw h;return a(h)}c||(d&&d.then&&typeof d.then=="function"?d.then(r,a):d instanceof Error?a(d):r(d))}function a(i,...c){n||(n=!0,e(i,...c))}function r(i){a(null,i)}}const Ua={basename:$F,dirname:HF,extname:UF,join:WF,sep:"/"};function $F(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ru(t);let n=0,s=-1,a=t.length,r;if(e===void 0||e.length===0||e.length>t.length){for(;a--;)if(t.codePointAt(a)===47){if(r){n=a+1;break}}else s<0&&(r=!0,s=a+1);return s<0?"":t.slice(n,s)}if(e===t)return"";let i=-1,c=e.length-1;for(;a--;)if(t.codePointAt(a)===47){if(r){n=a+1;break}}else i<0&&(r=!0,i=a+1),c>-1&&(t.codePointAt(a)===e.codePointAt(c--)?c<0&&(s=a):(c=-1,s=i));return n===s?s=i:s<0&&(s=t.length),t.slice(n,s)}function HF(t){if(Ru(t),t.length===0)return".";let e=-1,n=t.length,s;for(;--n;)if(t.codePointAt(n)===47){if(s){e=n;break}}else s||(s=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function UF(t){Ru(t);let e=t.length,n=-1,s=0,a=-1,r=0,i;for(;e--;){const c=t.codePointAt(e);if(c===47){if(i){s=e+1;break}continue}n<0&&(i=!0,n=e+1),c===46?a<0?a=e:r!==1&&(r=1):a>-1&&(r=-1)}return a<0||n<0||r===0||r===1&&a===n-1&&a===s+1?"":t.slice(a,n)}function WF(...t){let e=-1,n;for(;++e<t.length;)Ru(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":qF(n)}function qF(t){Ru(t);const e=t.codePointAt(0)===47;let n=VF(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function VF(t,e){let n="",s=0,a=-1,r=0,i=-1,c,d;for(;++i<=t.length;){if(i<t.length)c=t.codePointAt(i);else{if(c===47)break;c=47}if(c===47){if(!(a===i-1||r===1))if(a!==i-1&&r===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),a=i,r=0;continue}}else if(n.length>0){n="",s=0,a=i,r=0;continue}}e&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+t.slice(a+1,i):n=t.slice(a+1,i),s=i-a-1;a=i,r=0}else c===46&&r>-1?r++:r=-1}return n}function Ru(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const GF={cwd:YF};function YF(){return"/"}function Db(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function KF(t){if(typeof t=="string")t=new URL(t);else if(!Db(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return QF(t)}function QF(t){if(t.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const s=e.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(e)}const yg=["history","path","basename","stem","extname","dirname"];class RN{constructor(e){let n;e?Db(e)?n={path:e}:typeof e=="string"||XF(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":GF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<yg.length;){const r=yg[s];r in n&&n[r]!==void 0&&n[r]!==null&&(this[r]=r==="history"?[...n[r]]:n[r])}let a;for(a in n)yg.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ua.basename(this.path):void 0}set basename(e){wg(e,"basename"),vg(e,"basename"),this.path=Ua.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ua.dirname(this.path):void 0}set dirname(e){FS(this.basename,"dirname"),this.path=Ua.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ua.extname(this.path):void 0}set extname(e){if(vg(e,"extname"),FS(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ua.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Db(e)&&(e=KF(e)),wg(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ua.basename(this.path,this.extname):void 0}set stem(e){wg(e,"stem"),vg(e,"stem"),this.path=Ua.join(this.dirname||"",e+(this.extname||""))}fail(e,n,s){const a=this.message(e,n,s);throw a.fatal=!0,a}info(e,n,s){const a=this.message(e,n,s);return a.fatal=void 0,a}message(e,n,s){const a=new vs(e,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function vg(t,e){if(t&&t.includes(Ua.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ua.sep+"`")}function wg(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function FS(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function XF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const JF=(function(t){const s=this.constructor.prototype,a=s[t],r=function(){return a.apply(r,arguments)};return Object.setPrototypeOf(r,s),r}),ZF={}.hasOwnProperty;class Tx extends JF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=FF()}copy(){const e=new Tx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];e.use(...s)}return e.data(xg(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(Cg("data",this.frozen),this.namespace[e]=n,this):ZF.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Cg("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(e,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=af(e),s=this.parser||this.Parser;return kg("parse",s),s(String(n),n)}process(e,n){const s=this;return this.freeze(),kg("process",this.parser||this.Parser),Sg("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(r,i){const c=af(e),d=s.parse(c);s.run(d,c,function(h,m,x){if(h||!m||!x)return f(h);const y=m,v=s.stringify(y,x);n8(v)?x.value=v:x.result=v,f(h,x)});function f(h,m){h||!m?i(h):r?r(m):n(void 0,m)}}}processSync(e){let n=!1,s;return this.freeze(),kg("processSync",this.parser||this.Parser),Sg("processSync",this.compiler||this.Compiler),this.process(e,a),$S("processSync","process",n),s;function a(r,i){n=!0,IS(r),s=i}}run(e,n,s){zS(e),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?r(void 0,s):new Promise(r);function r(i,c){const d=af(n);a.run(e,d,f);function f(h,m,x){const y=m||e;h?c(h):i?i(y):s(void 0,y,x)}}}runSync(e,n){let s=!1,a;return this.run(e,n,r),$S("runSync","run",s),a;function r(i,c){IS(i),a=c,s=!0}}stringify(e,n){this.freeze();const s=af(n),a=this.compiler||this.Compiler;return Sg("stringify",a),zS(e),a(e,s)}use(e,...n){const s=this.attachers,a=this.namespace;if(Cg("use",this.frozen),e!=null)if(typeof e=="function")d(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):i(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function r(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[h,...m]=f;d(h,m)}else i(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function i(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(a.settings=xg(!0,a.settings,f.settings))}function c(f){let h=-1;if(f!=null)if(Array.isArray(f))for(;++h<f.length;){const m=f[h];r(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,h){let m=-1,x=-1;for(;++m<s.length;)if(s[m][0]===f){x=m;break}if(x===-1)s.push([f,...h]);else if(h.length>0){let[y,...v]=h;const S=s[x][1];Mb(S)&&Mb(y)&&(y=xg(!0,S,y)),s[x]=[f,y,...v]}}}}const e8=new Tx().freeze();function kg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Sg(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Cg(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zS(t){if(!Mb(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function $S(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function af(t){return t8(t)?t:new RN(t)}function t8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function n8(t){return typeof t=="string"||s8(t)}function s8(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const a8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",HS=[],US={allowDangerousHtml:!0},r8=/^(https?|ircs?|mailto|xmpp)$/i,i8=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Mr(t){const e=o8(t),n=l8(t);return c8(e.runSync(e.parse(n),n),t)}function o8(t){const e=t.rehypePlugins||HS,n=t.remarkPlugins||HS,s=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...US}:US;return e8().use(HB).use(n).use(PF,s).use(e)}function l8(t){const e=t.children||"",n=new RN;return typeof e=="string"&&(n.value=e),n}function c8(t,e){const n=e.allowedElements,s=e.allowElement,a=e.components,r=e.disallowedElements,i=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||u8;for(const h of i8)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+a8+h.id,void 0);return Nx(t,f),AP(t,{Fragment:o.Fragment,components:a,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function f(h,m,x){if(h.type==="raw"&&x&&typeof m=="number")return i?x.children.splice(m,1):x.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let y;for(y in hg)if(Object.hasOwn(hg,y)&&Object.hasOwn(h.properties,y)){const v=h.properties[y],S=hg[y];(S===null||S.includes(h.tagName))&&(h.properties[y]=d(String(v||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):r?r.includes(h.tagName):!1;if(!y&&s&&typeof m=="number"&&(y=!s(h,m,x)),y&&x&&typeof m=="number")return c&&h.children?x.children.splice(m,1,...h.children):x.children.splice(m,1),m}}}function u8(t){const e=t.indexOf(":"),n=t.indexOf("?"),s=t.indexOf("#"),a=t.indexOf("/");return e===-1||a!==-1&&e>a||n!==-1&&e>n||s!==-1&&e>s||r8.test(t.slice(0,e))?t:""}function WS(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let s=0,a=n.indexOf(e);for(;a!==-1;)s++,a=n.indexOf(e,a+e.length);return s}function d8(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function f8(t,e,n){const a=Cp((n||{}).ignore||[]),r=p8(e);let i=-1;for(;++i<r.length;)DN(t,"text",c);function c(f,h){let m=-1,x;for(;++m<h.length;){const y=h[m],v=x?x.children:void 0;if(a(y,v?v.indexOf(y):void 0,x))return;x=y}if(x)return d(f,h)}function d(f,h){const m=h[h.length-1],x=r[i][0],y=r[i][1];let v=0;const A=m.children.indexOf(f);let k=!1,N=[];x.lastIndex=0;let j=x.exec(f.value);for(;j;){const E=j.index,D={index:j.index,input:j.input,stack:[...h,f]};let _=y(...j,D);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?x.lastIndex=E+1:(v!==E&&N.push({type:"text",value:f.value.slice(v,E)}),Array.isArray(_)?N.push(..._):_&&N.push(_),v=E+j[0].length,k=!0),!x.global)break;j=x.exec(f.value)}return k?(v<f.value.length&&N.push({type:"text",value:f.value.slice(v)}),m.children.splice(A,1,...N)):N=[f],A+N.length}}function p8(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let s=-1;for(;++s<n.length;){const a=n[s];e.push([h8(a[0]),m8(a[1])])}return e}function h8(t){return typeof t=="string"?new RegExp(d8(t),"g"):t}function m8(t){return typeof t=="function"?t:function(){return t}}const Ag="phrasing",jg=["autolink","link","image","label"];function g8(){return{transforms:[S8],enter:{literalAutolink:x8,literalAutolinkEmail:Ng,literalAutolinkHttp:Ng,literalAutolinkWww:Ng},exit:{literalAutolink:k8,literalAutolinkEmail:w8,literalAutolinkHttp:y8,literalAutolinkWww:v8}}}function b8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ag,notInConstruct:jg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ag,notInConstruct:jg},{character:":",before:"[ps]",after:"\\/",inConstruct:Ag,notInConstruct:jg}]}}function x8(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Ng(t){this.config.enter.autolinkProtocol.call(this,t)}function y8(t){this.config.exit.autolinkProtocol.call(this,t)}function v8(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function w8(t){this.config.exit.autolinkEmail.call(this,t)}function k8(t){this.exit(t)}function S8(t){f8(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,C8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),A8]],{ignore:["link","linkReference"]})}function C8(t,e,n,s,a){let r="";if(!ON(a)||(/^w/i.test(e)&&(n=e+n,e="",r="http://"),!j8(n)))return!1;const i=N8(n+s);if(!i[0])return!1;const c={type:"link",title:null,url:r+e+i[0],children:[{type:"text",value:e+i[0]}]};return i[1]?[c,{type:"text",value:i[1]}]:c}function A8(t,e,n,s){return!ON(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function j8(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function N8(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],s=n.indexOf(")");const a=WS(t,"(");let r=WS(t,")");for(;s!==-1&&a>r;)t+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),r++;return[t,n]}function ON(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||co(n)||wp(n))&&(!e||n!==47)}LN.peek=P8;function T8(){this.buffer()}function _8(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function E8(){this.buffer()}function M8(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function D8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Da(this.sliceSerialize(t)).toLowerCase(),n.label=e}function R8(t){this.exit(t)}function O8(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Da(this.sliceSerialize(t)).toLowerCase(),n.label=e}function L8(t){this.exit(t)}function P8(){return"["}function LN(t,e,n,s){const a=n.createTracker(s);let r=a.move("[^");const i=n.enter("footnoteReference"),c=n.enter("reference");return r+=a.move(n.safe(n.associationId(t),{after:"]",before:r})),c(),i(),r+=a.move("]"),r}function I8(){return{enter:{gfmFootnoteCallString:T8,gfmFootnoteCall:_8,gfmFootnoteDefinitionLabelString:E8,gfmFootnoteDefinition:M8},exit:{gfmFootnoteCallString:D8,gfmFootnoteCall:R8,gfmFootnoteDefinitionLabelString:O8,gfmFootnoteDefinition:L8}}}function B8(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:LN},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,a,r,i){const c=r.createTracker(i);let d=c.move("[^");const f=r.enter("footnoteDefinition"),h=r.enter("label");return d+=c.move(r.safe(r.associationId(s),{before:d,after:"]"})),h(),d+=c.move("]:"),s.children&&s.children.length>0&&(c.shift(4),d+=c.move((e?`
|
|
61
|
+
`:" ")+r.indentLines(r.containerFlow(s,c.current()),e?PN:F8))),f(),d}}function F8(t,e,n){return e===0?t:PN(t,e,n)}function PN(t,e,n){return(n?"":" ")+t}const z8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];IN.peek=q8;function $8(){return{canContainEols:["delete"],enter:{strikethrough:U8},exit:{strikethrough:W8}}}function H8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:z8}],handlers:{delete:IN}}}function U8(t){this.enter({type:"delete",children:[]},t)}function W8(t){this.exit(t)}function IN(t,e,n,s){const a=n.createTracker(s),r=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(t,{...a.current(),before:i,after:"~"}),i+=a.move("~~"),r(),i}function q8(){return"~"}function V8(t){return t.length}function G8(t,e){const n=e||{},s=(n.align||[]).concat(),a=n.stringLength||V8,r=[],i=[],c=[],d=[];let f=0,h=-1;for(;++h<t.length;){const S=[],A=[];let k=-1;for(t[h].length>f&&(f=t[h].length);++k<t[h].length;){const N=Y8(t[h][k]);if(n.alignDelimiters!==!1){const j=a(N);A[k]=j,(d[k]===void 0||j>d[k])&&(d[k]=j)}S.push(N)}i[h]=S,c[h]=A}let m=-1;if(typeof s=="object"&&"length"in s)for(;++m<f;)r[m]=qS(s[m]);else{const S=qS(s);for(;++m<f;)r[m]=S}m=-1;const x=[],y=[];for(;++m<f;){const S=r[m];let A="",k="";S===99?(A=":",k=":"):S===108?A=":":S===114&&(k=":");let N=n.alignDelimiters===!1?1:Math.max(1,d[m]-A.length-k.length);const j=A+"-".repeat(N)+k;n.alignDelimiters!==!1&&(N=A.length+N+k.length,N>d[m]&&(d[m]=N),y[m]=N),x[m]=j}i.splice(1,0,x),c.splice(1,0,y),h=-1;const v=[];for(;++h<i.length;){const S=i[h],A=c[h];m=-1;const k=[];for(;++m<f;){const N=S[m]||"";let j="",E="";if(n.alignDelimiters!==!1){const D=d[m]-(A[m]||0),_=r[m];_===114?j=" ".repeat(D):_===99?D%2?(j=" ".repeat(D/2+.5),E=" ".repeat(D/2-.5)):(j=" ".repeat(D/2),E=j):E=" ".repeat(D)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(j),k.push(N),n.alignDelimiters!==!1&&k.push(E),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==f-1)&&k.push("|")}v.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return v.join(`
|
|
62
|
+
`)}function Y8(t){return t==null?"":String(t)}function qS(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function K8(t,e,n,s){const a=n.enter("blockquote"),r=n.createTracker(s);r.move("> "),r.shift(2);const i=n.indentLines(n.containerFlow(t,r.current()),Q8);return a(),i}function Q8(t,e,n){return">"+(n?"":" ")+t}function X8(t,e){return VS(t,e.inConstruct,!0)&&!VS(t,e.notInConstruct,!1)}function VS(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let s=-1;for(;++s<e.length;)if(t.includes(e[s]))return!0;return!1}function GS(t,e,n,s){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
63
|
+
`&&X8(n.stack,n.unsafe[a]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
64
|
+
`}function J8(t,e){const n=String(t);let s=n.indexOf(e),a=s,r=0,i=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===a?++r>i&&(i=r):r=1,a=s+e.length,s=n.indexOf(e,a);return i}function Z8(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function e9(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function t9(t,e,n,s){const a=e9(n),r=t.value||"",i=a==="`"?"GraveAccent":"Tilde";if(Z8(t,n)){const m=n.enter("codeIndented"),x=n.indentLines(r,n9);return m(),x}const c=n.createTracker(s),d=a.repeat(Math.max(J8(r,a)+1,3)),f=n.enter("codeFenced");let h=c.move(d);if(t.lang){const m=n.enter(`codeFencedLang${i}`);h+=c.move(n.safe(t.lang,{before:h,after:" ",encode:["`"],...c.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${i}`);h+=c.move(" "),h+=c.move(n.safe(t.meta,{before:h,after:`
|
|
65
|
+
`,encode:["`"],...c.current()})),m()}return h+=c.move(`
|
|
66
|
+
`),r&&(h+=c.move(r+`
|
|
67
|
+
`)),h+=c.move(d),f(),h}function n9(t,e,n){return(n?"":" ")+t}function _x(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function s9(t,e,n,s){const a=_x(n),r=a==='"'?"Quote":"Apostrophe",i=n.enter("definition");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("[");return f+=d.move(n.safe(n.associationId(t),{before:f,after:"]",...d.current()})),f+=d.move("]: "),c(),!t.url||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(t.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(t.url,{before:f,after:t.title?" ":`
|
|
68
|
+
`,...d.current()}))),c(),t.title&&(c=n.enter(`title${r}`),f+=d.move(" "+a),f+=d.move(n.safe(t.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),i(),f}function a9(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Cu(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Yf(t,e,n){const s=wl(t),a=wl(e);return s===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}BN.peek=r9;function BN(t,e,n,s){const a=a9(n),r=n.enter("emphasis"),i=n.createTracker(s),c=i.move(a);let d=i.move(n.containerPhrasing(t,{after:a,before:c,...i.current()}));const f=d.charCodeAt(0),h=Yf(s.before.charCodeAt(s.before.length-1),f,a);h.inside&&(d=Cu(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Yf(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+Cu(m));const y=i.move(a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function r9(t,e,n){return n.options.emphasis||"*"}function i9(t,e){let n=!1;return Nx(t,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,_b}),!!((!t.depth||t.depth<3)&&vx(t)&&(e.options.setext||n))}function o9(t,e,n,s){const a=Math.max(Math.min(6,t.depth||1),1),r=n.createTracker(s);if(i9(t,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),x=n.containerPhrasing(t,{...r.current(),before:`
|
|
69
|
+
`,after:`
|
|
70
|
+
`});return m(),h(),x+`
|
|
71
|
+
`+(a===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
|
|
72
|
+
`))+1))}const i="#".repeat(a),c=n.enter("headingAtx"),d=n.enter("phrasing");r.move(i+" ");let f=n.containerPhrasing(t,{before:"# ",after:`
|
|
73
|
+
`,...r.current()});return/^[\t ]/.test(f)&&(f=Cu(f.charCodeAt(0))+f.slice(1)),f=f?i+" "+f:i,n.options.closeAtx&&(f+=" "+i),d(),c(),f}FN.peek=l9;function FN(t){return t.value||""}function l9(){return"<"}zN.peek=c9;function zN(t,e,n,s){const a=_x(n),r=a==='"'?"Quote":"Apostrophe",i=n.enter("image");let c=n.enter("label");const d=n.createTracker(s);let f=d.move("![");return f+=d.move(n.safe(t.alt,{before:f,after:"]",...d.current()})),f+=d.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(n.safe(t.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(c=n.enter("destinationRaw"),f+=d.move(n.safe(t.url,{before:f,after:t.title?" ":")",...d.current()}))),c(),t.title&&(c=n.enter(`title${r}`),f+=d.move(" "+a),f+=d.move(n.safe(t.title,{before:f,after:a,...d.current()})),f+=d.move(a),c()),f+=d.move(")"),i(),f}function c9(){return"!"}$N.peek=u9;function $N(t,e,n,s){const a=t.referenceType,r=n.enter("imageReference");let i=n.enter("label");const c=n.createTracker(s);let d=c.move("![");const f=n.safe(t.alt,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return i(),n.stack=h,r(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function u9(){return"!"}HN.peek=d9;function HN(t,e,n){let s=t.value||"",a="`",r=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(s);)a+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++r<n.unsafe.length;){const i=n.unsafe[r],c=n.compilePattern(i);let d;if(i.atBreak)for(;d=c.exec(s);){let f=d.index;s.charCodeAt(f)===10&&s.charCodeAt(f-1)===13&&f--,s=s.slice(0,f)+" "+s.slice(d.index+1)}}return a+s+a}function d9(){return"`"}function UN(t,e){const n=vx(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}WN.peek=f9;function WN(t,e,n,s){const a=_x(n),r=a==='"'?"Quote":"Apostrophe",i=n.createTracker(s);let c,d;if(UN(t,n)){const h=n.stack;n.stack=[],c=n.enter("autolink");let m=i.move("<");return m+=i.move(n.containerPhrasing(t,{before:m,after:">",...i.current()})),m+=i.move(">"),c(),n.stack=h,m}c=n.enter("link"),d=n.enter("label");let f=i.move("[");return f+=i.move(n.containerPhrasing(t,{before:f,after:"](",...i.current()})),f+=i.move("]("),d(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(d=n.enter("destinationLiteral"),f+=i.move("<"),f+=i.move(n.safe(t.url,{before:f,after:">",...i.current()})),f+=i.move(">")):(d=n.enter("destinationRaw"),f+=i.move(n.safe(t.url,{before:f,after:t.title?" ":")",...i.current()}))),d(),t.title&&(d=n.enter(`title${r}`),f+=i.move(" "+a),f+=i.move(n.safe(t.title,{before:f,after:a,...i.current()})),f+=i.move(a),d()),f+=i.move(")"),c(),f}function f9(t,e,n){return UN(t,n)?"<":"["}qN.peek=p9;function qN(t,e,n,s){const a=t.referenceType,r=n.enter("linkReference");let i=n.enter("label");const c=n.createTracker(s);let d=c.move("[");const f=n.containerPhrasing(t,{before:d,after:"]",...c.current()});d+=c.move(f+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(t),{before:d,after:"]",...c.current()});return i(),n.stack=h,r(),a==="full"||!f||f!==m?d+=c.move(m+"]"):a==="shortcut"?d=d.slice(0,-1):d+=c.move("]"),d}function p9(){return"["}function Ex(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function h9(t){const e=Ex(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function m9(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function VN(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function g9(t,e,n,s){const a=n.enter("list"),r=n.bulletCurrent;let i=t.ordered?m9(n):Ex(n);const c=t.ordered?i==="."?")":".":h9(n);let d=e&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!t.ordered){const h=t.children?t.children[0]:void 0;if((i==="*"||i==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(d=!0),VN(n)===i&&h){let m=-1;for(;++m<t.children.length;){const x=t.children[m];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){d=!0;break}}}}d&&(i=c),n.bulletCurrent=i;const f=n.containerFlow(t,s);return n.bulletLastUsed=i,n.bulletCurrent=r,a(),f}function b9(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function x9(t,e,n,s){const a=b9(n);let r=n.bulletCurrent||Ex(n);e&&e.type==="list"&&e.ordered&&(r=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+r);let i=r.length+1;(a==="tab"||a==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(i=Math.ceil(i/4)*4);const c=n.createTracker(s);c.move(r+" ".repeat(i-r.length)),c.shift(i);const d=n.enter("listItem"),f=n.indentLines(n.containerFlow(t,c.current()),h);return d(),f;function h(m,x,y){return x?(y?"":" ".repeat(i))+m:(y?r:r+" ".repeat(i-r.length))+m}}function y9(t,e,n,s){const a=n.enter("paragraph"),r=n.enter("phrasing"),i=n.containerPhrasing(t,s);return r(),a(),i}const v9=Cp(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function w9(t,e,n,s){return(t.children.some(function(i){return v9(i)})?n.containerPhrasing:n.containerFlow).call(n,t,s)}function k9(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}GN.peek=S9;function GN(t,e,n,s){const a=k9(n),r=n.enter("strong"),i=n.createTracker(s),c=i.move(a+a);let d=i.move(n.containerPhrasing(t,{after:a,before:c,...i.current()}));const f=d.charCodeAt(0),h=Yf(s.before.charCodeAt(s.before.length-1),f,a);h.inside&&(d=Cu(f)+d.slice(1));const m=d.charCodeAt(d.length-1),x=Yf(s.after.charCodeAt(0),m,a);x.inside&&(d=d.slice(0,-1)+Cu(m));const y=i.move(a+a);return r(),n.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+d+y}function S9(t,e,n){return n.options.strong||"*"}function C9(t,e,n,s){return n.safe(t.value,s)}function A9(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function j9(t,e,n){const s=(VN(n)+(n.options.ruleSpaces?" ":"")).repeat(A9(n));return n.options.ruleSpaces?s.slice(0,-1):s}const YN={blockquote:K8,break:GS,code:t9,definition:s9,emphasis:BN,hardBreak:GS,heading:o9,html:FN,image:zN,imageReference:$N,inlineCode:HN,link:WN,linkReference:qN,list:g9,listItem:x9,paragraph:y9,root:w9,strong:GN,text:C9,thematicBreak:j9};function N9(){return{enter:{table:T9,tableData:YS,tableHeader:YS,tableRow:E9},exit:{codeText:M9,table:_9,tableData:Tg,tableHeader:Tg,tableRow:Tg}}}function T9(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function _9(t){this.exit(t),this.data.inTable=void 0}function E9(t){this.enter({type:"tableRow",children:[]},t)}function Tg(t){this.exit(t)}function YS(t){this.enter({type:"tableCell",children:[]},t)}function M9(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,D9));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function D9(t,e){return e==="|"?e:t}function R9(t){const e=t||{},n=e.tableCellPadding,s=e.tablePipeAlign,a=e.stringLength,r=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
74
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:i,tableCell:d,tableRow:c}};function i(y,v,S,A){return f(h(y,S,A),y.align)}function c(y,v,S,A){const k=m(y,S,A),N=f([k]);return N.slice(0,N.indexOf(`
|
|
75
|
+
`))}function d(y,v,S,A){const k=S.enter("tableCell"),N=S.enter("phrasing"),j=S.containerPhrasing(y,{...A,before:r,after:r});return N(),k(),j}function f(y,v){return G8(y,{align:v,alignDelimiters:s,padding:n,stringLength:a})}function h(y,v,S){const A=y.children;let k=-1;const N=[],j=v.enter("table");for(;++k<A.length;)N[k]=m(A[k],v,S);return j(),N}function m(y,v,S){const A=y.children;let k=-1;const N=[],j=v.enter("tableRow");for(;++k<A.length;)N[k]=d(A[k],y,v,S);return j(),N}function x(y,v,S){let A=YN.inlineCode(y,v,S);return S.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function O9(){return{exit:{taskListCheckValueChecked:KS,taskListCheckValueUnchecked:KS,paragraph:P9}}}function L9(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I9}}}function KS(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function P9(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const a=e.children;let r=-1,i;for(;++r<a.length;){const c=a[r];if(c.type==="paragraph"){i=c;break}}i===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(t)}function I9(t,e,n,s){const a=t.children[0],r=typeof t.checked=="boolean"&&a&&a.type==="paragraph",i="["+(t.checked?"x":" ")+"] ",c=n.createTracker(s);r&&c.move(i);let d=YN.listItem(t,e,n,{...s,...c.current()});return r&&(d=d.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),d;function f(h){return h+i}}function B9(){return[g8(),I8(),$8(),N9(),O9()]}function F9(t){return{extensions:[b8(),B8(t),H8(),R9(t),L9()]}}const z9={tokenize:V9,partial:!0},KN={tokenize:G9,partial:!0},QN={tokenize:Y9,partial:!0},XN={tokenize:K9,partial:!0},$9={tokenize:Q9,partial:!0},JN={name:"wwwAutolink",tokenize:W9,previous:e1},ZN={name:"protocolAutolink",tokenize:q9,previous:t1},Br={name:"emailAutolink",tokenize:U9,previous:n1},or={};function H9(){return{text:or}}let Yi=48;for(;Yi<123;)or[Yi]=Br,Yi++,Yi===58?Yi=65:Yi===91&&(Yi=97);or[43]=Br;or[45]=Br;or[46]=Br;or[95]=Br;or[72]=[Br,ZN];or[104]=[Br,ZN];or[87]=[Br,JN];or[119]=[Br,JN];function U9(t,e,n){const s=this;let a,r;return i;function i(m){return!Rb(m)||!n1.call(s,s.previous)||Mx(s.events)?n(m):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),c(m))}function c(m){return Rb(m)?(t.consume(m),c):m===64?(t.consume(m),d):n(m)}function d(m){return m===46?t.check($9,h,f)(m):m===45||m===95||ys(m)?(r=!0,t.consume(m),d):h(m)}function f(m){return t.consume(m),a=!0,d}function h(m){return r&&a&&js(s.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(m)):n(m)}}function W9(t,e,n){const s=this;return a;function a(i){return i!==87&&i!==119||!e1.call(s,s.previous)||Mx(s.events)?n(i):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(z9,t.attempt(KN,t.attempt(QN,r),n),n)(i))}function r(i){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(i)}}function q9(t,e,n){const s=this;let a="",r=!1;return i;function i(m){return(m===72||m===104)&&t1.call(s,s.previous)&&!Mx(s.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),t.consume(m),c):n(m)}function c(m){if(js(m)&&a.length<5)return a+=String.fromCodePoint(m),t.consume(m),c;if(m===58){const x=a.toLowerCase();if(x==="http"||x==="https")return t.consume(m),d}return n(m)}function d(m){return m===47?(t.consume(m),r?f:(r=!0,d)):n(m)}function f(m){return m===null||qf(m)||An(m)||co(m)||wp(m)?n(m):t.attempt(KN,t.attempt(QN,h),n)(m)}function h(m){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(m)}}function V9(t,e,n){let s=0;return a;function a(i){return(i===87||i===119)&&s<3?(s++,t.consume(i),a):i===46&&s===3?(t.consume(i),r):n(i)}function r(i){return i===null?n(i):e(i)}}function G9(t,e,n){let s,a,r;return i;function i(f){return f===46||f===95?t.check(XN,d,c)(f):f===null||An(f)||co(f)||f!==45&&wp(f)?d(f):(r=!0,t.consume(f),i)}function c(f){return f===95?s=!0:(a=s,s=void 0),t.consume(f),i}function d(f){return a||s||!r?n(f):e(f)}}function Y9(t,e){let n=0,s=0;return a;function a(i){return i===40?(n++,t.consume(i),a):i===41&&s<n?r(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?t.check(XN,e,r)(i):i===null||An(i)||co(i)?e(i):(t.consume(i),a)}function r(i){return i===41&&s++,t.consume(i),a}}function K9(t,e,n){return s;function s(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(t.consume(c),s):c===38?(t.consume(c),r):c===93?(t.consume(c),a):c===60||c===null||An(c)||co(c)?e(c):n(c)}function a(c){return c===null||c===40||c===91||An(c)||co(c)?e(c):s(c)}function r(c){return js(c)?i(c):n(c)}function i(c){return c===59?(t.consume(c),s):js(c)?(t.consume(c),i):n(c)}}function Q9(t,e,n){return s;function s(r){return t.consume(r),a}function a(r){return ys(r)?n(r):e(r)}}function e1(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||An(t)}function t1(t){return!js(t)}function n1(t){return!(t===47||Rb(t))}function Rb(t){return t===43||t===45||t===46||t===95||ys(t)}function Mx(t){let e=t.length,n=!1;for(;e--;){const s=t[e][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const X9={tokenize:r4,partial:!0};function J9(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:n4,continuation:{tokenize:s4},exit:a4}},text:{91:{name:"gfmFootnoteCall",tokenize:t4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Z9,resolveTo:e4}}}}function Z9(t,e,n){const s=this;let a=s.events.length;const r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i;for(;a--;){const d=s.events[a][1];if(d.type==="labelImage"){i=d;break}if(d.type==="gfmFootnoteCall"||d.type==="labelLink"||d.type==="label"||d.type==="image"||d.type==="link")break}return c;function c(d){if(!i||!i._balanced)return n(d);const f=Da(s.sliceSerialize({start:i.end,end:s.now()}));return f.codePointAt(0)!==94||!r.includes(f.slice(1))?n(d):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),e(d))}}function e4(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const r={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},t[t.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},r.start),end:Object.assign({},r.end)},c=[t[n+1],t[n+2],["enter",s,e],t[n+3],t[n+4],["enter",a,e],["exit",a,e],["enter",r,e],["enter",i,e],["exit",i,e],["exit",r,e],t[t.length-2],t[t.length-1],["exit",s,e]];return t.splice(n,t.length-n+1,...c),t}function t4(t,e,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r=0,i;return c;function c(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),d}function d(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",f)}function f(m){if(r>999||m===93&&!i||m===null||m===91||An(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteCallString");return a.includes(Da(s.sliceSerialize(x)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return An(m)||(i=!0),r++,t.consume(m),m===92?h:f}function h(m){return m===91||m===92||m===93?(t.consume(m),r++,f):f(m)}}function n4(t,e,n){const s=this,a=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let r,i=0,c;return d;function d(v){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(v){return v===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",h):n(v)}function h(v){if(i>999||v===93&&!c||v===null||v===91||An(v))return n(v);if(v===93){t.exit("chunkString");const S=t.exit("gfmFootnoteDefinitionLabelString");return r=Da(s.sliceSerialize(S)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(v),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),x}return An(v)||(c=!0),i++,t.consume(v),v===92?m:h}function m(v){return v===91||v===92||v===93?(t.consume(v),i++,h):h(v)}function x(v){return v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),a.includes(r)||a.push(r),on(t,y,"gfmFootnoteDefinitionWhitespace")):n(v)}function y(v){return e(v)}}function s4(t,e,n){return t.check(Du,e,t.attempt(X9,e,n))}function a4(t){t.exit("gfmFootnoteDefinition")}function r4(t,e,n){const s=this;return on(t,a,"gfmFootnoteDefinitionIndent",5);function a(r){const i=s.events[s.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?e(r):n(r)}}function i4(t){let n=(t||{}).singleTilde;const s={name:"strikethrough",tokenize:r,resolveAll:a};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function a(i,c){let d=-1;for(;++d<i.length;)if(i[d][0]==="enter"&&i[d][1].type==="strikethroughSequenceTemporary"&&i[d][1]._close){let f=d;for(;f--;)if(i[f][0]==="exit"&&i[f][1].type==="strikethroughSequenceTemporary"&&i[f][1]._open&&i[d][1].end.offset-i[d][1].start.offset===i[f][1].end.offset-i[f][1].start.offset){i[d][1].type="strikethroughSequence",i[f][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},i[f][1].start),end:Object.assign({},i[d][1].end)},m={type:"strikethroughText",start:Object.assign({},i[f][1].end),end:Object.assign({},i[d][1].start)},x=[["enter",h,c],["enter",i[f][1],c],["exit",i[f][1],c],["enter",m,c]],y=c.parser.constructs.insideSpan.null;y&&na(x,x.length,0,kp(y,i.slice(f+1,d),c)),na(x,x.length,0,[["exit",m,c],["enter",i[d][1],c],["exit",i[d][1],c],["exit",h,c]]),na(i,f-1,d-f+3,x),d=f+x.length-2;break}}for(d=-1;++d<i.length;)i[d][1].type==="strikethroughSequenceTemporary"&&(i[d][1].type="data");return i}function r(i,c,d){const f=this.previous,h=this.events;let m=0;return x;function x(v){return f===126&&h[h.length-1][1].type!=="characterEscape"?d(v):(i.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const S=wl(f);if(v===126)return m>1?d(v):(i.consume(v),m++,y);if(m<2&&!n)return d(v);const A=i.exit("strikethroughSequenceTemporary"),k=wl(v);return A._open=!k||k===2&&!!S,A._close=!S||S===2&&!!k,c(v)}}}class o4{constructor(){this.map=[]}add(e,n,s){l4(this,e,n,s)}consume(e){if(this.map.sort(function(r,i){return r[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];s.push(e.slice()),e.length=0;let a=s.pop();for(;a;){for(const r of a)e.push(r);a=s.pop()}this.map.length=0}}function l4(t,e,n,s){let a=0;if(!(n===0&&s.length===0)){for(;a<t.map.length;){if(t.map[a][0]===e){t.map[a][1]+=n,t.map[a][2].push(...s);return}a+=1}t.map.push([e,n,s])}}function c4(t,e){let n=!1;const s=[];for(;e<t.length;){const a=t[e];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&s.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const r=s.length-1;s[r]=s[r]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return s}function u4(){return{flow:{null:{name:"table",tokenize:d4,resolveAll:f4}}}}function d4(t,e,n){const s=this;let a=0,r=0,i;return c;function c(M){let R=s.events.length-1;for(;R>-1;){const U=s.events[R][1].type;if(U==="lineEnding"||U==="linePrefix")R--;else break}const F=R>-1?s.events[R][1].type:null,$=F==="tableHead"||F==="tableRow"?_:d;return $===_&&s.parser.lazy[s.now().line]?n(M):$(M)}function d(M){return t.enter("tableHead"),t.enter("tableRow"),f(M)}function f(M){return M===124||(i=!0,r+=1),h(M)}function h(M){return M===null?n(M):Dt(M)?r>1?(r=0,s.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),y):n(M):Zt(M)?on(t,h,"whitespace")(M):(r+=1,i&&(i=!1,a+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),i=!0,h):(t.enter("data"),m(M)))}function m(M){return M===null||M===124||An(M)?(t.exit("data"),h(M)):(t.consume(M),M===92?x:m)}function x(M){return M===92||M===124?(t.consume(M),m):m(M)}function y(M){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(M):(t.enter("tableDelimiterRow"),i=!1,Zt(M)?on(t,v,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):v(M))}function v(M){return M===45||M===58?A(M):M===124?(i=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),S):D(M)}function S(M){return Zt(M)?on(t,A,"whitespace")(M):A(M)}function A(M){return M===58?(r+=1,i=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),k):M===45?(r+=1,k(M)):M===null||Dt(M)?E(M):D(M)}function k(M){return M===45?(t.enter("tableDelimiterFiller"),N(M)):D(M)}function N(M){return M===45?(t.consume(M),N):M===58?(i=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),j):(t.exit("tableDelimiterFiller"),j(M))}function j(M){return Zt(M)?on(t,E,"whitespace")(M):E(M)}function E(M){return M===124?v(M):M===null||Dt(M)?!i||a!==r?D(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):D(M)}function D(M){return n(M)}function _(M){return t.enter("tableRow"),B(M)}function B(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),B):M===null||Dt(M)?(t.exit("tableRow"),e(M)):Zt(M)?on(t,B,"whitespace")(M):(t.enter("data"),O(M))}function O(M){return M===null||M===124||An(M)?(t.exit("data"),B(M)):(t.consume(M),M===92?T:O)}function T(M){return M===92||M===124?(t.consume(M),O):O(M)}}function f4(t,e){let n=-1,s=!0,a=0,r=[0,0,0,0],i=[0,0,0,0],c=!1,d=0,f,h,m;const x=new o4;for(;++n<t.length;){const y=t[n],v=y[1];y[0]==="enter"?v.type==="tableHead"?(c=!1,d!==0&&(QS(x,e,d,f,h),h=void 0,d=0),f={type:"table",start:Object.assign({},v.start),end:Object.assign({},v.end)},x.add(n,0,[["enter",f,e]])):v.type==="tableRow"||v.type==="tableDelimiterRow"?(s=!0,m=void 0,r=[0,0,0,0],i=[0,n+1,0,0],c&&(c=!1,h={type:"tableBody",start:Object.assign({},v.start),end:Object.assign({},v.end)},x.add(n,0,[["enter",h,e]])),a=v.type==="tableDelimiterRow"?2:h?3:1):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")?(s=!1,i[2]===0&&(r[1]!==0&&(i[0]=i[1],m=rf(x,e,r,a,void 0,m),r=[0,0,0,0]),i[2]=n)):v.type==="tableCellDivider"&&(s?s=!1:(r[1]!==0&&(i[0]=i[1],m=rf(x,e,r,a,void 0,m)),r=i,i=[r[1],n,0,0])):v.type==="tableHead"?(c=!0,d=n):v.type==="tableRow"||v.type==="tableDelimiterRow"?(d=n,r[1]!==0?(i[0]=i[1],m=rf(x,e,r,a,n,m)):i[1]!==0&&(m=rf(x,e,i,a,n,m)),a=0):a&&(v.type==="data"||v.type==="tableDelimiterMarker"||v.type==="tableDelimiterFiller")&&(i[3]=n)}for(d!==0&&QS(x,e,d,f,h),x.consume(e.events),n=-1;++n<e.events.length;){const y=e.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=c4(e.events,n))}return t}function rf(t,e,n,s,a,r){const i=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(r.end=Object.assign({},ul(e.events,n[0])),t.add(n[0],0,[["exit",r,e]]));const d=ul(e.events,n[1]);if(r={type:i,start:Object.assign({},d),end:Object.assign({},d)},t.add(n[1],0,[["enter",r,e]]),n[2]!==0){const f=ul(e.events,n[2]),h=ul(e.events,n[3]),m={type:c,start:Object.assign({},f),end:Object.assign({},h)};if(t.add(n[2],0,[["enter",m,e]]),s!==2){const x=e.events[n[2]],y=e.events[n[3]];if(x[1].end=Object.assign({},y[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const v=n[2]+1,S=n[3]-n[2]-1;t.add(v,S,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return a!==void 0&&(r.end=Object.assign({},ul(e.events,a)),t.add(a,0,[["exit",r,e]]),r=void 0),r}function QS(t,e,n,s,a){const r=[],i=ul(e.events,n);a&&(a.end=Object.assign({},i),r.push(["exit",a,e])),s.end=Object.assign({},i),r.push(["exit",s,e]),t.add(n+1,0,r)}function ul(t,e){const n=t[e],s=n[0]==="enter"?"start":"end";return n[1][s]}const p4={name:"tasklistCheck",tokenize:m4};function h4(){return{text:{91:p4}}}function m4(t,e,n){const s=this;return a;function a(d){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(d):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),r)}function r(d){return An(d)?(t.enter("taskListCheckValueUnchecked"),t.consume(d),t.exit("taskListCheckValueUnchecked"),i):d===88||d===120?(t.enter("taskListCheckValueChecked"),t.consume(d),t.exit("taskListCheckValueChecked"),i):n(d)}function i(d){return d===93?(t.enter("taskListCheckMarker"),t.consume(d),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),c):n(d)}function c(d){return Dt(d)?e(d):Zt(d)?t.check({tokenize:g4},e,n)(d):n(d)}}function g4(t,e,n){return on(t,s,"whitespace");function s(a){return a===null?n(a):e(a)}}function b4(t){return pN([H9(),J9(),i4(t),u4(),h4()])}const x4={};function Dr(t){const e=this,n=t||x4,s=e.data(),a=s.micromarkExtensions||(s.micromarkExtensions=[]),r=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),i=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);a.push(b4(n)),r.push(B9()),i.push(F9(n))}var _g={exports:{}},XS;function y4(){return XS||(XS=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
|
|
76
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
77
|
+
*
|
|
78
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
79
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
80
|
+
* @namespace
|
|
81
|
+
* @public
|
|
82
|
+
*/var n=(function(s){var a=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,i={},c={manual:s.Prism&&s.Prism.manual,disableWorkerMessageHandler:s.Prism&&s.Prism.disableWorkerMessageHandler,util:{encode:function N(j){return j instanceof d?new d(j.type,N(j.content),j.alias):Array.isArray(j)?j.map(N):j.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(N){return Object.prototype.toString.call(N).slice(8,-1)},objId:function(N){return N.__id||Object.defineProperty(N,"__id",{value:++r}),N.__id},clone:function N(j,E){E=E||{};var D,_;switch(c.util.type(j)){case"Object":if(_=c.util.objId(j),E[_])return E[_];D={},E[_]=D;for(var B in j)j.hasOwnProperty(B)&&(D[B]=N(j[B],E));return D;case"Array":return _=c.util.objId(j),E[_]?E[_]:(D=[],E[_]=D,j.forEach(function(O,T){D[T]=N(O,E)}),D);default:return j}},getLanguage:function(N){for(;N;){var j=a.exec(N.className);if(j)return j[1].toLowerCase();N=N.parentElement}return"none"},setLanguage:function(N,j){N.className=N.className.replace(RegExp(a,"gi"),""),N.classList.add("language-"+j)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(D){var N=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(D.stack)||[])[1];if(N){var j=document.getElementsByTagName("script");for(var E in j)if(j[E].src==N)return j[E]}return null}},isActive:function(N,j,E){for(var D="no-"+j;N;){var _=N.classList;if(_.contains(j))return!0;if(_.contains(D))return!1;N=N.parentElement}return!!E}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(N,j){var E=c.util.clone(c.languages[N]);for(var D in j)E[D]=j[D];return E},insertBefore:function(N,j,E,D){D=D||c.languages;var _=D[N],B={};for(var O in _)if(_.hasOwnProperty(O)){if(O==j)for(var T in E)E.hasOwnProperty(T)&&(B[T]=E[T]);E.hasOwnProperty(O)||(B[O]=_[O])}var M=D[N];return D[N]=B,c.languages.DFS(c.languages,function(R,F){F===M&&R!=N&&(this[R]=B)}),B},DFS:function N(j,E,D,_){_=_||{};var B=c.util.objId;for(var O in j)if(j.hasOwnProperty(O)){E.call(j,O,j[O],D||O);var T=j[O],M=c.util.type(T);M==="Object"&&!_[B(T)]?(_[B(T)]=!0,N(T,E,null,_)):M==="Array"&&!_[B(T)]&&(_[B(T)]=!0,N(T,E,O,_))}}},plugins:{},highlightAll:function(N,j){c.highlightAllUnder(document,N,j)},highlightAllUnder:function(N,j,E){var D={callback:E,container:N,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",D),D.elements=Array.prototype.slice.apply(D.container.querySelectorAll(D.selector)),c.hooks.run("before-all-elements-highlight",D);for(var _=0,B;B=D.elements[_++];)c.highlightElement(B,j===!0,D.callback)},highlightElement:function(N,j,E){var D=c.util.getLanguage(N),_=c.languages[D];c.util.setLanguage(N,D);var B=N.parentElement;B&&B.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(B,D);var O=N.textContent,T={element:N,language:D,grammar:_,code:O};function M(F){T.highlightedCode=F,c.hooks.run("before-insert",T),T.element.innerHTML=T.highlightedCode,c.hooks.run("after-highlight",T),c.hooks.run("complete",T),E&&E.call(T.element)}if(c.hooks.run("before-sanity-check",T),B=T.element.parentElement,B&&B.nodeName.toLowerCase()==="pre"&&!B.hasAttribute("tabindex")&&B.setAttribute("tabindex","0"),!T.code){c.hooks.run("complete",T),E&&E.call(T.element);return}if(c.hooks.run("before-highlight",T),!T.grammar){M(c.util.encode(T.code));return}if(j&&s.Worker){var R=new Worker(c.filename);R.onmessage=function(F){M(F.data)},R.postMessage(JSON.stringify({language:T.language,code:T.code,immediateClose:!0}))}else M(c.highlight(T.code,T.grammar,T.language))},highlight:function(N,j,E){var D={code:N,grammar:j,language:E};if(c.hooks.run("before-tokenize",D),!D.grammar)throw new Error('The language "'+D.language+'" has no grammar.');return D.tokens=c.tokenize(D.code,D.grammar),c.hooks.run("after-tokenize",D),d.stringify(c.util.encode(D.tokens),D.language)},tokenize:function(N,j){var E=j.rest;if(E){for(var D in E)j[D]=E[D];delete j.rest}var _=new m;return x(_,_.head,N),h(N,_,j,_.head,0),v(_)},hooks:{all:{},add:function(N,j){var E=c.hooks.all;E[N]=E[N]||[],E[N].push(j)},run:function(N,j){var E=c.hooks.all[N];if(!(!E||!E.length))for(var D=0,_;_=E[D++];)_(j)}},Token:d};s.Prism=c;function d(N,j,E,D){this.type=N,this.content=j,this.alias=E,this.length=(D||"").length|0}d.stringify=function N(j,E){if(typeof j=="string")return j;if(Array.isArray(j)){var D="";return j.forEach(function(M){D+=N(M,E)}),D}var _={type:j.type,content:N(j.content,E),tag:"span",classes:["token",j.type],attributes:{},language:E},B=j.alias;B&&(Array.isArray(B)?Array.prototype.push.apply(_.classes,B):_.classes.push(B)),c.hooks.run("wrap",_);var O="";for(var T in _.attributes)O+=" "+T+'="'+(_.attributes[T]||"").replace(/"/g,""")+'"';return"<"+_.tag+' class="'+_.classes.join(" ")+'"'+O+">"+_.content+"</"+_.tag+">"};function f(N,j,E,D){N.lastIndex=j;var _=N.exec(E);if(_&&D&&_[1]){var B=_[1].length;_.index+=B,_[0]=_[0].slice(B)}return _}function h(N,j,E,D,_,B){for(var O in E)if(!(!E.hasOwnProperty(O)||!E[O])){var T=E[O];T=Array.isArray(T)?T:[T];for(var M=0;M<T.length;++M){if(B&&B.cause==O+","+M)return;var R=T[M],F=R.inside,$=!!R.lookbehind,U=!!R.greedy,L=R.alias;if(U&&!R.pattern.global){var z=R.pattern.toString().match(/[imsuy]*$/)[0];R.pattern=RegExp(R.pattern.source,z+"g")}for(var W=R.pattern||R,V=D.next,Y=_;V!==j.tail&&!(B&&Y>=B.reach);Y+=V.value.length,V=V.next){var P=V.value;if(j.length>N.length)return;if(!(P instanceof d)){var K=1,Q;if(U){if(Q=f(W,Y,N,$),!Q||Q.index>=N.length)break;var Z=Q.index,q=Q.index+Q[0].length,be=Y;for(be+=V.value.length;Z>=be;)V=V.next,be+=V.value.length;if(be-=V.value.length,Y=be,V.value instanceof d)continue;for(var ue=V;ue!==j.tail&&(be<q||typeof ue.value=="string");ue=ue.next)K++,be+=ue.value.length;K--,P=N.slice(Y,be),Q.index-=Y}else if(Q=f(W,0,P,$),!Q)continue;var Z=Q.index,de=Q[0],Ce=P.slice(0,Z),xe=P.slice(Z+de.length),Ne=Y+P.length;B&&Ne>B.reach&&(B.reach=Ne);var qe=V.prev;Ce&&(qe=x(j,qe,Ce),Y+=Ce.length),y(j,qe,K);var Ge=new d(O,F?c.tokenize(de,F):de,L,de);if(V=x(j,qe,Ge),xe&&x(j,V,xe),K>1){var X={cause:O+","+M,reach:Ne};h(N,j,E,V.prev,Y,X),B&&X.reach>B.reach&&(B.reach=X.reach)}}}}}}function m(){var N={value:null,prev:null,next:null},j={value:null,prev:N,next:null};N.next=j,this.head=N,this.tail=j,this.length=0}function x(N,j,E){var D=j.next,_={value:E,prev:j,next:D};return j.next=_,D.prev=_,N.length++,_}function y(N,j,E){for(var D=j.next,_=0;_<E&&D!==N.tail;_++)D=D.next;j.next=D,D.prev=j,N.length-=_}function v(N){for(var j=[],E=N.head.next;E!==N.tail;)j.push(E.value),E=E.next;return j}if(!s.document)return s.addEventListener&&(c.disableWorkerMessageHandler||s.addEventListener("message",function(N){var j=JSON.parse(N.data),E=j.language,D=j.code,_=j.immediateClose;s.postMessage(c.highlight(D,c.languages[E],E)),_&&s.close()},!1)),c;var S=c.util.currentScript();S&&(c.filename=S.src,S.hasAttribute("data-manual")&&(c.manual=!0));function A(){c.manual||c.highlightAll()}if(!c.manual){var k=document.readyState;k==="loading"||k==="interactive"&&S&&S.defer?document.addEventListener("DOMContentLoaded",A):window.requestAnimationFrame?window.requestAnimationFrame(A):window.setTimeout(A,16)}return c})(e);t.exports&&(t.exports=n),typeof E0<"u"&&(E0.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",function(s){s.type==="entity"&&(s.attributes.title=s.content.replace(/&/,"&"))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(a,r){var i={};i["language-"+r]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[r]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+r]={pattern:/[\s\S]+/,inside:n.languages[r]};var d={};d[a]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:c},n.languages.insertBefore("markup","cdata",d)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(s,a){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+s+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[a,"language-"+a],inside:n.languages[a]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(s){var a=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+a.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+a.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+a.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+a.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:a,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var r=s.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,(function(){if(typeof n>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var s="Loading…",a=function(S,A){return"✖ Error "+S+" while fetching file: "+A},r="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",d="loading",f="loaded",h="failed",m="pre[data-src]:not(["+c+'="'+f+'"]):not(['+c+'="'+d+'"])';function x(S,A,k){var N=new XMLHttpRequest;N.open("GET",S,!0),N.onreadystatechange=function(){N.readyState==4&&(N.status<400&&N.responseText?A(N.responseText):N.status>=400?k(a(N.status,N.statusText)):k(r))},N.send(null)}function y(S){var A=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(S||"");if(A){var k=Number(A[1]),N=A[2],j=A[3];return N?j?[k,Number(j)]:[k,void 0]:[k,k]}}n.hooks.add("before-highlightall",function(S){S.selector+=", "+m}),n.hooks.add("before-sanity-check",function(S){var A=S.element;if(A.matches(m)){S.code="",A.setAttribute(c,d);var k=A.appendChild(document.createElement("CODE"));k.textContent=s;var N=A.getAttribute("data-src"),j=S.language;if(j==="none"){var E=(/\.(\w+)$/.exec(N)||[,"none"])[1];j=i[E]||E}n.util.setLanguage(k,j),n.util.setLanguage(A,j);var D=n.plugins.autoloader;D&&D.loadLanguages(j),x(N,function(_){A.setAttribute(c,f);var B=y(A.getAttribute("data-range"));if(B){var O=_.split(/\r\n?|\n/g),T=B[0],M=B[1]==null?O.length:B[1];T<0&&(T+=O.length),T=Math.max(0,Math.min(T-1,O.length)),M<0&&(M+=O.length),M=Math.max(0,Math.min(M,O.length)),_=O.slice(T,M).join(`
|
|
83
|
+
`),A.hasAttribute("data-start")||A.setAttribute("data-start",String(T+1))}k.textContent=_,n.highlightElement(k)},function(_){A.setAttribute(c,h),k.textContent=_})}}),n.plugins.fileHighlight={highlight:function(A){for(var k=(A||document).querySelectorAll(m),N=0,j;j=k[N++];)n.highlightElement(j)}};var v=!1;n.fileHighlight=function(){v||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),v=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(_g)),_g.exports}var v4=y4();const sa=Tu(v4);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;var JS={},ZS;function w4(){return ZS||(ZS=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var e=t.languages.extend("typescript",{});delete e["class-name"],t.languages.typescript["class-name"].inside=e,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),t.languages.ts=t.languages.typescript})(Prism)),JS}w4();(function(t){var e=t.util.clone(t.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,s=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,a=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function r(d,f){return d=d.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return s}).replace(/<SPREAD>/g,function(){return a}),RegExp(d,f)}a=r(a).source,t.languages.jsx=t.languages.extend("markup",e),t.languages.jsx.tag.pattern=r(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=e.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:r(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:r(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var i=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(i).join(""):""},c=function(d){for(var f=[],h=0;h<d.length;h++){var m=d[h],x=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?f.length>0&&f[f.length-1].tagName===i(m.content[0].content[1])&&f.pop():m.content[m.content.length-1].content==="/>"||f.push({tagName:i(m.content[0].content[1]),openedBraces:0}):f.length>0&&m.type==="punctuation"&&m.content==="{"?f[f.length-1].openedBraces++:f.length>0&&f[f.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?f[f.length-1].openedBraces--:x=!0),(x||typeof m=="string")&&f.length>0&&f[f.length-1].openedBraces===0){var y=i(m);h<d.length-1&&(typeof d[h+1]=="string"||d[h+1].type==="plain-text")&&(y+=i(d[h+1]),d.splice(h+1,1)),h>0&&(typeof d[h-1]=="string"||d[h-1].type==="plain-text")&&(y=i(d[h-1])+y,d.splice(h-1,1),h--),d[h]=new t.Token("plain-text",y,null,y)}m.content&&typeof m.content!="string"&&c(m.content)}};t.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||c(d.tokens)})})(Prism);(function(t){var e=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",e),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var n=t.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0})(Prism);(function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var n=t.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var e=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+n.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),r=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(c,d){d=(d||"").replace(/m/g,"")+"m";var f=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<value>>/g,function(){return c});return RegExp(f,d)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return s}).replace(/<<key>>/g,function(){return"(?:"+a+"|"+r+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(r),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);var eC={},tC;function k4(){return tC||(tC=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),eC}k4();(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],r=s.variable[1].inside,i=0;i<a.length;i++)r[a[i]]=t.languages.bash[a[i]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);(function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(h){return h=h.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),r=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+r+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+r+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+r+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(m){h!==m&&(t.languages.markdown[h].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function m(x){if(!(!x||typeof x=="string"))for(var y=0,v=x.length;y<v;y++){var S=x[y];if(S.type!=="code"){m(S.content);continue}var A=S.content[1],k=S.content[3];if(A&&k&&A.type==="code-language"&&k.type==="code-block"&&typeof A.content=="string"){var N=A.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");N=(/[a-z][\w-]*/i.exec(N)||[""])[0].toLowerCase();var j="language-"+N;k.alias?typeof k.alias=="string"?k.alias=[k.alias,j]:k.alias.push(j):k.alias=[j]}}}m(h.tokens)}),t.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var m="",x=0,y=h.classes.length;x<y;x++){var v=h.classes[x],S=/language-(.+)/.exec(v);if(S){m=S[1];break}}var A=t.languages[m];if(A)h.content=t.highlight(f(h.content),A,m);else if(m&&m!=="none"&&t.plugins.autoloader){var k="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=k,t.plugins.autoloader.loadLanguages(m,function(){var N=document.getElementById(k);N&&(N.innerHTML=t.highlight(N.textContent,t.languages[m],m))})}}});var i=RegExp(t.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function f(h){var m=h.replace(i,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(x,y){if(y=y.toLowerCase(),y[0]==="#"){var v;return y[1]==="x"?v=parseInt(y.slice(2),16):v=Number(y.slice(1)),d(v)}else{var S=c[y];return S||x}}),m}t.languages.md=t.languages.markdown})(Prism);Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var nC={},sC;function S4(){return sC||(sC=1,(function(t){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,n=0;n<2;n++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),nC}S4();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};const C4={".ts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"jsx",".mjs":"javascript",".cjs":"javascript",".css":"css",".scss":"scss",".sass":"scss",".less":"css",".html":"markup",".xml":"markup",".svg":"markup",".graphql":"graphql",".gql":"graphql",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".groovy":"groovy",".gradle":"groovy",".clj":"clojure",".cljs":"clojure",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hxx":"cpp",".cs":"csharp",".py":"python",".rb":"ruby",".php":"php",".lua":"lua",".pl":"perl",".pm":"perl",".r":"r",".R":"r",".hs":"haskell",".lhs":"haskell",".ex":"elixir",".exs":"elixir",".erl":"erlang",".hrl":"erlang",".rs":"rust",".go":"go",".swift":"swift",".sh":"bash",".bash":"bash",".zsh":"bash",".fish":"bash",".ps1":"powershell",".psm1":"powershell",".psd1":"powershell",".json":"json",".yaml":"yaml",".yml":"yaml",".toml":"toml",".ini":"ini",".cfg":"ini",".conf":"ini",".md":"markdown",".mdx":"markdown",".sql":"sql",".dockerfile":"docker",".nginx":"nginx",".vim":"vim",".vimrc":"vim",".diff":"diff",".patch":"diff",".makefile":"makefile",".mk":"makefile"},ve="/assets/vscode-icons/",Kf={".7z":`${ve}file_type_zip.svg`,".R":`${ve}file_type_r.svg`,".adoc":`${ve}file_type_asciidoc.svg`,".asciidoc":`${ve}file_type_asciidoc.svg`,".astro":`${ve}file_type_astro.svg`,".avi":`${ve}file_type_video.svg`,".babelrc":`${ve}file_type_babel.svg`,".bash":`${ve}file_type_shell.svg`,".bat":`${ve}file_type_bat.svg`,".bmp":`${ve}file_type_image.svg`,".c":`${ve}file_type_c.svg`,".cc":`${ve}file_type_cpp.svg`,".cfg":`${ve}file_type_ini.svg`,".circleci":`${ve}file_type_circleci.svg`,".cjs":`${ve}file_type_js_official.svg`,".clj":`${ve}file_type_clojure.svg`,".cljs":`${ve}file_type_clojure.svg`,".cmd":`${ve}file_type_bat.svg`,".conf":`${ve}file_type_ini.svg`,".cpp":`${ve}file_type_cpp.svg`,".cs":`${ve}file_type_csharp.svg`,".css":`${ve}file_type_css.svg`,".csv":`${ve}file_type_csv.svg`,".cxx":`${ve}file_type_cpp.svg`,".dart":`${ve}file_type_dart.svg`,".diff":`${ve}file_type_diff.svg`,".dockerfile":`${ve}file_type_docker.svg`,".dockerignore":`${ve}file_type_docker.svg`,".env":`${ve}file_type_dotenv.svg`,".env.development":`${ve}file_type_dotenv.svg`,".env.local":`${ve}file_type_dotenv.svg`,".env.production":`${ve}file_type_dotenv.svg`,".env.test":`${ve}file_type_dotenv.svg`,".erb":`${ve}file_type_ruby.svg`,".erl":`${ve}file_type_erlang.svg`,".eslintrc":`${ve}file_type_eslint.svg`,".eslintrc.js":`${ve}file_type_eslint.svg`,".eslintrc.json":`${ve}file_type_eslint.svg`,".ex":`${ve}file_type_elixir.svg`,".exs":`${ve}file_type_elixir.svg`,".fish":`${ve}file_type_shell.svg`,".gif":`${ve}file_type_image.svg`,".git":`${ve}file_type_git.svg`,".gitattributes":`${ve}file_type_git.svg`,".github":`${ve}file_type_github.svg`,".gitignore":`${ve}file_type_git.svg`,".gitlab-ci.yml":`${ve}file_type_gitlab.svg`,".gitmodules":`${ve}file_type_git.svg`,".go":`${ve}file_type_go.svg`,".gql":`${ve}file_type_graphql.svg`,".gradle":`${ve}file_type_gradle.svg`,".graphql":`${ve}file_type_graphql.svg`,".groovy":`${ve}file_type_groovy.svg`,".gz":`${ve}file_type_zip.svg`,".h":`${ve}file_type_c.svg`,".hpp":`${ve}file_type_cpp.svg`,".hrl":`${ve}file_type_erlang.svg`,".hs":`${ve}file_type_haskell.svg`,".htm":`${ve}file_type_html.svg`,".html":`${ve}file_type_html.svg`,".ico":`${ve}file_type_image.svg`,".ini":`${ve}file_type_ini.svg`,".java":`${ve}file_type_java.svg`,".jl":`${ve}file_type_julia.svg`,".jpeg":`${ve}file_type_image.svg`,".jpg":`${ve}file_type_image.svg`,".js":`${ve}file_type_js_official.svg`,".json":`${ve}file_type_json_official.svg`,".json5":`${ve}file_type_json5.svg`,".jsonc":`${ve}file_type_json_official.svg`,".jsx":`${ve}file_type_reactjs.svg`,".kt":`${ve}file_type_kotlin.svg`,".kts":`${ve}file_type_kotlin.svg`,".kubernetes.yaml":`${ve}file_type_kubernetes.svg`,".less":`${ve}file_type_less.svg`,".lhs":`${ve}file_type_haskell.svg`,".lock":`${ve}file_type_lock.svg`,".log":`${ve}file_type_log.svg`,".lua":`${ve}file_type_lua.svg`,".markdown":`${ve}file_type_markdown.svg`,".md":`${ve}file_type_markdown.svg`,".mdown":`${ve}file_type_markdown.svg`,".mdx":`${ve}file_type_markdown.svg`,".mjs":`${ve}file_type_js_official.svg`,".mk":`${ve}file_type_makefile.svg`,".mov":`${ve}file_type_video.svg`,".mp3":`${ve}file_type_audio.svg`,".mp4":`${ve}file_type_video.svg`,".nim":`${ve}file_type_nim.svg`,".nims":`${ve}file_type_nim.svg`,".patch":`${ve}file_type_diff.svg`,".pdf":`${ve}file_type_pdf.svg`,".php":`${ve}file_type_php.svg`,".pl":`${ve}file_type_perl.svg`,".pm":`${ve}file_type_perl.svg`,".png":`${ve}file_type_image.svg`,".prettier.json":`${ve}file_type_prettier.svg`,".prettierrc":`${ve}file_type_prettier.svg`,".ps1":`${ve}file_type_powershell.svg`,".psd1":`${ve}file_type_powershell.svg`,".psm1":`${ve}file_type_powershell.svg`,".py":`${ve}file_type_python.svg`,".pyw":`${ve}file_type_python.svg`,".r":`${ve}file_type_r.svg`,".rar":`${ve}file_type_zip.svg`,".rb":`${ve}file_type_ruby.svg`,".rs":`${ve}file_type_rust.svg`,".rst":`${ve}file_type_rst.svg`,".sass":`${ve}file_type_scss.svg`,".scala":`${ve}file_type_scala.svg`,".scss":`${ve}file_type_scss.svg`,".sh":`${ve}file_type_shell.svg`,".sql":`${ve}file_type_sql.svg`,".sty":`${ve}file_type_latex.svg`,".svelte":`${ve}file_type_svelte.svg`,".svg":`${ve}file_type_svg.svg`,".swift":`${ve}file_type_swift.svg`,".tar":`${ve}file_type_tar.svg`,".tar.bz2":`${ve}file_type_zip.svg`,".tar.gz":`${ve}file_type_zip.svg`,".terraform":`${ve}file_type_terraform.svg`,".tex":`${ve}file_type_latex.svg`,".toml":`${ve}file_type_toml.svg`,".travis.yml":`${ve}file_type_travis.svg`,".ts":`${ve}file_type_typescript_official.svg`,".tsv":`${ve}file_type_tsv.svg`,".tsx":`${ve}file_type_typescript_official.svg`,".txt":`${ve}file_type_text.svg`,".vue":`${ve}file_type_vue.svg`,".webm":`${ve}file_type_video.svg`,".webp":`${ve}file_type_image.svg`,".xml":`${ve}file_type_xml.svg`,".yaml":`${ve}file_type_yaml_official.svg`,".yml":`${ve}file_type_yaml_official.svg`,".zig":`${ve}file_type_zig.svg`,".zip":`${ve}file_type_zip.svg`,".zsh":`${ve}file_type_shell.svg`,"CMakeLists.txt":`${ve}file_type_cmake.svg`,"Cargo.lock":`${ve}file_type_cargo.svg`,"Cargo.toml":`${ve}file_type_cargo.svg`,Dockerfile:`${ve}file_type_docker.svg`,Gemfile:`${ve}file_type_ruby.svg`,"Gemfile.lock":`${ve}file_type_ruby.svg`,Justfile:`${ve}file_type_just.svg`,Makefile:`${ve}file_type_makefile.svg`,Pipfile:`${ve}file_type_python.svg`,"Pipfile.lock":`${ve}file_type_python.svg`,Procfile:`${ve}file_type_procfile.svg`,Vagrantfile:`${ve}file_type_vagrant.svg`,"azure-pipelines.yml":`${ve}file_type_azurepipelines.svg`,"build.gradle":`${ve}file_type_gradle.svg`,"build.sbt":`${ve}file_type_scala.svg`,"docker-compose.yaml":`${ve}file_type_docker.svg`,"docker-compose.yml":`${ve}file_type_docker.svg`,dune:`${ve}file_type_dune.svg`,"gatsby-config.js":`${ve}file_type_gatsby.svg`,"go.mod":`${ve}file_type_go.svg`,"go.sum":`${ve}file_type_go.svg`,"heroku.yml":`${ve}file_type_heroku.svg`,"jsconfig.json":`${ve}file_type_jsconfig.svg`,"kubernetes.yaml":`${ve}file_type_kubernetes.svg`,makefile:`${ve}file_type_makefile.svg`,"meson.build":`${ve}file_type_meson.svg`,"mix.exs":`${ve}file_type_elixir.svg`,"next.config.js":`${ve}file_type_nextjs.svg`,"nuxt.config.js":`${ve}file_type_nuxtjs.svg`,"package-lock.json":`${ve}file_type_npm.svg`,"package.json":`${ve}file_type_npm.svg`,"pnpm-lock.yaml":`${ve}file_type_pnpm.svg`,"pom.xml":`${ve}file_type_maven.svg`,"pubspec.lock":`${ve}file_type_dart.svg`,"pubspec.yaml":`${ve}file_type_dart.svg`,"pyproject.toml":`${ve}file_type_python.svg`,"rebar.config":`${ve}file_type_erlang.svg`,"requirements.txt":`${ve}file_type_python.svg`,"terraform.tfvars":`${ve}file_type_terraform.svg`,"tox.ini":`${ve}file_type_tox.svg`,"tsconfig.json":`${ve}file_type_tsconfig.svg`,"vite.config.js":`${ve}file_type_vite.svg`,"vite.config.ts":`${ve}file_type_vite.svg`,"webpack.config.js":`${ve}file_type_webpack.svg`,"yarn.lock":`${ve}file_type_yarn.svg`,default:`${ve}default_file.svg`},s1={conflict:{icon:"C",color:"#ff5555",label:"Conflicts"},modified:{icon:"M",color:"#c89a5a",label:"Modified"},added:{icon:"A",color:"#5cb88a",label:"Added"},deleted:{icon:"D",color:"#c85a5a",label:"Deleted"},untracked:{icon:"U",color:"#6ab8c8",label:"Untracked"},renamed:{icon:"R",color:"#9a80c0",label:"Renamed"}},A4={c:()=>vt(()=>import("./prism-c-BI05wwL9.js"),[]),cpp:()=>vt(()=>import("./prism-c-BI05wwL9.js"),[]).then(()=>vt(()=>import("./prism-cpp-CK2Ly5dS.js").then(t=>t.p),__vite__mapDeps([7,1]))),java:()=>vt(()=>import("./prism-java-CK6tws4L.js").then(t=>t.p),__vite__mapDeps([8,1])),scala:()=>vt(()=>import("./prism-java-CK6tws4L.js").then(t=>t.p),__vite__mapDeps([8,1])).then(()=>vt(()=>import("./prism-scala-BjNo2HkN.js"),[])),csharp:()=>vt(()=>import("./prism-csharp-ByDDDiWW.js").then(t=>t.p),__vite__mapDeps([9,1])),kotlin:()=>vt(()=>import("./prism-kotlin-B1uvbSyh.js"),[]),groovy:()=>vt(()=>import("./prism-groovy-CGzo1uDg.js"),[]),ruby:()=>vt(()=>import("./prism-ruby-CQBUuZIF.js").then(t=>t.p),__vite__mapDeps([10,1])),php:()=>vt(()=>import("./prism-markup-templating-Ct1xsyfA.js"),[]).then(()=>vt(()=>import("./prism-php-Dt9698bA.js").then(t=>t.p),__vite__mapDeps([11,1]))),scss:()=>vt(()=>import("./prism-scss-CeN16CFC.js").then(t=>t.p),__vite__mapDeps([12,1])),toml:()=>vt(()=>import("./prism-toml-BrQIw_NO.js"),[]),docker:()=>vt(()=>import("./prism-docker-MnIa7k-I.js"),[]),swift:()=>vt(()=>import("./prism-swift--kriB360.js"),[]),lua:()=>vt(()=>import("./prism-lua-Cp_o7ONA.js"),[]),perl:()=>vt(()=>import("./prism-perl-UZfqnD51.js").then(t=>t.p),__vite__mapDeps([13,1])),r:()=>vt(()=>import("./prism-r-TxsGuNZJ.js"),[]),haskell:()=>vt(()=>import("./prism-haskell-Ce8aBmia.js").then(t=>t.p),__vite__mapDeps([14,1])),elixir:()=>vt(()=>import("./prism-elixir-df27OMMQ.js").then(t=>t.p),__vite__mapDeps([15,1])),erlang:()=>vt(()=>import("./prism-erlang-C3Aahqfa.js"),[]),clojure:()=>vt(()=>import("./prism-clojure-u3w_tjfy.js"),[]),graphql:()=>vt(()=>import("./prism-graphql-DJ177lJj.js"),[]),nginx:()=>vt(()=>import("./prism-nginx-43e5TboO.js"),[]),vim:()=>vt(()=>import("./prism-vim-uciLQ2PQ.js"),[]),diff:()=>vt(()=>import("./prism-diff-jN23ddHu.js"),[]),ini:()=>vt(()=>import("./prism-ini-DX5Euru7.js"),[]),powershell:()=>vt(()=>import("./prism-powershell-Ud14i9UV.js"),[]),makefile:()=>vt(()=>import("./prism-makefile-Dk8DMwhC.js"),[])},Eg=new Map;async function a1(t){if(t in sa.languages)return!0;const e=A4[t];if(!e)return!1;let n=Eg.get(t);n||(n=e(),Eg.set(t,n));try{return await n,t in sa.languages}catch{return!1}finally{Eg.delete(t)}}function dV(t){sa.highlightElement(t)}function Af(t){return C4[t]||"plaintext"}function j4(t){return t in sa.languages}function aC(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function uo(t,e){if(!t)return"";const n=sa.languages[e];if(!n)return aC(t);try{return sa.highlight(t,n,e)}catch{return aC(t)}}function N4(t){if(typeof document>"u")throw new Error("Clipboard unavailable");const e=document.createElement("textarea");e.value=t,e.setAttribute("readonly","true"),e.style.position="fixed",e.style.top="-9999px",e.style.left="-9999px",document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);const n=document.execCommand("copy");if(document.body.removeChild(e),!n)throw new Error("Legacy clipboard copy failed")}async function fu(t){var e;if(typeof navigator<"u"&&((e=navigator.clipboard)!=null&&e.writeText)){await navigator.clipboard.writeText(t);return}N4(t)}function r1(t){const e=document.createElement("div");e.innerHTML=t;const n=e.firstElementChild;n&&(n.style.cssText+='font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;font-size:14px;color:#1f2328;line-height:1.6');const s={table:"border-collapse:collapse;width:100%;border:1px solid #d1d9e0;margin:12px 0;font-size:13px",th:"background:#f6f8fa;color:#1f2328;padding:6px 12px;border:1px solid #d1d9e0;font-weight:600;text-align:left;white-space:nowrap",td:"padding:6px 12px;border:1px solid #d1d9e0;color:#1f2328;vertical-align:top",h1:"font-size:2em;font-weight:700;margin:24px 0 12px;padding-bottom:6px;border-bottom:2px solid #d1d9e0;color:#1f2328",h2:"font-size:1.5em;font-weight:700;margin:20px 0 10px;padding-bottom:4px;border-bottom:1px solid #d1d9e0;color:#1f2328",h3:"font-size:1.25em;font-weight:600;margin:16px 0 8px;color:#1f2328",h4:"font-size:1.1em;font-weight:600;margin:12px 0 6px;color:#1f2328",h5:"font-size:1em;font-weight:600;margin:10px 0 4px;color:#1f2328",h6:"font-size:0.85em;font-weight:600;margin:10px 0 4px;color:#656d76",pre:'background:#f6f8fa;padding:16px;border-radius:6px;overflow:auto;border:1px solid #d1d9e0;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:1.5;margin:12px 0;color:#1f2328',blockquote:"border-left:4px solid #d1d9e0;padding:4px 16px;color:#656d76;margin:12px 0;background:#f6f8fa",a:"color:#0969da;text-decoration:underline",ul:"padding-left:28px;margin:8px 0",ol:"padding-left:28px;margin:8px 0",li:"margin:4px 0;color:#1f2328",hr:"border:none;border-top:2px solid #d1d9e0;margin:20px 0",strong:"font-weight:700;color:#1f2328",em:"font-style:italic",p:"margin:8px 0;line-height:1.6"};for(const[r,i]of Object.entries(s))for(const c of Array.from(e.querySelectorAll(r)))c.style.cssText+=i;for(const r of Array.from(e.querySelectorAll("code"))){const i=r.parentElement;i&&i.tagName.toLowerCase()==="pre"?r.style.cssText+='font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;background:transparent;padding:0;font-size:inherit;color:inherit':r.style.cssText+='background:#eff1f3;padding:2px 6px;border-radius:4px;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;font-size:0.85em;color:#cf222e'}for(const r of Array.from(e.querySelectorAll("table"))){r.setAttribute("width","100%"),r.querySelectorAll("tbody tr").forEach((j,E)=>{E%2===0?j.style.cssText+="background:#ffffff":j.style.cssText+="background:#f6f8fa"});const c=Array.from(r.querySelectorAll("thead th, thead td, tr:first-child th, tr:first-child td")),d=c.length;if(d<2)continue;const f=Array.from(r.querySelectorAll("tr")),h=new Array(d).fill(0),m=new Array(d).fill(0);c.forEach((j,E)=>{const D=(j.textContent||"").trim();D.length,h[E]=D.length});for(const j of f)Array.from(j.children).forEach((D,_)=>{if(_<d){const B=(D.textContent||"").trim();m[_]=Math.max(m[_],B.length);const O=B.split(/\s+/);for(const T of O)h[_]=Math.max(h[_],T.length)}});const x=h.reduce((j,E)=>j+E,0)||1,y=h.map(j=>{const E=j<=3?3:j<=6?5:8;return Math.max(E,Math.round(j/x*50))}),v=y.reduce((j,E)=>j+E,0),S=Math.max(0,100-v),A=m.reduce((j,E)=>j+E,0)||1,k=y.map((j,E)=>j+Math.round(m[E]/A*S)),N=k.reduce((j,E)=>j+E,0);k[k.length-1]+=100-N;for(const j of f)Array.from(j.children).forEach((D,_)=>{if(_<d){const B=`${k[_]}%`;D.setAttribute("width",B),D.style.cssText+=`;width:${B}`}})}const a={"hljs-keyword":"color:#cf222e;font-weight:600","hljs-built_in":"color:#8250df","hljs-type":"color:#8250df","hljs-literal":"color:#0550ae","hljs-number":"color:#0550ae","hljs-string":"color:#0a3069","hljs-comment":"color:#6e7781;font-style:italic","hljs-doctag":"color:#cf222e","hljs-meta":"color:#6e7781","hljs-attr":"color:#8250df","hljs-attribute":"color:#0550ae","hljs-name":"color:#116329","hljs-tag":"color:#116329","hljs-title":"color:#8250df;font-weight:600","hljs-variable":"color:#953800","hljs-params":"color:#1f2328","hljs-function":"color:#8250df","hljs-selector-tag":"color:#116329","hljs-selector-class":"color:#8250df","hljs-selector-id":"color:#0550ae","hljs-property":"color:#0550ae","hljs-regexp":"color:#0a3069","hljs-symbol":"color:#0550ae","hljs-addition":"color:#116329;background:#dafbe1","hljs-deletion":"color:#cf222e;background:#ffebe9"};for(const[r,i]of Object.entries(a))for(const c of Array.from(e.querySelectorAll(`.${r}`)))c.style.cssText+=i;return e.innerHTML}async function i1(t,e){const n=document.createElement("div");n.innerHTML=t,n.style.cssText='position:fixed;left:-9999px;top:-9999px;opacity:0;color:#1f2328;background:#ffffff;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.6',document.body.appendChild(n);const s=document.createRange();s.selectNodeContents(n);const a=window.getSelection();a&&(a.removeAllRanges(),a.addRange(s));const r=document.execCommand("copy");if(document.body.removeChild(n),a&&a.removeAllRanges(),!r)throw new Error("Rich text copy failed")}function Jn({content:t,children:e,position:n="top",delay:s=150,maxWidth:a=280,disabled:r=!1,className:i=""}){const[c,d]=b.useState(!1),[f,h]=b.useState(!1),[m,x]=b.useState({top:0,left:0}),y=b.useRef(null),v=b.useRef(null),S=b.useRef(null),A=b.useRef(null),k=b.useCallback(()=>{if(!y.current||!v.current)return;const D=y.current.getBoundingClientRect(),_=v.current.getBoundingClientRect(),B=window.scrollY,O=window.scrollX,T=8;let M=0,R=0;switch(n){case"top":M=D.top+B-_.height-T,R=D.left+O+(D.width-_.width)/2;break;case"bottom":M=D.bottom+B+T,R=D.left+O+(D.width-_.width)/2;break;case"left":M=D.top+B+(D.height-_.height)/2,R=D.left+O-_.width-T;break;case"right":M=D.top+B+(D.height-_.height)/2,R=D.right+O+T;break}const F=window.innerWidth,$=window.innerHeight;R<T&&(R=T),R+_.width>F-T&&(R=F-_.width-T),M<T&&(M=T),M+_.height>$+B-T&&(M=$+B-_.height-T),x({top:M,left:R})},[n]),N=b.useCallback(()=>{r||(A.current&&(clearTimeout(A.current),A.current=null),S.current=setTimeout(()=>{h(!0),d(!0)},s))},[s,r]),j=b.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),d(!1),A.current=setTimeout(()=>{h(!1)},100)},[]);b.useEffect(()=>{f&&c&&requestAnimationFrame(k)},[f,c,k]),b.useEffect(()=>()=>{S.current&&clearTimeout(S.current),A.current&&clearTimeout(A.current)},[]);const E=f&&t&&Dl.createPortal(o.jsxs("div",{ref:v,className:`tide-tooltip tide-tooltip--${n} ${c?"tide-tooltip--visible":"tide-tooltip--hiding"} ${i}`,style:{position:"absolute",top:m.top,left:m.left,maxWidth:a,zIndex:1e4},role:"tooltip",children:[o.jsx("div",{className:"tide-tooltip__content",children:t}),o.jsx("div",{className:"tide-tooltip__arrow"})]}),document.body);return o.jsxs(o.Fragment,{children:[o.jsx("span",{ref:y,className:"tide-tooltip-trigger",onMouseEnter:N,onMouseLeave:j,onFocus:N,onBlur:j,style:{display:"inline-flex"},children:e}),E]})}function fV({text:t,title:e,position:n="top",size:s="md"}){const a=o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"tide-tooltip__title",children:e}),o.jsx("div",{className:"tide-tooltip__text",children:t})]});return o.jsx(Jn,{content:a,position:n,children:o.jsx("span",{className:`tide-help-icon tide-help-icon--${s}`,tabIndex:0,children:"?"})})}function Mg(t,e){return t?uo(t,e):""}function T4(t,e,n){const s=t.split(`
|
|
84
|
+
`),a=e.split(`
|
|
85
|
+
`),r=n||"plaintext",i=s.length,c=a.length,d=Array(i+1).fill(null).map(()=>Array(c+1).fill(0));for(let D=1;D<=i;D++)for(let _=1;_<=c;_++)s[D-1]===a[_-1]?d[D][_]=d[D-1][_-1]+1:d[D][_]=Math.max(d[D-1][_],d[D][_-1]);const f=[];let h=i,m=c;for(;h>0||m>0;)h>0&&m>0&&s[h-1]===a[m-1]?(f.push({type:"equal",origIdx:h-1,modIdx:m-1}),h--,m--):m>0&&(h===0||d[h][m-1]>=d[h-1][m])?(f.push({type:"insert",modIdx:m-1}),m--):h>0&&(f.push({type:"delete",origIdx:h-1}),h--);f.reverse();const x=[],y=[],v=[],S=[];v.push({leftLine:0,rightLine:0});let A=-1,k=0,N=-1,j=0;const E=()=>{(k>0||j>0)&&S.push({leftStart:A>=0?A:x.length,leftCount:k,rightStart:N>=0?N:y.length,rightCount:j,type:k>0&&j>0?"modified":k>0?"removed":"added"}),A=-1,k=0,N=-1,j=0};for(const D of f)if(D.type==="equal"){E();const _=s[D.origIdx],B=Mg(_,r);x.push({num:D.origIdx+1,text:_,highlighted:B,type:"unchanged"}),y.push({num:D.modIdx+1,text:_,highlighted:B,type:"unchanged"}),v.push({leftLine:x.length,rightLine:y.length})}else if(D.type==="delete"){A<0&&(A=x.length),k++;const _=s[D.origIdx],B=Mg(_,r);x.push({num:D.origIdx+1,text:_,highlighted:B,type:"removed"})}else{N<0&&(N=y.length),j++;const _=a[D.modIdx],B=Mg(_,r);y.push({num:D.modIdx+1,text:_,highlighted:B,type:"added"})}return E(),v.push({leftLine:x.length,rightLine:y.length}),{leftLines:x,rightLines:y,alignments:v,changeBlocks:S}}function _4(t,e,n,s,a,r){if(e<=0||n<=0)return 0;const i=t/a;let c=null,d=null;for(let k=0;k<s.length-1;k++){const N=s[k],j=s[k+1],E=r?N.leftLine:N.rightLine,D=r?j.leftLine:j.rightLine;if(i>=E&&i<D){c=N,d=j;break}}if(!c||!d)return t/Math.max(1,e-1)*n;const f=r?c.leftLine:c.rightLine,h=r?d.leftLine:d.rightLine,m=r?c.rightLine:c.leftLine,x=r?d.rightLine:d.leftLine,y=h-f,v=x-m;if(y===0)return m*a;const S=(i-f)/y;return(m+S*v)*a}const E4=[".md",".mdx",".markdown"];function Ob({originalContent:t,modifiedContent:e,filename:n,language:s,initialModifiedOnly:a=!1}){const{t:r}=ht(["terminal","common"]),i=b.useRef(null),c=b.useRef(null),d=b.useRef(null),f=b.useRef(null),h=b.useRef(null),m=b.useRef(null),x=b.useRef(null),[y,v]=b.useState("idle"),[S,A]=b.useState("idle"),[k,N]=b.useState(a),[j,E]=b.useState(0);b.useEffect(()=>{s&&s!=="plaintext"&&a1(s).then(()=>E(Z=>Z+1))},[s]);const D=!t,_=!e,B=b.useMemo(()=>{const Z=n.substring(n.lastIndexOf(".")).toLowerCase();return E4.includes(Z)},[n]),O=b.useCallback(async()=>{try{if(B&&k&&d.current){const Z=d.current.innerHTML,de=r1(Z),Ce=d.current.innerText;await i1(de,Ce)}else await fu(e);v("copied"),setTimeout(()=>v("idle"),2e3)}catch(Z){console.error("Copy modified content failed:",Z),v("error"),setTimeout(()=>v("idle"),2e3)}},[e,B,k]),T=b.useCallback(async()=>{if(!d.current){console.error("Copy HTML: markdown content ref is not available"),A("error"),setTimeout(()=>A("idle"),2e3);return}try{const Z=d.current.innerHTML;await fu(Z),A("copied"),setTimeout(()=>A("idle"),2e3)}catch(Z){console.error("Copy HTML failed:",Z),A("error"),setTimeout(()=>A("idle"),2e3)}},[]),{leftLines:M,rightLines:R,alignments:F,changeBlocks:$}=b.useMemo(()=>T4(t,e,s),[t,e,s,j]),U=b.useCallback(()=>{const Z=f.current,de=i.current,Ce=c.current;if(!Z||!de||!Ce)return;const xe=window.devicePixelRatio||1,Ne=Z.parentElement;if(!Ne)return;const qe=Ne.clientWidth,Ge=Ne.clientHeight;if(qe===0||Ge===0)return;const X=Math.round(qe*xe),se=Math.round(Ge*xe);(Z.width!==X||Z.height!==se)&&(Z.width=X,Z.height=se);const Ee=Z.getContext("2d");if(!Ee)return;Ee.setTransform(xe,0,0,xe,0,0),Ee.clearRect(0,0,qe,Ge);const Ve=Ne.getBoundingClientRect(),at=de.getBoundingClientRect(),we=Ce.getBoundingClientRect(),$e=at.top-Ve.top,ie=we.top-Ve.top,fe=de.scrollTop,Ue=Ce.scrollTop,it=de.clientHeight,ot=Ce.clientHeight;for(const ce of $){const J=$e+ce.leftStart*K-fe,ae=$e+(ce.leftStart+Math.max(ce.leftCount,.5))*K-fe,Se=ie+ce.rightStart*K-Ue,ee=ie+(ce.rightStart+Math.max(ce.rightCount,.5))*K-Ue;if(ae<$e&&ee<ie||J>$e+it+20&&Se>ie+ot+20)continue;ce.type==="modified"?(Ee.fillStyle="rgba(90, 130, 180, 0.2)",Ee.strokeStyle="rgba(90, 130, 180, 0.45)"):ce.type==="removed"?(Ee.fillStyle="rgba(200, 90, 90, 0.2)",Ee.strokeStyle="rgba(200, 90, 90, 0.45)"):(Ee.fillStyle="rgba(92, 184, 138, 0.2)",Ee.strokeStyle="rgba(92, 184, 138, 0.45)");const ge=qe*.5;Ee.lineWidth=1,Ee.save(),Ee.beginPath(),Ee.rect(0,$e,qe,Ge-$e),Ee.clip(),Ee.beginPath(),Ee.moveTo(0,J),Ee.bezierCurveTo(ge,J,ge,Se,qe,Se),Ee.lineTo(qe,ee),Ee.bezierCurveTo(ge,ee,ge,ae,0,ae),Ee.closePath(),Ee.fill(),Ee.stroke(),Ee.restore()}},[$]);b.useEffect(()=>{if(k||D||_)return;const Z=f.current,de=i.current,Ce=c.current;if(!Z||!de||!Ce)return;const xe=Z.parentElement;if(!xe)return;const Ne=new ResizeObserver(()=>{U()});return Ne.observe(xe),requestAnimationFrame(()=>U()),()=>{Ne.disconnect(),h.current&&cancelAnimationFrame(h.current)}},[k,D,_,U]);const{leftBoundaries:L,rightBoundaries:z}=b.useMemo(()=>{const Z=new Map,de=new Map;for(const Ce of $){if(Ce.leftCount>0){const xe=Ce.leftStart,Ne=Ce.leftStart+Ce.leftCount-1;Z.set(xe,Z.has(xe)?"both":"top"),xe===Ne?Z.set(xe,"both"):Z.set(Ne,Z.has(Ne)?"both":"bottom")}if(Ce.rightCount>0){const xe=Ce.rightStart,Ne=Ce.rightStart+Ce.rightCount-1;de.set(xe,de.has(xe)?"both":"top"),xe===Ne?de.set(xe,"both"):de.set(Ne,de.has(Ne)?"both":"bottom")}}return{leftBoundaries:Z,rightBoundaries:de}},[$]),W=b.useMemo(()=>{const Z=R.filter(Ce=>Ce.type==="added").length,de=M.filter(Ce=>Ce.type==="removed").length;return{added:Z,removed:de}},[M,R]),V=b.useMemo(()=>{const Z=[];let de=!1;R.forEach((xe,Ne)=>{xe.type==="added"?de||(Z.push(Ne),de=!0):de=!1});let Ce=!1;return M.forEach((xe,Ne)=>{if(xe.type==="removed"){if(!Ce){const qe=Math.min(Ne,R.length-1);Z.includes(qe)||Z.push(qe),Ce=!0}}else Ce=!1}),Z.sort((xe,Ne)=>xe-Ne)},[M,R]),[Y,P]=b.useState(0),K=20,Q=b.useCallback(Z=>{const de=i.current,Ce=c.current;if(!de||!Ce||m.current&&m.current!==Z)return;m.current=Z,x.current&&cancelAnimationFrame(x.current);const xe=Z==="left"?de:Ce,Ne=Z==="left"?Ce:de;Ne.scrollLeft=xe.scrollLeft;const qe=_4(xe.scrollTop,xe.scrollHeight-xe.clientHeight,Ne.scrollHeight-Ne.clientHeight,F,K,Z==="left");Ne.scrollTop=qe,h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{U(),h.current=null}),x.current=requestAnimationFrame(()=>{m.current=null})},[F,U]);b.useEffect(()=>{const Z=i.current,de=c.current;if(!Z||!de)return;const Ce=()=>Q("left"),xe=()=>Q("right");return Z.addEventListener("scroll",Ce),de.addEventListener("scroll",xe),()=>{Z.removeEventListener("scroll",Ce),de.removeEventListener("scroll",xe),x.current&&cancelAnimationFrame(x.current)}},[Q]);const q=b.useCallback(Z=>{if(Z<0||Z>=V.length)return;const Ce=V[Z]*K;c.current&&(c.current.scrollTop=Ce),P(Z)},[V]),be=b.useCallback(()=>{const Z=Math.min(Y+1,V.length-1);q(Z)},[Y,V.length,q]),ue=b.useCallback(()=>{const Z=Math.max(Y-1,0);q(Z)},[Y,q]);return b.useEffect(()=>{V.length>0&&setTimeout(()=>{q(0),requestAnimationFrame(()=>U())},100)},[V,q,U]),o.jsxs("div",{className:"diff-viewer",children:[o.jsxs("div",{className:"diff-viewer-header",children:[o.jsx("div",{className:"diff-viewer-filename",children:n}),o.jsx("div",{className:"diff-viewer-nav",children:V.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Jn,{content:"Previous change (Up)",position:"bottom",children:o.jsx("button",{className:"diff-nav-btn",onClick:ue,disabled:Y===0,children:"↑"})}),o.jsxs("span",{className:"diff-nav-counter",children:[Y+1," / ",V.length]}),o.jsx(Jn,{content:"Next change (Down)",position:"bottom",children:o.jsx("button",{className:"diff-nav-btn",onClick:be,disabled:Y===V.length-1,children:"↓"})})]})}),o.jsxs("div",{className:"diff-viewer-stats",children:[W.added>0&&o.jsxs("span",{className:"diff-stat added",children:["+",W.added]}),W.removed>0&&o.jsxs("span",{className:"diff-stat removed",children:["-",W.removed]})]}),o.jsxs("div",{className:"diff-viewer-actions",children:[!D&&!_&&o.jsx(Jn,{content:k?"Show diff view":"View only modified",position:"bottom",children:o.jsx("button",{className:`diff-toggle-btn ${k?"active":""}`,onClick:()=>N(!k),children:r(k?"terminal:diffViewer.showDiff":"terminal:diffViewer.modifiedOnly")})}),o.jsx(Jn,{content:B&&k?"Copy as rich text":"Copy modified content",position:"bottom",children:o.jsx("button",{className:`diff-copy-btn ${y}`,onClick:O,children:y==="copied"?`✓ ${r("terminal:diffViewer.copied")}`:y==="error"?`✗ ${r("terminal:diffViewer.errorCopy")}`:r(B&&k?"terminal:diffViewer.copyRichText":"common:buttons.copy")})}),B&&k&&o.jsx(Jn,{content:"Copy as HTML tags (for Google Docs, HTML editors)",position:"bottom",children:o.jsx("button",{className:`diff-copy-btn ${S}`,onClick:T,children:S==="copied"?`✓ ${r("terminal:diffViewer.copied")}`:S==="error"?`✗ ${r("terminal:diffViewer.errorCopy")}`:r("terminal:diffViewer.copyHtml")})})]})]}),o.jsxs("div",{className:`diff-viewer-panels ${k||D||_?"modified-only":""}`,children:[!k&&!D&&o.jsxs("div",{className:"diff-panel diff-panel-original",children:[o.jsx("div",{className:"diff-panel-header",children:o.jsx("span",{className:"diff-panel-label",children:r("terminal:diffViewer.originalHead")})}),o.jsx("div",{className:"diff-panel-content",ref:i,children:M.map((Z,de)=>{const Ce=L.get(de),xe=Ce==="both"?"diff-hunk-top diff-hunk-bottom":Ce==="top"?"diff-hunk-top":Ce==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${Z.type} ${xe}`,children:[o.jsx("span",{className:"diff-line-num",children:Z.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:Z.highlighted||" "}})]},de)})})]}),!k&&!D&&!_&&o.jsx("div",{className:"diff-connector-gutter",children:o.jsx("canvas",{ref:f})}),!_&&o.jsxs("div",{className:"diff-panel diff-panel-modified",children:[o.jsx("div",{className:"diff-panel-header",children:o.jsx("span",{className:"diff-panel-label",children:r(k||D?"terminal:diffViewer.modifiedContent":"terminal:diffViewer.modifiedWorking")})}),k&&B?o.jsx("div",{className:"diff-panel-content diff-markdown-content",ref:d,children:o.jsx("div",{className:"markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],children:e})})}):o.jsx("div",{className:"diff-panel-content",ref:c,children:R.map((Z,de)=>{const Ce=z.get(de),xe=Ce==="both"?"diff-hunk-top diff-hunk-bottom":Ce==="top"?"diff-hunk-top":Ce==="bottom"?"diff-hunk-bottom":"";return o.jsxs("div",{className:`diff-line diff-line-${Z.type} ${xe}`,children:[o.jsx("span",{className:"diff-line-num",children:Z.num}),o.jsx("span",{className:"diff-line-content",dangerouslySetInnerHTML:{__html:Z.highlighted||" "}})]},de)})})]})]})]})}function M4(t,e){if(!t||t.startsWith("/")||!e||!e.startsWith("/"))return t;const n=t.replace(/^\.\//,""),s=e.split("/").filter(Boolean),a=n.split("/").filter(Boolean),r=[...s];for(const i of a)if(i!=="."){if(i===".."){r.length>0&&r.pop();continue}r.push(i)}return`/${r.join("/")}`}function o1(t){if(!t)return{path:t};const e=t.trim().replace(/^`|`$/g,"").replace(/[),.;]+$/g,""),n=e.match(/^(.*)#L(\d+)(?:C\d+)?$/i);if(n)return{path:n[1],line:Number(n[2])};const s=e.match(/^(.+?\.[^:\s]+):(\d+)(?::\d+)?$/);return s&&s[1].includes(".")?{path:s[1],line:Number(s[2])}:{path:e}}function jp(t,e){const n=o1(t);return{path:M4(n.path,e),line:n.line}}function D4(t,e){try{const n=t.split(`
|
|
86
|
+
`),s=e.split(`
|
|
87
|
+
`),a=[];let r=0;for(let i=0;i<s.length;i++){const d=s[i].match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@/);if(!d)continue;const f=parseInt(d[3],10),h=parseInt(d[4]??"1",10),m=f-1;for(;r<m&&r<n.length;)a.push(n[r]),r++;let x=0;for(let y=i+1;y<s.length;y++){const v=s[y];if(v.startsWith("@@")||v.startsWith("diff "))break;v.startsWith("---")||v.startsWith("+++")||v.startsWith("index ")||v.startsWith("new file")||v.startsWith("deleted file")||v.startsWith("\\")||(v.startsWith("-")?a.push(v.slice(1)):v.startsWith("+")?(x++,r++):(a.push(v.startsWith(" ")?v.slice(1):v),x++,r++))}}for(;r<n.length;)a.push(n[r]),r++;return a.join(`
|
|
88
|
+
`)}catch{return null}}const rC=[".md",".mdx",".markdown"],iC=[".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svg"],oC=[".pdf"];function l1({isOpen:t,onClose:e,filePath:n,action:s,editData:a,searchRoot:r}){const{t:i}=ht(["terminal","common"]),[c,d]=b.useState(null),[f,h]=b.useState(!1),[m,x]=b.useState(null),[y,v]=b.useState([]),[S,A]=b.useState([]),[k,N]=b.useState("idle"),[j,E]=b.useState("idle"),[D,_]=b.useState("idle"),[B,O]=b.useState("idle"),[T,M]=b.useState(null),[R,F]=b.useState(null),[$,U]=b.useState(!1),L=b.useRef(null),z=b.useRef(null),W=b.useRef(null),V=b.useMemo(()=>o1(n),[n]),Y=V.path,P=(a==null?void 0:a.targetLine)??V.line,K=(a==null?void 0:a.highlightRange)||void 0;b.useEffect(()=>{t&&Y?(v([]),A([]),M(null),F(null),Ee()):(d(null),x(null),v([]),A([]),M(null),F(null))},[t,Y]),b.useEffect(()=>{t&&W.current&&W.current.focus()},[t]),b.useEffect(()=>{if(!t)return;const oe=Le=>{if(!(Le.target instanceof HTMLInputElement||Le.target instanceof HTMLTextAreaElement)){if(Le.key==="Escape"){Le.preventDefault(),Le.stopPropagation(),e();return}if(Le.key==="j"||Le.key==="k"){Le.preventDefault(),Le.stopPropagation();const te=Le.key==="j"?100:-100;if(z.current){const pe=z.current.querySelectorAll(".diff-panel-content");if(pe.length>0)pe.forEach(ke=>{ke.scrollBy({top:te,behavior:"smooth"})});else{const ke=z.current.querySelector(".file-viewer-code-with-lines");ke?ke.scrollBy({top:te,behavior:"smooth"}):z.current.scrollBy({top:te,behavior:"smooth"})}}return}Le.stopPropagation()}};return window.addEventListener("keydown",oe,{capture:!0}),()=>window.removeEventListener("keydown",oe,{capture:!0})},[t,e]);const Q=b.useMemo(()=>{if(!c||!a||a.highlightRange)return null;const{oldString:oe="",newString:Le="",operation:te}=a;if(!oe&&!Le)return null;if(te==="append"&&Le){if(c.content.endsWith(Le))return c.content.slice(0,c.content.length-Le.length);const pe=c.content.lastIndexOf(Le);return pe!==-1?c.content.slice(0,pe)+c.content.slice(pe+Le.length):null}if(Le){const pe=c.content.indexOf(Le);return pe!==-1?c.content.slice(0,pe)+oe+c.content.slice(pe+Le.length):null}return null},[c,a]),q=!!a&&!a.highlightRange&&(!!a.oldString||!!a.newString),be=(a==null?void 0:a.unifiedDiff)||T,ue=!!be,Z=b.useMemo(()=>Q!==null||!c||!be?null:D4(c.content,be),[Q,c,be]),de=Q??Z??R,Ce=de!==null&&(q||ue),xe=ue&&!Ce,Ne=K!==void 0;b.useEffect(()=>{if(!c||!a||a.highlightRange||Ce||a.unifiedDiff||T!==null)return;(async()=>{try{const Le=c.path||Y,te=await Pt(Ot(`/api/files/git-diff?path=${encodeURIComponent(Le)}`));if(te.ok){const pe=await te.json();if(pe.diff&&pe.diff.trim()){M(pe.diff);return}}}catch{}M("")})()},[c,a,Ce,Y,T]),b.useEffect(()=>{if(!c||!a||a.highlightRange||Q!==null||Z!==null||R!==null||!q&&!ue)return;(async()=>{try{const Le=c.path||Y,te=await Pt(Ot(`/api/files/git-original?path=${encodeURIComponent(Le)}`));if(te.ok){const pe=await te.json();if(pe.content!==void 0&&pe.content!==c.content){F(pe.content);return}}}catch{}F("")})()},[c,a,Q,Z,R,q,ue,Y]),b.useEffect(()=>{if(!c)return;const oe=Af(c.extension);if(oe==="plaintext"||oe in sa.languages){U(!0);return}U(!1),a1(oe).then(()=>U(!0))},[c]);const qe=b.useMemo(()=>{if(!c||Ce||xe||rC.includes(c.extension))return[];const oe=Af(c.extension),Le=sa.languages[oe],te=pe=>pe.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return c.content.split(`
|
|
89
|
+
`).map(pe=>Le?sa.highlight(pe||" ",Le,oe):te(pe||" "))},[c,Ce,xe,$]);b.useEffect(()=>{if(!t||!c||!z.current)return;const oe=window.setTimeout(()=>{const Le=()=>{if(!z.current)return;const te=z.current.querySelector(".file-line-highlighted");if(te){te.scrollIntoView({block:"center",behavior:"auto"});return}if(P){const pe=z.current.querySelector(`.file-viewer-line-num[data-line="${P}"]`);pe==null||pe.scrollIntoView({block:"center",behavior:"auto"})}};window.requestAnimationFrame(()=>window.requestAnimationFrame(Le))},0);return()=>window.clearTimeout(oe)},[t,c,Ne,K==null?void 0:K.offset,P]);const Ge=async oe=>{const Le=oe.substring(oe.lastIndexOf(".")).toLowerCase(),te=oC.includes(Le),pe=iC.includes(Le),ke=te||pe?`/api/files/info?path=${encodeURIComponent(oe)}`:`/api/files/read?path=${encodeURIComponent(oe)}`,Be=await Pt(Ot(ke)),Ke=await Be.json();if(!Be.ok){const ze=Ke.error==="Path is a directory";return{ok:!1,error:Ke.error,isDirectory:ze}}return(te||pe)&&(Ke.content=""),{ok:!0,data:Ke}},X=async(oe,Le)=>{var te;try{const pe=await Pt(Ot(`/api/files/resolve?name=${encodeURIComponent(oe)}&root=${encodeURIComponent(Le)}`)),ke=await pe.json();if(pe.ok&&((te=ke.results)==null?void 0:te.length)>0)return ke.results}catch{}return[]},se=async oe=>{var Le;try{const te=await Pt(Ot(`/api/files/list?path=${encodeURIComponent(oe)}`)),pe=await te.json();if(te.ok&&((Le=pe.files)==null?void 0:Le.length)>0)return pe.files.slice(0,20).map(ke=>({name:ke.name,path:ke.path,isDirectory:ke.isDirectory,size:ke.size||0,extension:ke.extension||""}))}catch{}return[]},Ee=async()=>{h(!0),x(null),v([]),A([]);try{const oe=await Ge(Y);if(oe.ok){d(oe.data);return}if(oe.isDirectory){const pe=await se(Y);if(pe.length>0){A(pe);return}x(oe.error||i("terminal:fileExplorer.failedToLoad"));return}const Le=Y.split("/").pop()||Y,te=r||(Y.startsWith("/")?Y.split("/").slice(0,-1).join("/"):"");if(te&&Le){const pe=await X(Le,te);if(pe.length===1&&!pe[0].isDirectory){const ke=await Ge(pe[0].path);if(ke.ok){d(ke.data);return}}else if(pe.length>0){v(pe);return}}x(oe.error||i("terminal:fileExplorer.failedToLoad"))}catch(oe){x(oe.message||i("terminal:fileExplorer.failedToLoad"))}finally{h(!1)}},Ve=async oe=>{if(oe.isDirectory){h(!0),v([]),A([]),x(null);try{const Le=await se(oe.path);Le.length>0?A(Le):x("Empty directory")}catch{x("Failed to load directory")}finally{h(!1)}return}h(!0),v([]),A([]),x(null);try{const Le=await Ge(oe.path);Le.ok?d(Le.data):x(Le.error||i("terminal:fileExplorer.failedToLoad"))}catch(Le){x(Le.message||i("terminal:fileExplorer.failedToLoad"))}finally{h(!1)}},{handleMouseDown:at,handleClick:we}=Sa(e),$e=()=>{switch(s){case"created":return i("common:status.created");case"modified":return i("common:status.modified");case"deleted":return i("common:status.deleted");case"read":return i("common:status.read")}},ie=()=>{switch(s){case"created":return"var(--accent-green)";case"modified":return"var(--accent-orange)";case"deleted":return"var(--accent-red)";case"read":return"var(--text-secondary)"}},fe=b.useCallback(async()=>{if(!L.current){console.error("Copy Rich Text: markdown content ref is not available"),N("error"),setTimeout(()=>N("idle"),2e3);return}try{const oe=L.current.innerHTML,Le=r1(oe),te=L.current.innerText;await i1(Le,te),N("copied"),setTimeout(()=>N("idle"),2e3)}catch(oe){console.error("Copy Rich Text failed:",oe),N("error"),setTimeout(()=>N("idle"),2e3)}},[]),Ue=b.useCallback(async()=>{if(!L.current){console.error("Copy HTML: markdown content ref is not available"),E("error"),setTimeout(()=>E("idle"),2e3);return}try{const oe=L.current.innerHTML;await fu(oe),E("copied"),setTimeout(()=>E("idle"),2e3)}catch(oe){console.error("Copy HTML failed:",oe),E("error"),setTimeout(()=>E("idle"),2e3)}},[]),it=b.useCallback(async()=>{if(!c){_("error"),setTimeout(()=>_("idle"),2e3);return}try{await fu(c.content),_("copied"),setTimeout(()=>_("idle"),2e3)}catch{_("error"),setTimeout(()=>_("idle"),2e3)}},[c]),ot=b.useCallback(async()=>{if(!c){O("error"),setTimeout(()=>O("idle"),2e3);return}try{await fu(c.content),O("copied"),setTimeout(()=>O("idle"),2e3)}catch{O("error"),setTimeout(()=>O("idle"),2e3)}},[c]),ce=oe=>oe<1024?`${oe} B`:oe<1024*1024?`${(oe/1024).toFixed(1)} KB`:`${(oe/(1024*1024)).toFixed(1)} MB`,J=c&&rC.includes(c.extension),ae=c&&iC.includes(c.extension),Se=c&&oC.includes(c.extension),ee=ae?"Image":Se?"PDF":c?Af(c.extension):"text",ge=ji(),Re=ae?Ot(`/api/files/binary?path=${encodeURIComponent(Y)}${ge?`&token=${encodeURIComponent(ge)}`:""}`):null,Fe=Se?Ot(`/api/files/binary?path=${encodeURIComponent(Y)}${ge?`&token=${encodeURIComponent(ge)}`:""}`):null;return t?o.jsx(ir,{children:o.jsx("div",{ref:W,className:"file-viewer-overlay",onMouseDown:at,onClick:we,tabIndex:-1,children:o.jsxs("div",{className:"file-viewer-modal",children:[o.jsxs("div",{className:"file-viewer-header",children:[o.jsxs("div",{className:"file-viewer-title",children:[o.jsx("span",{className:"file-viewer-action",style:{color:ie()},children:$e()}),o.jsx("span",{className:"file-viewer-filename",children:(c==null?void 0:c.filename)||Y.split("/").pop()})]}),o.jsxs("div",{className:"file-viewer-header-buttons",children:[J&&c&&!Ce&&!xe&&!Ne&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`file-viewer-copy-html-btn ${k}`,onClick:fe,title:i("terminal:fileExplorer.copyRichTextTitle"),children:i(k==="copied"?"common:status.copied":k==="error"?"common:status.error":"terminal:fileExplorer.copyRichText")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${j}`,onClick:Ue,title:i("terminal:fileExplorer.copyHtmlTitle"),children:i(j==="copied"?"common:status.copied":j==="error"?"common:status.error":"terminal:fileExplorer.copyHtml")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${D}`,onClick:it,title:i("terminal:fileExplorer.copyMarkdownTitle"),children:i(D==="copied"?"common:status.copied":D==="error"?"common:status.error":"terminal:fileExplorer.copyMarkdown")}),o.jsx("button",{className:`file-viewer-copy-html-btn ${B}`,onClick:ot,title:i("terminal:fileExplorer.copyOriginalTitle"),children:i(B==="copied"?"common:status.copied":B==="error"?"common:status.error":"terminal:fileExplorer.copyOriginal")})]}),ae&&Re||Se&&Fe?o.jsx("a",{className:"file-viewer-copy-html-btn",href:`${ae?Re:Fe}&download=true`,download:c==null?void 0:c.filename,title:i(ae?"terminal:fileExplorer.downloadImage":"terminal:fileExplorer.downloadPdf"),children:i("common:buttons.download")}):null,o.jsx("button",{className:"file-viewer-close",onClick:e,children:"×"})]})]}),o.jsx("div",{className:"file-viewer-path",children:(c==null?void 0:c.path)||Y}),c&&o.jsxs("div",{className:"file-viewer-meta",children:[o.jsx("span",{children:ce(c.size)}),o.jsx("span",{children:"•"}),o.jsx("span",{children:ee}),c.content&&!ae&&!Se&&o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"•"}),o.jsx("span",{children:i("terminal:fileViewer.lineCount",{count:c.content.split(`
|
|
90
|
+
`).length})})]})]}),o.jsxs("div",{className:"file-viewer-content",ref:z,children:[f&&o.jsx("div",{className:"file-viewer-loading",children:i("terminal:fileExplorer.loadingFile")}),m&&!y.length&&!S.length&&o.jsx("div",{className:"file-viewer-error",children:m}),y.length>0&&o.jsxs("div",{className:"file-viewer-resolve-results",children:[o.jsxs("div",{className:"file-viewer-resolve-header",children:["Found ",y.length," matching file",y.length>1?"s":""," in project:"]}),o.jsx("div",{className:"file-viewer-resolve-list",children:y.map(oe=>o.jsxs("button",{className:"file-viewer-resolve-item",onClick:()=>Ve(oe),children:[o.jsx("span",{className:"file-viewer-resolve-icon",children:oe.isDirectory?"📁":"📄"}),o.jsxs("span",{className:"file-viewer-resolve-info",children:[o.jsx("span",{className:"file-viewer-resolve-name",children:oe.name}),o.jsx("span",{className:"file-viewer-resolve-path",children:oe.path})]}),!oe.isDirectory&&oe.size>0&&o.jsx("span",{className:"file-viewer-resolve-size",children:ce(oe.size)})]},oe.path))})]}),S.length>0&&o.jsxs("div",{className:"file-viewer-resolve-results",children:[o.jsxs("div",{className:"file-viewer-resolve-header",children:["Directory contents (",S.length," items):"]}),o.jsx("div",{className:"file-viewer-resolve-list",children:S.map(oe=>o.jsxs("button",{className:"file-viewer-resolve-item",onClick:()=>Ve(oe),children:[o.jsx("span",{className:"file-viewer-resolve-icon",children:oe.isDirectory?"📁":"📄"}),o.jsxs("span",{className:"file-viewer-resolve-info",children:[o.jsx("span",{className:"file-viewer-resolve-name",children:oe.name}),o.jsx("span",{className:"file-viewer-resolve-path",children:oe.path})]}),!oe.isDirectory&&oe.size>0&&o.jsx("span",{className:"file-viewer-resolve-size",children:ce(oe.size)})]},oe.path))})]}),c&&!f&&!m&&(ae&&Re?o.jsx("div",{className:"file-viewer-image-wrapper",children:o.jsx("img",{src:Re,alt:c.filename,className:"file-viewer-image"})}):Se&&Fe?o.jsx("div",{className:"file-viewer-pdf-embed",children:o.jsx("iframe",{src:Fe,title:c.filename,className:"file-viewer-pdf-iframe"})}):Ce?o.jsx(Ob,{originalContent:de,modifiedContent:c.content,filename:c.filename,language:ee}):xe?o.jsx("pre",{className:"file-viewer-code file-viewer-unified-diff",children:be.split(`
|
|
91
|
+
`).map((oe,Le)=>{let te="diff-ctx";return oe.startsWith("+")&&!oe.startsWith("+++")?te="diff-add":oe.startsWith("-")&&!oe.startsWith("---")?te="diff-del":oe.startsWith("@@")?te="diff-hdr":(oe.startsWith("diff ")||oe.startsWith("index ")||oe.startsWith("---")||oe.startsWith("+++"))&&(te="diff-meta"),o.jsxs("div",{className:`file-line file-line-${te}`,children:[o.jsx("span",{className:"file-line-num",children:Le+1}),o.jsx("code",{children:oe||" "})]},Le)})}):Ne?o.jsx("pre",{className:"file-viewer-code file-viewer-code-highlighted",children:c.content.split(`
|
|
92
|
+
`).map((oe,Le)=>{const te=Le+1,pe=K,ke=pe&&te>=pe.offset&&te<pe.offset+pe.limit;return o.jsxs("div",{className:`file-line ${ke?"file-line-highlighted":""}`,children:[o.jsx("span",{className:"file-line-num",children:te}),o.jsx("code",{className:`language-${ee}`,dangerouslySetInnerHTML:{__html:qe[Le]||oe||" "}})]},Le)})}):J?o.jsx("div",{className:"file-viewer-markdown markdown-content",ref:L,children:o.jsx(Mr,{remarkPlugins:[Dr],children:c.content})}):o.jsx("pre",{className:`file-viewer-code file-viewer-code-lines language-${ee}`,children:qe.map((oe,Le)=>o.jsxs("div",{className:`file-line ${P===Le+1?"file-line-highlighted":""}`,children:[o.jsx("span",{className:`file-line-num ${P===Le+1?"file-viewer-line-num-target":""}`,"data-line":Le+1,children:Le+1}),o.jsx("code",{className:`language-${ee}`,dangerouslySetInnerHTML:{__html:oe}})]},Le+1))}))]})]})})}):null}function R4({agentIds:t}){const{t:e}=ht(["terminal"]),n=fx(),s=Oj(),[a,r]=b.useState(null),[i,c]=b.useState(null),[d,f]=b.useState(()=>bi(pt.TOOLS_COLLAPSED)),[h,m]=b.useState(()=>bi(pt.FILES_COLLAPSED)),x=()=>{const O=!d;f(O),xi(pt.TOOLS_COLLAPSED,O)},y=()=>{const O=!h;m(O),xi(pt.FILES_COLLAPSED,O)},v=b.useMemo(()=>new Set(t),[t]),S=b.useMemo(()=>n.filter(O=>v.has(O.agentId)),[n,v]),A=b.useMemo(()=>s.filter(O=>v.has(O.agentId)),[s,v]),k=t.length>1,N=O=>new Date(O).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),j=O=>{const T=O.split("/");return T.length>2?".../"+T.slice(-2).join("/"):O},E=O=>{switch(O){case"created":return"+";case"modified":return"~";case"deleted":return"-";case"read":return">"}},D=O=>{switch(O){case"created":return"var(--accent-green)";case"modified":return"var(--accent-orange)";case"deleted":return"var(--accent-red)";case"read":return"var(--text-secondary)"}},_=O=>O==="Read"?"📖":O==="Write"?"📝":O==="Edit"?"✏️":O==="Bash"?"💻":O==="Grep"?"🔍":O==="Glob"?"📁":O==="Task"||O==="Agent"?"🤖":O==="WebFetch"?"🌐":O==="WebSearch"?"🔎":"🔧",B=(O,T)=>{r({path:O,action:T})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"tool-history-stacked",children:[o.jsxs("div",{className:`tool-history-panel ${d?"collapsed":""}`,children:[o.jsxs("div",{className:"tool-history-panel-header",onClick:x,children:[o.jsx("span",{className:"tool-history-panel-toggle",children:d?"▶":"▼"}),e("terminal:toolHistory.tools")," (",S.length,")"]}),!d&&o.jsx("div",{className:"tool-history-panel-content",children:S.length===0?o.jsx("div",{className:"tool-history-empty",children:e("terminal:toolHistory.noToolsYet")}):o.jsx("div",{className:"tool-history-list",children:S.slice(0,50).map((O,T)=>o.jsx(L4,{execution:O,formatTime:N,formatPath:j,getToolIcon:_,showAgentName:k,isExpanded:i===T,onToggle:()=>c(i===T?null:T),onViewFile:M=>r({path:M,action:"modified"})},T))})})]}),o.jsxs("div",{className:`tool-history-panel ${h?"collapsed":""}`,children:[o.jsxs("div",{className:"tool-history-panel-header",onClick:y,children:[o.jsx("span",{className:"tool-history-panel-toggle",children:h?"▶":"▼"}),e("terminal:toolHistory.filesSection")," (",A.length,")"]}),!h&&o.jsx("div",{className:"tool-history-panel-content",children:A.length===0?o.jsx("div",{className:"tool-history-empty",children:e("terminal:toolHistory.noFileChangesYet")}):o.jsx("div",{className:"tool-history-list",children:A.slice(0,50).map((O,T)=>o.jsx(I4,{change:O,formatTime:N,formatPath:j,getActionIcon:E,getActionColor:D,onClick:()=>B(O.filePath,O.action),showAgentName:k},T))})})]})]}),o.jsx(l1,{isOpen:a!==null,onClose:()=>r(null),filePath:(a==null?void 0:a.path)||"",action:(a==null?void 0:a.action)||"read"})]})}function O4(t,e){if(!e)return null;switch(t){case"WebSearch":return e.query||null;case"WebFetch":const n=e.url;return n&&n.length>50?n.slice(0,47)+"...":n||null;case"Read":case"Write":case"Edit":const s=e.file_path||e.path;return s?s.length>40?".../"+s.split("/").slice(-2).join("/"):s:null;case"Bash":const a=e.command;return a?a.length>50?a.slice(0,47)+"...":a:null;case"Grep":return e.pattern?`"${e.pattern}"`:null;case"Glob":return e.pattern||null;case"Task":const r=e.description;return r?r.length>40?r.slice(0,37)+"...":r:null;case"TodoWrite":const i=e.todos;return i!=null&&i.length?`${i.length} item${i.length>1?"s":""}`:null;default:for(const[,c]of Object.entries(e))if(typeof c=="string"&&c.length>0&&c.length<80)return c.length>50?c.slice(0,47)+"...":c;return null}}function L4({execution:t,formatTime:e,formatPath:n,getToolIcon:s,showAgentName:a,isExpanded:r,onToggle:i,onViewFile:c}){const{t:d}=ht(["terminal"]),f=O4(t.toolName,t.toolInput),h=t.toolInput&&Object.keys(t.toolInput).length>0,m=t.toolInput?t.toolInput.file_path||t.toolInput.path:void 0,x=["Write","Edit","Read"].includes(t.toolName)&&m;return o.jsxs("div",{className:`tool-history-item tool-compact ${r?"expanded":""} ${h?"clickable":""}`,children:[o.jsxs("div",{className:"tool-row",onClick:h?i:void 0,title:t.toolName,children:[o.jsx("span",{className:"tool-expand-icon",children:h?r?"▼":"▶":" "}),o.jsx("span",{className:"tool-icon",title:t.toolName,children:s(t.toolName)}),o.jsx("div",{className:"tool-input-inline",title:f||t.toolName,children:f||t.toolName}),a&&o.jsx("span",{className:"tool-agent-compact",children:t.agentName}),o.jsx("span",{className:"tool-time",children:e(t.timestamp)})]}),r&&t.toolInput&&o.jsxs("div",{className:"tool-expanded-details",children:[o.jsxs("div",{className:"tool-expanded-header",children:[o.jsx("span",{className:"tool-expanded-name",children:t.toolName}),x&&o.jsx("button",{className:"tool-view-file-btn",onClick:y=>{y.stopPropagation(),c(m)},children:d("terminal:toolHistory.viewFile")})]}),o.jsx("pre",{className:"tool-input-json",children:P4(t.toolName,t.toolInput)})]})]})}function P4(t,e){if(t==="Write"&&e.content){const n=e.content,s=e.file_path||e.path,a=n.length>2e3?n.slice(0,2e3)+`
|
|
93
|
+
|
|
94
|
+
... (truncated)`:n;return`file: ${s}
|
|
95
|
+
|
|
96
|
+
${a}`}if(t==="Edit"){const n=[];if(e.file_path&&n.push(`file: ${e.file_path}`),e.old_string){const s=e.old_string;n.push(`
|
|
97
|
+
- old:
|
|
98
|
+
${s.slice(0,500)}${s.length>500?"...":""}`)}if(e.new_string){const s=e.new_string;n.push(`
|
|
99
|
+
+ new:
|
|
100
|
+
${s.slice(0,500)}${s.length>500?"...":""}`)}return n.join(`
|
|
101
|
+
`)}return t==="Bash"&&e.command?e.command:t==="TodoWrite"&&e.todos?e.todos.map((s,a)=>`${s.status==="completed"?"✓":s.status==="in_progress"?"→":"○"} ${s.content}`).join(`
|
|
102
|
+
`):JSON.stringify(e,null,2)}function I4({change:t,formatTime:e,formatPath:n,getActionIcon:s,getActionColor:a,onClick:r,showAgentName:i}){return o.jsxs("div",{className:"tool-history-item file-change clickable",onClick:r,children:[o.jsx("span",{className:"file-action",style:{color:a(t.action)},children:s(t.action)}),o.jsx("span",{className:"file-path",title:t.filePath,children:n(t.filePath)}),i&&o.jsx("span",{className:"tool-agent-compact",children:t.agentName}),o.jsx("span",{className:"tool-time",children:e(t.timestamp)})]})}function al(t,e,n){let s=n.initialDeps??[],a,r=!0;function i(){var c,d,f;let h;n.key&&((c=n.debug)!=null&&c.call(n))&&(h=Date.now());const m=t();if(!(m.length!==s.length||m.some((v,S)=>s[S]!==v)))return a;s=m;let y;if(n.key&&((d=n.debug)!=null&&d.call(n))&&(y=Date.now()),a=e(...m),n.key&&((f=n.debug)!=null&&f.call(n))){const v=Math.round((Date.now()-h)*100)/100,S=Math.round((Date.now()-y)*100)/100,A=S/16,k=(N,j)=>{for(N=String(N);N.length<j;)N=" "+N;return N};console.info(`%c⏱ ${k(S,5)} /${k(v,5)} ms`,`
|
|
103
|
+
font-size: .6rem;
|
|
104
|
+
font-weight: bold;
|
|
105
|
+
color: hsl(${Math.max(0,Math.min(120-120*A,120))}deg 100% 31%);`,n==null?void 0:n.key)}return n!=null&&n.onChange&&!(r&&n.skipInitialOnChange)&&n.onChange(a),r=!1,a}return i.updateDeps=c=>{s=c},i}function lC(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const B4=(t,e)=>Math.abs(t-e)<1.01,F4=(t,e,n)=>{let s;return function(...a){t.clearTimeout(s),s=t.setTimeout(()=>e.apply(this,a),n)}},cC=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},z4=t=>t,$4=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),s=[];for(let a=e;a<=n;a++)s.push(a);return s},H4=(t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;const a=i=>{const{width:c,height:d}=i;e({width:Math.round(c),height:Math.round(d)})};if(a(cC(n)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(i=>{const c=()=>{const d=i[0];if(d!=null&&d.borderBoxSize){const f=d.borderBoxSize[0];if(f){a({width:f.inlineSize,height:f.blockSize});return}}a(cC(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return r.observe(n,{box:"border-box"}),()=>{r.unobserve(n)}},uC={passive:!0},dC=typeof window>"u"?!0:"onscrollend"in window,U4=(t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;let a=0;const r=t.options.useScrollendEvent&&dC?()=>{}:F4(s,()=>{e(a,!1)},t.options.isScrollingResetDelay),i=h=>()=>{const{horizontal:m,isRtl:x}=t.options;a=m?n.scrollLeft*(x&&-1||1):n.scrollTop,r(),e(a,h)},c=i(!0),d=i(!1);n.addEventListener("scroll",c,uC);const f=t.options.useScrollendEvent&&dC;return f&&n.addEventListener("scrollend",d,uC),()=>{n.removeEventListener("scroll",c),f&&n.removeEventListener("scrollend",d)}},W4=(t,e,n)=>{if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},q4=(t,{adjustments:e=0,behavior:n},s)=>{var a,r;const i=t+e;(r=(a=s.scrollElement)==null?void 0:a.scrollTo)==null||r.call(a,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class V4{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var n,s,a;return((a=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:a.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(a=>{a.forEach(r=>{const i=()=>{const c=r.target,d=this.indexFromElement(c);if(!c.isConnected){this.observer.unobserve(c);return}this.shouldMeasureDuringScroll(d)&&this.resizeItem(d,this.options.measureElement(c,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var a;(a=s())==null||a.disconnect(),n=null},observe:a=>{var r;return(r=s())==null?void 0:r.observe(a,{box:"border-box"})},unobserve:a=>{var r;return(r=s())==null?void 0:r.unobserve(a)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,a])=>{typeof a>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:z4,rangeExtractor:$4,onChange:()=>{},measureElement:W4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,a;(a=(s=this.options).onChange)==null||a.call(s,this,n)},this.maybeNotify=al(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=r,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const a=new Map,r=new Map;for(let i=s-1;i>=0;i--){const c=n[i];if(a.has(c.lane))continue;const d=r.get(c.lane);if(d==null||c.end>d.end?r.set(c.lane,c):c.end<d.end&&a.set(c.lane,!0),a.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((i,c)=>i.end===c.end?i.index-c.index:i.end-c.end)[0]:void 0},this.getMeasurementOptions=al(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(n,s,a,r,i,c)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:a,getItemKey:r,enabled:i,lanes:c}),{key:!1}),this.getMeasurements=al(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:a,getItemKey:r,enabled:i,lanes:c},d)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const f=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,f),m=new Array(c).fill(void 0);for(let x=0;x<f;x++){const y=h[x];y&&(m[y.lane]=x)}for(let x=f;x<n;x++){const y=r(x),v=this.laneAssignments.get(x);let S,A;if(v!==void 0&&this.options.lanes>1){S=v;const E=m[S],D=E!==void 0?h[E]:void 0;A=D?D.end+this.options.gap:s+a}else{const E=this.options.lanes===1?h[x-1]:this.getFurthestMeasurement(h,x);A=E?E.end+this.options.gap:s+a,S=E?E.lane:x%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(x,S)}const k=d.get(y),N=typeof k=="number"?k:this.options.estimateSize(x),j=A+N;h[x]={index:x,start:A,size:N,end:j,key:y,lane:S},m[S]=x}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=al(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,a,r)=>this.range=n.length>0&&s>0?G4({measurements:n,outerSize:s,scrollOffset:a,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=al(()=>{let n=null,s=null;const a=this.calculateRange();return a&&(n=a.startIndex,s=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,a,r,i)=>r===null||i===null?[]:n({startIndex:r,endIndex:i,overscan:s,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,a=n.getAttribute(s);return a?parseInt(a,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(a!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,a-r),c=Math.min(this.options.count-1,a+r);return n>=i&&n<=c}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,c)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(c))});return}const s=this.indexFromElement(n),a=this.options.getItemKey(s),r=this.elementsCache.get(a);r!==n&&(r&&this.observer.unobserve(r),this.observer.observe(n),this.elementsCache.set(a,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var a;const r=this.measurementsCache[n];if(!r)return;const i=this.itemSizeCache.get(r.key)??r.size,c=s-i;c!==0&&(((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,c,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=c,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.getVirtualItems=al(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const a=[];for(let r=0,i=n.length;r<i;r++){const c=n[r],d=s[c];a.push(d)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return lC(s[c1(0,s.length-1,a=>lC(s[a]).start,n)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(n,s,a=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=n>=i+r?"end":"start"),s==="center"?n+=(a-r)/2:s==="end"&&(n-=r);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(s==="auto")if(i.end>=r+a-this.options.scrollPaddingEnd)s="end";else if(i.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const c=s==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,s,i.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:a="auto"}={})=>{const r=this.getOffsetForAlignment(n,s),i=this.now();this.scrollState={index:null,align:s,behavior:a,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:a="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getOffsetForIndex(n,s);if(!r)return;const[i,c]=r,d=this.now();this.scrollState={index:n,align:c,behavior:a,startedAt:d,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const a=this.getScrollOffset()+n,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let a;if(s.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((n=s[s.length-1])==null?void 0:n.end)??0;else{const r=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&r.some(c=>c===null);){const c=s[i];r[c.lane]===null&&(r[c.lane]=c.end),i--}a=Math.max(...r.filter(c=>c!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:a})=>{this.options.scrollToFn(n,{behavior:a,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=s?s[0]:this.scrollState.lastTargetOffset,r=1,i=a!==this.scrollState.lastTargetOffset;if(!i&&B4(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=a,this.scrollState.behavior="auto",this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const c1=(t,e,n,s)=>{for(;t<=e;){const a=(t+e)/2|0,r=n(a);if(r<s)t=a+1;else if(r>s)e=a-1;else return a}return t>0?t-1:0};function G4({measurements:t,outerSize:e,scrollOffset:n,lanes:s}){const a=t.length-1,r=d=>t[d].start;if(t.length<=s)return{startIndex:0,endIndex:a};let i=c1(0,a,r,n),c=i;if(s===1)for(;c<a&&t[c].end<n+e;)c++;else if(s>1){const d=Array(s).fill(0);for(;c<a&&d.some(h=>h<n+e);){const h=t[c];d[h.lane]=h.end,c++}const f=Array(s).fill(n+e);for(;i>=0&&f.some(h=>h>=n);){const h=t[i];f[h.lane]=h.start,i--}i=Math.max(0,i-i%s),c=Math.min(a,c+(s-1-c%s))}return{startIndex:i,endIndex:c}}const fC=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Y4({useFlushSync:t=!0,...e}){const n=b.useReducer(()=>({}),{})[1],s={...e,onChange:(r,i)=>{var c;t&&i?Dl.flushSync(n):n(),(c=e.onChange)==null||c.call(e,r,i)}},[a]=b.useState(()=>new V4(s));return a.setOptions(s),fC(()=>a._didMount(),[]),fC(()=>a._willUpdate()),a}function u1(t){return Y4({observeElementRect:H4,observeElementOffset:U4,scrollToFn:q4,...t})}const pC={30:"#000000",31:"#ef4444",32:"#22c55e",33:"#eab308",34:"#3b82f6",35:"#a855f7",36:"#06b6d4",37:"#e5e5e5",90:"#666666",91:"#f87171",92:"#4ade80",93:"#facc15",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"},hC={40:"#000000",41:"#ef4444",42:"#22c55e",43:"#eab308",44:"#3b82f6",45:"#a855f7",46:"#06b6d4",47:"#e5e5e5",100:"#666666",101:"#f87171",102:"#4ade80",103:"#facc15",104:"#60a5fa",105:"#c084fc",106:"#22d3ee",107:"#ffffff"};function mC(t){const e=[];return t.color&&e.push(`color:${t.color}`),t.bgColor&&e.push(`background-color:${t.bgColor}`),t.bold&&e.push("font-weight:bold"),t.dim&&e.push("opacity:0.6"),t.italic&&e.push("font-style:italic"),t.underline&&e.push("text-decoration:underline"),e.join(";")}function K4(t,e){const n={...t};return e===0?{}:(e===1?n.bold=!0:e===2?n.dim=!0:e===3?n.italic=!0:e===4?n.underline=!0:e===7?n.inverse=!0:e===22?(n.bold=!1,n.dim=!1):e===23?n.italic=!1:e===24?n.underline=!1:e===27?n.inverse=!1:e===39?delete n.color:e===49?delete n.bgColor:e>=30&&e<=37?n.color=pC[e]:e>=40&&e<=47?n.bgColor=hC[e]:e>=90&&e<=97?n.color=pC[e]:e>=100&&e<=107&&(n.bgColor=hC[e]),n)}function kl(t){const e=/(?:\x1b|\u001b)?\[([0-9;]*)m/g;let n="",s=0,a={},r;for(;(r=e.exec(t))!==null;){const c=t.slice(s,r.index);if(c){const f=mC(a);f?n+=`<span style="${f}">${of(c)}</span>`:n+=of(c)}const d=r[1].split(";").filter(Boolean).map(Number);if(d.length===0)a={};else for(const f of d)a=K4(a,f);s=r.index+r[0].length}const i=t.slice(s);if(i){const c=mC(a);c?n+=`<span style="${c}">${of(i)}</span>`:n+=of(i)}return n}function of(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const fo=b.memo(function({isOpen:e,position:n,actions:s,onClose:a}){const r=b.useRef(null),i=b.useRef(null);b.useEffect(()=>{if(!e)return;const d=setTimeout(()=>{const f=x=>{r.current&&!r.current.contains(x.target)&&a()},h=x=>{x.key==="Escape"&&a()},m=x=>{var v,S;const y=x.target;y&&y!==document&&y!==document.documentElement&&((v=y.classList)!=null&&v.contains("xterm-viewport")||(S=y.closest)!=null&&S.call(y,".guake-bottom-terminal-embed"))||a()};document.addEventListener("mousedown",f),document.addEventListener("touchstart",f,{passive:!0}),document.addEventListener("keydown",h),window.addEventListener("scroll",m,!0),i.current=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("touchstart",f),document.removeEventListener("keydown",h),window.removeEventListener("scroll",m,!0)}},100);return()=>{var f;clearTimeout(d),(f=i.current)==null||f.call(i),i.current=null}},[e,a]),b.useEffect(()=>{if(!e||!r.current)return;const d=r.current,f=d.getBoundingClientRect(),h=window.innerWidth,m=window.innerHeight;let x=n.x,y=n.y;n.x+f.width>h-10&&(x=h-f.width-10),n.y+f.height>m-10&&(y=m-f.height-10),d.style.left=`${Math.max(10,x)}px`,d.style.top=`${Math.max(10,y)}px`},[e,n]);const c=b.useCallback(d=>{d.disabled||(d.onClick(),a())},[a]);return e?o.jsx("div",{ref:r,className:"context-menu",style:{left:n.x,top:n.y},onClick:d=>d.stopPropagation(),children:s.map((d,f)=>d.divider?o.jsx("div",{className:"context-menu-divider"},`divider-${f}`):o.jsxs("button",{className:`context-menu-item ${d.disabled?"disabled":""} ${d.danger?"danger":""}`,onClick:()=>c(d),onTouchEnd:h=>{h.preventDefault(),h.stopPropagation(),c(d)},disabled:d.disabled,children:[d.icon&&o.jsx("span",{className:"context-menu-icon",children:d.icon}),o.jsx("span",{className:"context-menu-label",children:d.label}),d.shortcut&&o.jsx("span",{className:"context-menu-shortcut",children:d.shortcut})]},d.id))}):null});function d1(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(n=d1(t[e]))&&(s&&(s+=" "),s+=n)}else for(n in t)t[n]&&(s&&(s+=" "),s+=n);return s}function ns(){for(var t,e,n=0,s="",a=arguments.length;n<a;n++)(t=arguments[n])&&(e=d1(t))&&(s&&(s+=" "),s+=e);return s}const f1=6048e5,Q4=864e5,Np=6e4,Tp=36e5,X4=1e3,gC=Symbol.for("constructDateFrom");function xn(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&gC in t?t[gC](e):t instanceof Date?new t.constructor(e):new Date(e)}function St(t,e){return xn(e||t,t)}function Ra(t,e,n){const s=St(t,n==null?void 0:n.in);return isNaN(e)?xn((n==null?void 0:n.in)||t,NaN):(e&&s.setDate(s.getDate()+e),s)}function La(t,e,n){const s=St(t,n==null?void 0:n.in);if(isNaN(e))return xn(t,NaN);if(!e)return s;const a=s.getDate(),r=xn(t,s.getTime());r.setMonth(s.getMonth()+e+1,0);const i=r.getDate();return a>=i?r:(s.setFullYear(r.getFullYear(),r.getMonth(),a),s)}function p1(t,e,n){return xn(t,+St(t)+e)}function J4(t,e,n){return p1(t,e*Tp)}let Z4={};function go(){return Z4}function Pr(t,e){var c,d,f,h;const n=go(),s=(e==null?void 0:e.weekStartsOn)??((d=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??0,a=St(t,e==null?void 0:e.in),r=a.getDay(),i=(r<s?7:0)+r-s;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function Sl(t,e){return Pr(t,{...e,weekStartsOn:1})}function h1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=xn(n,0);a.setFullYear(s+1,0,4),a.setHours(0,0,0,0);const r=Sl(a),i=xn(n,0);i.setFullYear(s,0,4),i.setHours(0,0,0,0);const c=Sl(i);return n.getTime()>=r.getTime()?s+1:n.getTime()>=c.getTime()?s:s-1}function Qf(t){const e=St(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Fr(t,...e){const n=xn.bind(null,e.find(s=>typeof s=="object"));return e.map(n)}function po(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(0,0,0,0),n}function Cl(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e),r=po(s),i=po(a),c=+r-Qf(r),d=+i-Qf(i);return Math.round((c-d)/Q4)}function ez(t,e){const n=h1(t,e),s=xn(t,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),Sl(s)}function Au(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setTime(s.getTime()+e*Np),s}function Dx(t,e,n){return La(t,e*3,n)}function tz(t,e,n){return p1(t,e*1e3)}function Xf(t,e,n){return Ra(t,e*7,n)}function Oa(t,e,n){return La(t,e*12,n)}function bC(t,e){let n,s=e==null?void 0:e.in;return t.forEach(a=>{!s&&typeof a=="object"&&(s=xn.bind(null,a));const r=St(a,s);(!n||n<r||isNaN(+r))&&(n=r)}),xn(s,n||NaN)}function xC(t,e){let n,s=e==null?void 0:e.in;return t.forEach(a=>{!s&&typeof a=="object"&&(s=xn.bind(null,a));const r=St(a,s);(!n||n>r||isNaN(+r))&&(n=r)}),xn(s,n||NaN)}function nz(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e);return+po(s)==+po(a)}function Za(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Al(t){return!(!Za(t)&&typeof t!="number"||isNaN(+St(t)))}function Jf(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=s.getMonth()-a.getMonth();return r*12+i}function yi(t,e){const n=St(t,e==null?void 0:e.in);return Math.trunc(n.getMonth()/3)+1}function Zf(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e),r=s.getFullYear()-a.getFullYear(),i=yi(s)-yi(a);return r*4+i}function ep(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e);return s.getFullYear()-a.getFullYear()}function sz(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e),r=yC(s,a),i=Math.abs(Cl(s,a));s.setDate(s.getDate()-r*i);const c=+(yC(s,a)===-r),d=r*(i-c);return d===0?0:d}function yC(t,e){const n=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return n<0?-1:n>0?1:n}function m1(t,e){const n=St(t,e==null?void 0:e.in);return n.setHours(23,59,59,999),n}function g1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getMonth();return n.setFullYear(n.getFullYear(),s+1,0),n.setHours(23,59,59,999),n}function Lb(t,e){const n=St(t,e==null?void 0:e.in),s=n.getMonth(),a=s-s%3;return n.setMonth(a,1),n.setHours(0,0,0,0),n}function b1(t,e){const n=St(t,e==null?void 0:e.in);return n.setDate(1),n.setHours(0,0,0,0),n}function x1(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear();return n.setFullYear(s+1,0,0),n.setHours(23,59,59,999),n}function _p(t,e){const n=St(t,e==null?void 0:e.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function az(t,e){var c,d;const n=go(),s=n.weekStartsOn??((d=(c=n.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,a=St(t,e==null?void 0:e.in),r=a.getDay(),i=(r<s?-7:0)+6-(r-s);return a.setDate(a.getDate()+i),a.setHours(23,59,59,999),a}const rz={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},iz=(t,e,n)=>{let s;const a=rz[t];return typeof a=="string"?s=a:e===1?s=a.one:s=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Dg(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const oz={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},lz={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},cz={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},uz={date:Dg({formats:oz,defaultWidth:"full"}),time:Dg({formats:lz,defaultWidth:"full"}),dateTime:Dg({formats:cz,defaultWidth:"full"})},dz={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},fz=(t,e,n,s)=>dz[t];function Wc(t){return(e,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,c=n!=null&&n.width?String(n.width):i;a=t.formattingValues[c]||t.formattingValues[i]}else{const i=t.defaultWidth,c=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[c]||t.values[i]}const r=t.argumentCallback?t.argumentCallback(e):e;return a[r]}}const pz={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},hz={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},mz={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},gz={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},bz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xz={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},yz=(t,e)=>{const n=Number(t),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},vz={ordinalNumber:yz,era:Wc({values:pz,defaultWidth:"wide"}),quarter:Wc({values:hz,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Wc({values:mz,defaultWidth:"wide"}),day:Wc({values:gz,defaultWidth:"wide"}),dayPeriod:Wc({values:bz,defaultWidth:"wide",formattingValues:xz,defaultFormattingWidth:"wide"})};function qc(t){return(e,n={})=>{const s=n.width,a=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],r=e.match(a);if(!r)return null;const i=r[0],c=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(c)?kz(c,m=>m.test(i)):wz(c,m=>m.test(i));let f;f=t.valueCallback?t.valueCallback(d):d,f=n.valueCallback?n.valueCallback(f):f;const h=e.slice(i.length);return{value:f,rest:h}}}function wz(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function kz(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Sz(t){return(e,n={})=>{const s=e.match(t.matchPattern);if(!s)return null;const a=s[0],r=e.match(t.parsePattern);if(!r)return null;let i=t.valueCallback?t.valueCallback(r[0]):r[0];i=n.valueCallback?n.valueCallback(i):i;const c=e.slice(a.length);return{value:i,rest:c}}}const Cz=/^(\d+)(th|st|nd|rd)?/i,Az=/\d+/i,jz={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Nz={any:[/^b/i,/^(a|c)/i]},Tz={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},_z={any:[/1/i,/2/i,/3/i,/4/i]},Ez={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Mz={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Dz={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Rz={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Oz={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Lz={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Pz={ordinalNumber:Sz({matchPattern:Cz,parsePattern:Az,valueCallback:t=>parseInt(t,10)}),era:qc({matchPatterns:jz,defaultMatchWidth:"wide",parsePatterns:Nz,defaultParseWidth:"any"}),quarter:qc({matchPatterns:Tz,defaultMatchWidth:"wide",parsePatterns:_z,defaultParseWidth:"any",valueCallback:t=>t+1}),month:qc({matchPatterns:Ez,defaultMatchWidth:"wide",parsePatterns:Mz,defaultParseWidth:"any"}),day:qc({matchPatterns:Dz,defaultMatchWidth:"wide",parsePatterns:Rz,defaultParseWidth:"any"}),dayPeriod:qc({matchPatterns:Oz,defaultMatchWidth:"any",parsePatterns:Lz,defaultParseWidth:"any"})},y1={code:"en-US",formatDistance:iz,formatLong:uz,formatRelative:fz,localize:vz,match:Pz,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Iz(t,e){const n=St(t,e==null?void 0:e.in);return Cl(n,_p(n))+1}function Rx(t,e){const n=St(t,e==null?void 0:e.in),s=+Sl(n)-+ez(n);return Math.round(s/f1)+1}function Ox(t,e){var h,m,x,y;const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=go(),r=(e==null?void 0:e.firstWeekContainsDate)??((m=(h=e==null?void 0:e.locale)==null?void 0:h.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((y=(x=a.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??1,i=xn((e==null?void 0:e.in)||t,0);i.setFullYear(s+1,0,r),i.setHours(0,0,0,0);const c=Pr(i,e),d=xn((e==null?void 0:e.in)||t,0);d.setFullYear(s,0,r),d.setHours(0,0,0,0);const f=Pr(d,e);return+n>=+c?s+1:+n>=+f?s:s-1}function Bz(t,e){var c,d,f,h;const n=go(),s=(e==null?void 0:e.firstWeekContainsDate)??((d=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((h=(f=n.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=Ox(t,e),r=xn((e==null?void 0:e.in)||t,0);return r.setFullYear(a,0,s),r.setHours(0,0,0,0),Pr(r,e)}function v1(t,e){const n=St(t,e==null?void 0:e.in),s=+Pr(n,e)-+Bz(n,e);return Math.round(s/f1)+1}function bn(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const gi={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return bn(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):bn(n+1,2)},d(t,e){return bn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return bn(t.getHours()%12||12,e.length)},H(t,e){return bn(t.getHours(),e.length)},m(t,e){return bn(t.getMinutes(),e.length)},s(t,e){return bn(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return bn(a,e.length)}},rl={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},vC={G:function(t,e,n){const s=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const s=t.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return gi.y(t,e)},Y:function(t,e,n,s){const a=Ox(t,s),r=a>0?a:1-a;if(e==="YY"){const i=r%100;return bn(i,2)}return e==="Yo"?n.ordinalNumber(r,{unit:"year"}):bn(r,e.length)},R:function(t,e){const n=h1(t);return bn(n,e.length)},u:function(t,e){const n=t.getFullYear();return bn(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return bn(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return bn(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return gi.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return bn(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const a=v1(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):bn(a,e.length)},I:function(t,e,n){const s=Rx(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):bn(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):gi.d(t,e)},D:function(t,e,n){const s=Iz(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):bn(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(r);case"ee":return bn(r,2);case"eo":return n.ordinalNumber(r,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const a=t.getDay(),r=(a-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(r);case"cc":return bn(r,e.length);case"co":return n.ordinalNumber(r,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),a=s===0?7:s;switch(e){case"i":return String(a);case"ii":return bn(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let a;switch(s===12?a=rl.noon:s===0?a=rl.midnight:a=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const s=t.getHours();let a;switch(s>=17?a=rl.evening:s>=12?a=rl.afternoon:s>=4?a=rl.morning:a=rl.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let s=t.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return gi.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):gi.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):bn(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):bn(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):gi.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):gi.s(t,e)},S:function(t,e){return gi.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return kC(s);case"XXXX":case"XX":return Ji(s);case"XXXXX":case"XXX":default:return Ji(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return kC(s);case"xxxx":case"xx":return Ji(s);case"xxxxx":case"xxx":default:return Ji(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+wC(s,":");case"OOOO":default:return"GMT"+Ji(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+wC(s,":");case"zzzz":default:return"GMT"+Ji(s,":")}},t:function(t,e,n){const s=Math.trunc(+t/1e3);return bn(s,e.length)},T:function(t,e,n){return bn(+t,e.length)}};function wC(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=Math.trunc(s/60),r=s%60;return r===0?n+String(a):n+String(a)+e+bn(r,2)}function kC(t,e){return t%60===0?(t>0?"-":"+")+bn(Math.abs(t)/60,2):Ji(t,e)}function Ji(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=bn(Math.trunc(s/60),2),r=bn(s%60,2);return n+a+e+r}const SC=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},w1=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Fz=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return SC(t,e);let r;switch(s){case"P":r=e.dateTime({width:"short"});break;case"PP":r=e.dateTime({width:"medium"});break;case"PPP":r=e.dateTime({width:"long"});break;case"PPPP":default:r=e.dateTime({width:"full"});break}return r.replace("{{date}}",SC(s,e)).replace("{{time}}",w1(a,e))},Pb={p:w1,P:Fz},zz=/^D+$/,$z=/^Y+$/,Hz=["D","DD","YY","YYYY"];function Uz(t){return zz.test(t)}function Wz(t){return $z.test(t)}function qz(t,e,n){const s=Vz(t,e,n);if(console.warn(s),Hz.includes(t))throw new RangeError(s)}function Vz(t,e,n){const s=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Gz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Yz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Kz=/^'([^]*?)'?$/,Qz=/''/g,Xz=/[a-zA-Z]/;function CC(t,e,n){var h,m,x,y,v,S,A,k;const s=go(),a=(n==null?void 0:n.locale)??s.locale??y1,r=(n==null?void 0:n.firstWeekContainsDate)??((m=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:m.firstWeekContainsDate)??s.firstWeekContainsDate??((y=(x=s.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((S=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:S.weekStartsOn)??s.weekStartsOn??((k=(A=s.locale)==null?void 0:A.options)==null?void 0:k.weekStartsOn)??0,c=St(t,n==null?void 0:n.in);if(!Al(c))throw new RangeError("Invalid time value");let d=e.match(Yz).map(N=>{const j=N[0];if(j==="p"||j==="P"){const E=Pb[j];return E(N,a.formatLong)}return N}).join("").match(Gz).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const j=N[0];if(j==="'")return{isToken:!1,value:Jz(N)};if(vC[j])return{isToken:!0,value:N};if(j.match(Xz))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:N}});a.localize.preprocessor&&(d=a.localize.preprocessor(c,d));const f={firstWeekContainsDate:r,weekStartsOn:i,locale:a};return d.map(N=>{if(!N.isToken)return N.value;const j=N.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Wz(j)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Uz(j))&&qz(j,e,String(t));const E=vC[j[0]];return E(c,j,a.localize,f)}).join("")}function Jz(t){const e=t.match(Kz);return e?e[1].replace(Qz,"'"):t}function AC(t,e){return St(t,e==null?void 0:e.in).getDate()}function Zz(t,e){return St(t,e==null?void 0:e.in).getDay()}function e3(t,e){const n=St(t,e==null?void 0:e.in),s=n.getFullYear(),a=n.getMonth(),r=xn(n,0);return r.setFullYear(s,a+1,0),r.setHours(0,0,0,0),r.getDate()}function t3(){return Object.assign({},go())}function bs(t,e){return St(t,e==null?void 0:e.in).getHours()}function n3(t,e){const n=St(t,e==null?void 0:e.in).getDay();return n===0?7:n}function xs(t,e){return St(t,e==null?void 0:e.in).getMinutes()}function Is(t,e){return St(t,e==null?void 0:e.in).getMonth()}function vi(t){return St(t).getSeconds()}function Ib(t){return+St(t)}function Jt(t,e){return St(t,e==null?void 0:e.in).getFullYear()}function Rr(t,e){return+St(t)>+St(e)}function Qa(t,e){return+St(t)<+St(e)}function s3(t,e){return+St(t)==+St(e)}function a3(t,e){const n=r3(e)?new e(0):xn(e,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}function r3(t){var e;return typeof t=="function"&&((e=t.prototype)==null?void 0:e.constructor)===t}const i3=10;class k1{constructor(){Je(this,"subPriority",0)}validate(e,n){return!0}}class o3 extends k1{constructor(e,n,s,a,r){super(),this.value=e,this.validateValue=n,this.setValue=s,this.priority=a,r&&(this.subPriority=r)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,s){return this.setValue(e,n,this.value,s)}}class l3 extends k1{constructor(n,s){super();Je(this,"priority",i3);Je(this,"subPriority",-1);this.context=n||(a=>xn(s,a))}set(n,s){return s.timestampIsSet?n:xn(n,a3(n,this.context))}}class hn{run(e,n,s,a){const r=this.parse(e,n,s,a);return r?{setter:new o3(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}validate(e,n,s){return!0}}class c3 extends hn{constructor(){super(...arguments);Je(this,"priority",140);Je(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,a){switch(s){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})||a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"})}}set(n,s,a){return s.era=a,n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}const Wn={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Va={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function qn(t,e){return t&&{value:e(t.value),rest:t.rest}}function Ln(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function Ga(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const s=n[1]==="+"?1:-1,a=n[2]?parseInt(n[2],10):0,r=n[3]?parseInt(n[3],10):0,i=n[5]?parseInt(n[5],10):0;return{value:s*(a*Tp+r*Np+i*X4),rest:e.slice(n[0].length)}}function S1(t){return Ln(Wn.anyDigitsSigned,t)}function zn(t,e){switch(t){case 1:return Ln(Wn.singleDigit,e);case 2:return Ln(Wn.twoDigits,e);case 3:return Ln(Wn.threeDigits,e);case 4:return Ln(Wn.fourDigits,e);default:return Ln(new RegExp("^\\d{1,"+t+"}"),e)}}function tp(t,e){switch(t){case 1:return Ln(Wn.singleDigitSigned,e);case 2:return Ln(Wn.twoDigitsSigned,e);case 3:return Ln(Wn.threeDigitsSigned,e);case 4:return Ln(Wn.fourDigitsSigned,e);default:return Ln(new RegExp("^-?\\d{1,"+t+"}"),e)}}function Lx(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function C1(t,e){const n=e>0,s=n?e:1-e;let a;if(s<=50)a=t||100;else{const r=s+50,i=Math.trunc(r/100)*100,c=t>=r%100;a=t+i-(c?100:0)}return n?a:1-a}function A1(t){return t%400===0||t%4===0&&t%100!==0}class u3 extends hn{constructor(){super(...arguments);Je(this,"priority",130);Je(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,a){const r=i=>({year:i,isTwoDigitYear:s==="yy"});switch(s){case"y":return qn(zn(4,n),r);case"yo":return qn(a.ordinalNumber(n,{unit:"year"}),r);default:return qn(zn(s.length,n),r)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a){const r=n.getFullYear();if(a.isTwoDigitYear){const c=C1(a.year,r);return n.setFullYear(c,0,1),n.setHours(0,0,0,0),n}const i=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class d3 extends hn{constructor(){super(...arguments);Je(this,"priority",130);Je(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,a){const r=i=>({year:i,isTwoDigitYear:s==="YY"});switch(s){case"Y":return qn(zn(4,n),r);case"Yo":return qn(a.ordinalNumber(n,{unit:"year"}),r);default:return qn(zn(s.length,n),r)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,r){const i=Ox(n,r);if(a.isTwoDigitYear){const d=C1(a.year,i);return n.setFullYear(d,0,r.firstWeekContainsDate),n.setHours(0,0,0,0),Pr(n,r)}const c=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(c,0,r.firstWeekContainsDate),n.setHours(0,0,0,0),Pr(n,r)}}class f3 extends hn{constructor(){super(...arguments);Je(this,"priority",130);Je(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return tp(s==="R"?4:s.length,n)}set(n,s,a){const r=xn(n,0);return r.setFullYear(a,0,4),r.setHours(0,0,0,0),Sl(r)}}class p3 extends hn{constructor(){super(...arguments);Je(this,"priority",130);Je(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return tp(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class h3 extends hn{constructor(){super(...arguments);Je(this,"priority",120);Je(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"Q":case"QQ":return zn(s.length,n);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})||a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class m3 extends hn{constructor(){super(...arguments);Je(this,"priority",120);Je(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"q":case"qq":return zn(s.length,n);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})||a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class g3 extends hn{constructor(){super(...arguments);Je(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Je(this,"priority",110)}parse(n,s,a){const r=i=>i-1;switch(s){case"M":return qn(Ln(Wn.month,n),r);case"MM":return qn(zn(2,n),r);case"Mo":return qn(a.ordinalNumber(n,{unit:"month"}),r);case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})||a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}class b3 extends hn{constructor(){super(...arguments);Je(this,"priority",110);Je(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,a){const r=i=>i-1;switch(s){case"L":return qn(Ln(Wn.month,n),r);case"LL":return qn(zn(2,n),r);case"Lo":return qn(a.ordinalNumber(n,{unit:"month"}),r);case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})||a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}function x3(t,e,n){const s=St(t,n==null?void 0:n.in),a=v1(s,n)-e;return s.setDate(s.getDate()-a*7),St(s,n==null?void 0:n.in)}class y3 extends hn{constructor(){super(...arguments);Je(this,"priority",100);Je(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return Ln(Wn.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,r){return Pr(x3(n,a,r),r)}}function v3(t,e,n){const s=St(t,n==null?void 0:n.in),a=Rx(s,n)-e;return s.setDate(s.getDate()-a*7),s}class w3 extends hn{constructor(){super(...arguments);Je(this,"priority",100);Je(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,a){switch(s){case"I":return Ln(Wn.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return Sl(v3(n,a))}}const k3=[31,28,31,30,31,30,31,31,30,31,30,31],S3=[31,29,31,30,31,30,31,31,30,31,30,31];class C3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"subPriority",1);Je(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return Ln(Wn.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return zn(s.length,n)}}validate(n,s){const a=n.getFullYear(),r=A1(a),i=n.getMonth();return r?s>=1&&s<=S3[i]:s>=1&&s<=k3[i]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class A3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"subpriority",1);Je(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,a){switch(s){case"D":case"DD":return Ln(Wn.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return zn(s.length,n)}}validate(n,s){const a=n.getFullYear();return A1(a)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,a){return n.setMonth(0,a),n.setHours(0,0,0,0),n}}function Px(t,e,n){var m,x,y,v;const s=go(),a=(n==null?void 0:n.weekStartsOn)??((x=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??s.weekStartsOn??((v=(y=s.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??0,r=St(t,n==null?void 0:n.in),i=r.getDay(),d=(e%7+7)%7,f=7-a,h=e<0||e>6?e-(i+f)%7:(d+f)%7-(i+f)%7;return Ra(r,h,n)}class j3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=Px(n,a,r),n.setHours(0,0,0,0),n}}class N3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,r){const i=c=>{const d=Math.floor((c-1)/7)*7;return(c+r.weekStartsOn+6)%7+d};switch(s){case"e":case"ee":return qn(zn(s.length,n),i);case"eo":return qn(a.ordinalNumber(n,{unit:"day"}),i);case"eee":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeeee":return a.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=Px(n,a,r),n.setHours(0,0,0,0),n}}class T3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,r){const i=c=>{const d=Math.floor((c-1)/7)*7;return(c+r.weekStartsOn+6)%7+d};switch(s){case"c":case"cc":return qn(zn(s.length,n),i);case"co":return qn(a.ordinalNumber(n,{unit:"day"}),i);case"ccc":return a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"ccccc":return a.day(n,{width:"narrow",context:"standalone"});case"cccccc":return a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(n,{width:"wide",context:"standalone"})||a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,r){return n=Px(n,a,r),n.setHours(0,0,0,0),n}}function _3(t,e,n){const s=St(t,n==null?void 0:n.in),a=n3(s,n),r=e-a;return Ra(s,r,n)}class E3 extends hn{constructor(){super(...arguments);Je(this,"priority",90);Je(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,a){const r=i=>i===0?7:i;switch(s){case"i":case"ii":return zn(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return qn(a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r);case"iiiii":return qn(a.day(n,{width:"narrow",context:"formatting"}),r);case"iiiiii":return qn(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r);case"iiii":default:return qn(a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),r)}}validate(n,s){return s>=1&&s<=7}set(n,s,a){return n=_3(n,a),n.setHours(0,0,0,0),n}}class M3 extends hn{constructor(){super(...arguments);Je(this,"priority",80);Je(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,a){switch(s){case"a":case"aa":case"aaa":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Lx(a),0,0,0),n}}class D3 extends hn{constructor(){super(...arguments);Je(this,"priority",80);Je(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,a){switch(s){case"b":case"bb":case"bbb":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Lx(a),0,0,0),n}}class R3 extends hn{constructor(){super(...arguments);Je(this,"priority",80);Je(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,a){switch(s){case"B":case"BB":case"BBB":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(Lx(a),0,0,0),n}}class O3 extends hn{constructor(){super(...arguments);Je(this,"priority",70);Je(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return Ln(Wn.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,a){const r=n.getHours()>=12;return r&&a<12?n.setHours(a+12,0,0,0):!r&&a===12?n.setHours(0,0,0,0):n.setHours(a,0,0,0),n}}class L3 extends hn{constructor(){super(...arguments);Je(this,"priority",70);Je(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return Ln(Wn.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class P3 extends hn{constructor(){super(...arguments);Je(this,"priority",70);Je(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return Ln(Wn.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.getHours()>=12&&a<12?n.setHours(a+12,0,0,0):n.setHours(a,0,0,0),n}}class I3 extends hn{constructor(){super(...arguments);Je(this,"priority",70);Je(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return Ln(Wn.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return zn(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,a){const r=a<=24?a%24:a;return n.setHours(r,0,0,0),n}}class B3 extends hn{constructor(){super(...arguments);Je(this,"priority",60);Je(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return Ln(Wn.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class F3 extends hn{constructor(){super(...arguments);Je(this,"priority",50);Je(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return Ln(Wn.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return zn(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class z3 extends hn{constructor(){super(...arguments);Je(this,"priority",30);Je(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=r=>Math.trunc(r*Math.pow(10,-s.length+3));return qn(zn(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class $3 extends hn{constructor(){super(...arguments);Je(this,"priority",10);Je(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Ga(Va.basicOptionalMinutes,n);case"XX":return Ga(Va.basic,n);case"XXXX":return Ga(Va.basicOptionalSeconds,n);case"XXXXX":return Ga(Va.extendedOptionalSeconds,n);case"XXX":default:return Ga(Va.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class H3 extends hn{constructor(){super(...arguments);Je(this,"priority",10);Je(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Ga(Va.basicOptionalMinutes,n);case"xx":return Ga(Va.basic,n);case"xxxx":return Ga(Va.basicOptionalSeconds,n);case"xxxxx":return Ga(Va.extendedOptionalSeconds,n);case"xxx":default:return Ga(Va.extended,n)}}set(n,s,a){return s.timestampIsSet?n:xn(n,n.getTime()-Qf(n)-a)}}class U3 extends hn{constructor(){super(...arguments);Je(this,"priority",40);Je(this,"incompatibleTokens","*")}parse(n){return S1(n)}set(n,s,a){return[xn(n,a*1e3),{timestampIsSet:!0}]}}class W3 extends hn{constructor(){super(...arguments);Je(this,"priority",20);Je(this,"incompatibleTokens","*")}parse(n){return S1(n)}set(n,s,a){return[xn(n,a),{timestampIsSet:!0}]}}const q3={G:new c3,y:new u3,Y:new d3,R:new f3,u:new p3,Q:new h3,q:new m3,M:new g3,L:new b3,w:new y3,I:new w3,d:new C3,D:new A3,E:new j3,e:new N3,c:new T3,i:new E3,a:new M3,b:new D3,B:new R3,h:new O3,H:new L3,K:new P3,k:new I3,m:new B3,s:new F3,S:new z3,X:new $3,x:new H3,t:new U3,T:new W3},V3=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,G3=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Y3=/^'([^]*?)'?$/,K3=/''/g,Q3=/\S/,X3=/[a-zA-Z]/;function J3(t,e,n,s){var A,k,N,j,E,D,_,B;const a=()=>xn((s==null?void 0:s.in)||n,NaN),r=t3(),i=(s==null?void 0:s.locale)??r.locale??y1,c=(s==null?void 0:s.firstWeekContainsDate)??((k=(A=s==null?void 0:s.locale)==null?void 0:A.options)==null?void 0:k.firstWeekContainsDate)??r.firstWeekContainsDate??((j=(N=r.locale)==null?void 0:N.options)==null?void 0:j.firstWeekContainsDate)??1,d=(s==null?void 0:s.weekStartsOn)??((D=(E=s==null?void 0:s.locale)==null?void 0:E.options)==null?void 0:D.weekStartsOn)??r.weekStartsOn??((B=(_=r.locale)==null?void 0:_.options)==null?void 0:B.weekStartsOn)??0;if(!e)return t?a():St(n,s==null?void 0:s.in);const f={firstWeekContainsDate:c,weekStartsOn:d,locale:i},h=[new l3(s==null?void 0:s.in,n)],m=e.match(G3).map(O=>{const T=O[0];if(T in Pb){const M=Pb[T];return M(O,i.formatLong)}return O}).join("").match(V3),x=[];for(let O of m){const T=O[0],M=q3[T];if(M){const{incompatibleTokens:R}=M;if(Array.isArray(R)){const $=x.find(U=>R.includes(U.token)||U.token===T);if($)throw new RangeError(`The format string mustn't contain \`${$.fullToken}\` and \`${O}\` at the same time`)}else if(M.incompatibleTokens==="*"&&x.length>0)throw new RangeError(`The format string mustn't contain \`${O}\` and any other token at the same time`);x.push({token:T,fullToken:O});const F=M.run(t,O,i.match,f);if(!F)return a();h.push(F.setter),t=F.rest}else{if(T.match(X3))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");if(O==="''"?O="'":T==="'"&&(O=Z3(O)),t.indexOf(O)===0)t=t.slice(O.length);else return a()}}if(t.length>0&&Q3.test(t))return a();const y=h.map(O=>O.priority).sort((O,T)=>T-O).filter((O,T,M)=>M.indexOf(O)===T).map(O=>h.filter(T=>T.priority===O).sort((T,M)=>M.subPriority-T.subPriority)).map(O=>O[0]);let v=St(n,s==null?void 0:s.in);if(isNaN(+v))return a();const S={};for(const O of y){if(!O.validate(v,f))return a();const T=O.set(v,S,f);Array.isArray(T)?(v=T[0],Object.assign(S,T[1])):v=T}return v}function Z3(t){return t.match(Y3)[1].replace(K3,"'")}function e$(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()&&s.getMonth()===a.getMonth()}function t$(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e);return+Lb(s)==+Lb(a)}function n$(t,e,n){const[s,a]=Fr(n==null?void 0:n.in,t,e);return s.getFullYear()===a.getFullYear()}function ju(t,e,n){const s=+St(t,n==null?void 0:n.in),[a,r]=[+St(e.start,n==null?void 0:n.in),+St(e.end,n==null?void 0:n.in)].sort((i,c)=>i-c);return s>=a&&s<=r}function s$(t,e,n){return Ra(t,-1,n)}function a$(t,e){const n=()=>xn(e==null?void 0:e.in,NaN),a=l$(t);let r;if(a.date){const f=c$(a.date,2);r=u$(f.restDateString,f.year)}if(!r||isNaN(+r))return n();const i=+r;let c=0,d;if(a.time&&(c=d$(a.time),isNaN(c)))return n();if(a.timezone){if(d=f$(a.timezone),isNaN(d))return n()}else{const f=new Date(i+c),h=St(0,e==null?void 0:e.in);return h.setFullYear(f.getUTCFullYear(),f.getUTCMonth(),f.getUTCDate()),h.setHours(f.getUTCHours(),f.getUTCMinutes(),f.getUTCSeconds(),f.getUTCMilliseconds()),h}return St(i+c+d,e==null?void 0:e.in)}const lf={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},r$=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,i$=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,o$=/^([+-])(\d{2})(?::?(\d{2}))?$/;function l$(t){const e={},n=t.split(lf.dateTimeDelimiter);let s;if(n.length>2)return e;if(/:/.test(n[0])?s=n[0]:(e.date=n[0],s=n[1],lf.timeZoneDelimiter.test(e.date)&&(e.date=t.split(lf.timeZoneDelimiter)[0],s=t.substr(e.date.length,t.length))),s){const a=lf.timezone.exec(s);a?(e.time=s.replace(a[1],""),e.timezone=a[1]):e.time=s}return e}function c$(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),s=t.match(n);if(!s)return{year:NaN,restDateString:""};const a=s[1]?parseInt(s[1]):null,r=s[2]?parseInt(s[2]):null;return{year:r===null?a:r*100,restDateString:t.slice((s[1]||s[2]).length)}}function u$(t,e){if(e===null)return new Date(NaN);const n=t.match(r$);if(!n)return new Date(NaN);const s=!!n[4],a=Vc(n[1]),r=Vc(n[2])-1,i=Vc(n[3]),c=Vc(n[4]),d=Vc(n[5])-1;if(s)return b$(e,c,d)?p$(e,c,d):new Date(NaN);{const f=new Date(0);return!m$(e,r,i)||!g$(e,a)?new Date(NaN):(f.setUTCFullYear(e,r,Math.max(a,i)),f)}}function Vc(t){return t?parseInt(t):1}function d$(t){const e=t.match(i$);if(!e)return NaN;const n=Rg(e[1]),s=Rg(e[2]),a=Rg(e[3]);return x$(n,s,a)?n*Tp+s*Np+a*1e3:NaN}function Rg(t){return t&&parseFloat(t.replace(",","."))||0}function f$(t){if(t==="Z")return 0;const e=t.match(o$);if(!e)return 0;const n=e[1]==="+"?-1:1,s=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return y$(s,a)?n*(s*Tp+a*Np):NaN}function p$(t,e,n){const s=new Date(0);s.setUTCFullYear(t,0,4);const a=s.getUTCDay()||7,r=(e-1)*7+n+1-a;return s.setUTCDate(s.getUTCDate()+r),s}const h$=[31,null,31,30,31,30,31,31,30,31,30,31];function j1(t){return t%400===0||t%4===0&&t%100!==0}function m$(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(h$[e]||(j1(t)?29:28))}function g$(t,e){return e>=1&&e<=(j1(t)?366:365)}function b$(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function x$(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function y$(t,e){return e>=0&&e<=59}function Js(t,e,n){const s=St(t,n==null?void 0:n.in),a=s.getFullYear(),r=s.getDate(),i=xn(t,0);i.setFullYear(a,e,15),i.setHours(0,0,0,0);const c=e3(i);return s.setMonth(e,Math.min(r,c)),s}function jf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setHours(e),s}function Nf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setMinutes(e),s}function dl(t,e,n){const s=St(t,n==null?void 0:n.in),a=Math.trunc(s.getMonth()/3)+1,r=e-a;return Js(s,s.getMonth()+r*3)}function Tf(t,e,n){const s=St(t,n==null?void 0:n.in);return s.setSeconds(e),s}function Wa(t,e,n){const s=St(t,n==null?void 0:n.in);return isNaN(+s)?xn(t,NaN):(s.setFullYear(e),s)}function ao(t,e,n){return La(t,-e,n)}function N1(t,e,n){return Dx(t,-1,n)}function jC(t,e,n){return Xf(t,-1,n)}function Si(t,e,n){return Oa(t,-e,n)}function Ep(){return typeof window<"u"}function Ll(t){return T1(t)?(t.nodeName||"").toLowerCase():"#document"}function aa(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function lr(t){var e;return(e=(T1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function T1(t){return Ep()?t instanceof Node||t instanceof aa(t).Node:!1}function Ns(t){return Ep()?t instanceof Element||t instanceof aa(t).Element:!1}function zr(t){return Ep()?t instanceof HTMLElement||t instanceof aa(t).HTMLElement:!1}function NC(t){return!Ep()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof aa(t).ShadowRoot}function Ou(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=Ca(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&a!=="inline"&&a!=="contents"}function v$(t){return/^(table|td|th)$/.test(Ll(t))}function Mp(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const w$=/transform|translate|scale|rotate|perspective|filter/,k$=/paint|layout|strict|content/,Ki=t=>!!t&&t!=="none";let Og;function Ix(t){const e=Ns(t)?Ca(t):t;return Ki(e.transform)||Ki(e.translate)||Ki(e.scale)||Ki(e.rotate)||Ki(e.perspective)||!Bx()&&(Ki(e.backdropFilter)||Ki(e.filter))||w$.test(e.willChange||"")||k$.test(e.contain||"")}function S$(t){let e=Ci(t);for(;zr(e)&&!jl(e);){if(Ix(e))return e;if(Mp(e))return null;e=Ci(e)}return null}function Bx(){return Og==null&&(Og=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Og}function jl(t){return/^(html|body|#document)$/.test(Ll(t))}function Ca(t){return aa(t).getComputedStyle(t)}function Dp(t){return Ns(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ci(t){if(Ll(t)==="html")return t;const e=t.assignedSlot||t.parentNode||NC(t)&&t.host||lr(t);return NC(e)?e.host:e}function _1(t){const e=Ci(t);return jl(e)?t.ownerDocument?t.ownerDocument.body:t.body:zr(e)&&Ou(e)?e:_1(e)}function Nu(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=_1(t),r=a===((s=t.ownerDocument)==null?void 0:s.body),i=aa(a);if(r){const c=Bb(i);return e.concat(i,i.visualViewport||[],Ou(a)?a:[],c&&n?Nu(c):[])}else return e.concat(a,Nu(a,[],n))}function Bb(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Nl=Math.min,ro=Math.max,np=Math.round,cf=Math.floor,er=t=>({x:t,y:t}),C$={left:"right",right:"left",bottom:"top",top:"bottom"};function A$(t,e,n){return ro(t,Nl(e,n))}function Rp(t,e){return typeof t=="function"?t(e):t}function Tl(t){return t.split("-")[0]}function Lu(t){return t.split("-")[1]}function j$(t){return t==="x"?"y":"x"}function Fx(t){return t==="y"?"height":"width"}function to(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function zx(t){return j$(to(t))}function N$(t,e,n){n===void 0&&(n=!1);const s=Lu(t),a=zx(t),r=Fx(a);let i=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(i=sp(i)),[i,sp(i)]}function T$(t){const e=sp(t);return[Fb(t),e,Fb(e)]}function Fb(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const TC=["left","right"],_C=["right","left"],_$=["top","bottom"],E$=["bottom","top"];function M$(t,e,n){switch(t){case"top":case"bottom":return n?e?_C:TC:e?TC:_C;case"left":case"right":return e?_$:E$;default:return[]}}function D$(t,e,n,s){const a=Lu(t);let r=M$(Tl(t),n==="start",s);return a&&(r=r.map(i=>i+"-"+a),e&&(r=r.concat(r.map(Fb)))),r}function sp(t){const e=Tl(t);return C$[e]+t.slice(e.length)}function R$(t){return{top:0,right:0,bottom:0,left:0,...t}}function E1(t){return typeof t!="number"?R$(t):{top:t,right:t,bottom:t,left:t}}function ap(t){const{x:e,y:n,width:s,height:a}=t;return{width:s,height:a,top:n,left:e,right:e+s,bottom:n+a,x:e,y:n}}var O$=typeof document<"u",L$=function(){},rp=O$?b.useLayoutEffect:L$;const P$={...qA},I$=P$.useInsertionEffect,B$=I$||(t=>t());function F$(t){const e=b.useRef(()=>{});return B$(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return e.current==null?void 0:e.current(...s)},[])}function EC(t,e,n){let{reference:s,floating:a}=t;const r=to(e),i=zx(e),c=Fx(i),d=Tl(e),f=r==="y",h=s.x+s.width/2-a.width/2,m=s.y+s.height/2-a.height/2,x=s[c]/2-a[c]/2;let y;switch(d){case"top":y={x:h,y:s.y-a.height};break;case"bottom":y={x:h,y:s.y+s.height};break;case"right":y={x:s.x+s.width,y:m};break;case"left":y={x:s.x-a.width,y:m};break;default:y={x:s.x,y:s.y}}switch(Lu(e)){case"start":y[i]-=x*(n&&f?-1:1);break;case"end":y[i]+=x*(n&&f?-1:1);break}return y}async function z$(t,e){var n;e===void 0&&(e={});const{x:s,y:a,platform:r,rects:i,elements:c,strategy:d}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:x=!1,padding:y=0}=Rp(e,t),v=E1(y),A=c[x?m==="floating"?"reference":"floating":m],k=ap(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(A)))==null||n?A:A.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:d})),N=m==="floating"?{x:s,y:a,width:i.floating.width,height:i.floating.height}:i.reference,j=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),E=await(r.isElement==null?void 0:r.isElement(j))?await(r.getScale==null?void 0:r.getScale(j))||{x:1,y:1}:{x:1,y:1},D=ap(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:N,offsetParent:j,strategy:d}):N);return{top:(k.top-D.top+v.top)/E.y,bottom:(D.bottom-k.bottom+v.bottom)/E.y,left:(k.left-D.left+v.left)/E.x,right:(D.right-k.right+v.right)/E.x}}const $$=50,H$=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:r=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:z$},d=await(i.isRTL==null?void 0:i.isRTL(e));let f=await i.getElementRects({reference:t,floating:e,strategy:a}),{x:h,y:m}=EC(f,s,d),x=s,y=0;const v={};for(let S=0;S<r.length;S++){const A=r[S];if(!A)continue;const{name:k,fn:N}=A,{x:j,y:E,data:D,reset:_}=await N({x:h,y:m,initialPlacement:s,placement:x,strategy:a,middlewareData:v,rects:f,platform:c,elements:{reference:t,floating:e}});h=j??h,m=E??m,v[k]={...v[k],...D},_&&y<$$&&(y++,typeof _=="object"&&(_.placement&&(x=_.placement),_.rects&&(f=_.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:a}):_.rects),{x:h,y:m}=EC(f,x,d)),S=-1)}return{x:h,y:m,placement:x,strategy:a,middlewareData:v}},U$=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:a,rects:r,platform:i,elements:c,middlewareData:d}=e,{element:f,padding:h=0}=Rp(t,e)||{};if(f==null)return{};const m=E1(h),x={x:n,y:s},y=zx(a),v=Fx(y),S=await i.getDimensions(f),A=y==="y",k=A?"top":"left",N=A?"bottom":"right",j=A?"clientHeight":"clientWidth",E=r.reference[v]+r.reference[y]-x[y]-r.floating[v],D=x[y]-r.reference[y],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let B=_?_[j]:0;(!B||!await(i.isElement==null?void 0:i.isElement(_)))&&(B=c.floating[j]||r.floating[v]);const O=E/2-D/2,T=B/2-S[v]/2-1,M=Nl(m[k],T),R=Nl(m[N],T),F=M,$=B-S[v]-R,U=B/2-S[v]/2+O,L=A$(F,U,$),z=!d.arrow&&Lu(a)!=null&&U!==L&&r.reference[v]/2-(U<F?M:R)-S[v]/2<0,W=z?U<F?U-F:U-$:0;return{[y]:x[y]+W,data:{[y]:L,centerOffset:U-L-W,...z&&{alignmentOffset:W}},reset:z}}}),W$=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:a,middlewareData:r,rects:i,initialPlacement:c,platform:d,elements:f}=e,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:S=!0,...A}=Rp(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const k=Tl(a),N=to(c),j=Tl(c)===c,E=await(d.isRTL==null?void 0:d.isRTL(f.floating)),D=x||(j||!S?[sp(c)]:T$(c)),_=v!=="none";!x&&_&&D.push(...D$(c,S,v,E));const B=[c,...D],O=await d.detectOverflow(e,A),T=[];let M=((s=r.flip)==null?void 0:s.overflows)||[];if(h&&T.push(O[k]),m){const U=N$(a,i,E);T.push(O[U[0]],O[U[1]])}if(M=[...M,{placement:a,overflows:T}],!T.every(U=>U<=0)){var R,F;const U=(((R=r.flip)==null?void 0:R.index)||0)+1,L=B[U];if(L&&(!(m==="alignment"?N!==to(L):!1)||M.every(V=>to(V.placement)===N?V.overflows[0]>0:!0)))return{data:{index:U,overflows:M},reset:{placement:L}};let z=(F=M.filter(W=>W.overflows[0]<=0).sort((W,V)=>W.overflows[1]-V.overflows[1])[0])==null?void 0:F.placement;if(!z)switch(y){case"bestFit":{var $;const W=($=M.filter(V=>{if(_){const Y=to(V.placement);return Y===N||Y==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(Y=>Y>0).reduce((Y,P)=>Y+P,0)]).sort((V,Y)=>V[1]-Y[1])[0])==null?void 0:$[0];W&&(z=W);break}case"initialPlacement":z=c;break}if(a!==z)return{reset:{placement:z}}}return{}}}},q$=new Set(["left","top"]);async function V$(t,e){const{placement:n,platform:s,elements:a}=t,r=await(s.isRTL==null?void 0:s.isRTL(a.floating)),i=Tl(n),c=Lu(n),d=to(n)==="y",f=q$.has(i)?-1:1,h=r&&d?-1:1,m=Rp(e,t);let{mainAxis:x,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),d?{x:y*h,y:x*f}:{x:x*f,y:y*h}}const G$=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:a,y:r,placement:i,middlewareData:c}=e,d=await V$(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:a+d.x,y:r+d.y,data:{...d,placement:i}}}}};function M1(t){const e=Ca(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=zr(t),r=a?t.offsetWidth:n,i=a?t.offsetHeight:s,c=np(n)!==r||np(s)!==i;return c&&(n=r,s=i),{width:n,height:s,$:c}}function $x(t){return Ns(t)?t:t.contextElement}function bl(t){const e=$x(t);if(!zr(e))return er(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:r}=M1(e);let i=(r?np(n.width):n.width)/s,c=(r?np(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Y$=er(0);function D1(t){const e=aa(t);return!Bx()||!e.visualViewport?Y$:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function K$(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==aa(t)?!1:e}function ho(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),r=$x(t);let i=er(1);e&&(s?Ns(s)&&(i=bl(s)):i=bl(t));const c=K$(r,n,s)?D1(r):er(0);let d=(a.left+c.x)/i.x,f=(a.top+c.y)/i.y,h=a.width/i.x,m=a.height/i.y;if(r){const x=aa(r),y=s&&Ns(s)?aa(s):s;let v=x,S=Bb(v);for(;S&&s&&y!==v;){const A=bl(S),k=S.getBoundingClientRect(),N=Ca(S),j=k.left+(S.clientLeft+parseFloat(N.paddingLeft))*A.x,E=k.top+(S.clientTop+parseFloat(N.paddingTop))*A.y;d*=A.x,f*=A.y,h*=A.x,m*=A.y,d+=j,f+=E,v=aa(S),S=Bb(v)}}return ap({width:h,height:m,x:d,y:f})}function Op(t,e){const n=Dp(t).scrollLeft;return e?e.left+n:ho(lr(t)).left+n}function R1(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-Op(t,n),a=n.top+e.scrollTop;return{x:s,y:a}}function Q$(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const r=a==="fixed",i=lr(s),c=e?Mp(e.floating):!1;if(s===i||c&&r)return n;let d={scrollLeft:0,scrollTop:0},f=er(1);const h=er(0),m=zr(s);if((m||!m&&!r)&&((Ll(s)!=="body"||Ou(i))&&(d=Dp(s)),m)){const y=ho(s);f=bl(s),h.x=y.x+s.clientLeft,h.y=y.y+s.clientTop}const x=i&&!m&&!r?R1(i,d):er(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+h.x+x.x,y:n.y*f.y-d.scrollTop*f.y+h.y+x.y}}function X$(t){return Array.from(t.getClientRects())}function J$(t){const e=lr(t),n=Dp(t),s=t.ownerDocument.body,a=ro(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=ro(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let i=-n.scrollLeft+Op(t);const c=-n.scrollTop;return Ca(s).direction==="rtl"&&(i+=ro(e.clientWidth,s.clientWidth)-a),{width:a,height:r,x:i,y:c}}const MC=25;function Z$(t,e){const n=aa(t),s=lr(t),a=n.visualViewport;let r=s.clientWidth,i=s.clientHeight,c=0,d=0;if(a){r=a.width,i=a.height;const h=Bx();(!h||h&&e==="fixed")&&(c=a.offsetLeft,d=a.offsetTop)}const f=Op(s);if(f<=0){const h=s.ownerDocument,m=h.body,x=getComputedStyle(m),y=h.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,v=Math.abs(s.clientWidth-m.clientWidth-y);v<=MC&&(r-=v)}else f<=MC&&(r+=f);return{width:r,height:i,x:c,y:d}}function eH(t,e){const n=ho(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,r=zr(t)?bl(t):er(1),i=t.clientWidth*r.x,c=t.clientHeight*r.y,d=a*r.x,f=s*r.y;return{width:i,height:c,x:d,y:f}}function DC(t,e,n){let s;if(e==="viewport")s=Z$(t,n);else if(e==="document")s=J$(lr(t));else if(Ns(e))s=eH(e,n);else{const a=D1(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ap(s)}function O1(t,e){const n=Ci(t);return n===e||!Ns(n)||jl(n)?!1:Ca(n).position==="fixed"||O1(n,e)}function tH(t,e){const n=e.get(t);if(n)return n;let s=Nu(t,[],!1).filter(c=>Ns(c)&&Ll(c)!=="body"),a=null;const r=Ca(t).position==="fixed";let i=r?Ci(t):t;for(;Ns(i)&&!jl(i);){const c=Ca(i),d=Ix(i);!d&&c.position==="fixed"&&(a=null),(r?!d&&!a:!d&&c.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Ou(i)&&!d&&O1(t,i))?s=s.filter(h=>h!==i):a=c,i=Ci(i)}return e.set(t,s),s}function nH(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const i=[...n==="clippingAncestors"?Mp(e)?[]:tH(e,this._c):[].concat(n),s],c=DC(e,i[0],a);let d=c.top,f=c.right,h=c.bottom,m=c.left;for(let x=1;x<i.length;x++){const y=DC(e,i[x],a);d=ro(y.top,d),f=Nl(y.right,f),h=Nl(y.bottom,h),m=ro(y.left,m)}return{width:f-m,height:h-d,x:m,y:d}}function sH(t){const{width:e,height:n}=M1(t);return{width:e,height:n}}function aH(t,e,n){const s=zr(e),a=lr(e),r=n==="fixed",i=ho(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const d=er(0);function f(){d.x=Op(a)}if(s||!s&&!r)if((Ll(e)!=="body"||Ou(a))&&(c=Dp(e)),s){const y=ho(e,!0,r,e);d.x=y.x+e.clientLeft,d.y=y.y+e.clientTop}else a&&f();r&&!s&&a&&f();const h=a&&!s&&!r?R1(a,c):er(0),m=i.left+c.scrollLeft-d.x-h.x,x=i.top+c.scrollTop-d.y-h.y;return{x:m,y:x,width:i.width,height:i.height}}function Lg(t){return Ca(t).position==="static"}function RC(t,e){if(!zr(t)||Ca(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return lr(t)===n&&(n=n.ownerDocument.body),n}function L1(t,e){const n=aa(t);if(Mp(t))return n;if(!zr(t)){let a=Ci(t);for(;a&&!jl(a);){if(Ns(a)&&!Lg(a))return a;a=Ci(a)}return n}let s=RC(t,e);for(;s&&v$(s)&&Lg(s);)s=RC(s,e);return s&&jl(s)&&Lg(s)&&!Ix(s)?n:s||S$(t)||n}const rH=async function(t){const e=this.getOffsetParent||L1,n=this.getDimensions,s=await n(t.floating);return{reference:aH(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function iH(t){return Ca(t).direction==="rtl"}const oH={convertOffsetParentRelativeRectToViewportRelativeRect:Q$,getDocumentElement:lr,getClippingRect:nH,getOffsetParent:L1,getElementRects:rH,getClientRects:X$,getDimensions:sH,getScale:bl,isElement:Ns,isRTL:iH};function P1(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function lH(t,e){let n=null,s;const a=lr(t);function r(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function i(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),r();const f=t.getBoundingClientRect(),{left:h,top:m,width:x,height:y}=f;if(c||e(),!x||!y)return;const v=cf(m),S=cf(a.clientWidth-(h+x)),A=cf(a.clientHeight-(m+y)),k=cf(h),j={rootMargin:-v+"px "+-S+"px "+-A+"px "+-k+"px",threshold:ro(0,Nl(1,d))||1};let E=!0;function D(_){const B=_[0].intersectionRatio;if(B!==d){if(!E)return i();B?i(!1,B):s=setTimeout(()=>{i(!1,1e-7)},1e3)}B===1&&!P1(f,t.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(D,{...j,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,j)}n.observe(t)}return i(!0),r}function cH(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,f=$x(t),h=a||r?[...f?Nu(f):[],...e?Nu(e):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),r&&k.addEventListener("resize",n)});const m=f&&c?lH(f,n):null;let x=-1,y=null;i&&(y=new ResizeObserver(k=>{let[N]=k;N&&N.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(e)})),n()}),f&&!d&&y.observe(f),e&&y.observe(e));let v,S=d?ho(t):null;d&&A();function A(){const k=ho(t);S&&!P1(S,k)&&n(),S=k,v=requestAnimationFrame(A)}return n(),()=>{var k;h.forEach(N=>{a&&N.removeEventListener("scroll",n),r&&N.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,d&&cancelAnimationFrame(v)}}const uH=G$,dH=W$,OC=U$,fH=(t,e,n)=>{const s=new Map,a={platform:oH,...n},r={...a.platform,_c:s};return H$(t,e,{...a,platform:r})};var pH=typeof document<"u",hH=function(){},_f=pH?b.useLayoutEffect:hH;function ip(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,s,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!ip(t[s],e[s]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,a[s]))return!1;for(s=n;s--!==0;){const r=a[s];if(!(r==="_owner"&&t.$$typeof)&&!ip(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function I1(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function LC(t,e){const n=I1(t);return Math.round(e*n)/n}function Pg(t){const e=b.useRef(t);return _f(()=>{e.current=t}),e}function mH(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:r,floating:i}={},transform:c=!0,whileElementsMounted:d,open:f}=t,[h,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=b.useState(s);ip(x,s)||y(s);const[v,S]=b.useState(null),[A,k]=b.useState(null),N=b.useCallback(V=>{V!==_.current&&(_.current=V,S(V))},[]),j=b.useCallback(V=>{V!==B.current&&(B.current=V,k(V))},[]),E=r||v,D=i||A,_=b.useRef(null),B=b.useRef(null),O=b.useRef(h),T=d!=null,M=Pg(d),R=Pg(a),F=Pg(f),$=b.useCallback(()=>{if(!_.current||!B.current)return;const V={placement:e,strategy:n,middleware:x};R.current&&(V.platform=R.current),fH(_.current,B.current,V).then(Y=>{const P={...Y,isPositioned:F.current!==!1};U.current&&!ip(O.current,P)&&(O.current=P,Dl.flushSync(()=>{m(P)}))})},[x,e,n,R,F]);_f(()=>{f===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,m(V=>({...V,isPositioned:!1})))},[f]);const U=b.useRef(!1);_f(()=>(U.current=!0,()=>{U.current=!1}),[]),_f(()=>{if(E&&(_.current=E),D&&(B.current=D),E&&D){if(M.current)return M.current(E,D,$);$()}},[E,D,$,M,T]);const L=b.useMemo(()=>({reference:_,floating:B,setReference:N,setFloating:j}),[N,j]),z=b.useMemo(()=>({reference:E,floating:D}),[E,D]),W=b.useMemo(()=>{const V={position:n,left:0,top:0};if(!z.floating)return V;const Y=LC(z.floating,h.x),P=LC(z.floating,h.y);return c?{...V,transform:"translate("+Y+"px, "+P+"px)",...I1(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:P}},[n,c,z.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:$,refs:L,elements:z,floatingStyles:W}),[h,$,L,z,W])}const gH=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:a}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?OC({element:s.current,padding:a}).fn(n):{}:s?OC({element:s,padding:a}).fn(n):{}}}},bH=(t,e)=>{const n=uH(t);return{name:n.name,fn:n.fn,options:[t,e]}},xH=(t,e)=>{const n=dH(t);return{name:n.name,fn:n.fn,options:[t,e]}},yH=(t,e)=>{const n=gH(t);return{name:n.name,fn:n.fn,options:[t,e]}},vH={...qA};let PC=!1,wH=0;const IC=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+wH++;function kH(){const[t,e]=b.useState(()=>PC?IC():void 0);return rp(()=>{t==null&&e(IC())},[]),b.useEffect(()=>{PC=!0},[]),t}const SH=vH.useId,B1=SH||kH,CH=b.forwardRef(function(e,n){const{context:{placement:s,elements:{floating:a},middlewareData:{arrow:r,shift:i}},width:c=14,height:d=7,tipRadius:f=0,strokeWidth:h=0,staticOffset:m,stroke:x,d:y,style:{transform:v,...S}={},...A}=e,k=B1(),[N,j]=b.useState(!1);if(rp(()=>{if(!a)return;Ca(a).direction==="rtl"&&j(!0)},[a]),!a)return null;const[E,D]=s.split("-"),_=E==="top"||E==="bottom";let B=m;(_&&i!=null&&i.x||!_&&i!=null&&i.y)&&(B=null);const O=h*2,T=O/2,M=c/2*(f/-8+1),R=d/2*f/4,F=!!y,$=B&&D==="end"?"bottom":"top";let U=B&&D==="end"?"right":"left";B&&N&&(U=D==="end"?"left":"right");const L=(r==null?void 0:r.x)!=null?B||r.x:"",z=(r==null?void 0:r.y)!=null?B||r.y:"",W=y||"M0,0"+(" H"+c)+(" L"+(c-M)+","+(d-R))+(" Q"+c/2+","+d+" "+M+","+(d-R))+" Z",V={top:F?"rotate(180deg)":"",left:F?"rotate(90deg)":"rotate(-90deg)",bottom:F?"":"rotate(180deg)",right:F?"rotate(-90deg)":"rotate(90deg)"}[E];return o.jsxs("svg",{...A,"aria-hidden":!0,ref:n,width:F?c:c+O,height:c,viewBox:"0 0 "+c+" "+(d>c?d:c),style:{position:"absolute",pointerEvents:"none",[U]:L,[$]:z,[E]:_||F?"100%":"calc(100% - "+O/2+"px)",transform:[V,v].filter(Y=>!!Y).join(" "),...S},children:[O>0&&o.jsx("path",{clipPath:"url(#"+k+")",fill:"none",stroke:x,strokeWidth:O+(y?0:1),d:W}),o.jsx("path",{stroke:O&&!y?A.fill:"none",d:W}),o.jsx("clipPath",{id:k,children:o.jsx("rect",{x:-T,y:T*(F?-1:1),width:c+O,height:c})})]})});function AH(){const t=new Map;return{emit(e,n){var s;(s=t.get(e))==null||s.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var s;(s=t.get(e))==null||s.delete(n)}}}const jH=b.createContext(null),NH=b.createContext(null),TH=()=>{var t;return((t=b.useContext(jH))==null?void 0:t.id)||null},_H=()=>b.useContext(NH);function EH(t){const{open:e=!1,onOpenChange:n,elements:s}=t,a=B1(),r=b.useRef({}),[i]=b.useState(()=>AH()),c=TH()!=null,[d,f]=b.useState(s.reference),h=F$((y,v,S)=>{r.current.openEvent=y?v:void 0,i.emit("openchange",{open:y,event:v,reason:S,nested:c}),n==null||n(y,v,S)}),m=b.useMemo(()=>({setPositionReference:f}),[]),x=b.useMemo(()=>({reference:d||s.reference||null,floating:s.floating||null,domReference:s.reference}),[d,s.reference,s.floating]);return b.useMemo(()=>({dataRef:r,open:e,onOpenChange:h,elements:x,events:i,floatingId:a,refs:m}),[e,h,x,i,a,m])}function MH(t){t===void 0&&(t={});const{nodeId:e}=t,n=EH({...t,elements:{reference:null,floating:null,...t.elements}}),s=t.rootContext||n,a=s.elements,[r,i]=b.useState(null),[c,d]=b.useState(null),h=(a==null?void 0:a.domReference)||r,m=b.useRef(null),x=_H();rp(()=>{h&&(m.current=h)},[h]);const y=mH({...t,elements:{...a,...c&&{reference:c}}}),v=b.useCallback(j=>{const E=Ns(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(E),y.refs.setReference(E)},[y.refs]),S=b.useCallback(j=>{(Ns(j)||j===null)&&(m.current=j,i(j)),(Ns(y.refs.reference.current)||y.refs.reference.current===null||j!==null&&!Ns(j))&&y.refs.setReference(j)},[y.refs]),A=b.useMemo(()=>({...y.refs,setReference:S,setPositionReference:v,domReference:m}),[y.refs,S,v]),k=b.useMemo(()=>({...y.elements,domReference:h}),[y.elements,h]),N=b.useMemo(()=>({...y,...s,refs:A,elements:k,nodeId:e}),[y,A,k,e,s]);return rp(()=>{s.dataRef.current.floatingContext=N;const j=x==null?void 0:x.nodesRef.current.find(E=>E.id===e);j&&(j.context=N)}),b.useMemo(()=>({...y,context:N,refs:A,elements:k}),[y,A,k,N])}/*!
|
|
106
|
+
react-datepicker v9.1.0
|
|
107
|
+
https://github.com/Hacker0x01/react-datepicker
|
|
108
|
+
Released under the MIT License.
|
|
109
|
+
*/var zb=function(e,n){return zb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,a){s.__proto__=a}||function(s,a){for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])},zb(e,n)};function hs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zb(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var qt=function(){return qt=Object.assign||function(n){for(var s,a=1,r=arguments.length;a<r;a++){s=arguments[a];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])}return n},qt.apply(this,arguments)};function Xa(t,e,n){if(n||arguments.length===2)for(var s=0,a=e.length,r;s<a;s++)(r||!(s in e))&&(r||(r=Array.prototype.slice.call(e,0,s)),r[s]=e[s]);return t.concat(r||Array.prototype.slice.call(e))}var DH=function(t){var e=t.showTimeSelectOnly,n=e===void 0?!1:e,s=t.showTime,a=s===void 0?!1:s,r=t.className,i=t.children,c=t.inline,d=n?"Choose Time":"Choose Date".concat(a?" and Time":"");return je.createElement("div",{className:r,"aria-label":d,role:c?void 0:"dialog","aria-modal":c?void 0:"true",translate:"no"},i)},RH=function(t,e){var n=b.useRef(null),s=b.useRef(t);b.useEffect(function(){s.current=t},[t]);var a=b.useCallback(function(r){var i,c=r.composed&&r.composedPath&&r.composedPath().find(function(d){return d instanceof Node})||r.target;n.current&&!n.current.contains(c)&&(e&&c instanceof HTMLElement&&c.classList.contains(e)||(i=s.current)===null||i===void 0||i.call(s,r))},[e]);return b.useEffect(function(){return document.addEventListener("mousedown",a),function(){document.removeEventListener("mousedown",a)}},[a]),n},Lp=function(t){var e=t.children,n=t.onClickOutside,s=t.className,a=t.containerRef,r=t.style,i=t.ignoreClass,c=RH(n,i);return je.createElement("div",{className:s,style:r,ref:function(d){c.current=d,a&&(a.current=d)}},e)},uf=null,BC=!1;function F1(){if(BC)return uf;BC=!0;try{var t="date-fns-tz";uf=require(t)}catch{uf=null}return uf}function FC(t,e){if(!e)return t;var n=F1();return n?n.toZonedTime(t,e):t}function jr(t,e){if(!e)return t;var n=F1();return n?n.fromZonedTime(t,e):t}var dt;(function(t){t.ArrowUp="ArrowUp",t.ArrowDown="ArrowDown",t.ArrowLeft="ArrowLeft",t.ArrowRight="ArrowRight",t.PageUp="PageUp",t.PageDown="PageDown",t.Home="Home",t.End="End",t.Enter="Enter",t.Space=" ",t.Tab="Tab",t.Escape="Escape",t.Backspace="Backspace",t.X="x"})(dt||(dt={}));function z1(){var t=typeof window<"u"?window:globalThis;return t}var Pu=12;function ln(t){if(t==null)return new Date;var e=typeof t=="string"?a$(t):St(t);return Ps(e)?e:new Date}function Qi(t,e,n,s,a){a===void 0&&(a=ln());for(var r=_l(n)||_l(Hx()),i=Array.isArray(e)?e:[e],c=0,d=i;c<d.length;c++){var f=d[c],h=J3(t,f,a,{locale:r});if(Ps(h)&&(!s||t===Mn(h,f,n)))return h}if(!s&&t&&t.length>=8){var m=new Date(t);if(Al(m))return m}return null}function OH(t,e){if(e===void 0&&(e=ln()),!t)return null;var n=t.match(/\b(1\d{3}|2\d{3})\b/);if(!n||!n[1])return null;var s=parseInt(n[1],10),a=t.match(/(?:^|[/\-\s])?(0?[1-9]|1[0-2])(?:[/\-\s]|$)/),r=a&&a[1]?parseInt(a[1],10)-1:e.getMonth();return new Date(s,r,1)}function Ps(t){return Al(t)}function no(t){return t==null?null:Za(t)&&Al(t)?t:null}function Mn(t,e,n){if(n==="en")return CC(t,e,{useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0});var s=n?_l(n):void 0;return n&&!s&&console.warn('A locale object was not found for the provided string ["'.concat(n,'"].')),s=s||_l(Hx()),CC(t,e,{locale:s,useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0})}function Ls(t,e){var n=e.dateFormat,s=e.locale,a=Array.isArray(n)&&n.length>0?n[0]:n;return t&&Mn(t,a,s)||""}var $1=" - ";function LH(t,e,n){if(!t&&!e)return"";var s=t?Ls(t,n):"",a=e?Ls(e,n):"",r=n.rangeSeparator||$1;return"".concat(s).concat(r).concat(a)}function PH(t,e){if(!(t!=null&&t.length))return"";var n=t[0]?Ls(t[0],e):"";if(t.length===1)return n;if(t.length===2&&t[1]){var s=Ls(t[1],e);return"".concat(n,", ").concat(s)}var a=t.length-1;return"".concat(n," (+").concat(a,")")}function Nr(t,e){var n=e.hour,s=n===void 0?0:n,a=e.minute,r=a===void 0?0:a,i=e.second,c=i===void 0?0:i;return jf(Nf(Tf(t,c),r),s)}function IH(t){return Rx(t)}function BH(t,e){return Mn(t,"ddd",e)}function Jc(t){return po(t)}function wi(t,e,n){var s=_l(e||Hx());return Pr(t,{locale:s,weekStartsOn:n})}function Or(t){return b1(t)}function Zc(t){return _p(t)}function zC(t){return Lb(t)}function $C(){return po(ln())}function HC(t){return m1(t)}function FH(t){return az(t)}function zH(t){return g1(t)}function qa(t,e){return t&&e?n$(t,e):!t&&!e}function As(t,e){return t&&e?e$(t,e):!t&&!e}function op(t,e){return t&&e?t$(t,e):!t&&!e}function sn(t,e){return t&&e?nz(t,e):!t&&!e}function so(t,e){return t&&e?s3(t,e):!t&&!e}function Zi(t,e,n){var s,a=po(e),r=m1(n);try{s=ju(t,{start:a,end:r})}catch{s=!1}return s}function Hx(){var t=z1();return t.__localeId__}function _l(t){if(typeof t=="string"){var e=z1();return e.__localeData__?e.__localeData__[t]:void 0}else return t}function $H(t,e,n){return e(Mn(t,"EEEE",n))}function HH(t,e){return Mn(t,"EEEEEE",e)}function UH(t,e){return Mn(t,"EEE",e)}function Ux(t,e){return Mn(Js(ln(),t),"LLLL",e)}function H1(t,e){return Mn(Js(ln(),t),"LLL",e)}function WH(t,e){return Mn(dl(ln(),t),"QQQ",e)}function va(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.excludeDateIntervals,c=n.includeDates,d=n.includeDateIntervals,f=n.filterDate,h=n.disabled;return h?!0:Iu(t,{minDate:s,maxDate:a})||r&&r.some(function(m){return m instanceof Date?sn(t,m):sn(t,m.date)})||i&&i.some(function(m){var x=m.start,y=m.end;return ju(t,{start:x,end:y})})||c&&!c.some(function(m){return sn(t,m)})||d&&!d.some(function(m){var x=m.start,y=m.end;return ju(t,{start:x,end:y})})||f&&!f(ln(t))||!1}function Wx(t,e){var n=e===void 0?{}:e,s=n.excludeDates,a=n.excludeDateIntervals;return a&&a.length>0?a.some(function(r){var i=r.start,c=r.end;return ju(t,{start:i,end:c})}):s&&s.some(function(r){var i;return r instanceof Date?sn(t,r):sn(t,(i=r.date)!==null&&i!==void 0?i:new Date)})||!1}function U1(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate;return Iu(t,{minDate:s?b1(s):void 0,maxDate:a?g1(a):void 0})||(r==null?void 0:r.some(function(d){return As(t,d instanceof Date?d:d.date)}))||i&&!i.some(function(d){return As(t,d)})||c&&!c(ln(t))||!1}function df(t,e,n,s){var a=Jt(t),r=Is(t),i=Jt(e),c=Is(e),d=Jt(s);return a===i&&a===d?r<=n&&n<=c:a<i?d===a&&r<=n||d===i&&c>=n||d<i&&d>a:!1}function qH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates;return Iu(t,{minDate:s,maxDate:a})||r&&r.some(function(c){return As(c instanceof Date?c:c.date,t)})||i&&!i.some(function(c){return As(c,t)})||!1}function ff(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate,d=n.disabled;return d?!0:Iu(t,{minDate:s,maxDate:a})||(r==null?void 0:r.some(function(f){return op(t,f instanceof Date?f:f.date)}))||i&&!i.some(function(f){return op(t,f)})||c&&!c(ln(t))||!1}function pf(t,e,n){if(!e||!n||!Al(e)||!Al(n))return!1;var s=Jt(e),a=Jt(n);return s<=t&&a>=t}function Ef(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.maxDate,r=n.excludeDates,i=n.includeDates,c=n.filterDate,d=n.disabled;if(d)return!0;var f=new Date(t,0,1);return Iu(f,{minDate:s?_p(s):void 0,maxDate:a?x1(a):void 0})||(r==null?void 0:r.some(function(h){return qa(f,h instanceof Date?h:h.date)}))||i&&!i.some(function(h){return qa(f,h)})||c&&!c(ln(f))||!1}function hf(t,e,n,s){var a=Jt(t),r=yi(t),i=Jt(e),c=yi(e),d=Jt(s);return a===i&&a===d?r<=n&&n<=c:a<i?d===a&&r<=n||d===i&&c>=n||d<i&&d>a:!1}function Iu(t,e){var n,s=e===void 0?{}:e,a=s.minDate,r=s.maxDate;return(n=a&&Cl(t,a)<0||r&&Cl(t,r)>0)!==null&&n!==void 0?n:!1}function UC(t,e){return e.some(function(n){return bs(n)===bs(t)&&xs(n)===xs(t)&&vi(n)===vi(t)})}function WC(t,e){var n=e===void 0?{}:e,s=n.excludeTimes,a=n.includeTimes,r=n.filterTime;return s&&UC(t,s)||a&&!UC(t,a)||r&&!r(t)||!1}function qC(t,e){var n=e.minTime,s=e.maxTime;if(!n||!s)throw new Error("Both minTime and maxTime props required");var a=ln();a=jf(a,bs(t)),a=Nf(a,xs(t)),a=Tf(a,vi(t));var r=ln();r=jf(r,bs(n)),r=Nf(r,xs(n)),r=Tf(r,vi(n));var i=ln();i=jf(i,bs(s)),i=Nf(i,xs(s)),i=Tf(i,vi(s));var c;try{c=!ju(a,{start:r,end:i})}catch{c=!1}return c}function VC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=ao(t,1);return s&&Jf(s,r)>0||a&&a.every(function(i){return Jf(i,r)>0})||!1}function GC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=La(t,1);return s&&Jf(r,s)>0||a&&a.every(function(i){return Jf(r,i)>0})||!1}function VH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=_p(t),i=N1(r);return s&&Zf(s,i)>0||a&&a.every(function(c){return Zf(c,i)>0})||!1}function GH(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=x1(t),i=Dx(r,1);return s&&Zf(i,s)>0||a&&a.every(function(c){return Zf(i,c)>0})||!1}function YC(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.includeDates,r=Si(t,1);return s&&ep(s,r)>0||a&&a.every(function(i){return ep(i,r)>0})||!1}function YH(t,e){var n=e===void 0?{}:e,s=n.minDate,a=n.yearItemNumber,r=a===void 0?Pu:a,i=Zc(Si(t,r)),c=_r(i,r).endPeriod,d=s&&Jt(s);return d&&d>c||!1}function KC(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.includeDates,r=Oa(t,1);return s&&ep(r,s)>0||a&&a.every(function(i){return ep(r,i)>0})||!1}function KH(t,e){var n=e===void 0?{}:e,s=n.maxDate,a=n.yearItemNumber,r=a===void 0?Pu:a,i=Oa(t,r),c=_r(i,r).startPeriod,d=s&&Jt(s);return d&&d<c||!1}function W1(t){var e=t.minDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Cl(a,e)>=0});return xC(s)}else return n?xC(n):e}function q1(t){var e=t.maxDate,n=t.includeDates;if(n&&e){var s=n.filter(function(a){return Cl(a,e)<=0});return bC(s)}else return n?bC(n):e}function QC(t,e){var n;t===void 0&&(t=[]),e===void 0&&(e="react-datepicker__day--highlighted");for(var s=new Map,a=0,r=t.length;a<r;a++){var i=t[a];if(Za(i)){var c=Mn(i,"MM.dd.yyyy"),d=s.get(c)||[];d.includes(e)||(d.push(e),s.set(c,d))}else if(typeof i=="object"){var f=Object.keys(i),h=(n=f[0])!==null&&n!==void 0?n:"",m=i[h];if(typeof h=="string"&&Array.isArray(m))for(var x=0,y=m.length;x<y;x++){var v=m[x];if(v){var c=Mn(v,"MM.dd.yyyy"),d=s.get(c)||[];d.includes(h)||(d.push(h),s.set(c,d))}}}}return s}function QH(t,e){return t.length!==e.length?!1:t.every(function(n,s){return n===e[s]})}function XH(t,e){t===void 0&&(t=[]),e===void 0&&(e="react-datepicker__day--holidays");var n=new Map;return t.forEach(function(s){var a=s.date,r=s.holidayName;if(Za(a)){var i=Mn(a,"MM.dd.yyyy"),c=n.get(i)||{className:"",holidayNames:[]};if(!("className"in c&&c.className===e&&QH(c.holidayNames,[r]))){c.className=e;var d=c.holidayNames;c.holidayNames=d?Xa(Xa([],d,!0),[r],!1):[r],n.set(i,c)}}}),n}function JH(t,e,n,s,a){for(var r=a.length,i=[],c=0;c<r;c++){var d=t,f=a[c];f&&(d=J4(d,bs(f)),d=Au(d,xs(f)),d=tz(d,vi(f)));var h=Au(t,(n+1)*s);Rr(d,e)&&Qa(d,h)&&f!=null&&i.push(f)}return i}function il(t){return t<10?"0".concat(t):"".concat(t)}function _r(t,e){e===void 0&&(e=Pu);var n=Math.ceil(Jt(t)/e)*e,s=n-(e-1);return{startPeriod:s,endPeriod:n}}function ZH(t){var e=new Date(t.getFullYear(),t.getMonth(),t.getDate()),n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),24);return Math.round((+n-+e)/36e5)}function XC(t){var e=t.getSeconds(),n=t.getMilliseconds();return St(t.getTime()-e*1e3-n)}function V1(t,e){return XC(t).getTime()===XC(e).getTime()}function JC(t){if(!Za(t))throw new Error("Invalid date");var e=new Date(t);return e.setHours(0,0,0,0),e}function Ig(t,e){if(!Za(t)||!Za(e))throw new Error("Invalid date received");var n=JC(t),s=JC(e);return Qa(n,s)}function G1(t){return t.key===dt.Space}var Bg=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.inputRef=je.createRef(),s.onTimeChange=function(a){var r,i;s.setState({time:a});var c=s.props.date,d=c instanceof Date&&!isNaN(+c),f=d?c:new Date;if(a!=null&&a.includes(":")){var h=a.split(":"),m=h[0],x=h[1];f.setHours(Number(m)),f.setMinutes(Number(x))}(i=(r=s.props).onChange)===null||i===void 0||i.call(r,f)},s.renderTimeInput=function(){var a=s.state.time,r=s.props,i=r.date,c=r.timeString,d=r.customTimeInput;return d?b.cloneElement(d,{date:i,value:a,onChange:s.onTimeChange}):je.createElement("input",{type:"time",className:"react-datepicker-time__input",placeholder:"Time",name:"time-input",ref:s.inputRef,onClick:function(){var f;(f=s.inputRef.current)===null||f===void 0||f.focus()},required:!0,value:a,onChange:function(f){s.onTimeChange(f.target.value||c)}})},s.state={time:s.props.timeString},s}return e.getDerivedStateFromProps=function(n,s){return n.timeString!==s.time?{time:n.timeString}:null},e.prototype.render=function(){return je.createElement("div",{className:"react-datepicker__input-time-container"},je.createElement("div",{className:"react-datepicker-time__caption"},this.props.timeInputLabel),je.createElement("div",{className:"react-datepicker-time__input-container"},je.createElement("div",{className:"react-datepicker-time__input"},this.renderTimeInput())))},e})(b.Component),eU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.dayEl=b.createRef(),n.handleClick=function(s){!n.isDisabled()&&n.props.onClick&&n.props.onClick(s)},n.handleMouseEnter=function(s){!n.isDisabled()&&n.props.onMouseEnter&&n.props.onMouseEnter(s)},n.handleOnKeyDown=function(s){var a,r,i=s.key;i===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(r=(a=n.props).handleOnKeyDown)===null||r===void 0||r.call(a,s)},n.isSameDay=function(s){return sn(n.props.day,s)},n.isKeyboardSelected=function(){var s;if(n.props.disabledKeyboardNavigation)return!1;var a=n.props.selectsMultiple?(s=n.props.selectedDates)===null||s===void 0?void 0:s.some(function(i){return n.isSameDayOrWeek(i)}):n.isSameDayOrWeek(n.props.selected),r=n.props.preSelection&&n.isDisabled(n.props.preSelection);return!a&&n.isSameDayOrWeek(n.props.preSelection)&&!r},n.isDisabled=function(s){return s===void 0&&(s=n.props.day),va(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate,disabled:n.props.disabled})},n.isExcluded=function(){return Wx(n.props.day,{excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals})},n.isStartOfWeek=function(){return sn(n.props.day,wi(n.props.day,n.props.locale,n.props.calendarStartDay))},n.isSameWeek=function(s){return n.props.showWeekPicker&&sn(s,wi(n.props.day,n.props.locale,n.props.calendarStartDay))},n.isSameDayOrWeek=function(s){return n.isSameDay(s)||n.isSameWeek(s)},n.getHighLightedClass=function(){var s=n.props,a=s.day,r=s.highlightDates;if(!r)return!1;var i=Mn(a,"MM.dd.yyyy");return r.get(i)},n.getHolidaysClass=function(){var s,a=n.props,r=a.day,i=a.holidays;if(!i)return[void 0];var c=Mn(r,"MM.dd.yyyy");return i.has(c)?[(s=i.get(c))===null||s===void 0?void 0:s.className]:[void 0]},n.isInRange=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:Zi(a,r,i)},n.isInSelectingRange=function(){var s,a=n.props,r=a.day,i=a.selectsStart,c=a.selectsEnd,d=a.selectsRange,f=a.selectsDisabledDaysInRange,h=a.startDate,m=a.swapRange,x=a.endDate,y=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;if(n.isAfterMonth()||n.isBeforeMonth()||!(i||c||d)||!y||!f&&n.isDisabled())return!1;if(i&&x&&(Qa(y,x)||so(y,x)))return Zi(r,y,x);if(c&&h&&(Rr(y,h)||so(y,h)))return Zi(r,h,y);if(d&&h&&!x){if(so(y,h)||Rr(y,h))return Zi(r,h,y);if(m&&Qa(y,h))return Zi(r,y,h)}return!1},n.isSelectingRangeStart=function(){var s;if(!n.isInSelectingRange())return!1;var a=n.props,r=a.day,i=a.startDate,c=a.selectsStart,d=a.swapRange,f=a.selectsRange,h=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;return c?sn(r,h):f&&d&&i&&h?sn(r,Qa(h,i)?h:i):sn(r,i)},n.isSelectingRangeEnd=function(){var s;if(!n.isInSelectingRange())return!1;var a=n.props,r=a.day,i=a.endDate,c=a.selectsEnd,d=a.selectsRange,f=a.swapRange,h=a.startDate,m=(s=n.props.selectingDate)!==null&&s!==void 0?s:n.props.preSelection;return c?sn(r,m):d&&f&&h&&m?sn(r,Qa(m,h)?h:m):d?sn(r,m):sn(r,i)},n.isRangeStart=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:sn(r,a)},n.isRangeEnd=function(){var s=n.props,a=s.day,r=s.startDate,i=s.endDate;return!r||!i?!1:sn(i,a)},n.isWeekend=function(){var s=Zz(n.props.day);return s===0||s===6},n.isAfterMonth=function(){return n.props.month!==void 0&&(n.props.month+1)%12===Is(n.props.day)},n.isBeforeMonth=function(){return n.props.month!==void 0&&(Is(n.props.day)+1)%12===n.props.month},n.isCurrentDay=function(){return n.isSameDay(ln())},n.isSelected=function(){var s;return n.props.selectsMultiple?(s=n.props.selectedDates)===null||s===void 0?void 0:s.some(function(a){return n.isSameDayOrWeek(a)}):n.isSameDayOrWeek(n.props.selected)},n.getClassNames=function(s){var a=n.props.dayClassName?n.props.dayClassName(s):void 0;return ns("react-datepicker__day",a,"react-datepicker__day--"+BH(n.props.day),{"react-datepicker__day--disabled":n.isDisabled(),"react-datepicker__day--excluded":n.isExcluded(),"react-datepicker__day--selected":n.isSelected(),"react-datepicker__day--keyboard-selected":n.isKeyboardSelected(),"react-datepicker__day--range-start":n.isRangeStart(),"react-datepicker__day--range-end":n.isRangeEnd(),"react-datepicker__day--in-range":n.isInRange(),"react-datepicker__day--in-selecting-range":n.isInSelectingRange(),"react-datepicker__day--selecting-range-start":n.isSelectingRangeStart(),"react-datepicker__day--selecting-range-end":n.isSelectingRangeEnd(),"react-datepicker__day--today":n.isCurrentDay(),"react-datepicker__day--weekend":n.isWeekend(),"react-datepicker__day--outside-month":n.isAfterMonth()||n.isBeforeMonth()},n.getHighLightedClass(),n.getHolidaysClass())},n.getAriaLabel=function(){var s=n.props,a=s.day,r=s.ariaLabelPrefixWhenEnabled,i=r===void 0?"Choose":r,c=s.ariaLabelPrefixWhenDisabled,d=c===void 0?"Not available":c,f=n.isDisabled()||n.isExcluded()?d:i;return"".concat(f," ").concat(Mn(a,"PPPP",n.props.locale))},n.getTitle=function(){var s=n.props,a=s.day,r=s.holidays,i=r===void 0?new Map:r,c=s.excludeDates,d=Mn(a,"MM.dd.yyyy"),f=[];return i.has(d)&&f.push.apply(f,i.get(d).holidayNames),n.isExcluded()&&f.push(c==null?void 0:c.filter(function(h){return h instanceof Date?sn(h,a):sn(h==null?void 0:h.date,a)}).map(function(h){if(!(h instanceof Date))return h==null?void 0:h.message})),f.join(", ")},n.getTabIndex=function(){var s=n.props.selected,a=n.props.preSelection,r=!(n.props.showWeekPicker&&(n.props.showWeekNumber||!n.isStartOfWeek()))&&(n.isKeyboardSelected()||n.isSameDay(s)&&sn(a,s))?0:-1;return r},n.handleFocusDay=function(){var s;n.shouldFocusDay()&&((s=n.dayEl.current)===null||s===void 0||s.focus({preventScroll:!0}))},n.renderDayContents=function(){return n.props.monthShowsDuplicateDaysEnd&&n.isAfterMonth()||n.props.monthShowsDuplicateDaysStart&&n.isBeforeMonth()?null:n.props.renderDayContents?n.props.renderDayContents(AC(n.props.day),n.props.day):AC(n.props.day)},n.render=function(){return je.createElement("div",{ref:n.dayEl,className:n.getClassNames(n.props.day),onKeyDown:n.handleOnKeyDown,onClick:n.handleClick,onMouseEnter:n.props.usePointerEvent?void 0:n.handleMouseEnter,onPointerEnter:n.props.usePointerEvent?n.handleMouseEnter:void 0,tabIndex:n.getTabIndex(),"aria-label":n.getAriaLabel(),role:"gridcell",title:n.getTitle(),"aria-disabled":n.isDisabled(),"aria-current":n.isCurrentDay()?"date":void 0,"aria-selected":n.isSelected()||n.isInRange()},n.renderDayContents(),n.getTitle()!==""&&je.createElement("span",{className:"overlay"},n.getTitle()))},n}return e.prototype.componentDidMount=function(){this.handleFocusDay()},e.prototype.componentDidUpdate=function(){this.handleFocusDay()},e.prototype.shouldFocusDay=function(){var n=!1;return this.getTabIndex()===0&&this.isSameDay(this.props.preSelection)&&((!document.activeElement||document.activeElement===document.body)&&(n=!0),this.props.inline&&!this.props.shouldFocusDayInline&&(n=!1),this.isDayActiveElement()&&(n=!0),this.isDuplicateDay()&&(n=!1)),n},e.prototype.isDayActiveElement=function(){var n,s,a;return((s=(n=this.props.containerRef)===null||n===void 0?void 0:n.current)===null||s===void 0?void 0:s.contains(document.activeElement))&&((a=document.activeElement)===null||a===void 0?void 0:a.classList.contains("react-datepicker__day"))},e.prototype.isDuplicateDay=function(){return this.props.monthShowsDuplicateDaysEnd&&this.isAfterMonth()||this.props.monthShowsDuplicateDaysStart&&this.isBeforeMonth()},e})(b.Component),tU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.weekNumberEl=b.createRef(),n.handleClick=function(s){n.props.onClick&&n.props.onClick(s)},n.handleOnKeyDown=function(s){var a,r,i=s.key;i===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(r=(a=n.props).handleOnKeyDown)===null||r===void 0||r.call(a,s)},n.isKeyboardSelected=function(){return!n.props.disabledKeyboardNavigation&&!sn(n.props.date,n.props.selected)&&sn(n.props.date,n.props.preSelection)},n.getTabIndex=function(){return n.props.showWeekPicker&&n.props.showWeekNumber&&(n.isKeyboardSelected()||sn(n.props.date,n.props.selected)&&sn(n.props.preSelection,n.props.selected))?0:-1},n.handleFocusWeekNumber=function(s){var a=!1;n.getTabIndex()===0&&!(s!=null&&s.isInputFocused)&&sn(n.props.date,n.props.preSelection)&&((!document.activeElement||document.activeElement===document.body)&&(a=!0),n.props.inline&&!n.props.shouldFocusDayInline&&(a=!1),n.props.containerRef&&n.props.containerRef.current&&n.props.containerRef.current.contains(document.activeElement)&&document.activeElement&&document.activeElement.classList.contains("react-datepicker__week-number")&&(a=!0)),a&&n.weekNumberEl.current&&n.weekNumberEl.current.focus({preventScroll:!0})},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{ariaLabelPrefix:"week "}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){this.handleFocusWeekNumber()},e.prototype.componentDidUpdate=function(n){this.handleFocusWeekNumber(n)},e.prototype.render=function(){var n=this.props,s=n.weekNumber,a=n.isWeekDisabled,r=n.ariaLabelPrefix,i=r===void 0?e.defaultProps.ariaLabelPrefix:r,c=n.onClick,d={"react-datepicker__week-number":!0,"react-datepicker__week-number--clickable":!!c&&!a,"react-datepicker__week-number--selected":!!c&&sn(this.props.date,this.props.selected)};return je.createElement("div",{ref:this.weekNumberEl,className:ns(d),"aria-label":"".concat(i," ").concat(this.props.weekNumber),onClick:this.handleClick,onKeyDown:this.handleOnKeyDown,tabIndex:this.getTabIndex(),role:"gridcell"},s)},e})(b.Component),nU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.isDisabled=function(s){return va(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate})},n.handleDayClick=function(s,a){n.props.onDayClick&&n.props.onDayClick(s,a)},n.handleDayMouseEnter=function(s){n.props.onDayMouseEnter&&n.props.onDayMouseEnter(s)},n.handleWeekClick=function(s,a,r){for(var i,c,d,f=new Date(s),h=0;h<7;h++){var m=new Date(s);m.setDate(m.getDate()+h);var x=!n.isDisabled(m);if(x){f=m;break}}typeof n.props.onWeekSelect=="function"&&n.props.onWeekSelect(f,a,r),n.props.showWeekPicker&&n.handleDayClick(f,r),((i=n.props.shouldCloseOnSelect)!==null&&i!==void 0?i:e.defaultProps.shouldCloseOnSelect)&&((d=(c=n.props).setOpen)===null||d===void 0||d.call(c,!1))},n.formatWeekNumber=function(s){return n.props.formatWeekNumber?n.props.formatWeekNumber(s):IH(s)},n.isWeekDisabled=function(){for(var s=n.startOfWeek(),a=Ra(s,6),r=new Date(s);r<=a;){if(!n.isDisabled(r))return!1;r=Ra(r,1)}return!0},n.renderDays=function(){var s=n.startOfWeek(),a=[],r=n.formatWeekNumber(s);if(n.props.showWeekNumber){var i=n.props.onWeekSelect||n.props.showWeekPicker?n.handleWeekClick.bind(n,s,r):void 0;a.push(je.createElement(tU,qt({key:"W"},e.defaultProps,n.props,{weekNumber:r,isWeekDisabled:n.isWeekDisabled(),date:s,onClick:i})))}return a.concat([0,1,2,3,4,5,6].map(function(c){var d=Ra(s,c);return je.createElement(eU,qt({},e.defaultProps,n.props,{ariaLabelPrefixWhenEnabled:n.props.chooseDayAriaLabelPrefix,ariaLabelPrefixWhenDisabled:n.props.disabledDayAriaLabelPrefix,key:d.valueOf(),day:d,onClick:n.handleDayClick.bind(n,d),onMouseEnter:n.handleDayMouseEnter.bind(n,d)}))}))},n.startOfWeek=function(){return wi(n.props.day,n.props.locale,n.props.calendarStartDay)},n.isKeyboardSelected=function(){return!n.props.disabledKeyboardNavigation&&!sn(n.startOfWeek(),n.props.selected)&&sn(n.startOfWeek(),n.props.preSelection)},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{shouldCloseOnSelect:!0}},enumerable:!1,configurable:!0}),e.prototype.render=function(){var n={"react-datepicker__week":!0,"react-datepicker__week--selected":sn(this.startOfWeek(),this.props.selected),"react-datepicker__week--keyboard-selected":this.isKeyboardSelected()},s=this.props.weekClassName?this.props.weekClassName(this.startOfWeek()):void 0;return je.createElement("div",{className:ns(n,s),role:"row"},this.renderDays())},e})(b.Component),Gc,sU=6,xl={TWO_COLUMNS:"two_columns",THREE_COLUMNS:"three_columns",FOUR_COLUMNS:"four_columns"},Fg=(Gc={},Gc[xl.TWO_COLUMNS]={grid:[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]],verticalNavigationOffset:2},Gc[xl.THREE_COLUMNS]={grid:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]],verticalNavigationOffset:3},Gc[xl.FOUR_COLUMNS]={grid:[[0,1,2,3],[4,5,6,7],[8,9,10,11]],verticalNavigationOffset:4},Gc),mf=1;function ZC(t,e){return t?xl.FOUR_COLUMNS:e?xl.TWO_COLUMNS:xl.THREE_COLUMNS}var aU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.MONTH_REFS=Xa([],Array(12),!0).map(function(){return b.createRef()}),n.QUARTER_REFS=Xa([],Array(4),!0).map(function(){return b.createRef()}),n.isDisabled=function(s){return va(s,{minDate:n.props.minDate,maxDate:n.props.maxDate,excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals,includeDateIntervals:n.props.includeDateIntervals,includeDates:n.props.includeDates,filterDate:n.props.filterDate,disabled:n.props.disabled})},n.isExcluded=function(s){return Wx(s,{excludeDates:n.props.excludeDates,excludeDateIntervals:n.props.excludeDateIntervals})},n.handleDayClick=function(s,a){var r,i;(i=(r=n.props).onDayClick)===null||i===void 0||i.call(r,s,a,n.props.orderInDisplay)},n.handleDayMouseEnter=function(s){var a,r;(r=(a=n.props).onDayMouseEnter)===null||r===void 0||r.call(a,s)},n.handleMouseLeave=function(){var s,a;(a=(s=n.props).onMouseLeave)===null||a===void 0||a.call(s)},n.isRangeStartMonth=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:As(Js(r,s),i)},n.isRangeStartQuarter=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:op(dl(r,s),i)},n.isRangeEndMonth=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:As(Js(r,s),c)},n.isRangeEndQuarter=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate;return!i||!c?!1:op(dl(r,s),c)},n.isInSelectingRangeMonth=function(s){var a,r=n.props,i=r.day,c=r.selectsStart,d=r.selectsEnd,f=r.selectsRange,h=r.startDate,m=r.endDate,x=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return!(c||d||f)||!x?!1:c&&m?df(x,m,s,i):d&&h||f&&h&&!m?df(h,x,s,i):!1},n.isSelectingMonthRangeStart=function(s){var a;if(!n.isInSelectingRangeMonth(s))return!1;var r=n.props,i=r.day,c=r.startDate,d=r.selectsStart,f=Js(i,s),h=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d?As(f,h):As(f,c)},n.isSelectingMonthRangeEnd=function(s){var a;if(!n.isInSelectingRangeMonth(s))return!1;var r=n.props,i=r.day,c=r.endDate,d=r.selectsEnd,f=r.selectsRange,h=Js(i,s),m=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return d||f?As(h,m):As(h,c)},n.isInSelectingRangeQuarter=function(s){var a,r=n.props,i=r.day,c=r.selectsStart,d=r.selectsEnd,f=r.selectsRange,h=r.startDate,m=r.endDate,x=(a=n.props.selectingDate)!==null&&a!==void 0?a:n.props.preSelection;return!(c||d||f)||!x?!1:c&&m?hf(x,m,s,i):d&&h||f&&h&&!m?hf(h,x,s,i):!1},n.isWeekInMonth=function(s){var a=n.props.day,r=Ra(s,6);return As(s,a)||As(r,a)},n.isCurrentMonth=function(s,a){return Jt(s)===Jt(ln())&&a===Is(ln())},n.isCurrentQuarter=function(s,a){return Jt(s)===Jt(ln())&&a===yi(ln())},n.isSelectedMonth=function(s,a,r){return Is(r)===a&&Jt(s)===Jt(r)},n.isSelectMonthInList=function(s,a,r){return r.some(function(i){return n.isSelectedMonth(s,a,i)})},n.isSelectedQuarter=function(s,a,r){return yi(r)===a&&Jt(s)===Jt(r)},n.isSelectQuarterInList=function(s,a,r){return r.some(function(i){return n.isSelectedQuarter(s,a,i)})},n.isMonthSelected=function(){var s=n.props,a=s.day,r=s.selected,i=s.selectedDates,c=s.selectsMultiple,d=Is(a);return c?i==null?void 0:i.some(function(f){return n.isSelectedMonth(a,d,f)}):!!r&&n.isSelectedMonth(a,d,r)},n.isQuarterSelected=function(){var s=n.props,a=s.day,r=s.selected,i=s.selectedDates,c=s.selectsMultiple,d=yi(a);return c?i==null?void 0:i.some(function(f){return n.isSelectedQuarter(a,d,f)}):!!r&&n.isSelectedQuarter(a,d,r)},n.renderWeeks=function(){if(!Ps(n.props.day))return[];for(var s=[],a=n.props.fixedHeight,r=0,i=!1,c=wi(Or(n.props.day),n.props.locale,n.props.calendarStartDay),d=function(v){return n.props.showWeekPicker?wi(v,n.props.locale,n.props.calendarStartDay):n.props.preSelection},f=function(v){return n.props.showWeekPicker?wi(v,n.props.locale,n.props.calendarStartDay):n.props.selected},h=n.props.selected?f(n.props.selected):void 0,m=n.props.preSelection?d(n.props.preSelection):void 0;s.push(je.createElement(nU,qt({},n.props,{ariaLabelPrefix:n.props.weekAriaLabelPrefix,key:r,day:c,month:Is(n.props.day),onDayClick:n.handleDayClick,onDayMouseEnter:n.handleDayMouseEnter,selected:h,preSelection:m,showWeekNumber:n.props.showWeekNumbers}))),!i;){r++,c=Xf(c,1);var x=a&&r>=sU,y=!a&&!n.isWeekInMonth(c);if(x||y)if(n.props.peekNextMonth)i=!0;else break}return s},n.onMonthClick=function(s,a){var r=n.isMonthDisabledForLabelDate(a),i=r.isDisabled,c=r.labelDate;i||n.handleDayClick(Or(c),s)},n.onMonthMouseEnter=function(s){var a=n.isMonthDisabledForLabelDate(s),r=a.isDisabled,i=a.labelDate;r||n.handleDayMouseEnter(Or(i))},n.handleMonthNavigation=function(s,a){var r,i,c,d;(i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,a),(d=(c=n.MONTH_REFS[s])===null||c===void 0?void 0:c.current)===null||d===void 0||d.focus()},n.handleKeyboardNavigation=function(s,a,r){var i,c=n.props,d=c.selected,f=c.preSelection,h=c.setPreSelection,m=c.minDate,x=c.maxDate,y=c.showFourColumnMonthYearPicker,v=c.showTwoColumnMonthYearPicker;if(f){var S=ZC(y,v),A=n.getVerticalOffset(S),k=(i=Fg[S])===null||i===void 0?void 0:i.grid,N=function(B,O,T){var M,R,F=O,$=T;switch(B){case dt.ArrowRight:F=La(O,mf),$=T===11?0:T+mf;break;case dt.ArrowLeft:F=ao(O,mf),$=T===0?11:T-mf;break;case dt.ArrowUp:F=ao(O,A),$=!((M=k==null?void 0:k[0])===null||M===void 0)&&M.includes(T)?T+12-A:T-A;break;case dt.ArrowDown:F=La(O,A),$=!((R=k==null?void 0:k[k.length-1])===null||R===void 0)&&R.includes(T)?T-12+A:T+A;break}return{newCalculatedDate:F,newCalculatedMonth:$}},j=function(B,O,T){for(var M=40,R=B,F=!1,$=0,U=N(R,O,T),L=U.newCalculatedDate,z=U.newCalculatedMonth;!F;){if($>=M){L=O,z=T;break}if(m&&L<m){R=dt.ArrowRight;var W=N(R,L,z);L=W.newCalculatedDate,z=W.newCalculatedMonth}if(x&&L>x){R=dt.ArrowLeft;var W=N(R,L,z);L=W.newCalculatedDate,z=W.newCalculatedMonth}if(qH(L,n.props)){var W=N(R,L,z);L=W.newCalculatedDate,z=W.newCalculatedMonth}else F=!0;$++}return{newCalculatedDate:L,newCalculatedMonth:z}};if(a===dt.Enter){n.isMonthDisabled(r)||(n.onMonthClick(s,r),h==null||h(d));return}var E=j(a,f,r),D=E.newCalculatedDate,_=E.newCalculatedMonth;switch(a){case dt.ArrowRight:case dt.ArrowLeft:case dt.ArrowUp:case dt.ArrowDown:n.handleMonthNavigation(_,D);break}}},n.getVerticalOffset=function(s){var a,r;return(r=(a=Fg[s])===null||a===void 0?void 0:a.verticalNavigationOffset)!==null&&r!==void 0?r:0},n.onMonthKeyDown=function(s,a){var r=n.props,i=r.disabledKeyboardNavigation,c=r.handleOnMonthKeyDown,d=s.key;d!==dt.Tab&&s.preventDefault(),i||n.handleKeyboardNavigation(s,d,a),c&&c(s)},n.onQuarterClick=function(s,a){var r=dl(n.props.day,a);ff(r,n.props)||n.handleDayClick(zC(r),s)},n.onQuarterMouseEnter=function(s){var a=dl(n.props.day,s);ff(a,n.props)||n.handleDayMouseEnter(zC(a))},n.handleQuarterNavigation=function(s,a){var r,i,c,d;n.isDisabled(a)||n.isExcluded(a)||((i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,a),(d=(c=n.QUARTER_REFS[s-1])===null||c===void 0?void 0:c.current)===null||d===void 0||d.focus())},n.onQuarterKeyDown=function(s,a){var r,i,c=s.key;if(!n.props.disabledKeyboardNavigation)switch(c){case dt.Enter:n.onQuarterClick(s,a),(i=(r=n.props).setPreSelection)===null||i===void 0||i.call(r,n.props.selected);break;case dt.ArrowRight:if(!n.props.preSelection)break;n.handleQuarterNavigation(a===4?1:a+1,Dx(n.props.preSelection,1));break;case dt.ArrowLeft:if(!n.props.preSelection)break;n.handleQuarterNavigation(a===1?4:a-1,N1(n.props.preSelection));break}},n.isMonthDisabledForLabelDate=function(s){var a,r=n.props,i=r.day,c=r.disabled,d=r.minDate,f=r.maxDate,h=r.excludeDates,m=r.includeDates,x=Js(i,s);return c?{isDisabled:!0,labelDate:Js(i,s)}:{isDisabled:(a=(d||f||h||m)&&U1(x,n.props))!==null&&a!==void 0?a:!1,labelDate:x}},n.isMonthDisabled=function(s){var a=n.isMonthDisabledForLabelDate(s).isDisabled;return a},n.getMonthClassNames=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate,d=a.preSelection,f=a.monthClassName,h=f?f(Js(r,s)):void 0,m=n.getSelection();return ns("react-datepicker__month-text","react-datepicker__month-".concat(s),h,{"react-datepicker__month-text--disabled":n.isMonthDisabled(s),"react-datepicker__month-text--selected":m?n.isSelectMonthInList(r,s,m):void 0,"react-datepicker__month-text--keyboard-selected":!n.props.disabledKeyboardNavigation&&d&&n.isSelectedMonth(r,s,d)&&!n.isMonthSelected()&&!n.isMonthDisabled(s),"react-datepicker__month-text--in-selecting-range":n.isInSelectingRangeMonth(s),"react-datepicker__month-text--in-range":i&&c?df(i,c,s,r):void 0,"react-datepicker__month-text--range-start":n.isRangeStartMonth(s),"react-datepicker__month-text--range-end":n.isRangeEndMonth(s),"react-datepicker__month-text--selecting-range-start":n.isSelectingMonthRangeStart(s),"react-datepicker__month-text--selecting-range-end":n.isSelectingMonthRangeEnd(s),"react-datepicker__month-text--today":n.isCurrentMonth(r,s)})},n.getTabIndex=function(s){if(n.props.preSelection==null)return"-1";var a=Is(n.props.preSelection),r=n.isMonthDisabledForLabelDate(a).isDisabled,i=s===a&&!(r||n.props.disabledKeyboardNavigation)?"0":"-1";return i},n.getQuarterTabIndex=function(s){if(n.props.preSelection==null)return"-1";var a=yi(n.props.preSelection),r=ff(n.props.day,n.props),i=s===a&&!(r||n.props.disabledKeyboardNavigation)?"0":"-1";return i},n.getAriaLabel=function(s){var a=n.props,r=a.chooseDayAriaLabelPrefix,i=r===void 0?"Choose":r,c=a.disabledDayAriaLabelPrefix,d=c===void 0?"Not available":c,f=a.day,h=a.locale,m=Js(f,s),x=n.isDisabled(m)||n.isExcluded(m)?d:i;return"".concat(x," ").concat(Mn(m,"MMMM yyyy",h))},n.getQuarterClassNames=function(s){var a=n.props,r=a.day,i=a.startDate,c=a.endDate,d=a.minDate,f=a.maxDate,h=a.excludeDates,m=a.includeDates,x=a.filterDate,y=a.preSelection,v=a.disabledKeyboardNavigation,S=a.disabled,A=(d||f||h||m||x||S)&&ff(dl(r,s),n.props),k=n.getSelection();return ns("react-datepicker__quarter-text","react-datepicker__quarter-".concat(s),{"react-datepicker__quarter-text--disabled":A,"react-datepicker__quarter-text--selected":k?n.isSelectQuarterInList(r,s,k):void 0,"react-datepicker__quarter-text--keyboard-selected":!v&&y&&n.isSelectedQuarter(r,s,y)&&!n.isQuarterSelected()&&!A,"react-datepicker__quarter-text--in-selecting-range":n.isInSelectingRangeQuarter(s),"react-datepicker__quarter-text--in-range":i&&c?hf(i,c,s,r):void 0,"react-datepicker__quarter-text--range-start":n.isRangeStartQuarter(s),"react-datepicker__quarter-text--range-end":n.isRangeEndQuarter(s),"react-datepicker__quarter-text--today":n.isCurrentQuarter(r,s)})},n.getMonthContent=function(s){var a=n.props,r=a.showFullMonthYearPicker,i=a.renderMonthContent,c=a.locale,d=a.day,f=H1(s,c),h=Ux(s,c);return i?i(s,f,h,d):r?h:f},n.getQuarterContent=function(s){var a,r=n.props,i=r.renderQuarterContent,c=r.locale,d=WH(s,c);return(a=i==null?void 0:i(s,d))!==null&&a!==void 0?a:d},n.renderMonths=function(){var s,a=n.props,r=a.showTwoColumnMonthYearPicker,i=a.showFourColumnMonthYearPicker,c=a.day,d=a.selected,f=(s=Fg[ZC(i,r)])===null||s===void 0?void 0:s.grid;return f==null?void 0:f.map(function(h,m){return je.createElement("div",{className:"react-datepicker__month-wrapper",key:m},h.map(function(x,y){return je.createElement("div",{ref:n.MONTH_REFS[x],key:y,onClick:function(v){n.onMonthClick(v,x)},onKeyDown:function(v){G1(v)&&(v.preventDefault(),v.key=dt.Enter),n.onMonthKeyDown(v,x)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onMonthMouseEnter(x)},onPointerEnter:n.props.usePointerEvent?function(){return n.onMonthMouseEnter(x)}:void 0,tabIndex:Number(n.getTabIndex(x)),className:n.getMonthClassNames(x),"aria-disabled":n.isMonthDisabled(x),role:"option","aria-label":n.getAriaLabel(x),"aria-current":n.isCurrentMonth(c,x)?"date":void 0,"aria-selected":d?n.isSelectedMonth(c,x,d):void 0},n.getMonthContent(x))}))})},n.renderQuarters=function(){var s=n.props,a=s.day,r=s.selected,i=[1,2,3,4];return je.createElement("div",{className:"react-datepicker__quarter-wrapper"},i.map(function(c,d){return je.createElement("div",{key:d,ref:n.QUARTER_REFS[d],role:"option",onClick:function(f){n.onQuarterClick(f,c)},onKeyDown:function(f){n.onQuarterKeyDown(f,c)},onMouseEnter:n.props.usePointerEvent?void 0:function(){return n.onQuarterMouseEnter(c)},onPointerEnter:n.props.usePointerEvent?function(){return n.onQuarterMouseEnter(c)}:void 0,className:n.getQuarterClassNames(c),"aria-selected":r?n.isSelectedQuarter(a,c,r):void 0,tabIndex:Number(n.getQuarterTabIndex(c)),"aria-current":n.isCurrentQuarter(a,c)?"date":void 0},n.getQuarterContent(c))}))},n.getClassNames=function(){var s=n.props,a=s.selectingDate,r=s.selectsStart,i=s.selectsEnd,c=s.showMonthYearPicker,d=s.showQuarterYearPicker,f=s.showWeekPicker;return ns("react-datepicker__month",{"react-datepicker__month--selecting-range":a&&(r||i)},{"react-datepicker__monthPicker":c},{"react-datepicker__quarterPicker":d},{"react-datepicker__weekPicker":f})},n}return e.prototype.getSelection=function(){var n=this.props,s=n.selected,a=n.selectedDates,r=n.selectsMultiple;if(r)return a;if(s)return[s]},e.prototype.render=function(){var n=this.props,s=n.showMonthYearPicker,a=n.showQuarterYearPicker,r=n.day,i=n.ariaLabelPrefix,c=i===void 0?"Month ":i,d=c?c.trim()+" ":"",f=Ps(r)?"".concat(d).concat(Mn(r,"MMMM, yyyy",this.props.locale)):"",h=s||a;return h?je.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":f,role:"listbox"},s?this.renderMonths():this.renderQuarters()):je.createElement("div",{role:"table"},this.props.dayNamesHeader&&je.createElement("div",{role:"rowgroup"},this.props.dayNamesHeader),this.props.monthHeader&&je.createElement("div",{role:"rowgroup"},this.props.monthHeader),je.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":f,role:"rowgroup"},this.renderWeeks()),this.props.monthFooter&&je.createElement("div",{role:"rowgroup"},this.props.monthFooter))},e})(b.Component),rU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.monthOptionButtonsRef={},n.isSelectedMonth=function(s){return n.props.month===s},n.handleOptionKeyDown=function(s,a){var r;switch(a.key){case"Enter":a.preventDefault(),n.onChange(s);break;case"Escape":a.preventDefault(),n.props.onCancel();break;case"ArrowUp":case"ArrowDown":{a.preventDefault();var i=(s+(a.key==="ArrowUp"?-1:1)+n.props.monthNames.length)%n.props.monthNames.length;(r=n.monthOptionButtonsRef[i])===null||r===void 0||r.focus();break}}},n.renderOptions=function(){return n.monthOptionButtonsRef={},n.props.monthNames.map(function(s,a){return je.createElement("div",{ref:function(r){n.monthOptionButtonsRef[a]=r,n.isSelectedMonth(a)&&(r==null||r.focus())},role:"button",tabIndex:0,className:n.isSelectedMonth(a)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:s,onClick:n.onChange.bind(n,a),onKeyDown:n.handleOptionKeyDown.bind(n,a),"aria-selected":n.isSelectedMonth(a)?"true":void 0},n.isSelectedMonth(a)?je.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",s)})},n.onChange=function(s){return n.props.onChange(s)},n.handleClickOutside=function(){return n.props.onCancel()},n}return e.prototype.render=function(){return je.createElement(Lp,{className:"react-datepicker__month-dropdown",onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),iU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(s){return s.map(function(a,r){return je.createElement("option",{key:a,value:r},a)})},n.renderSelectMode=function(s){return je.createElement("select",{value:n.props.month,className:"react-datepicker__month-select",onChange:function(a){return n.onChange(parseInt(a.target.value))}},n.renderSelectOptions(s))},n.renderReadView=function(s,a){return je.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:n.toggleDropdown},je.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),je.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},a[n.props.month]))},n.renderDropdown=function(s){return je.createElement(rU,qt({key:"dropdown"},n.props,{monthNames:s,onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(s){var a=n.state.dropdownVisible,r=[n.renderReadView(!a,s)];return a&&r.unshift(n.renderDropdown(s)),r},n.onChange=function(s){n.toggleDropdown(),s!==n.props.month&&n.props.onChange(s)},n.toggleDropdown=function(){return n.setState({dropdownVisible:!n.state.dropdownVisible})},n}return e.prototype.render=function(){var n=this,s=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(r){return H1(r,n.props.locale)}:function(r){return Ux(r,n.props.locale)}),a;switch(this.props.dropdownMode){case"scroll":a=this.renderScrollMode(s);break;case"select":a=this.renderSelectMode(s);break}return je.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},a)},e})(b.Component),eA=5;function oU(t,e,n){for(var s=[],a=t??Si(n,eA),r=e??Oa(n,eA),i=Or(a),c=Or(r);!Rr(i,c);)s.push(ln(i)),i=La(i,1);return s}var lU=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.renderOptions=function(){return s.state.monthYearsList.map(function(a){var r=Ib(a),i=qa(s.props.date,a)&&As(s.props.date,a);return je.createElement("div",{className:i?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:r,onClick:s.onChange.bind(s,r),"aria-selected":i?"true":void 0},i?je.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",Mn(a,s.props.dateFormat,s.props.locale))})},s.onChange=function(a){return s.props.onChange(a)},s.handleClickOutside=function(){s.props.onCancel()},s.state={monthYearsList:oU(s.props.minDate,s.props.maxDate,s.props.date)},s}return e.prototype.render=function(){var n=ns({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return je.createElement(Lp,{className:n,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),tA=5,cU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(){for(var s,a,r=(s=n.props.minDate)!==null&&s!==void 0?s:Si(n.props.date,tA),i=(a=n.props.maxDate)!==null&&a!==void 0?a:Oa(n.props.date,tA),c=Or(r),d=Or(i),f=[];!Rr(c,d);){var h=Ib(c);f.push(je.createElement("option",{key:h,value:h},Mn(c,n.props.dateFormat,n.props.locale))),c=La(c,1)}return f},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return je.createElement("select",{value:Ib(Or(n.props.date)),className:"react-datepicker__month-year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){var a=Mn(n.props.date,n.props.dateFormat,n.props.locale);return je.createElement("div",{key:"read",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:n.toggleDropdown},je.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),je.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},a))},n.renderDropdown=function(){return je.createElement(lU,qt({key:"dropdown"},n.props,{onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(){var s=n.state.dropdownVisible,a=[n.renderReadView(!s)];return s&&a.unshift(n.renderDropdown()),a},n.onChange=function(s){n.toggleDropdown();var a=ln(s);qa(n.props.date,a)&&As(n.props.date,a)||n.props.onChange(a)},n.toggleDropdown=function(){return n.setState({dropdownVisible:!n.state.dropdownVisible})},n}return e.prototype.render=function(){var n;switch(this.props.dropdownMode){case"scroll":n=this.renderScrollMode();break;case"select":n=this.renderSelectMode();break}return je.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),uU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={height:null},n.scrollToTheSelectedTime=function(){requestAnimationFrame(function(){var s,a,r;n.list&&(n.list.scrollTop=(r=n.centerLi&&e.calcCenterPosition(n.props.monthRef?n.props.monthRef.clientHeight-((a=(s=n.header)===null||s===void 0?void 0:s.clientHeight)!==null&&a!==void 0?a:0):n.list.clientHeight,n.centerLi))!==null&&r!==void 0?r:0)})},n.handleClick=function(s){var a,r;(n.props.minTime||n.props.maxTime)&&qC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&WC(s,n.props)||(r=(a=n.props).onChange)===null||r===void 0||r.call(a,s)},n.isSelectedTime=function(s){var a=no(n.props.selected);return a&&V1(a,s)},n.isDisabledTime=function(s){return(n.props.minTime||n.props.maxTime)&&qC(s,n.props)||(n.props.excludeTimes||n.props.includeTimes||n.props.filterTime)&&WC(s,n.props)},n.liClasses=function(s){var a,r=["react-datepicker__time-list-item",n.props.timeClassName?n.props.timeClassName(s):void 0];return n.isSelectedTime(s)&&r.push("react-datepicker__time-list-item--selected"),n.isDisabledTime(s)&&r.push("react-datepicker__time-list-item--disabled"),n.props.injectTimes&&(bs(s)*3600+xs(s)*60+vi(s))%(((a=n.props.intervals)!==null&&a!==void 0?a:e.defaultProps.intervals)*60)!==0&&r.push("react-datepicker__time-list-item--injected"),r.join(" ")},n.handleOnKeyDown=function(s,a){var r,i;s.key===dt.Space&&(s.preventDefault(),s.key=dt.Enter),(s.key===dt.ArrowUp||s.key===dt.ArrowLeft)&&s.target instanceof HTMLElement&&s.target.previousSibling&&(s.preventDefault(),s.target.previousSibling instanceof HTMLElement&&s.target.previousSibling.focus()),(s.key===dt.ArrowDown||s.key===dt.ArrowRight)&&s.target instanceof HTMLElement&&s.target.nextSibling&&(s.preventDefault(),s.target.nextSibling instanceof HTMLElement&&s.target.nextSibling.focus()),s.key===dt.Enter&&n.handleClick(a),(i=(r=n.props).handleOnKeyDown)===null||i===void 0||i.call(r,s)},n.renderTimes=function(){for(var s,a=[],r=typeof n.props.format=="string"?n.props.format:"p",i=(s=n.props.intervals)!==null&&s!==void 0?s:e.defaultProps.intervals,c=no(n.props.selected)||no(n.props.openToDate)||ln(),d=Jc(c),f=n.props.injectTimes&&n.props.injectTimes.sort(function(A,k){return A.getTime()-k.getTime()}),h=60*ZH(c),m=h/i,x=0;x<m;x++){var y=Au(d,x*i);if(a.push(y),f){var v=JH(d,y,x,i,f);a=a.concat(v)}}var S=a.reduce(function(A,k){return k.getTime()<=c.getTime()?k:A},a[0]);return a.map(function(A){return je.createElement("li",{key:A.valueOf(),onClick:n.handleClick.bind(n,A),className:n.liClasses(A),ref:function(k){A===S&&(n.centerLi=k)},onKeyDown:function(k){n.handleOnKeyDown(k,A)},tabIndex:A===S?0:-1,role:"option","aria-selected":n.isSelectedTime(A)?"true":void 0,"aria-disabled":n.isDisabledTime(A)?"true":void 0},Mn(A,r,n.props.locale))})},n.renderTimeCaption=function(){return n.props.showTimeCaption===!1?je.createElement(je.Fragment,null):je.createElement("div",{className:"react-datepicker__header react-datepicker__header--time ".concat(n.props.showTimeSelectOnly?"react-datepicker__header--time--only":""),ref:function(s){n.header=s}},je.createElement("div",{className:"react-datepicker-time__header"},n.props.timeCaption))},n}return Object.defineProperty(e,"defaultProps",{get:function(){return{intervals:30,todayButton:null,timeCaption:"Time",showTimeCaption:!0}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){this.scrollToTheSelectedTime(),this.observeDatePickerHeightChanges()},e.prototype.componentWillUnmount=function(){var n;(n=this.resizeObserver)===null||n===void 0||n.disconnect()},e.prototype.observeDatePickerHeightChanges=function(){var n=this,s=this.props.monthRef;this.updateContainerHeight(),s&&(this.resizeObserver=new ResizeObserver(function(){n.updateContainerHeight()}),this.resizeObserver.observe(s))},e.prototype.updateContainerHeight=function(){if(this.props.monthRef&&this.header){var n=this.props.monthRef.clientHeight-this.header.clientHeight;this.state.height!==n&&this.setState({height:n})}},e.prototype.render=function(){var n=this,s,a=this.state.height;return je.createElement("div",{className:"react-datepicker__time-container ".concat(((s=this.props.todayButton)!==null&&s!==void 0?s:e.defaultProps.todayButton)?"react-datepicker__time-container--with-today-button":"")},this.renderTimeCaption(),je.createElement("div",{className:"react-datepicker__time"},je.createElement("div",{className:"react-datepicker__time-box"},je.createElement("ul",{className:"react-datepicker__time-list",ref:function(r){n.list=r},style:a?{height:a}:{},role:"listbox","aria-label":this.props.timeCaption},this.renderTimes()))))},e.calcCenterPosition=function(n,s){return s.offsetTop-(n/2-s.clientHeight/2)},e})(b.Component),nA=3,dU=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.YEAR_REFS=Xa([],Array(s.props.yearItemNumber),!0).map(function(){return b.createRef()}),s.isDisabled=function(a){return va(a,{minDate:s.props.minDate,maxDate:s.props.maxDate,excludeDates:s.props.excludeDates,includeDates:s.props.includeDates,filterDate:s.props.filterDate})},s.isExcluded=function(a){return Wx(a,{excludeDates:s.props.excludeDates})},s.selectingDate=function(){var a;return(a=s.props.selectingDate)!==null&&a!==void 0?a:s.props.preSelection},s.updateFocusOnPaginate=function(a){var r=function(){var i,c;(c=(i=s.YEAR_REFS[a])===null||i===void 0?void 0:i.current)===null||c===void 0||c.focus()};window.requestAnimationFrame(r)},s.handleYearClick=function(a,r){s.props.onDayClick&&s.props.onDayClick(a,r)},s.handleYearNavigation=function(a,r){var i,c,d,f,h=s.props,m=h.date,x=h.yearItemNumber;if(!(m===void 0||x===void 0)){var y=_r(m,x).startPeriod;s.isDisabled(r)||s.isExcluded(r)||((c=(i=s.props).setPreSelection)===null||c===void 0||c.call(i,r),a-y<0?s.updateFocusOnPaginate(x-(y-a)):a-y>=x?s.updateFocusOnPaginate(Math.abs(x-(a-y))):(f=(d=s.YEAR_REFS[a-y])===null||d===void 0?void 0:d.current)===null||f===void 0||f.focus())}},s.isSameDay=function(a,r){return sn(a,r)},s.isCurrentYear=function(a){return a===Jt(ln())},s.isRangeStart=function(a){return s.props.startDate&&s.props.endDate&&qa(Wa(ln(),a),s.props.startDate)},s.isRangeEnd=function(a){return s.props.startDate&&s.props.endDate&&qa(Wa(ln(),a),s.props.endDate)},s.isInRange=function(a){return pf(a,s.props.startDate,s.props.endDate)},s.isInSelectingRange=function(a){var r=s.props,i=r.selectsStart,c=r.selectsEnd,d=r.selectsRange,f=r.startDate,h=r.endDate;return!(i||c||d)||!s.selectingDate()?!1:i&&h?pf(a,s.selectingDate(),h):c&&f||d&&f&&!h?pf(a,f,s.selectingDate()):!1},s.isSelectingRangeStart=function(a){var r;if(!s.isInSelectingRange(a))return!1;var i=s.props,c=i.startDate,d=i.selectsStart,f=Wa(ln(),a);return d?qa(f,(r=s.selectingDate())!==null&&r!==void 0?r:null):qa(f,c??null)},s.isSelectingRangeEnd=function(a){var r;if(!s.isInSelectingRange(a))return!1;var i=s.props,c=i.endDate,d=i.selectsEnd,f=i.selectsRange,h=Wa(ln(),a);return d||f?qa(h,(r=s.selectingDate())!==null&&r!==void 0?r:null):qa(h,c??null)},s.isKeyboardSelected=function(a){if(!(s.props.disabledKeyboardNavigation||s.props.date===void 0||s.props.preSelection==null)){var r=s.props,i=r.minDate,c=r.maxDate,d=r.excludeDates,f=r.includeDates,h=r.filterDate,m=r.selected,x=Zc(Wa(s.props.date,a)),y=(i||c||d||f||h)&&Ef(a,s.props),v=!!m&&sn(x,Zc(m)),S=sn(x,Zc(s.props.preSelection));return!s.props.inline&&!v&&S&&!y}},s.isSelectedYear=function(a){var r=s.props,i=r.selectsMultiple,c=r.selected,d=r.selectedDates;return i?d==null?void 0:d.some(function(f){return a===Jt(f)}):!!c&&a===Jt(c)},s.onYearClick=function(a,r){var i=s.props.date;i!==void 0&&s.handleYearClick(Zc(Wa(i,r)),a)},s.onYearKeyDown=function(a,r){var i,c,d=a.key,f=s.props,h=f.date,m=f.yearItemNumber,x=f.handleOnKeyDown;if(d!==dt.Tab&&a.preventDefault(),!s.props.disabledKeyboardNavigation)switch(d){case dt.Enter:if(s.props.selected==null)break;s.onYearClick(a,r),(c=(i=s.props).setPreSelection)===null||c===void 0||c.call(i,s.props.selected);break;case dt.ArrowRight:if(s.props.preSelection==null)break;s.handleYearNavigation(r+1,Oa(s.props.preSelection,1));break;case dt.ArrowLeft:if(s.props.preSelection==null)break;s.handleYearNavigation(r-1,Si(s.props.preSelection,1));break;case dt.ArrowUp:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var y=_r(h,m).startPeriod,v=nA,S=r-v;if(S<y){var A=m%v;r>=y&&r<y+A?v=A:v+=A,S=r-v}s.handleYearNavigation(S,Si(s.props.preSelection,v));break}case dt.ArrowDown:{if(h===void 0||m===void 0||s.props.preSelection==null)break;var k=_r(h,m).endPeriod,v=nA,S=r+v;if(S>k){var A=m%v;r<=k&&r>k-A?v=A:v+=A,S=r+v}s.handleYearNavigation(S,Oa(s.props.preSelection,v));break}}x&&x(a)},s.getYearClassNames=function(a){var r=s.props,i=r.date,c=r.disabled,d=r.minDate,f=r.maxDate,h=r.excludeDates,m=r.includeDates,x=r.filterDate,y=r.yearClassName;return ns("react-datepicker__year-text","react-datepicker__year-".concat(a),i?y==null?void 0:y(Wa(i,a)):void 0,{"react-datepicker__year-text--selected":s.isSelectedYear(a),"react-datepicker__year-text--disabled":(d||f||h||m||x||c)&&Ef(a,s.props),"react-datepicker__year-text--keyboard-selected":s.isKeyboardSelected(a),"react-datepicker__year-text--range-start":s.isRangeStart(a),"react-datepicker__year-text--range-end":s.isRangeEnd(a),"react-datepicker__year-text--in-range":s.isInRange(a),"react-datepicker__year-text--in-selecting-range":s.isInSelectingRange(a),"react-datepicker__year-text--selecting-range-start":s.isSelectingRangeStart(a),"react-datepicker__year-text--selecting-range-end":s.isSelectingRangeEnd(a),"react-datepicker__year-text--today":s.isCurrentYear(a)})},s.getYearTabIndex=function(a){if(s.props.disabledKeyboardNavigation||s.props.preSelection==null)return"-1";var r=Jt(s.props.preSelection),i=Ef(a,s.props);return a===r&&!i?"0":"-1"},s.getYearContent=function(a){return s.props.renderYearContent?s.props.renderYearContent(a):a},s}return e.prototype.render=function(){var n=this,s=[],a=this.props,r=a.date,i=a.yearItemNumber,c=a.onYearMouseEnter,d=a.onYearMouseLeave;if(r===void 0)return null;for(var f=_r(r,i),h=f.startPeriod,m=f.endPeriod,x=function(S){s.push(je.createElement("div",{ref:y.YEAR_REFS[S-h],onClick:function(A){n.onYearClick(A,S)},onKeyDown:function(A){G1(A)&&(A.preventDefault(),A.key=dt.Enter),n.onYearKeyDown(A,S)},tabIndex:Number(y.getYearTabIndex(S)),className:y.getYearClassNames(S),onMouseEnter:y.props.usePointerEvent?void 0:function(A){return c(A,S)},onPointerEnter:y.props.usePointerEvent?function(A){return c(A,S)}:void 0,onMouseLeave:y.props.usePointerEvent?void 0:function(A){return d(A,S)},onPointerLeave:y.props.usePointerEvent?function(A){return d(A,S)}:void 0,key:S,"aria-current":y.isCurrentYear(S)?"date":void 0},y.getYearContent(S)))},y=this,v=h;v<=m;v++)x(v);return je.createElement("div",{className:"react-datepicker__year"},je.createElement("div",{className:"react-datepicker__year-wrapper",onMouseLeave:this.props.usePointerEvent?void 0:this.props.clearSelectingDate,onPointerLeave:this.props.usePointerEvent?this.props.clearSelectingDate:void 0},s))},e})(b.Component);function fU(t,e,n,s){for(var a=[],r=0;r<2*e+1;r++){var i=t+e-r,c=!0;n&&(c=Jt(n)<=i),s&&c&&(c=Jt(s)>=i),c&&a.push(i)}return a}var pU=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;s.yearOptionButtonsRef={},s.handleOptionKeyDown=function(c,d){var f;switch(d.key){case"Enter":d.preventDefault(),s.onChange(c);break;case"Escape":d.preventDefault(),s.props.onCancel();break;case"ArrowUp":case"ArrowDown":{d.preventDefault();var h=c+(d.key==="ArrowUp"?1:-1);s.yearOptionButtonsRef[h]&&((f=s.yearOptionButtonsRef[h])===null||f===void 0||f.focus());break}}},s.renderOptions=function(){s.yearOptionButtonsRef={};var c=s.props.year,d=s.state.yearsList.map(function(m){return je.createElement("div",{ref:function(x){s.yearOptionButtonsRef[m]=x,m===c&&(x==null||x.focus())},role:"button",tabIndex:0,className:c===m?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:m,onClick:s.onChange.bind(s,m),onKeyDown:s.handleOptionKeyDown.bind(s,m),"aria-selected":c===m?"true":void 0},c===m?je.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",m)}),f=s.props.minDate?Jt(s.props.minDate):null,h=s.props.maxDate?Jt(s.props.maxDate):null;return(!h||!s.state.yearsList.find(function(m){return m===h}))&&d.unshift(je.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:s.incrementYears},je.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),(!f||!s.state.yearsList.find(function(m){return m===f}))&&d.push(je.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:s.decrementYears},je.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),d},s.onChange=function(c){s.props.onChange(c)},s.handleClickOutside=function(){s.props.onCancel()},s.shiftYears=function(c){var d=s.state.yearsList.map(function(f){return f+c});s.setState({yearsList:d})},s.incrementYears=function(){return s.shiftYears(1)},s.decrementYears=function(){return s.shiftYears(-1)};var a=n.yearDropdownItemNumber,r=n.scrollableYearDropdown,i=a||(r?10:5);return s.state={yearsList:fU(s.props.year,i,s.props.minDate,s.props.maxDate)},s.dropdownRef=b.createRef(),s}return e.prototype.componentDidMount=function(){var n=this.dropdownRef.current;if(n){var s=n.children?Array.from(n.children):null,a=s?s.find(function(r){return r.ariaSelected}):null;n.scrollTop=a&&a instanceof HTMLElement?a.offsetTop+(a.clientHeight-n.clientHeight)/2:(n.scrollHeight-n.clientHeight)/2}},e.prototype.render=function(){var n=ns({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return je.createElement(Lp,{className:n,containerRef:this.dropdownRef,onClickOutside:this.handleClickOutside},this.renderOptions())},e})(b.Component),hU=(function(t){hs(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={dropdownVisible:!1},n.renderSelectOptions=function(){for(var s=n.props.minDate?Jt(n.props.minDate):1900,a=n.props.maxDate?Jt(n.props.maxDate):2100,r=[],i=s;i<=a;i++)r.push(je.createElement("option",{key:i,value:i},i));return r},n.onSelectChange=function(s){n.onChange(parseInt(s.target.value))},n.renderSelectMode=function(){return je.createElement("select",{value:n.props.year,className:"react-datepicker__year-select",onChange:n.onSelectChange},n.renderSelectOptions())},n.renderReadView=function(s){return je.createElement("button",{key:"read",type:"button",style:{visibility:s?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:n.toggleDropdown},je.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),je.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},n.props.year))},n.renderDropdown=function(){return je.createElement(pU,qt({key:"dropdown"},n.props,{onChange:n.onChange,onCancel:n.toggleDropdown}))},n.renderScrollMode=function(){var s=n.state.dropdownVisible,a=[n.renderReadView(!s)];return s&&a.unshift(n.renderDropdown()),a},n.onChange=function(s){n.toggleDropdown(),s!==n.props.year&&n.props.onChange(s)},n.toggleDropdown=function(s){n.setState({dropdownVisible:!n.state.dropdownVisible},function(){n.props.adjustDateOnChange&&n.handleYearChange(n.props.date,s)})},n.handleYearChange=function(s,a){var r;(r=n.onSelect)===null||r===void 0||r.call(n,s,a),n.setOpen()},n.onSelect=function(s,a){var r,i;(i=(r=n.props).onSelect)===null||i===void 0||i.call(r,s,a)},n.setOpen=function(){var s,a;(a=(s=n.props).setOpen)===null||a===void 0||a.call(s,!0)},n}return e.prototype.render=function(){var n;switch(this.props.dropdownMode){case"scroll":n=this.renderScrollMode();break;case"select":n=this.renderSelectMode();break}return je.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},n)},e})(b.Component),mU=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],Y1="react-datepicker-ignore-onclickoutside",gU=function(t){var e=(t.className||"").split(/\s+/);return mU.some(function(n){return e.indexOf(n)>=0})},bU=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.monthContainer=void 0,s.handleClickOutside=function(a){s.props.onClickOutside(a)},s.setClickOutsideRef=function(){return s.containerRef.current},s.handleDropdownFocus=function(a){var r,i;gU(a.target)&&((i=(r=s.props).onDropdownFocus)===null||i===void 0||i.call(r,a))},s.getDateInView=function(){var a=s.props,r=a.preSelection,i=a.selected,c=a.openToDate,d=W1(s.props),f=q1(s.props),h=ln(),m=c||i||r;return m||(d&&Qa(h,d)?d:f&&Rr(h,f)?f:h)},s.increaseMonth=function(){s.setState(function(a){var r=a.date;return{date:La(r,1)}},function(){return s.handleMonthChange(s.state.date)})},s.decreaseMonth=function(){s.setState(function(a){var r=a.date;return{date:ao(r,1)}},function(){return s.handleMonthChange(s.state.date)})},s.handleDayClick=function(a,r,i){s.props.onSelect(a,r,i),s.props.setPreSelection&&s.props.setPreSelection(a)},s.handleDayMouseEnter=function(a){s.setState({selectingDate:a}),s.props.onDayMouseEnter&&s.props.onDayMouseEnter(a)},s.handleMonthMouseLeave=function(){s.setState({selectingDate:void 0}),s.props.onMonthMouseLeave&&s.props.onMonthMouseLeave()},s.handleYearMouseEnter=function(a,r){s.setState({selectingDate:Wa(ln(),r)}),s.props.onYearMouseEnter&&s.props.onYearMouseEnter(a,r)},s.handleYearMouseLeave=function(a,r){s.props.onYearMouseLeave&&s.props.onYearMouseLeave(a,r)},s.handleYearChange=function(a){var r,i,c,d;(i=(r=s.props).onYearChange)===null||i===void 0||i.call(r,a),s.setState({isRenderAriaLiveMessage:!0}),s.props.adjustDateOnChange&&(s.props.onSelect(a),(d=(c=s.props).setOpen)===null||d===void 0||d.call(c,!0)),s.props.setPreSelection&&s.props.setPreSelection(a)},s.getEnabledPreSelectionDateForMonth=function(a){if(!va(a,s.props))return a;for(var r=Or(a),i=zH(a),c=sz(i,r),d=null,f=0;f<=c;f++){var h=Ra(r,f);if(!va(h,s.props)){d=h;break}}return d},s.handleMonthChange=function(a){var r,i,c,d=(r=s.getEnabledPreSelectionDateForMonth(a))!==null&&r!==void 0?r:a;s.handleCustomMonthChange(d),s.props.adjustDateOnChange&&(s.props.onSelect(d),(c=(i=s.props).setOpen)===null||c===void 0||c.call(i,!0)),s.props.setPreSelection&&s.props.setPreSelection(d)},s.handleCustomMonthChange=function(a){var r,i;(i=(r=s.props).onMonthChange)===null||i===void 0||i.call(r,a),s.setState({isRenderAriaLiveMessage:!0})},s.handleMonthYearChange=function(a){s.handleYearChange(a),s.handleMonthChange(a)},s.changeYear=function(a){s.setState(function(r){var i=r.date;return{date:Wa(i,Number(a))}},function(){return s.handleYearChange(s.state.date)})},s.changeMonth=function(a){s.setState(function(r){var i=r.date;return{date:Js(i,Number(a))}},function(){var r,i;s.handleMonthChange(s.state.date),(i=(r=s.props).onMonthSelectedInChange)===null||i===void 0||i.call(r,0)})},s.changeMonthYear=function(a){s.setState(function(r){var i=r.date;return{date:Wa(Js(i,Is(a)),Jt(a))}},function(){return s.handleMonthYearChange(s.state.date)})},s.header=function(a,r){if(a===void 0&&(a=s.state.date),r===void 0&&(r=0),!Ps(a))return[];var i=s.props.disabled,c=wi(a,s.props.locale,s.props.calendarStartDay),d=[];return s.props.showWeekNumbers&&d.push(je.createElement("div",{key:"W",className:"react-datepicker__day-name ".concat(i?"react-datepicker__day-name--disabled":""),role:"columnheader"},je.createElement("span",{className:"react-datepicker__sr-only"},"Week number"),je.createElement("span",{"aria-hidden":"true"},s.props.weekLabel||"#"))),d.concat([0,1,2,3,4,5,6].map(function(f){var h=Ra(c,f),m=s.formatWeekday(h,s.props.locale),x=Mn(h,"EEEE",s.props.locale),y=s.props.weekDayClassName?s.props.weekDayClassName(h):void 0;if(s.props.renderCustomDayName){var v=s.props.renderCustomDayName({day:h,shortName:m,fullName:x,locale:s.props.locale,customDayNameCount:r});return je.createElement("div",{key:f,role:"columnheader",className:ns("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},v)}return je.createElement("div",{key:f,role:"columnheader",className:ns("react-datepicker__day-name",y,i?"react-datepicker__day-name--disabled":"")},je.createElement("span",{className:"react-datepicker__sr-only"},x),je.createElement("span",{"aria-hidden":"true"},m))}))},s.formatWeekday=function(a,r){return s.props.formatWeekDay?$H(a,s.props.formatWeekDay,r):s.props.useWeekdaysShort?UH(a,r):HH(a,r)},s.decreaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Si(i,s.props.showYearPicker?(r=s.props.yearItemNumber)!==null&&r!==void 0?r:e.defaultProps.yearItemNumber:1)}},function(){return s.handleYearChange(s.state.date)})},s.clearSelectingDate=function(){s.setState({selectingDate:void 0})},s.renderPreviousButton=function(){var a,r,i;if(!s.props.renderCustomHeader){var c=(a=s.props.monthsShown)!==null&&a!==void 0?a:e.defaultProps.monthsShown,d=s.props.showPreviousMonths?c-1:0,f=(r=s.props.monthSelectedIn)!==null&&r!==void 0?r:d,h=ao(s.state.date,f),m;switch(!0){case s.props.disabled:m=!0;break;case s.props.showMonthYearPicker:m=YC(s.state.date,s.props);break;case s.props.showYearPicker:m=YH(s.state.date,s.props);break;case s.props.showQuarterYearPicker:m=VH(s.state.date,s.props);break;default:m=VC(h,s.props);break}if(!(!((i=s.props.forceShowMonthNavigation)!==null&&i!==void 0?i:e.defaultProps.forceShowMonthNavigation)&&!s.props.showDisabledMonthNavigation&&m||s.props.showTimeSelectOnly)){var x=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"],y=["react-datepicker__navigation","react-datepicker__navigation--previous"],v=s.decreaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(v=s.decreaseYear),m&&s.props.showDisabledMonthNavigation&&(y.push("react-datepicker__navigation--previous--disabled"),v=void 0);var S=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,A=s.props,k=A.previousMonthButtonLabel,N=k===void 0?e.defaultProps.previousMonthButtonLabel:k,j=A.previousYearButtonLabel,E=j===void 0?e.defaultProps.previousYearButtonLabel:j,D=s.props,_=D.previousMonthAriaLabel,B=_===void 0?typeof N=="string"?N:"Previous Month":_,O=D.previousYearAriaLabel,T=O===void 0?typeof E=="string"?E:"Previous Year":O;return je.createElement("button",{type:"button",className:y.join(" "),onClick:v,onKeyDown:s.props.handleOnKeyDown,"aria-label":S?T:B},je.createElement("span",{className:x.join(" ")},S?E:N))}}},s.increaseYear=function(){s.setState(function(a){var r,i=a.date;return{date:Oa(i,s.props.showYearPicker?(r=s.props.yearItemNumber)!==null&&r!==void 0?r:e.defaultProps.yearItemNumber:1)}},function(){return s.handleYearChange(s.state.date)})},s.renderNextButton=function(){var a;if(!s.props.renderCustomHeader){var r;switch(!0){case s.props.disabled:r=!0;break;case s.props.showMonthYearPicker:r=KC(s.state.date,s.props);break;case s.props.showYearPicker:r=KH(s.state.date,s.props);break;case s.props.showQuarterYearPicker:r=GH(s.state.date,s.props);break;default:r=GC(s.state.date,s.props);break}if(!(!((a=s.props.forceShowMonthNavigation)!==null&&a!==void 0?a:e.defaultProps.forceShowMonthNavigation)&&!s.props.showDisabledMonthNavigation&&r||s.props.showTimeSelectOnly)){var i=["react-datepicker__navigation","react-datepicker__navigation--next"],c=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"];s.props.showTimeSelect&&i.push("react-datepicker__navigation--next--with-time"),s.props.todayButton&&i.push("react-datepicker__navigation--next--with-today-button");var d=s.increaseMonth;(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker)&&(d=s.increaseYear),r&&s.props.showDisabledMonthNavigation&&(i.push("react-datepicker__navigation--next--disabled"),d=void 0);var f=s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker,h=s.props,m=h.nextMonthButtonLabel,x=m===void 0?e.defaultProps.nextMonthButtonLabel:m,y=h.nextYearButtonLabel,v=y===void 0?e.defaultProps.nextYearButtonLabel:y,S=s.props,A=S.nextMonthAriaLabel,k=A===void 0?typeof x=="string"?x:"Next Month":A,N=S.nextYearAriaLabel,j=N===void 0?typeof v=="string"?v:"Next Year":N;return je.createElement("button",{type:"button",className:i.join(" "),onClick:d,onKeyDown:s.props.handleOnKeyDown,"aria-label":f?j:k},je.createElement("span",{className:c.join(" ")},f?v:x))}}},s.renderCurrentMonth=function(a){a===void 0&&(a=s.state.date);var r=["react-datepicker__current-month"];return s.props.showYearDropdown&&r.push("react-datepicker__current-month--hasYearDropdown"),s.props.showMonthDropdown&&r.push("react-datepicker__current-month--hasMonthDropdown"),s.props.showMonthYearDropdown&&r.push("react-datepicker__current-month--hasMonthYearDropdown"),je.createElement("h2",{className:r.join(" ")},Ps(a)?Mn(a,s.props.dateFormat,s.props.locale):"")},s.renderYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showYearDropdown||a))return je.createElement(hU,qt({},e.defaultProps,s.props,{date:s.state.date,onChange:s.changeYear,year:Jt(s.state.date)}))},s.renderMonthDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showMonthDropdown||a))return je.createElement(iU,qt({},e.defaultProps,s.props,{month:Is(s.state.date),onChange:s.changeMonth}))},s.renderMonthYearDropdown=function(a){if(a===void 0&&(a=!1),!(!s.props.showMonthYearDropdown||a))return je.createElement(cU,qt({},e.defaultProps,s.props,{date:s.state.date,onChange:s.changeMonthYear}))},s.handleTodayButtonClick=function(a){s.props.onSelect($C(),a),s.props.setPreSelection&&s.props.setPreSelection($C())},s.renderTodayButton=function(){if(!(!s.props.todayButton||s.props.showTimeSelectOnly))return je.createElement("div",{className:"react-datepicker__today-button",onClick:s.handleTodayButtonClick},s.props.todayButton)},s.renderDayNamesHeader=function(a,r){return r===void 0&&(r=0),je.createElement("div",{className:"react-datepicker__day-names",role:"row"},s.header(a,r))},s.renderDefaultHeader=function(a){var r=a.monthDate,i=a.i,c=je.createElement("div",{className:ns("react-datepicker__header",{"react-datepicker__header--has-time-select":s.props.showTimeSelect,"react-datepicker__header--middle":s.props.monthHeaderPosition==="middle","react-datepicker__header--bottom":s.props.monthHeaderPosition==="bottom"})},s.renderCurrentMonth(r),je.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(s.props.dropdownMode),onFocus:s.handleDropdownFocus},s.renderMonthDropdown(i!==0),s.renderMonthYearDropdown(i!==0),s.renderYearDropdown(i!==0)));return s.props.monthHeaderPosition==="top"?c:je.createElement("div",{className:"react-datepicker__header-wrapper"},s.renderPreviousButton()||null,s.renderNextButton()||null,c)},s.renderCustomHeader=function(a){var r,i,c=a.monthDate,d=a.i;if(s.props.showTimeSelect&&!s.state.monthContainer||s.props.showTimeSelectOnly)return null;var f=s.props,h=f.showYearPicker,m=f.yearItemNumber,x;if(h){var y=_r(c,m),v=y.startPeriod,S=y.endPeriod;x={startYear:v,endYear:S}}var A=VC(s.state.date,s.props),k=GC(s.state.date,s.props),N=YC(s.state.date,s.props),j=KC(s.state.date,s.props);return je.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:s.props.onDropdownFocus},(i=(r=s.props).renderCustomHeader)===null||i===void 0?void 0:i.call(r,qt(qt(qt({},s.state),h&&{visibleYearsRange:x}),{customHeaderCount:d,monthDate:c,changeMonth:s.changeMonth,changeYear:s.changeYear,decreaseMonth:s.decreaseMonth,increaseMonth:s.increaseMonth,decreaseYear:s.decreaseYear,increaseYear:s.increaseYear,prevMonthButtonDisabled:A,nextMonthButtonDisabled:k,prevYearButtonDisabled:N,nextYearButtonDisabled:j})))},s.renderYearHeader=function(a){var r=a.monthDate,i=s.props,c=i.showYearPicker,d=i.yearItemNumber,f=d===void 0?e.defaultProps.yearItemNumber:d,h=_r(r,f),m=h.startPeriod,x=h.endPeriod;return je.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},c?"".concat(m," - ").concat(x):Jt(r))},s.renderHeader=function(a){var r=a.monthDate,i=a.i,c=i===void 0?0:i,d={monthDate:r,i:c};switch(!0){case s.props.renderCustomHeader!==void 0:return s.renderCustomHeader(d);case(s.props.showMonthYearPicker||s.props.showQuarterYearPicker||s.props.showYearPicker):return s.renderYearHeader(d);default:return s.renderDefaultHeader(d)}},s.renderMonths=function(){var a,r;if(!(s.props.showTimeSelectOnly||s.props.showYearPicker)){for(var i=[],c=(a=s.props.monthsShown)!==null&&a!==void 0?a:e.defaultProps.monthsShown,d=s.props.showPreviousMonths?c-1:0,f=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?Oa(s.state.date,d):ao(s.state.date,d),h=(r=s.props.monthSelectedIn)!==null&&r!==void 0?r:d,m=0;m<c;++m){var x=m-h+d,y=s.props.showMonthYearPicker||s.props.showQuarterYearPicker?Oa(f,x):La(f,x),v="month-".concat(m),S=m<c-1,A=m>0;i.push(je.createElement("div",{key:v,ref:function(k){s.monthContainer=k??void 0},className:"react-datepicker__month-container"},s.props.monthHeaderPosition==="top"&&s.renderHeader({monthDate:y,i:m}),je.createElement(aU,qt({},e.defaultProps,s.props,{containerRef:s.containerRef,ariaLabelPrefix:s.props.monthAriaLabelPrefix,day:y,onDayClick:s.handleDayClick,handleOnKeyDown:s.props.handleOnDayKeyDown,handleOnMonthKeyDown:s.props.handleOnKeyDown,onDayMouseEnter:s.handleDayMouseEnter,onMouseLeave:s.handleMonthMouseLeave,orderInDisplay:m,selectingDate:s.state.selectingDate,monthShowsDuplicateDaysEnd:S,monthShowsDuplicateDaysStart:A,dayNamesHeader:s.renderDayNamesHeader(y,m),monthHeader:s.props.monthHeaderPosition==="middle"?s.renderHeader({monthDate:y,i:m}):void 0,monthFooter:s.props.monthHeaderPosition==="bottom"?s.renderHeader({monthDate:y,i:m}):void 0}))))}return i}},s.renderYears=function(){if(!s.props.showTimeSelectOnly&&s.props.showYearPicker)return je.createElement("div",{className:"react-datepicker__year--container"},s.renderHeader({monthDate:s.state.date}),je.createElement(dU,qt({},e.defaultProps,s.props,{selectingDate:s.state.selectingDate,date:s.state.date,onDayClick:s.handleDayClick,clearSelectingDate:s.clearSelectingDate,onYearMouseEnter:s.handleYearMouseEnter,onYearMouseLeave:s.handleYearMouseLeave})))},s.renderTimeSection=function(){if(s.props.showTimeSelect&&(s.state.monthContainer||s.props.showTimeSelectOnly))return je.createElement(uU,qt({},e.defaultProps,s.props,{onChange:s.props.onTimeChange,format:s.props.timeFormat,intervals:s.props.timeIntervals,monthRef:s.state.monthContainer}))},s.renderInputTimeSection=function(){var a,r;if(s.props.showTimeInput){if(s.props.selectsRange){var i=s.props,c=i.startDate,d=i.endDate,f=c?new Date(c):void 0,h=f&&Ps(f)&&!!c,m=h?"".concat(il(f.getHours()),":").concat(il(f.getMinutes())):"",x=d?new Date(d):void 0,y=x&&Ps(x)&&!!d,v=y?"".concat(il(x.getHours()),":").concat(il(x.getMinutes())):"";return je.createElement(je.Fragment,null,je.createElement(Bg,qt({},e.defaultProps,s.props,{date:f,timeString:m,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N,"start")},timeInputLabel:((a=s.props.timeInputLabel)!==null&&a!==void 0?a:"Time")+" (Start)"})),je.createElement(Bg,qt({},e.defaultProps,s.props,{date:x,timeString:v,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N,"end")},timeInputLabel:((r=s.props.timeInputLabel)!==null&&r!==void 0?r:"Time")+" (End)"})))}var S=s.props.selected?new Date(s.props.selected):void 0,A=S&&Ps(S)&&!!s.props.selected,k=A?"".concat(il(S.getHours()),":").concat(il(S.getMinutes())):"";return je.createElement(Bg,qt({},e.defaultProps,s.props,{date:S,timeString:k,onChange:function(N){var j,E;(E=(j=s.props).onTimeChange)===null||E===void 0||E.call(j,N)}}))}},s.renderAriaLiveRegion=function(){var a;if(!Ps(s.state.date))return je.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"});var r=_r(s.state.date,(a=s.props.yearItemNumber)!==null&&a!==void 0?a:e.defaultProps.yearItemNumber),i=r.startPeriod,c=r.endPeriod,d;return s.props.showYearPicker?d="".concat(i," - ").concat(c):s.props.showMonthYearPicker||s.props.showQuarterYearPicker?d=Jt(s.state.date):d="".concat(Ux(Is(s.state.date),s.props.locale)," ").concat(Jt(s.state.date)),je.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},s.state.isRenderAriaLiveMessage&&d)},s.renderChildren=function(){if(s.props.children)return je.createElement("div",{className:"react-datepicker__children-container"},s.props.children)},s.containerRef=b.createRef(),s.state={date:s.getDateInView(),selectingDate:void 0,monthContainer:void 0,isRenderAriaLiveMessage:!1},s}return Object.defineProperty(e,"defaultProps",{get:function(){return{monthsShown:1,forceShowMonthNavigation:!1,outsideClickIgnoreClass:Y1,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:Pu,monthHeaderPosition:"top"}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){var n=this;this.props.showTimeSelect&&(this.assignMonthContainer=(function(){n.setState({monthContainer:n.monthContainer})})())},e.prototype.componentDidUpdate=function(n){var s=this;if(this.props.preSelection&&Ps(this.props.preSelection)&&(!sn(this.props.preSelection,n.preSelection)||this.props.monthSelectedIn!==n.monthSelectedIn)){var a=!As(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},function(){return a&&s.handleCustomMonthChange(s.state.date)})}else this.props.openToDate&&!sn(this.props.openToDate,n.openToDate)&&this.setState({date:this.props.openToDate})},e.prototype.render=function(){var n=this.props.container||DH;return je.createElement(Lp,{onClickOutside:this.handleClickOutside,style:{display:"contents"},ignoreClass:this.props.outsideClickIgnoreClass},je.createElement("div",{style:{display:"contents"},ref:this.containerRef},je.createElement(n,{className:ns("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showTime:this.props.showTimeSelect||this.props.showTimeInput,showTimeSelectOnly:this.props.showTimeSelectOnly,inline:this.props.inline},this.renderAriaLiveRegion(),this.props.monthHeaderPosition==="top"&&this.renderPreviousButton(),this.props.monthHeaderPosition==="top"&&this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren())))},e})(b.Component),xU=function(t){var e=t.icon,n=t.className,s=n===void 0?"":n,a=t.onClick,r="react-datepicker__calendar-icon";if(typeof e=="string")return je.createElement("i",{className:"".concat(r," ").concat(e," ").concat(s),"aria-hidden":"true",onClick:a});if(je.isValidElement(e)){var i=e;return je.cloneElement(i,{className:"".concat(i.props.className||""," ").concat(r," ").concat(s),onClick:function(c){typeof i.props.onClick=="function"&&i.props.onClick(c),typeof a=="function"&&a(c)}})}return je.createElement("svg",{className:"".concat(r," ").concat(s),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:a},je.createElement("path",{d:"M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"}))},K1=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.portalRoot=null,s.el=document.createElement("div"),s}return e.prototype.componentDidMount=function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)},e.prototype.componentWillUnmount=function(){this.portalRoot&&this.portalRoot.removeChild(this.el)},e.prototype.render=function(){return T2.createPortal(this.props.children,this.el)},e})(b.Component),yU="[tabindex], a, button, input, select, textarea",vU=function(t){return(t instanceof HTMLAnchorElement||!t.disabled)&&t.tabIndex!==-1},Q1=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.getTabChildren=function(){var a;return Array.prototype.slice.call((a=s.tabLoopRef.current)===null||a===void 0?void 0:a.querySelectorAll(yU),1,-1).filter(vU)},s.handleFocusStart=function(){var a=s.getTabChildren();a&&a.length>1&&a[a.length-1].focus()},s.handleFocusEnd=function(){var a=s.getTabChildren();a&&a.length>1&&a[0].focus()},s.tabLoopRef=b.createRef(),s}return e.prototype.render=function(){var n;return((n=this.props.enableTabLoop)!==null&&n!==void 0?n:e.defaultProps.enableTabLoop)?je.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},je.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,je.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},e.defaultProps={enableTabLoop:!0},e})(b.Component);function wU(t){function e(n){var s,a=typeof n.hidePopper=="boolean"?n.hidePopper:!0,r=b.useRef(null),i=MH(qt({open:!a,whileElementsMounted:cH,placement:n.popperPlacement,middleware:Xa([xH({padding:15}),bH(10),yH({element:r})],(s=n.popperModifiers)!==null&&s!==void 0?s:[],!0)},n.popperProps)),c=qt(qt({},n),{hidePopper:a,popperProps:qt(qt({},i),{arrowRef:r})});return je.createElement(t,qt({},c))}return e.displayName="withFloating(".concat(t.displayName||t.name||"Component",")"),e}var kU=function(t){var e=t.className,n=t.wrapperClassName,s=t.hidePopper,a=s===void 0?!0:s,r=t.popperComponent,i=t.targetComponent,c=t.enableTabLoop,d=t.popperOnKeyDown,f=t.portalId,h=t.portalHost,m=t.popperProps,x=t.showArrow,y=t.popperTargetRef,v=t.monthHeaderPosition;b.useEffect(function(){y!=null&&y.current&&m.refs.setPositionReference(y.current)},[y,m.refs]);var S=void 0;if(!a){var A=ns("react-datepicker-popper",!x&&"react-datepicker-popper-offset",v==="middle"&&"react-datepicker-popper--header-middle",v==="bottom"&&"react-datepicker-popper--header-bottom",e);S=je.createElement(Q1,{enableTabLoop:c},je.createElement("div",{ref:m.refs.setFloating,style:m.floatingStyles,className:A,"data-placement":m.placement,onKeyDown:d},r,x&&je.createElement(CH,{ref:m.arrowRef,context:m.context,fill:"currentColor",strokeWidth:1,height:8,width:16,style:{transform:"translateY(-1px)"},className:"react-datepicker__triangle"})))}t.popperContainer&&(S=b.createElement(t.popperContainer,{},S)),f&&!a&&(S=je.createElement(K1,{portalId:f,portalHost:h},S));var k=ns("react-datepicker-wrapper",n);return je.createElement(je.Fragment,null,je.createElement("div",{ref:m.refs.setReference,className:k},i),S)},SU=wU(kU);function sA(t,e){return t&&e?Is(t)!==Is(e)||Jt(t)!==Jt(e):t!==e}var zg="Date input not valid.",CU=(function(t){hs(e,t);function e(n){var s=t.call(this,n)||this;return s.calendar=null,s.input=null,s.getPreSelection=function(){var a=s.props.timeZone,r=s.props.openToDate?s.props.openToDate:s.props.selectsEnd&&s.props.startDate?s.props.startDate:s.props.selectsStart&&s.props.endDate?s.props.endDate:ln();return a?FC(r,a):r},s.modifyHolidays=function(){var a;return(a=s.props.holidays)===null||a===void 0?void 0:a.reduce(function(r,i){var c=Qi(i.date,"yyyy-MM-dd",void 0,!1);return c?Xa(Xa([],r,!0),[qt(qt({},i),{date:c})],!1):r},[])},s.calcInitialState=function(){var a=s.props.timeZone,r=s.getPreSelection(),i=W1(s.props),c=q1(s.props),d=i&&Qa(r,Jc(i))?i:c&&Rr(r,HC(c))?c:r,f=s.props.selectsRange?s.props.startDate:s.props.selected;return f&&a&&(f=FC(f,a)),{open:s.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:f??d,highlightDates:QC(s.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1,wasHidden:!1}},s.getInputValue=function(){var a,r=s.props,i=r.locale,c=r.startDate,d=r.endDate,f=r.rangeSeparator,h=r.selected,m=r.selectedDates,x=r.selectsMultiple,y=r.selectsRange,v=r.formatMultipleDates,S=r.value,A=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,k=s.state.inputValue;if(typeof S=="string")return S;if(typeof k=="string")return k;if(y)return LH(c,d,{dateFormat:A,locale:i,rangeSeparator:f});if(x){if(v){var N=function(j){return Ls(j,{dateFormat:A,locale:i})};return v(m??[],N)}return PH(m??[],{dateFormat:A,locale:i})}return Ls(h,{dateFormat:A,locale:i})},s.resetHiddenStatus=function(){s.setState(qt(qt({},s.state),{wasHidden:!1}))},s.setHiddenStatus=function(){s.setState(qt(qt({},s.state),{wasHidden:!0}))},s.setHiddenStateOnVisibilityHidden=function(){document.visibilityState==="hidden"&&s.setHiddenStatus()},s.clearPreventFocusTimeout=function(){s.preventFocusTimeout&&clearTimeout(s.preventFocusTimeout)},s.setFocus=function(){var a,r;(r=(a=s.input)===null||a===void 0?void 0:a.focus)===null||r===void 0||r.call(a,{preventScroll:!0})},s.setBlur=function(){var a,r;(r=(a=s.input)===null||a===void 0?void 0:a.blur)===null||r===void 0||r.call(a),s.cancelFocusInput()},s.deferBlur=function(){requestAnimationFrame(function(){s.setBlur()})},s.setOpen=function(a,r){r===void 0&&(r=!1),s.setState({open:a,preSelection:a&&s.state.open?s.state.preSelection:s.calcInitialState().preSelection,lastPreSelectChange:$g},function(){a||s.setState(function(i){return{focused:r?i.focused:!1}},function(){!r&&s.deferBlur(),s.setState({inputValue:null})})})},s.inputOk=function(){return Za(s.state.preSelection)},s.isCalendarOpen=function(){return s.props.open===void 0?s.state.open&&!s.props.disabled&&!s.props.readOnly:s.props.open},s.handleFocus=function(a){var r,i,c=s.state.wasHidden,d=c?s.state.open:!0;c&&s.resetHiddenStatus(),s.state.preventFocus||((i=(r=s.props).onFocus)===null||i===void 0||i.call(r,a),d&&!s.props.preventOpenOnFocus&&!s.props.readOnly&&s.setOpen(!0)),s.setState({focused:!0})},s.sendFocusBackToInput=function(){s.preventFocusTimeout&&s.clearPreventFocusTimeout(),s.setState({preventFocus:!0},function(){s.preventFocusTimeout=setTimeout(function(){s.setFocus(),s.setState({preventFocus:!1})})})},s.cancelFocusInput=function(){clearTimeout(s.inputFocusTimeout),s.inputFocusTimeout=void 0},s.deferFocusInput=function(){s.cancelFocusInput(),s.inputFocusTimeout=setTimeout(function(){return s.setFocus()},1)},s.handleDropdownFocus=function(){s.cancelFocusInput()},s.resetInputValue=function(){s.setState(qt(qt({},s.state),{inputValue:null}))},s.handleBlur=function(a){var r,i;(!s.state.open||s.props.withPortal||s.props.showTimeInput)&&((i=(r=s.props).onBlur)===null||i===void 0||i.call(r,a));var c=s.state.inputValue;if(typeof c=="string"&&c.length>0){var d=/[a-zA-Z0-9]/.test(c);!d&&s.props.selected&&s.setSelected(null,void 0,!0)}s.resetInputValue(),s.state.open&&s.props.open===!1&&s.setOpen(!1),s.setState({focused:!1})},s.handleCalendarClickOutside=function(a){var r,i;(i=(r=s.props).onClickOutside)===null||i===void 0||i.call(r,a),!s.props.inline&&!a.defaultPrevented&&s.setOpen(!1),s.props.withPortal&&a.preventDefault()},s.handleChange=function(){for(var a,r,i,c,d,f,h,m,x=[],y=0;y<arguments.length;y++)x[y]=arguments[y];var v=x[0];if(!(s.props.onChangeRaw&&(s.props.onChangeRaw.apply(s,x),!v||typeof v.isDefaultPrevented!="function"||v.isDefaultPrevented()))){s.setState({inputValue:(v==null?void 0:v.target)instanceof HTMLInputElement?v.target.value:null,lastPreSelectChange:AU});var S=s.props,A=S.selectsRange,k=S.startDate,N=S.endDate,j=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,E=(r=s.props.strictParsing)!==null&&r!==void 0?r:e.defaultProps.strictParsing,D=(v==null?void 0:v.target)instanceof HTMLInputElement?v.target.value:"";if(A){var _=s.props.rangeSeparator,B=_.trim(),O=D.split(j.includes(B)?_:B,2).map(function(W){return W.trim()}),T=O[0],M=O[1],R=Qi(T??"",j,s.props.locale,E),F=R?Qi(M??"",j,s.props.locale,E):null,$=((i=no(k))===null||i===void 0?void 0:i.getTime())!==(R==null?void 0:R.getTime()),U=((c=no(N))===null||c===void 0?void 0:c.getTime())!==(F==null?void 0:F.getTime());if(!$&&!U||R&&va(R,s.props)||F&&va(F,s.props))return;R&&s.setState({preSelection:R}),(f=(d=s.props).onChange)===null||f===void 0||f.call(d,[R,F],v)}else{var L=Qi(D,j,s.props.locale,E,(h=s.props.selected)!==null&&h!==void 0?h:void 0);if(L||!D)s.setSelected(L,v,!0);else if(!s.props.inline){var z=OH(D,(m=s.state.preSelection)!==null&&m!==void 0?m:void 0);z&&(!s.props.minDate||!Qa(z,s.props.minDate))&&(!s.props.maxDate||!Rr(z,s.props.maxDate))&&s.setState({preSelection:z})}}}},s.handleSelect=function(a,r,i){var c;if(!s.props.readOnly){var d=s.props,f=d.selectsRange,h=d.startDate,m=d.endDate,x=d.locale,y=d.swapRange,v=(c=s.props.dateFormat)!==null&&c!==void 0?c:e.defaultProps.dateFormat,S=!f||h&&!m&&(y||!Ig(a,h));if(s.props.shouldCloseOnSelect&&!s.props.showTimeSelect&&S&&s.sendFocusBackToInput(),s.props.onChangeRaw){var A=Ls(a,{dateFormat:v,locale:x});s.props.onChangeRaw(r,{date:a,formattedDate:A})}s.setSelected(a,r,!1,i),s.props.showDateSelect&&s.setState({isRenderAriaLiveMessage:!0}),!s.props.shouldCloseOnSelect||s.props.showTimeSelect?s.setPreSelection(a):S&&s.setOpen(!1)}},s.setSelected=function(a,r,i,c){var d,f,h=s.props.timeZone,m=a;if(m&&h&&(m=jr(m,h)),s.props.showYearPicker){if(m!==null&&Ef(Jt(m),s.props))return}else if(s.props.showMonthYearPicker){if(m!==null&&U1(m,s.props))return}else if(m!==null&&va(m,s.props))return;var x=s.props,y=x.onChange,v=x.selectsRange,S=x.startDate,A=x.endDate,k=x.selectsMultiple,N=x.selectedDates,j=x.minTime,E=x.swapRange;if(!so(s.props.selected,m)||s.props.allowSameDay||v||k)if(m!==null&&(s.props.selected&&(!i||!s.props.showTimeSelect&&!s.props.showTimeSelectOnly&&!s.props.showTimeInput)&&(m=Nr(m,{hour:bs(s.props.selected),minute:xs(s.props.selected),second:vi(s.props.selected)})),!i&&(s.props.showTimeSelect||s.props.showTimeSelectOnly)&&j&&(m=Nr(m,{hour:j.getHours(),minute:j.getMinutes(),second:j.getSeconds()})),s.props.inline||s.setState({preSelection:m}),s.props.focusSelectedMonth||s.setState({monthSelectedIn:c})),v){var D=y,_=!S&&!A,B=S&&!A,O=!S&&!!A,T=S&&A;_?D==null||D([m,null],r):B?m===null?D==null||D([null,null],r):Ig(m,S)?E?D==null||D([m,S],r):D==null||D([m,null],r):D==null||D([S,m],r):O&&(m&&Ig(m,A)?D==null||D([m,A],r):D==null||D([m,null],r)),T&&(D==null||D([m,null],r))}else if(k){var M=y;if(m!==null)if(!(N!=null&&N.length))M==null||M([m],r);else{var R=N.some(function($){return sn($,m)});if(R){var F=N.filter(function($){return!sn($,m)});M==null||M(F,r)}else M==null||M(Xa(Xa([],N,!0),[m],!1),r)}}else y==null||y(m,r);i||((f=(d=s.props).onSelect)===null||f===void 0||f.call(d,m,r),s.setState({inputValue:null}))},s.setPreSelection=function(a){if(!s.props.readOnly){var r=Za(s.props.minDate),i=Za(s.props.maxDate),c=!0;if(a){var d=Jc(a);if(r&&i)c=Zi(a,s.props.minDate,s.props.maxDate);else if(r){var f=Jc(s.props.minDate);c=Rr(a,f)||so(d,f)}else if(i){var h=HC(s.props.maxDate);c=Qa(a,h)||so(d,h)}}c&&s.setState({preSelection:a})}},s.toggleCalendar=function(){s.setOpen(!s.state.open)},s.handleTimeChange=function(a,r){var i,c;if(!s.props.selectsMultiple){var d=s.props,f=d.selectsRange,h=d.startDate,m=d.endDate,x=d.onChange,y=d.timeZone;if(f){var v=x;if(r==="start"){if(h){var S=Nr(h,{hour:bs(a),minute:xs(a)});s.setState({preSelection:S}),y&&(S=jr(S,y)),v==null||v([S,m?y?jr(m,y):m:null],void 0)}}else if(r==="end"){if(m){var A=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:A}),y&&(A=jr(A,y)),v==null||v([h?y?jr(h,y):h:null,A],void 0)}}else{var k=h&&!m;if(k){var S=Nr(h,{hour:bs(a),minute:xs(a)});s.setState({preSelection:S}),y&&(S=jr(S,y)),v==null||v([S,null],void 0)}else if(h&&m){var A=Nr(m,{hour:bs(a),minute:xs(a)});s.setState({preSelection:A}),y&&(A=jr(A,y)),v==null||v([y?jr(h,y):h,A],void 0)}else{var N=Nr(s.getPreSelection(),{hour:bs(a),minute:xs(a)});s.setState({preSelection:N})}}}else{var j=s.props.selected?s.props.selected:s.getPreSelection(),N=s.props.selected?a:Nr(j,{hour:bs(a),minute:xs(a)});s.setState({preSelection:N}),N&&y&&(N=jr(N,y)),(c=(i=s.props).onChange)===null||c===void 0||c.call(i,N)}s.props.shouldCloseOnSelect&&!s.props.showTimeInput&&(s.sendFocusBackToInput(),s.setOpen(!1)),s.props.showTimeInput&&s.setOpen(!0),(s.props.showTimeSelectOnly||s.props.showTimeSelect)&&s.setState({isRenderAriaLiveMessage:!0}),s.setState({inputValue:null})}},s.onInputClick=function(){var a,r;!s.props.disabled&&!s.props.readOnly&&s.setOpen(!0),(r=(a=s.props).onInputClick)===null||r===void 0||r.call(a)},s.handleTimeOnlyArrowKey=function(a){var r,i,c,d,f=no(s.props.selected)||s.state.preSelection||ln(),h=(r=s.props.timeIntervals)!==null&&r!==void 0?r:30,m=(i=s.props.dateFormat)!==null&&i!==void 0?i:e.defaultProps.dateFormat,x=Array.isArray(m)?m[0]:m,y=Jc(f),v=bs(f)*60+xs(f),S=1440-h,A;if(a===dt.ArrowUp){var k=Math.max(0,v-h);A=Au(y,k)}else{var k=Math.min(S,v+h);A=Au(y,k)}var N=Mn(A,x||e.defaultProps.dateFormat,s.props.locale);if(s.setState({preSelection:A,inputValue:N}),!(s.props.selectsRange||s.props.selectsMultiple)){var j=s.props.selected?s.props.selected:s.getPreSelection(),E=s.props.selected?A:Nr(j,{hour:bs(A),minute:xs(A)});(d=(c=s.props).onChange)===null||d===void 0||d.call(c,E),(s.props.showTimeSelectOnly||s.props.showTimeSelect)&&s.setState({isRenderAriaLiveMessage:!0}),requestAnimationFrame(function(){s.scrollToTimeOption(A)})}},s.handleTimeOnlyEnterKey=function(a){var r,i,c,d,f=a.target,h=f.value,m=(r=s.props.dateFormat)!==null&&r!==void 0?r:e.defaultProps.dateFormat,x=s.props.timeFormat||"p",y=s.state.preSelection||no(s.props.selected)||ln(),v=Qi(h,m,s.props.locale,(i=s.props.strictParsing)!==null&&i!==void 0?i:!1,y),S=y;if(v&&Ps(v))S=v;else{var A=((c=s.calendar)===null||c===void 0?void 0:c.containerRef.current)instanceof Element&&s.calendar.containerRef.current.querySelector(".react-datepicker__time-list-item[tabindex='0']");if(A instanceof HTMLElement){var k=(d=A.textContent)===null||d===void 0?void 0:d.trim();if(k){var N=Qi(k,x,s.props.locale,!1,y);N&&Ps(N)&&(S=N)}}}s.handleTimeChange(S),s.setOpen(!1),s.sendFocusBackToInput()},s.scrollToTimeOption=function(a){var r,i;if(!((r=s.calendar)===null||r===void 0)&&r.containerRef.current){for(var c=s.calendar.containerRef.current,d=Array.from(c.querySelectorAll(".react-datepicker__time-list-item")),f=null,h=1/0,m=s.props.timeFormat||"p",x=0,y=d;x<y.length;x++){var v=y[x],S=(i=v.textContent)===null||i===void 0?void 0:i.trim();if(S){var A=Qi(S,m,s.props.locale,!1,a);if(A&&Ps(A)){if(V1(A,a)){f=v;break}var k=Math.abs(A.getTime()-a.getTime());k<h&&(h=k,f=v)}}}f&&(d.forEach(function(N){N.setAttribute("tabindex","-1")}),f.setAttribute("tabindex","0"),f.scrollIntoView({behavior:"smooth",block:"center"}))}},s.onInputKeyDown=function(a){var r,i,c,d,f,h;(i=(r=s.props).onKeyDown)===null||i===void 0||i.call(r,a);var m=a.key;if(!s.state.open&&!s.props.inline&&!s.props.preventOpenOnFocus){(m===dt.ArrowDown||m===dt.ArrowUp||m===dt.Enter)&&((c=s.onInputClick)===null||c===void 0||c.call(s));return}if(s.state.open&&s.props.showTimeSelectOnly){if(m===dt.ArrowDown||m===dt.ArrowUp){a.preventDefault(),s.handleTimeOnlyArrowKey(m);return}if(m===dt.Enter){a.preventDefault(),s.handleTimeOnlyEnterKey(a);return}}if(s.state.open){if(m===dt.ArrowDown||m===dt.ArrowUp){a.preventDefault();var x=s.props.showTimeSelectOnly?".react-datepicker__time-list-item[tabindex='0']":s.props.showWeekPicker&&s.props.showWeekNumbers?'.react-datepicker__week-number[tabindex="0"]':s.props.showFullMonthYearPicker||s.props.showMonthYearPicker?'.react-datepicker__month-text[tabindex="0"]':'.react-datepicker__day[tabindex="0"]',y=((d=s.calendar)===null||d===void 0?void 0:d.containerRef.current)instanceof Element&&s.calendar.containerRef.current.querySelector(x);y instanceof HTMLElement&&y.focus({preventScroll:!0});return}var v=ln(s.state.preSelection);m===dt.Enter?(a.preventDefault(),a.target.blur(),s.inputOk()&&s.state.lastPreSelectChange===$g?(s.handleSelect(v,a),!s.props.shouldCloseOnSelect&&s.setPreSelection(v)):s.setOpen(!1)):m===dt.Escape?(a.preventDefault(),a.target.blur(),s.sendFocusBackToInput(),s.setOpen(!1)):m===dt.Tab&&s.setOpen(!1),s.inputOk()||(h=(f=s.props).onInputError)===null||h===void 0||h.call(f,{code:1,msg:zg})}},s.onPortalKeyDown=function(a){var r=a.key;r===dt.Escape&&(a.preventDefault(),s.setState({preventFocus:!0},function(){s.setOpen(!1),setTimeout(function(){s.setFocus(),s.setState({preventFocus:!1})})}))},s.onDayKeyDown=function(a){var r,i,c,d,f,h,m=s.props,x=m.minDate,y=m.maxDate,v=m.disabledKeyboardNavigation,S=m.showWeekPicker,A=m.shouldCloseOnSelect,k=m.locale,N=m.calendarStartDay,j=m.adjustDateOnChange,E=m.inline;if((i=(r=s.props).onKeyDown)===null||i===void 0||i.call(r,a),!v){var D=a.key,_=a.shiftKey,B=ln(s.state.preSelection),O=function(R,F){var $=F;switch(R){case dt.ArrowRight:$=S?Xf(F,1):Ra(F,1);break;case dt.ArrowLeft:$=S?jC(F):s$(F);break;case dt.ArrowUp:$=jC(F);break;case dt.ArrowDown:$=Xf(F,1);break;case dt.PageUp:$=_?Si(F,1):ao(F,1);break;case dt.PageDown:$=_?Oa(F,1):La(F,1);break;case dt.Home:$=wi(F,k,N);break;case dt.End:$=FH(F);break}return $},T=function(R,F){for(var $=40,U=R,L=!1,z=0,W=O(R,F);!L;){if(z>=$){W=F;break}x&&W<x&&(U=dt.ArrowRight,W=va(x,s.props)?O(U,W):x),y&&W>y&&(U=dt.ArrowLeft,W=va(y,s.props)?O(U,W):y),va(W,s.props)?((U===dt.PageUp||U===dt.Home)&&(U=dt.ArrowRight),(U===dt.PageDown||U===dt.End)&&(U=dt.ArrowLeft),W=O(U,W)):L=!0,z++}return W};if(D===dt.Enter){a.preventDefault(),s.handleSelect(B,a),!A&&s.setPreSelection(B);return}else if(D===dt.Escape){a.preventDefault(),s.setOpen(!1),s.inputOk()||(d=(c=s.props).onInputError)===null||d===void 0||d.call(c,{code:1,msg:zg});return}var M=null;switch(D){case dt.ArrowLeft:case dt.ArrowRight:case dt.ArrowUp:case dt.ArrowDown:case dt.PageUp:case dt.PageDown:case dt.Home:case dt.End:M=T(D,B);break}if(!M){(h=(f=s.props).onInputError)===null||h===void 0||h.call(f,{code:1,msg:zg});return}a.preventDefault(),s.setState({lastPreSelectChange:$g}),j&&s.setSelected(M),s.setPreSelection(M),E&&s.setState({shouldFocusDayInline:!0})}},s.onPopperKeyDown=function(a){var r=a.key;r===dt.Escape&&(a.preventDefault(),s.sendFocusBackToInput(),s.setOpen(!1))},s.onClearClick=function(a){a&&a.preventDefault&&a.preventDefault(),s.sendFocusBackToInput();var r=s.props,i=r.selectsRange,c=r.onChange;i?c==null||c([null,null],a):c==null||c(null,a),s.setState({inputValue:null})},s.clear=function(){s.onClearClick()},s.onScroll=function(a){typeof s.props.closeOnScroll=="boolean"&&s.props.closeOnScroll?(a.target===document||a.target===document.documentElement||a.target===document.body)&&s.setOpen(!1):typeof s.props.closeOnScroll=="function"&&s.props.closeOnScroll(a)&&s.setOpen(!1)},s.handleMonthSelectedInChange=function(a){s.setState({monthSelectedIn:a})},s.renderCalendar=function(){var a,r;return!s.props.inline&&!s.isCalendarOpen()?null:je.createElement(bU,qt({showMonthYearDropdown:void 0,ref:function(i){s.calendar=i}},s.props,s.state,{setOpen:s.setOpen,dateFormat:(a=s.props.dateFormatCalendar)!==null&&a!==void 0?a:e.defaultProps.dateFormatCalendar,onSelect:s.handleSelect,onClickOutside:s.handleCalendarClickOutside,holidays:XH(s.modifyHolidays()),outsideClickIgnoreClass:s.props.outsideClickIgnoreClass,onDropdownFocus:s.handleDropdownFocus,onTimeChange:s.handleTimeChange,className:s.props.calendarClassName,container:s.props.calendarContainer,handleOnKeyDown:s.props.onKeyDown,handleOnDayKeyDown:s.onDayKeyDown,setPreSelection:s.setPreSelection,dropdownMode:(r=s.props.dropdownMode)!==null&&r!==void 0?r:e.defaultProps.dropdownMode,onMonthSelectedInChange:s.handleMonthSelectedInChange}),s.props.children)},s.renderAriaLiveRegion=function(){var a,r=s.props.locale,i=(a=s.props.dateFormat)!==null&&a!==void 0?a:e.defaultProps.dateFormat,c=s.props.showTimeInput||s.props.showTimeSelect,d=c?"PPPPp":"PPPP",f;return s.props.selectsRange?f="Selected start date: ".concat(Ls(s.props.startDate,{dateFormat:d,locale:r}),". ").concat(s.props.endDate?"End date: "+Ls(s.props.endDate,{dateFormat:d,locale:r}):""):s.props.showTimeSelectOnly?f="Selected time: ".concat(Ls(s.props.selected,{dateFormat:i,locale:r})):s.props.showYearPicker?f="Selected year: ".concat(Ls(s.props.selected,{dateFormat:"yyyy",locale:r})):s.props.showMonthYearPicker?f="Selected month: ".concat(Ls(s.props.selected,{dateFormat:"MMMM yyyy",locale:r})):s.props.showQuarterYearPicker?f="Selected quarter: ".concat(Ls(s.props.selected,{dateFormat:"yyyy, QQQ",locale:r})):f="Selected date: ".concat(Ls(s.props.selected,{dateFormat:d,locale:r})),je.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},f)},s.renderDateInput=function(){var a,r,i,c,d,f,h,m=ns(s.props.className,(a={},a[s.props.outsideClickIgnoreClass||e.defaultProps.outsideClickIgnoreClass]=s.state.open,a)),x=s.props.customInput||je.createElement("input",{type:"text"}),y=s.props.customInputRef||"ref",v={},S=(i=s.props["aria-describedby"])!==null&&i!==void 0?i:s.props.ariaDescribedBy,A=(c=s.props["aria-invalid"])!==null&&c!==void 0?c:s.props.ariaInvalid,k=(d=s.props["aria-label"])!==null&&d!==void 0?d:s.props.ariaLabel,N=(f=s.props["aria-labelledby"])!==null&&f!==void 0?f:s.props.ariaLabelledBy,j=(h=s.props["aria-required"])!==null&&h!==void 0?h:s.props.ariaRequired;return S!=null&&(v["aria-describedby"]=S),A!=null&&(v["aria-invalid"]=A),k!=null&&(v["aria-label"]=k),N!=null&&(v["aria-labelledby"]=N),j!=null&&(v["aria-required"]=j),b.cloneElement(x,qt((r={},r[y]=function(E){s.input=E},r.value=s.getInputValue(),r.onBlur=s.handleBlur,r.onChange=s.handleChange,r.onClick=s.onInputClick,r.onFocus=s.handleFocus,r.onKeyDown=s.onInputKeyDown,r.id=s.props.id,r.name=s.props.name,r.form=s.props.form,r.autoFocus=s.props.autoFocus,r.placeholder=s.props.placeholderText,r.disabled=s.props.disabled,r.autoComplete=s.props.autoComplete,r.className=ns(x.props.className,m),r.title=s.props.title,r.readOnly=s.props.readOnly,r.required=s.props.required,r.tabIndex=s.props.tabIndex,r),v))},s.renderClearButton=function(){var a=s.props,r=a.isClearable,i=a.disabled,c=a.selected,d=a.startDate,f=a.endDate,h=a.clearButtonTitle,m=a.clearButtonClassName,x=m===void 0?"":m,y=a.ariaLabelClose,v=y===void 0?"Close":y,S=a.selectedDates,A=a.readOnly;return r&&!A&&(c!=null||d!=null||f!=null||S!=null&&S.length)?je.createElement("button",{type:"button",className:ns("react-datepicker__close-icon",x,{"react-datepicker__close-icon--disabled":i}),disabled:i,"aria-label":v,onClick:s.onClearClick,title:h,tabIndex:-1}):null},s.state=s.calcInitialState(),s.preventFocusTimeout=void 0,s}return Object.defineProperty(e,"defaultProps",{get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",preventOpenOnFocus:!1,monthsShown:1,outsideClickIgnoreClass:Y1,readOnly:!1,rangeSeparator:$1,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,showWeekPicker:!1,strictParsing:!1,swapRange:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:Pu,focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0,toggleCalendarOnIconClick:!1,usePointerEvent:!1}},enumerable:!1,configurable:!0}),e.prototype.componentDidMount=function(){window.addEventListener("scroll",this.onScroll,!0),document.addEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},e.prototype.componentDidUpdate=function(n,s){var a,r,i,c;this.props.selectsRange&&sA(n.startDate,this.props.startDate)?this.setPreSelection(this.props.startDate):sA(n.selected,this.props.selected)&&this.setPreSelection(this.props.selected),this.state.monthSelectedIn!==void 0&&n.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),this.props.selectsRange&&s.open===!1&&this.state.open===!0&&this.state.monthSelectedIn!==0&&this.setState({monthSelectedIn:0}),n.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:QC(this.props.highlightDates)}),!s.focused&&!so(n.selected,this.props.selected)&&this.setState({inputValue:null}),s.open!==this.state.open&&(s.open===!1&&this.state.open===!0&&((r=(a=this.props).onCalendarOpen)===null||r===void 0||r.call(a)),s.open===!0&&this.state.open===!1&&((c=(i=this.props).onCalendarClose)===null||c===void 0||c.call(i)))},e.prototype.componentWillUnmount=function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0),document.removeEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},e.prototype.renderInputContainer=function(){var n=this.props,s=n.showIcon,a=n.icon,r=n.calendarIconClassname,i=n.calendarIconClassName,c=n.toggleCalendarOnIconClick,d=this.state.open;return r&&console.warn("calendarIconClassname props is deprecated. should use calendarIconClassName props."),je.createElement("div",{className:"react-datepicker__input-container".concat(s?" react-datepicker__view-calendar-icon":"")},s&&je.createElement(xU,qt({icon:a,className:ns(i,!i&&r,d&&"react-datepicker-ignore-onclickoutside")},c?{onClick:this.toggleCalendar}:null)),this.state.isRenderAriaLiveMessage&&this.renderAriaLiveRegion(),this.renderDateInput(),this.renderClearButton())},e.prototype.render=function(){var n=this.renderCalendar();if(this.props.inline)return n;if(this.props.withPortal){var s=this.state.open?je.createElement(Q1,{enableTabLoop:this.props.enableTabLoop},je.createElement("div",{className:"react-datepicker__portal",tabIndex:-1,onKeyDown:this.onPortalKeyDown},n)):null;return this.state.open&&this.props.portalId&&(s=je.createElement(K1,qt({portalId:this.props.portalId},this.props),s)),je.createElement(je.Fragment,null,this.renderInputContainer(),s)}return je.createElement(SU,qt({},this.props,{className:this.props.popperClassName,hidePopper:!this.isCalendarOpen(),targetComponent:this.renderInputContainer(),popperComponent:n,popperOnKeyDown:this.onPopperKeyDown,showArrow:this.props.showPopperArrow,monthHeaderPosition:this.props.monthHeaderPosition}))},e})(b.Component),AU="input",$g="navigate";const jU=[25,50,100,250,500,1e3],NU=250,Yc=t=>String(t).padStart(2,"0"),gf=t=>t?/(datetime|timestamp|timestamptz|datetime2|smalldatetime)/i.test(t):!1,aA=t=>`${t.getFullYear()}-${Yc(t.getMonth()+1)}-${Yc(t.getDate())} ${Yc(t.getHours())}:${Yc(t.getMinutes())}:${Yc(t.getSeconds())}`,rA=t=>{if(t==null)return null;if(t instanceof Date)return t;const e=String(t).trim();if(!e)return null;if(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}(:\d{2})?(\.\d+)?$/.test(e)){const s=e.replace(" ","T"),a=new Date(s);return Number.isNaN(a.getTime())?null:a}if(/^\d{4}-\d{2}-\d{2}T/.test(e)){const s=new Date(e.replace(/Z$/,""));return Number.isNaN(s.getTime())?null:s}const n=new Date(e);return Number.isNaN(n.getTime())?null:n},TU=t=>t===null?"NULL":t===void 0?"undefined":typeof t=="object"?JSON.stringify(t,null,2):String(t),_U=t=>t==null?"":typeof t=="object"?JSON.stringify(t):String(t),EU=t=>{const e=t.match(/FROM\s+(?:`?[\w]+`?\.)?`?([\w]+)`?(?:\s+(?:AS\s+)?\w+)?(?=\s|;|$)/i);return e!=null&&e[1]?e[1]:null},Hg=t=>!t||!t.columns?[]:t.columns.filter(e=>e.primaryKey).map(e=>e.name),MU=(t,e,n,s,a,r,i=!0)=>{const c=x=>t==="mysql"?`\`${x}\``:t==="postgres"?`"${x}"`:x,d=x=>x===null?"NULL":typeof x=="boolean"?x?"1":"0":typeof x=="number"?String(x):typeof x=="object"?`'${JSON.stringify(x).replace(/'/g,"''")}'`:`'${String(x).replace(/'/g,"''")}'`,f=`${c(n)} = ${d(r)}`,h=[];for(const[x,y]of Object.entries(s))h.push(`${c(x)} = ${d(y)}`);i&&(a===null?h.push(`${c(n)} IS NULL`):typeof a=="object"||h.push(`${c(n)} = ${d(a)}`));const m=h.join(" AND ");return`UPDATE ${c(e)} SET ${f} WHERE ${m}`},DU=({result:t,buildingId:e,building:n})=>{var ae,Se;const{t:s}=ht(["terminal"]),a=px(e),[r,i]=b.useState(0),[c,d]=b.useState(NU),[f,h]=b.useState(null),[m,x]=b.useState("asc"),[y,v]=b.useState(null),[S,A]=b.useState(!1),[k,N]=b.useState({}),[j,E]=b.useState(null),[D,_]=b.useState(null),[B,O]=b.useState(null),[T,M]=b.useState(!1),[R,F]=b.useState(null),[$,U]=b.useState(null),[L,z]=b.useState(new Map),[W,V]=b.useState(null),[Y,P]=b.useState(null),K=b.useRef(null),Q=b.useRef(null),q=b.useRef(null),be=b.useRef(!1),ue=t.status==="error",Z=!t.rows||t.rows.length===0;b.useEffect(()=>{var ge,Re;const ee=EU(t.query||"");if(_(ee),M(!1),O(null),z(new Map),ee&&a.activeConnectionId&&a.activeDatabase){const Fe=`${a.activeConnectionId}:${a.activeDatabase}:${ee}`,oe=(Re=(ge=a.tableSchemas)==null?void 0:ge.get)==null?void 0:Re.call(ge,Fe);if(oe){O(oe);const Le=Hg(oe);M(Le.length>0)}else H.getTableSchema(e,a.activeConnectionId,a.activeDatabase,ee)}},[t.query,t.rows,e,a.activeConnectionId,a.activeDatabase]),b.useEffect(()=>{var ee,ge;if(D&&a.activeConnectionId&&a.activeDatabase){const Re=`${a.activeConnectionId}:${a.activeDatabase}:${D}`,Fe=(ge=(ee=a.tableSchemas)==null?void 0:ee.get)==null?void 0:ge.call(ee,Re);if(Fe){O(Le=>Le===Fe?Le:Fe);const oe=Hg(Fe);M(oe.length>0)}}},[a.tableSchemas,D,a.activeConnectionId,a.activeDatabase]);const de=b.useMemo(()=>!f||!t.rows?t.rows:[...t.rows].sort((ee,ge)=>{const Re=ee[f],Fe=ge[f];if(Re===null&&Fe===null)return 0;if(Re===null)return m==="asc"?-1:1;if(Fe===null)return m==="asc"?1:-1;if(typeof Re=="number"&&typeof Fe=="number")return m==="asc"?Re-Fe:Fe-Re;const oe=String(Re),Le=String(Fe);return m==="asc"?oe.localeCompare(Le):Le.localeCompare(oe)}),[t.rows,f,m]),Ce=b.useMemo(()=>{if(!de)return[];const ee=r*c;return de.slice(ee,ee+c)},[de,r,c]),xe=Math.ceil(((de==null?void 0:de.length)??0)/c),Ne=((ae=t.fields)==null?void 0:ae.map(ee=>ee.name))??Object.keys(((Se=t.rows)==null?void 0:Se[0])||{}),qe=b.useMemo(()=>{const ee=new Map;return(t.fields??[]).forEach(ge=>{ge!=null&&ge.name&&ee.set(ge.name,String(ge.type??""))}),ee},[t.fields]),Ge=b.useMemo(()=>Hg(B),[B]),X=b.useCallback((ee,ge)=>{const Re=qe.get(ee);if(gf(Re)){const Fe=rA(ge);return Fe?aA(Fe):""}return _U(ge)},[qe]),se=b.useMemo(()=>T?"Editable":!a.activeConnectionId||!a.activeDatabase?"Read-only: no active connection or database":D?B?Ge.length===0?"Read-only: table has no primary key":"Read-only: editing unavailable":"Read-only: loading table schema":"Read-only: query is not a single-table SELECT",[T,a.activeConnectionId,a.activeDatabase,D,B,Ge.length]),Ee=b.useCallback(ee=>{if(be.current){be.current=!1;return}f===ee?x(ge=>ge==="asc"?"desc":"asc"):(h(ee),x("asc"))},[f]),Ve=b.useCallback((ee,ge,Re,Fe)=>{!T||j||Y||E({rowIndex:Re,rowKey:Fe,columnName:ee,originalValue:ge,currentValue:X(ee,ge),isUpdating:!1})},[T,j,Y,X]),at=b.useCallback((ee,ge)=>{v({column:ee,value:ge})},[]),we=b.useCallback(ee=>{var Tt,he;if(!D||!B||!a.activeConnectionId||!a.activeDatabase)return;const{rowIndex:ge,columnName:Re,originalValue:Fe,currentValue:oe}=ee,Le=String(oe??"");if(oe!==null&&Le===X(Re,Fe)){E(null);return}const te=r*c+ge,pe=de==null?void 0:de[te];if(!pe)return;const ke=Ge;if(ke.length===0){E(_e=>_e?{..._e,error:"No primary key found"}:null);return}const Be={};for(const _e of ke)Be[_e]=pe[_e];let Ke=Le;const ze=qe.get(Re);if(oe===null)Ke=null;else if(gf(ze))Ke=Le.trim()===""?null:Le.trim();else if(typeof Fe=="number")if(Le.trim()==="")Ke=null;else{const _e=Number(Le);if(Number.isNaN(_e)){E(We=>We?{...We,isUpdating:!1,error:"Invalid number value"}:null);return}Ke=_e}else if(typeof Fe=="boolean"){const _e=Le.trim().toLowerCase();if(_e==="true"||_e==="1")Ke=!0;else if(_e==="false"||_e==="0")Ke=!1;else{E(We=>We?{...We,isUpdating:!1,error:"Invalid boolean value"}:null);return}}else if(Fe!==null&&typeof Fe=="object")try{Ke=JSON.parse(Le)}catch{E(_e=>_e?{..._e,isUpdating:!1,error:"Invalid JSON value"}:null);return}E(_e=>_e?{..._e,isUpdating:!0}:null);const Ze=(Tt=n.database)==null?void 0:Tt.connections.find(_e=>_e.id===a.activeConnectionId),lt=(Ze==null?void 0:Ze.engine)||"mysql",et=MU(lt,D,Re,Be,Fe,Ke,!gf(ze));U(et);const ct=JSON.stringify(Be),st=((he=t.query)==null?void 0:he.trim())||"",bt=`${Date.now()}-${Math.random().toString(36).slice(2,10)}`;P({requestId:bt,query:et,rowKey:ct,columnName:Re,parsedValue:Ke,startedAt:Date.now(),originalQuery:st}),H.executeSilentQuery(e,a.activeConnectionId,a.activeDatabase,et,bt)},[D,B,r,c,de,Ge,e,a.activeConnectionId,a.activeDatabase,t.query,X,qe]);b.useEffect(()=>{const ee=a.lastSilentQueryResult;if(!(!Y||!ee)&&!(ee.requestId&&ee.requestId!==Y.requestId)&&!(ee.timestamp<Y.startedAt)){if(!ee.success){F({message:ee.error||"Update failed on backend",type:"error"}),setTimeout(()=>F(null),5e3),E(ge=>ge&&{...ge,isUpdating:!1,error:ee.error||"Update failed on backend"}),P(null);return}if(ee.affectedRows===0){F({message:"No rows were updated",type:"error"}),setTimeout(()=>F(null),5e3),E(ge=>ge&&{...ge,isUpdating:!1,error:"No rows were updated"}),P(null);return}z(ge=>{const Re=new Map(ge),Fe=Re.get(Y.rowKey)||{};return Fe[Y.columnName]=Y.parsedValue,Re.set(Y.rowKey,Fe),Re}),E(null),F({message:"Row updated successfully",type:"success"}),setTimeout(()=>F(null),3e3),Y.originalQuery&&a.activeConnectionId&&a.activeDatabase&&setTimeout(()=>{H.executeQuery(e,a.activeConnectionId,a.activeDatabase,Y.originalQuery)},200),P(null)}},[Y,a.lastSilentQueryResult,a.activeConnectionId,a.activeDatabase,e]),b.useEffect(()=>{if(!Y)return;const ee=window.setTimeout(()=>{F({message:"Update timed out waiting for backend",type:"error"}),setTimeout(()=>F(null),5e3),E(ge=>ge&&{...ge,isUpdating:!1,error:"Update timed out waiting for backend"}),P(null)},1e4);return()=>window.clearTimeout(ee)},[Y]);const $e=b.useCallback(()=>{j&&we(j)},[j,we]),ie=b.useCallback((ee,ge,Re,Fe,oe)=>{ee.preventDefault(),ee.stopPropagation(),V({position:{x:ee.clientX,y:ee.clientY},rowIndex:Fe,rowKey:oe,columnName:ge,value:Re})},[j,D,B,r,c,de,Ge,e,a.activeConnectionId,a.activeDatabase]),fe=b.useMemo(()=>{if(!W)return[];const ee=!T||!!j||!!Y||!D||!B||!a.activeConnectionId||!a.activeDatabase;return[{id:"editability",label:T?"Cell actions":se,icon:T?"▣":"ℹ",disabled:!0,onClick:()=>{}},{id:"divider-1",label:"",divider:!0,onClick:()=>{}},{id:"edit-cell",label:"Edit Cell",icon:"✏️",disabled:ee,onClick:()=>{E({rowIndex:W.rowIndex,rowKey:W.rowKey,columnName:W.columnName,originalValue:W.value,currentValue:X(W.columnName,W.value),isUpdating:!1})}},{id:"set-null",label:"Set NULL",icon:"∅",disabled:ee||W.value===null,onClick:()=>{we({rowIndex:W.rowIndex,rowKey:W.rowKey,columnName:W.columnName,originalValue:W.value,currentValue:null,isUpdating:!1})}}]},[W,T,j,Y,D,B,a.activeConnectionId,a.activeDatabase,se,we,X]),Ue=b.useCallback(ee=>{ee.key==="Enter"?(ee.preventDefault(),$e()):ee.key==="Escape"&&(ee.preventDefault(),ee.stopPropagation(),E(null))},[$e]),it=b.useCallback((ee,ge)=>{ee.preventDefault(),ee.stopPropagation();const Re=ee.target.closest("th");if(!Re)return;const Fe=Re.getBoundingClientRect().width;q.current={column:ge,startX:ee.clientX,startWidth:Fe};const oe=te=>{if(!q.current)return;const pe=te.clientX-q.current.startX,ke=Math.max(50,q.current.startWidth+pe);N(Be=>({...Be,[q.current.column]:ke}))},Le=()=>{q.current=null,be.current=!0,document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",Le),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",oe),document.addEventListener("mouseup",Le),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]);b.useEffect(()=>{if(!y)return;const ee=Re=>{Re.key==="Escape"&&(Re.stopPropagation(),v(null))},ge=Re=>{K.current&&!K.current.contains(Re.target)&&v(null)};return document.addEventListener("keydown",ee),document.addEventListener("mousedown",ge),()=>{document.removeEventListener("keydown",ee),document.removeEventListener("mousedown",ge)}},[y]);const ot=j?`${j.rowKey}:${j.columnName}`:null;b.useEffect(()=>{Q.current&&ot&&(Q.current.focus(),Q.current.select())},[ot]);const ce=b.useCallback(async()=>{var oe;if(!t.rows||t.rows.length===0)return;const ee=((oe=t.fields)==null?void 0:oe.map(Le=>Le.name))??Object.keys(t.rows[0]||{}),ge=de??t.rows,Re=["<table><thead><tr>"];ee.forEach(Le=>Re.push(`<th>${Le}</th>`)),Re.push("</tr></thead><tbody>"),ge.forEach(Le=>{Re.push("<tr>"),ee.forEach(te=>{const pe=Le[te];Re.push(`<td>${pe===null?"NULL":typeof pe=="object"?JSON.stringify(pe):String(pe)}</td>`)}),Re.push("</tr>")}),Re.push("</tbody></table>");const Fe=[ee.join(" ")];ge.forEach(Le=>{Fe.push(ee.map(te=>{const pe=Le[te];return pe===null?"NULL":typeof pe=="object"?JSON.stringify(pe):String(pe)}).join(" "))});try{const Le=new Blob([Re.join("")],{type:"text/html"}),te=new Blob([Fe.join(`
|
|
110
|
+
`)],{type:"text/plain"});await navigator.clipboard.write([new ClipboardItem({"text/html":Le,"text/plain":te})]),A(!0),setTimeout(()=>A(!1),2e3)}catch{await navigator.clipboard.writeText(Fe.join(`
|
|
111
|
+
`)),A(!0),setTimeout(()=>A(!1),2e3)}},[t,de]),J=ee=>{if(ee===null)return o.jsx("span",{className:"results-table__null",children:"NULL"});if(ee===void 0)return o.jsx("span",{className:"results-table__null",children:"undefined"});if(typeof ee=="boolean")return o.jsx("span",{className:`results-table__bool results-table__bool--${ee}`,children:String(ee)});if(typeof ee=="number")return o.jsx("span",{className:"results-table__number",children:ee.toLocaleString()});if(ee instanceof Date)return o.jsx("span",{className:"results-table__date",children:ee.toISOString()});if(typeof ee=="object")return o.jsx("span",{className:"results-table__json",title:JSON.stringify(ee,null,2),children:JSON.stringify(ee)});const ge=String(ee);return ge.length>100?o.jsxs("span",{className:"results-table__long",title:ge,children:[ge.substring(0,100),"..."]}):ge};return ue?o.jsx("div",{className:"results-table results-table--error",children:o.jsxs("div",{className:"results-table__error",children:[o.jsxs("div",{className:"results-table__error-header",children:[o.jsx("span",{className:"results-table__error-icon",children:"✗"}),s("terminal:database.queryError")]}),o.jsx("div",{className:"results-table__error-message",children:t.error}),t.errorCode&&o.jsx("div",{className:"results-table__error-code",children:s("terminal:database.errorCode",{code:t.errorCode})}),o.jsx("div",{className:"results-table__error-query",children:o.jsx("code",{children:t.query})})]})}):Z?o.jsx("div",{className:"results-table results-table--success",children:o.jsxs("div",{className:"results-table__success",children:[o.jsx("span",{className:"results-table__success-icon",children:"✓"}),s("terminal:database.querySuccess"),t.affectedRows!==void 0&&o.jsx("span",{className:"results-table__affected",children:s("terminal:database.rowsAffected",{count:t.affectedRows})}),o.jsxs("span",{className:"results-table__duration",children:[t.duration,"ms"]})]})}):o.jsxs("div",{className:"results-table",children:[o.jsxs("div",{className:"results-table__status-bar",children:[o.jsxs("div",{className:"results-table__status-info",children:[o.jsx("span",{className:"results-table__row-count",children:s("terminal:database.rowCount",{count:t.rowCount})}),o.jsxs("span",{className:"results-table__duration",children:[t.duration,"ms"]}),o.jsx("span",{className:`results-table__edit-status ${T?"results-table__edit-status--editable":"results-table__edit-status--readonly"}`,title:se,children:se}),o.jsx("button",{className:`results-table__copy-btn ${S?"results-table__copy-btn--success":""}`,onClick:ce,title:s("terminal:database.copyAllResults"),children:s(S?"terminal:database.copied":"terminal:database.copyAll")})]}),o.jsxs("div",{className:"results-table__pagination",children:[o.jsx("select",{className:"results-table__page-size",value:c,onChange:ee=>{d(Number(ee.target.value)),i(0)},children:jU.map(ee=>o.jsx("option",{value:ee,children:s("terminal:database.rowsPerPage",{count:ee})},ee))}),o.jsx("button",{className:"results-table__page-btn",disabled:r===0,onClick:()=>i(0),title:s("terminal:database.firstPage"),children:"«"}),o.jsx("button",{className:"results-table__page-btn",disabled:r===0,onClick:()=>i(ee=>ee-1),title:s("terminal:database.previousPage"),children:"‹"}),o.jsx("span",{className:"results-table__page-info",children:s("terminal:database.pageInfo",{current:r+1,total:xe})}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=xe-1,onClick:()=>i(ee=>ee+1),title:s("terminal:database.nextPage"),children:"›"}),o.jsx("button",{className:"results-table__page-btn",disabled:r>=xe-1,onClick:()=>i(xe-1),title:s("terminal:database.lastPage"),children:"»"})]})]}),o.jsx("div",{className:"results-table__wrapper",children:o.jsxs("table",{className:`results-table__table ${Object.keys(k).length>0?"results-table__table--resized":""}`,children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"results-table__row-num",children:"#"}),Ne.map(ee=>{var Fe;const ge=(Fe=t.fields)==null?void 0:Fe.find(oe=>oe.name===ee),Re=f===ee;return o.jsxs("th",{className:`results-table__header ${Re?"results-table__header--sorted":""}`,onClick:()=>Ee(ee),title:ge!=null&&ge.type?`Type: ${ge.type}`:void 0,style:k[ee]?{width:k[ee],minWidth:k[ee],maxWidth:k[ee]}:void 0,children:[o.jsx("span",{className:"results-table__header-name",children:ee}),Re&&o.jsx("span",{className:"results-table__sort-indicator",children:m==="asc"?"▲":"▼"}),o.jsx("span",{className:"results-table__resize-handle",onMouseDown:oe=>it(oe,ee)})]},ee)})]})}),o.jsx("tbody",{children:Ce.map((ee,ge)=>o.jsxs("tr",{className:"results-table__row",children:[o.jsx("td",{className:"results-table__row-num",children:r*c+ge+1}),Ne.map(Re=>{const Fe=JSON.stringify(Object.fromEntries(Ge.map(pe=>[pe,ee[pe]]))),oe=(j==null?void 0:j.rowKey)===Fe&&(j==null?void 0:j.columnName)===Re,Le=L.get(Fe),te=Le?Le[Re]:ee[Re];return o.jsx("td",{className:`results-table__cell ${oe?"results-table__cell--editing":""} ${T?"results-table__cell--editable":""} ${Le&&Le[Re]!==ee[Re]?"results-table__cell--updated":""}`,onClick:()=>Ve(Re,te,ge,Fe),onDoubleClick:()=>at(Re,te),onContextMenu:pe=>ie(pe,Re,te,ge,Fe),children:oe?o.jsxs("div",{className:"results-table__cell-input-wrapper",children:[gf(qe.get(j.columnName))?o.jsx(CU,{selected:rA(j.currentValue),onChange:pe=>{const ke=Array.isArray(pe)?pe[0]:pe;E(Be=>Be?{...Be,currentValue:ke?aA(ke):""}:null)},onCalendarClose:$e,showTimeSelect:!0,showTimeInput:!0,timeIntervals:1,timeFormat:"HH:mm:ss",dateFormat:"yyyy-MM-dd HH:mm:ss",className:"results-table__cell-input results-table__cell-input--datetime",disabled:j.isUpdating,placeholderText:"Select date and time",autoFocus:!0}):o.jsx("input",{ref:Q,type:"text",className:"results-table__cell-input",value:String(j.currentValue??""),onChange:pe=>E(ke=>ke?{...ke,currentValue:pe.target.value}:null),onBlur:$e,onKeyDown:Ue,disabled:j.isUpdating,autoFocus:!0}),j.isUpdating&&o.jsx("span",{className:"results-table__cell-feedback results-table__cell-feedback--loading",children:"⏳"}),j.error&&o.jsx("button",{type:"button",className:"results-table__cell-feedback results-table__cell-feedback--error results-table__cell-feedback-btn",title:`${j.error}. Click to cancel editing.`,onMouseDown:pe=>{pe.preventDefault(),pe.stopPropagation()},onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),E(null)},children:"✕"})]}):J(te)},Re)})]},ge))})]})}),y&&o.jsx("div",{className:"results-table__detail-backdrop",children:o.jsxs("div",{className:"results-table__detail",ref:K,children:[o.jsxs("div",{className:"results-table__detail-header",children:[o.jsx("span",{className:"results-table__detail-column",children:y.column}),o.jsxs("div",{className:"results-table__detail-actions",children:[T&&o.jsx("button",{className:"results-table__detail-edit-btn",onClick:()=>{v(null);const ee=Ce.find(ge=>Ne.some(Re=>ge[Re]===y.value&&Re===y.column));if(ee){const ge=Ce.indexOf(ee),Re=JSON.stringify(Object.fromEntries(Ge.map(Fe=>[Fe,ee[Fe]])));E({rowIndex:ge,rowKey:Re,columnName:y.column,originalValue:y.value,currentValue:X(y.column,y.value),isUpdating:!1})}},title:"Edit this cell",children:"✏️"}),o.jsx("button",{className:"results-table__detail-close",onClick:()=>v(null),children:"✕"})]})]}),o.jsx("textarea",{className:"results-table__detail-textarea",value:TU(y.value),readOnly:!0,onFocus:ee=>ee.target.select()})]})}),R&&o.jsx("div",{className:`results-table__toast results-table__toast--${R.type}`,children:R.message}),$&&o.jsxs("div",{className:"results-table__query-log",children:[o.jsx("div",{className:"results-table__query-log-label",children:"Executed Query:"}),o.jsx("code",{className:"results-table__query-log-code",children:$})]}),o.jsx(fo,{isOpen:W!==null,position:(W==null?void 0:W.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:fe,onClose:()=>V(null)})]})};function qx(t){const e=[];let n=!1,s=!1,a=!1,r=!1,i=0;for(let d=0;d<t.length;d++){const f=t[d],h=t[d+1];if(a){f===`
|
|
112
|
+
`&&(a=!1);continue}if(r){f==="*"&&h==="/"&&(r=!1,d++);continue}if(n){if(f==="'"&&h==="'"){d++;continue}f==="'"&&(n=!1);continue}if(s){if(f==='"'&&h==='"'){d++;continue}f==='"'&&(s=!1);continue}if(f==="-"&&h==="-"){a=!0,d++;continue}if(f==="/"&&h==="*"){r=!0,d++;continue}if(f==="'"){n=!0;continue}if(f==='"'){s=!0;continue}if(f===";"){const m=t.slice(i,d).trim();m&&e.push({sql:m,start:i,end:d}),i=d+1}}const c=t.slice(i).trim();return c&&e.push({sql:c,start:i,end:t.length}),e}function RU(t,e){const n=qx(t);if(n.length===0)return null;for(const s of n)if(e>=s.start&&e<=s.end)return s.sql;return n[n.length-1].sql}const pV=({query:t,onChange:e,onExecute:n,isExecuting:s,disabled:a,autoFocus:r=!0})=>{const{t:i}=ht(["terminal"]),c=b.useRef(null),d=b.useRef(null),f=b.useRef(!1),h="query-editor-height",m=80,x=800,[y,v]=b.useState(()=>{try{const B=localStorage.getItem(h);if(B){const O=Number(B);if(O>=m&&O<=x)return O}}catch{}return 150}),S=b.useCallback(B=>{try{localStorage.setItem(h,String(B))}catch{}},[]),A=b.useCallback(B=>{B.preventDefault(),f.current=!0;const O=B.clientY,T=y,M=F=>{const $=F.clientY-O,U=Math.max(m,Math.min(x,T+$));v(U)},R=()=>{var $;f.current=!1,document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",R),document.body.style.cursor="",document.body.style.userSelect="";const F=($=c.current)==null?void 0:$.parentElement;F&&S(F.getBoundingClientRect().height)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",R),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[y,S]);b.useEffect(()=>{if(r&&!a&&c.current){const B=setTimeout(()=>{var O;(O=c.current)==null||O.focus()},100);return()=>clearTimeout(B)}},[r,a]);const k=b.useCallback(B=>{const O=B.currentTarget;d.current&&(d.current.scrollLeft=O.scrollLeft,d.current.scrollTop=O.scrollTop)},[]),N=b.useMemo(()=>qx(t).length>1,[t]),j=b.useCallback(B=>{if((B.ctrlKey||B.metaKey)&&B.shiftKey&&B.key==="Enter"){B.preventDefault(),!a&&!s&&n("all");return}if((B.ctrlKey||B.metaKey)&&B.key==="Enter"&&(B.preventDefault(),!a&&!s&&n("cursor")),B.key==="Tab"){B.preventDefault();const O=B.currentTarget,T=O.selectionStart,M=O.selectionEnd,R=t.substring(0,T)+" "+t.substring(M);e(R),setTimeout(()=>{O.selectionStart=O.selectionEnd=T+2},0)}},[t,e,n,a,s]),E=b.useMemo(()=>{if(!t)return"";try{return sa.highlight(t,sa.languages.sql,"sql")}catch{return t}},[t]),D=b.useMemo(()=>t.split(`
|
|
113
|
+
`).map((O,T)=>T+1),[t]),_=b.useCallback(()=>{var B;return((B=c.current)==null?void 0:B.selectionStart)??0},[]);return o.jsxs("div",{className:"query-editor",children:[o.jsxs("div",{className:"query-editor__toolbar",children:[o.jsxs("div",{className:"query-editor__buttons",children:[o.jsx("button",{className:"query-editor__execute",onClick:()=>n("cursor"),disabled:a||s||!t.trim(),title:i("terminal:database.executeShortcut"),children:s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"query-editor__spinner"}),i("common:status.running")]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"query-editor__play-icon",children:"▶"}),i(N?"terminal:database.runAtCursor":"terminal:database.runQuery")]})}),N&&o.jsxs("button",{className:"query-editor__execute-cursor",onClick:()=>n("all"),disabled:a||s||!t.trim(),title:i("terminal:database.executeCursorShortcut"),children:[o.jsx("span",{className:"query-editor__cursor-icon",children:"▶▶"}),i("terminal:database.runAll")]})]}),o.jsx("div",{className:"query-editor__hint",children:i(N?"terminal:database.pressCtrlEnterMulti":"terminal:database.pressCtrlEnter")})]}),o.jsxs("div",{className:"query-editor__input-wrapper",children:[o.jsx("div",{className:"query-editor__line-numbers",children:D.map(B=>o.jsx("span",{children:B},B))}),o.jsxs("div",{className:"query-editor__editor",style:{height:y},children:[o.jsx("pre",{ref:d,className:"query-editor__highlight","aria-hidden":"true",dangerouslySetInnerHTML:{__html:E+`
|
|
114
|
+
`}}),o.jsx("textarea",{ref:c,className:"query-editor__textarea",value:t,onChange:B=>e(B.target.value),onKeyDown:j,onScroll:k,placeholder:i(a?"terminal:database.selectDbPlaceholder":"terminal:database.enterQueryPlaceholder"),disabled:a,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off","data-cursor-pos":_()})]})]}),o.jsx("div",{className:"query-editor__resize-handle",onMouseDown:A})]})},iA=t=>`db-panel-${t}`,OU=({building:t})=>{var O,T,M,R,F,$;const e=px(t.id),n=cL(t.id),s=uL(t.id),a=((O=t.database)==null?void 0:O.connections)??[],[r,i]=b.useState(""),[c,d]=b.useState(!1),f=b.useRef(null),h=b.useRef(null),m=b.useMemo(()=>{if(!r)return"";try{return sa.highlight(r,sa.languages.sql,"sql")}catch{return r}},[r]),x=b.useCallback(()=>{h.current&&f.current&&(h.current.scrollLeft=f.current.scrollLeft,h.current.scrollTop=f.current.scrollTop)},[]),y=e.activeConnectionId??((T=t.database)==null?void 0:T.activeConnectionId)??((M=a[0])==null?void 0:M.id),v=e.activeDatabase??((R=t.database)==null?void 0:R.activeDatabase),S=a.find(U=>U.id===y),A=y?((F=e.databases)==null?void 0:F.get(y))??[]:[],k=y&&v?(($=e.tables)==null?void 0:$.get(`${y}:${v}`))??[]:[];b.useEffect(()=>{if(!c&&a.length>0){try{const U=localStorage.getItem(iA(t.id));if(U){const L=JSON.parse(U);L.connectionId&&a.some(z=>z.id===L.connectionId)&&(H.setActiveConnection(t.id,L.connectionId),H.listDatabases(t.id,L.connectionId),L.database&&(H.setActiveDatabase(t.id,L.database),H.listTables(t.id,L.connectionId,L.database)),L.lastQuery&&i(L.lastQuery))}}catch{}!e.activeConnectionId&&a[0]&&(H.setActiveConnection(t.id,a[0].id),H.listDatabases(t.id,a[0].id)),d(!0)}},[t.id,a,c,e.activeConnectionId]),b.useEffect(()=>{if(c)try{const U=iA(t.id),L=JSON.parse(localStorage.getItem(U)||"{}");L.lastQuery=r,y&&(L.connectionId=y),v&&(L.database=v),localStorage.setItem(U,JSON.stringify(L))}catch{}},[t.id,r,y,v,c]);const N=b.useCallback(U=>{H.setActiveConnection(t.id,U),H.listDatabases(t.id,U)},[t.id]),j=b.useCallback(U=>{y&&(H.setActiveDatabase(t.id,U),H.listTables(t.id,y,U))},[t.id,y]),E=b.useCallback(()=>{var z;if(!y||!v||!r.trim()||s)return;const U=((z=f.current)==null?void 0:z.selectionStart)??0;if(qx(r).length<=1)H.executeQuery(t.id,y,v,r.trim());else{const W=RU(r,U);W?H.executeQuery(t.id,y,v,W):H.executeQuery(t.id,y,v,r.trim())}},[t.id,y,v,r,s]),D=b.useCallback(U=>{(U.ctrlKey||U.metaKey)&&U.key==="Enter"&&(U.preventDefault(),E())},[E]),_=b.useCallback(U=>{const L=`SELECT * FROM ${U} LIMIT 100`;i(L),y&&v&&H.executeQuery(t.id,y,v,L)},[t.id,y,v]),B=n[0];return a.length===0?o.jsx("div",{className:"db-inline",children:o.jsx("div",{className:"db-inline__empty",children:"🔌 No connections configured"})}):o.jsxs("div",{className:"db-inline",children:[o.jsxs("div",{className:"db-inline__toolbar",children:[a.length>1&&o.jsx("select",{className:"db-inline__select",value:y??"",onChange:U=>N(U.target.value),title:"Connection",children:a.map(U=>o.jsxs("option",{value:U.id,children:[U.engine==="mysql"?"🐬":"🐘"," ",U.name]},U.id))}),a.length===1&&S&&o.jsxs("span",{className:"db-inline__connection-badge",title:`${S.host}:${S.port}`,children:[S.engine==="mysql"?"🐬":"🐘"," ",S.name]}),o.jsxs("select",{className:"db-inline__select",value:v??"",onChange:U=>j(U.target.value),title:"Database",children:[o.jsx("option",{value:"",children:"Select database..."}),A.map(U=>o.jsx("option",{value:U,children:U},U))]}),k.length>0&&o.jsxs("select",{className:"db-inline__select db-inline__select--tables",value:"",onChange:U=>{U.target.value&&_(U.target.value)},title:"Quick query table",children:[o.jsxs("option",{value:"",children:["Tables (",k.length,")"]}),k.map(U=>o.jsx("option",{value:U.name,children:U.name},U.name))]}),o.jsx("button",{className:"db-inline__run",onClick:E,disabled:s||!v||!r.trim(),title:"Execute (Ctrl+Enter)",children:s?"⏳":"▶"})]}),o.jsxs("div",{className:"db-inline__editor",children:[o.jsx("pre",{ref:h,className:"db-inline__highlight","aria-hidden":"true",dangerouslySetInnerHTML:{__html:m+`
|
|
115
|
+
`}}),o.jsx("textarea",{ref:f,className:"db-inline__textarea",value:r,onChange:U=>i(U.target.value),onKeyDown:D,onScroll:x,placeholder:"SELECT * FROM ...",spellCheck:!1,rows:2})]}),o.jsx("div",{className:"db-inline__results",children:B?o.jsx(DU,{result:B,buildingId:t.id,building:t}):o.jsx("div",{className:"db-inline__empty",children:v?"Run a query or select a table above":"Select a database to get started"})})]})};function LU(){const t=b.useRef(!1),e=b.useRef(!1),n=b.useRef(null),s=b.useRef(0),a=b.useRef(!1),r=b.useRef(0),i=b.useRef(0),c=b.useRef(0),d=b.useCallback((v,S)=>{const A=document.querySelector(".app");A&&(A.style.setProperty("--keyboard-height",`${v}px`),A.style.setProperty("--keyboard-visible",S?"1":"0"),A.classList.toggle("keyboard-visible",S)),s.current=v,a.current=S},[]),f=b.useCallback(()=>{d(0,!1),e.current=!1},[d]),h=b.useCallback(()=>{r.current&&(cancelAnimationFrame(r.current),r.current=0),window.visualViewport&&n.current&&(window.visualViewport.removeEventListener("resize",n.current),window.visualViewport.removeEventListener("scroll",n.current),n.current=null)},[]),m=b.useCallback(()=>{if(t.current=!0,!(window.innerWidth<=768))return;if(h(),e.current=!0,!(typeof window.__nativeKeyboardHeight=="number")&&window.visualViewport){i.current=Math.max(0,window.innerHeight-(window.visualViewport.height+window.visualViewport.offsetTop)),c.current=window.innerHeight;const A=()=>{const k=window.visualViewport;k&&(r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(!t.current){f();return}const N=k.height+k.offsetTop,j=Math.max(0,window.innerHeight-N),E=Math.max(0,c.current-window.innerHeight),D=j>=120||E>=120;D||(i.current=j,c.current=window.innerHeight);const _=E>=120?0:D?Math.max(0,j):0;(_!==s.current||D!==a.current)&&d(_,D),D&&setTimeout(()=>{e.current=!1},300)}))};n.current=A,window.visualViewport.addEventListener("resize",A),window.visualViewport.addEventListener("scroll",A),A()}},[h,f,d]),x=b.useCallback(()=>{t.current=!1,window.innerWidth<=768&&setTimeout(()=>{t.current||(f(),h())},100)},[f,h]),y=b.useCallback(()=>{window.innerWidth<=768&&s.current>0&&(t.current=!1,f(),h())},[f,h]);return{isInputFocusedRef:t,keyboardScrollLockRef:e,handleInputFocus:m,handleInputBlur:x,cleanup:y}}function PU(){const[t,e]=b.useState(()=>{const d=Qb(pt.TERMINAL_HEIGHT,Bk);return d>=Fk&&d<=zk?d:Bk}),n=b.useRef(!1),s=b.useRef(0),a=b.useRef(0),r=b.useRef(null),i=b.useRef(t);i.current=t;const c=b.useCallback(d=>{d.preventDefault(),n.current=!0,s.current=d.clientY,a.current=t,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",H.setTerminalResizing(!0)},[t]);return b.useEffect(()=>{const d=h=>{if(!n.current)return;const m=h.clientY-s.current,x=window.innerHeight,y=m/x*100,v=Math.min(zk,Math.max(Fk,a.current+y));e(v)},f=()=>{n.current&&(n.current=!1,document.body.style.cursor="",document.body.style.userSelect="",Xb(pt.TERMINAL_HEIGHT,i.current),H.setTerminalResizing(!1))};return document.addEventListener("mousemove",d),document.addEventListener("mouseup",f),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",f)}},[]),{terminalHeight:t,terminalRef:r,handleResizeStart:c}}const IU=120,BU=.7;function FU(){const[t,e]=b.useState(()=>Qb(pt.MOBILE_OVERVIEW_HEIGHT,0)),n=b.useRef(t);n.current=t;const s=b.useRef(0),a=b.useRef(0),r=()=>Math.floor(window.innerHeight*BU),i=m=>Math.min(r(),Math.max(IU,m)),c=b.useCallback(m=>{e(m);const x=document.querySelector(".guake-terminal");x&&x.style.setProperty("--guake-mobile-overview-height",`${m}px`)},[]),d=b.useCallback(()=>{document.body.style.cursor="",document.body.style.userSelect="",Xb(pt.MOBILE_OVERVIEW_HEIGHT,n.current),H.setTerminalResizing(!1)},[]),f=b.useCallback(m=>{m.preventDefault();const x=document.querySelector(".agent-overview-panel"),y=n.current>0?n.current:(x==null?void 0:x.getBoundingClientRect().height)??240;s.current=m.clientY,a.current=y,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",H.setTerminalResizing(!0);const v=A=>{const k=A.clientY-s.current;c(i(a.current+k))},S=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",S),d()};document.addEventListener("mousemove",v),document.addEventListener("mouseup",S)},[c,d]),h=b.useCallback(m=>{if(m.touches.length!==1)return;const x=document.querySelector(".agent-overview-panel"),y=n.current>0?n.current:(x==null?void 0:x.getBoundingClientRect().height)??240;s.current=m.touches[0].clientY,a.current=y,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",H.setTerminalResizing(!0);const v=A=>{if(A.touches.length!==1)return;A.preventDefault();const k=A.touches[0].clientY-s.current;c(i(a.current+k))},S=()=>{document.removeEventListener("touchmove",v),document.removeEventListener("touchend",S),document.removeEventListener("touchcancel",S),d()};document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",S),document.addEventListener("touchcancel",S)},[c,d]);return{mobileOverviewHeight:t,handleResizeMouseDown:f,handleResizeTouchStart:h}}function zU({agents:t,selectedAgentId:e,isOpen:n,overviewPanelOpen:s,loadingHistory:a,hasModalOpen:r=!1,outputRef:i}){const c=sr(),d=fx(),h=Ir().vibrationIntensity??1,m=()=>{if(typeof document>"u")return!1;const F=document.querySelector(".agent-bar");if(!F)return!1;const $=window.getComputedStyle(F);if($.display==="none"||$.visibility==="hidden")return!1;const U=F.getBoundingClientRect();return U.width>0&&U.height>0},x=b.useMemo(()=>{const F=Array.from(t.values());if(!s&&m()){const Q=KR(),q=F.filter(X=>{if(H.isAgentInArchivedArea(X.id))return!1;if(Q){const se=H.getAreaForAgent(X.id);if(!ax((se==null?void 0:se.id)??null))return!1}return!0}).sort((X,se)=>(X.createdAt||0)-(se.createdAt||0)),be=ea(pt.AGENT_ORDER,[]),ue=new Set(q.map(X=>X.id)),Z=be.filter(X=>ue.has(X)),de=q.filter(X=>!Z.includes(X.id)).map(X=>X.id),Ce=[...Z,...de],xe=new Map(q.map(X=>[X.id,X])),Ne=Ce.map(X=>xe.get(X)).filter(X=>X!==void 0),qe=new Map;for(const X of Ne){const se=H.getAreaForAgent(X.id),Ee=(se==null?void 0:se.id)??null;qe.has(Ee)||qe.set(Ee,{name:(se==null?void 0:se.name)??"",agents:[]}),qe.get(Ee).agents.push(X)}const Ge=Array.from(qe.entries());return Ge.sort(([X,se],[Ee,Ve])=>X===null&&Ee!==null?1:X!==null&&Ee===null?-1:X===null&&Ee===null?0:se.name.localeCompare(Ve.name)),Ge.flatMap(([,X])=>X.agents)}const $=ea(pt.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",sameAreaOnly:!1}),U=H.getState(),L=new Map;for(const Q of d)L.has(Q.agentId)||L.set(Q.agentId,Q.timestamp);const z=new Map;for(const Q of F){const q=H.getAreaForAgent(Q.id);!q||q.archived||z.set(Q.id,q.id)}let W=F.filter(Q=>{if($.filterMode==="working"&&Q.status!=="working"||$.filterMode==="idle"&&Q.status!=="idle"||$.filterMode==="error"&&Q.status!=="error")return!1;if($.sameAreaOnly&&e){const q=z.get(e)??null,be=z.get(Q.id)??null;if(q!==be)return!1}return!0});const V=Q=>[...Q].sort((q,be)=>{const ue=!!(q.isBoss||q.class==="boss"),Z=!!(be.isBoss||be.class==="boss");if(ue!==Z)return ue?-1:1;if($.sortMode==="name")return q.name.localeCompare(be.name);if($.sortMode==="status"){const xe=["working","waiting_input","waiting_permission","error","idle","stopped"],Ne=xe.indexOf(q.status)-xe.indexOf(be.status);if(Ne!==0)return Ne;const qe=U.agentsWithUnseenOutput.has(q.id),Ge=U.agentsWithUnseenOutput.has(be.id);if(qe!==Ge)return qe?-1:1;if(q.status==="working"&&be.status==="working")return q.name.localeCompare(be.name);if(q.status==="idle"&&be.status==="idle"){const X=!!q.taskLabel,se=!!be.taskLabel;return X!==se?X?-1:1:(be.lastActivity||0)-(q.lastActivity||0)}return(be.lastActivity||0)-(q.lastActivity||0)}const de=L.get(q.id)||0;return(L.get(be.id)||0)-de});if(!$.groupByArea)return V(W);const Y=[],P=new Set;for(const[Q,q]of c){if(q.archived)continue;const be=W.filter(ue=>z.get(ue.id)===Q);if(be.length>0){const ue=V(be);Y.push(...ue);for(const Z of ue)P.add(Z.id)}}const K=V(W.filter(Q=>!P.has(Q.id)));return Y.push(...K),W=Y,W},[t,c,d,e,s]),[y,v]=b.useState(0),[S,A]=b.useState(""),k=b.useRef(null),[N,j]=b.useState(null),E=e?x.findIndex(F=>F.id===e):-1,D=E>0?x[E-1]:x[x.length-1],_=E<x.length-1?x[E+1]:x[0],B=b.useRef(null),O=b.useCallback(()=>{if(!e||x.length<=1)return;const F=x.findIndex(U=>U.id===e);if(F===-1)return;const $=(F-1+x.length)%x.length;j("left"),v(0),A(""),H.setLastSelectionViaSwipe(!0),H.selectAgent(x[$].id)},[e,x]),T=b.useCallback(()=>{if(!e||x.length<=1)return;const F=x.findIndex(U=>U.id===e);if(F===-1)return;const $=(F+1)%x.length;j("right"),v(0),A(""),H.setLastSelectionViaSwipe(!0),H.selectAgent(x[$].id)},[e,x]),M=b.useCallback(F=>{v(F),A("is-swiping")},[]),R=b.useCallback(()=>{A("is-animating"),v(0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{A("")},100)},[]);return b.useEffect(()=>{if(!N||a)return;const F=N;j(null),requestAnimationFrame(()=>{A(F==="left"?"swipe-in-left":"swipe-in-right"),k.current=setTimeout(()=>{A("")},120)})},[N,a]),b.useEffect(()=>()=>{k.current&&clearTimeout(k.current)},[]),gk(B,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:40,maxVerticalMovement:50,vibrationIntensity:h}),gk(i,{enabled:n&&x.length>1,onSwipeLeft:T,onSwipeRight:O,onSwipeMove:M,onSwipeCancel:R,threshold:50,maxVerticalMovement:35,vibrationIntensity:h}),b.useEffect(()=>{const F=$=>{if(!n||x.length<=1||r)return;const U=H.getShortcuts(),L=U.find(K=>K.id==="prev-working-agent"),z=U.find(K=>K.id==="next-working-agent"),W=U.find(K=>K.id==="prev-agent-terminal"),V=U.find(K=>K.id==="next-agent-terminal"),Y=$.altKey&&$.shiftKey&&!$.ctrlKey&&!$.metaKey&&$.code==="KeyJ",P=$.altKey&&$.shiftKey&&!$.ctrlKey&&!$.metaKey&&$.code==="KeyK";if(Cn($,L)){$.preventDefault();const K=H.getState();let Q=x.filter(ue=>K.agentsWithUnseenOutput.has(ue.id));if(Q.length===0&&(Q=x.filter(ue=>ue.status==="working")),Q.length===0)return;const q=e?Q.findIndex(ue=>ue.id===e):-1,be=q===-1?Q.length-1:(q-1+Q.length)%Q.length;H.selectAgent(Q[be].id);return}if(Cn($,z)){$.preventDefault();const K=H.getState();let Q=x.filter(ue=>K.agentsWithUnseenOutput.has(ue.id));if(Q.length===0&&(Q=x.filter(ue=>ue.status==="working")),Q.length===0)return;const q=e?Q.findIndex(ue=>ue.id===e):-1,be=q===-1?0:(q+1)%Q.length;H.selectAgent(Q[be].id);return}if(Cn($,W)||P){$.preventDefault(),O();return}if(Cn($,V)||Y){$.preventDefault(),T();return}};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[n,x,e,O,T,r]),{sortedAgents:x,swipeOffset:y,swipeAnimationClass:S,currentAgentIndex:E,prevAgent:D,nextAgent:_,headerRef:B,outputRef:i,handleSwipeLeft:O,handleSwipeRight:T}}const $U=3e4;function HU(t){const[e,n]=b.useState(new Map),[s,a]=b.useState(new Set),r=b.useRef(null),i=b.useMemo(()=>!t||t.length===0?null:[...new Set(t.map(h=>h.dir))].sort(),[t]),c=i?i.join(`
|
|
116
|
+
`):"",d=b.useCallback(async()=>{if(!i||i.length===0){n(new Map);return}const h=ji(),m={};h&&(m.Authorization=`Bearer ${h}`);const x=Aa(),y=new Map;await Promise.all(i.map(async v=>{try{const S=await fetch(`${x}/api/files/git-branch?path=${encodeURIComponent(v)}`,{headers:m});if(S.ok){const A=await S.json();A.branch&&y.set(v,{branch:A.branch,ahead:A.ahead||0,behind:A.behind||0})}}catch{}})),n(y)},[i]);b.useEffect(()=>{if(!i||i.length===0){n(new Map);return}return d(),r.current=setInterval(d,$U),()=>{r.current&&clearInterval(r.current)}},[c,d]);const f=b.useCallback(async h=>{a(m=>new Set(m).add(h));try{await Pt(Ot("/api/files/git-fetch"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:h})}),await d()}catch{}finally{a(m=>{const x=new Set(m);return x.delete(h),x})}},[d]);return{branches:e,fetchRemote:f,fetchingDirs:s,refetch:d}}const UU={id:"dracula",name:"Dracula",description:"Vampire purple with fangs pink",colors:{bgPrimary:"#282a36",bgSecondary:"#21222c",bgTertiary:"#343746",borderColor:"#44475a",textPrimary:"#f8f8f2",textSecondary:"#bfbfbf",textMuted:"#6272a4",accentBlue:"#8be9fd",accentGreen:"#50fa7b",accentOrange:"#ffb86c",accentRed:"#ff5555",accentPurple:"#bd93f9",accentCyan:"#8be9fd",accentClaude:"#50fa7b",accentClaudeLight:"#69ff94",accentPink:"#ff79c6",accentYellow:"#f1fa8c",msgUserBg:"rgba(189, 147, 249, 0.12)",msgUserBorder:"#bd93f9",msgUserText:"#bd93f9",msgAssistantBg:"rgba(255, 121, 198, 0.12)",msgAssistantBorder:"#ff79c6",msgAssistantText:"#ff79c6",toolUseBg:"rgba(255, 184, 108, 0.08)",toolUseBorder:"#ffb86c",toolUseText:"#ffb86c",toolUseName:"#8be9fd",toolResultBg:"rgba(80, 250, 123, 0.08)",toolResultBorder:"#50fa7b",toolResultText:"#50fa7b",outputLineBg:"rgba(189, 147, 249, 0.04)",contextBarBg:"rgba(189, 147, 249, 0.25)",contextBarFill:"#bd93f9",taskLabelColor:"#ff79c6"}},X1={id:"muted",name:"Muted",description:"Foggy dawn through frosted glass",colors:{bgPrimary:"#16181c",bgSecondary:"#1c1f24",bgTertiary:"#24282e",borderColor:"#33393f",textPrimary:"#c8ccd4",textSecondary:"#9099a4",textMuted:"#5c6670",accentBlue:"#7aa8c8",accentGreen:"#8ab898",accentOrange:"#c8a878",accentRed:"#c88888",accentPurple:"#a898b8",accentCyan:"#88b8c0",accentClaude:"#8ab898",accentClaudeLight:"#9ac8a8",accentPink:"#b898a8",accentYellow:"#c8c098",msgUserBg:"rgba(138, 184, 152, 0.06)",msgUserBorder:"rgba(138, 184, 152, 0.3)",msgUserText:"#8ab898",msgAssistantBg:"rgba(168, 152, 184, 0.06)",msgAssistantBorder:"rgba(168, 152, 184, 0.3)",msgAssistantText:"#a898b8",toolUseBg:"rgba(200, 168, 120, 0.05)",toolUseBorder:"rgba(200, 168, 120, 0.3)",toolUseText:"#c8a878",toolUseName:"#88b8c0",toolResultBg:"rgba(136, 184, 192, 0.05)",toolResultBorder:"rgba(136, 184, 192, 0.3)",toolResultText:"#88b8c0",outputLineBg:"rgba(144, 153, 164, 0.03)",contextBarBg:"rgba(168, 152, 184, 0.2)",contextBarFill:"#a898b8",taskLabelColor:"#c8a878"}},WU={id:"muted-red",name:"Rosewood",description:"Aged wine by candlelight",colors:{bgPrimary:"#1a1014",bgSecondary:"#221418",bgTertiary:"#2c1c20",borderColor:"#482830",textPrimary:"#f0e4e8",textSecondary:"#c8b0b8",textMuted:"#8c6878",accentBlue:"#8898c8",accentGreen:"#78a890",accentOrange:"#d8a068",accentRed:"#c85868",accentPurple:"#a878a0",accentCyan:"#88a8b0",accentClaude:"#78a890",accentClaudeLight:"#88b8a0",accentPink:"#d88898",accentYellow:"#d8c088",msgUserBg:"rgba(216, 136, 152, 0.10)",msgUserBorder:"#d88898",msgUserText:"#d88898",msgAssistantBg:"rgba(200, 88, 104, 0.10)",msgAssistantBorder:"#c85868",msgAssistantText:"#c85868",toolUseBg:"rgba(216, 160, 104, 0.08)",toolUseBorder:"#d8a068",toolUseText:"#d8a068",toolUseName:"#d8c088",toolResultBg:"rgba(168, 120, 160, 0.08)",toolResultBorder:"#a878a0",toolResultText:"#a878a0",outputLineBg:"rgba(200, 88, 104, 0.03)",contextBarBg:"rgba(216, 136, 152, 0.25)",contextBarFill:"#d88898",taskLabelColor:"#d8c088"}},qU={id:"nord",name:"Nord",description:"Polar night with aurora",colors:{bgPrimary:"#2e3440",bgSecondary:"#3b4252",bgTertiary:"#434c5e",borderColor:"#4c566a",textPrimary:"#eceff4",textSecondary:"#d8dee9",textMuted:"#7b88a1",accentBlue:"#81a1c1",accentGreen:"#a3be8c",accentOrange:"#d08770",accentRed:"#bf616a",accentPurple:"#b48ead",accentCyan:"#88c0d0",accentClaude:"#a3be8c",accentClaudeLight:"#b3ce9c",accentPink:"#b48ead",accentYellow:"#ebcb8b",msgUserBg:"rgba(136, 192, 208, 0.10)",msgUserBorder:"#88c0d0",msgUserText:"#88c0d0",msgAssistantBg:"rgba(163, 190, 140, 0.10)",msgAssistantBorder:"#a3be8c",msgAssistantText:"#a3be8c",toolUseBg:"rgba(208, 135, 112, 0.08)",toolUseBorder:"#d08770",toolUseText:"#d08770",toolUseName:"#ebcb8b",toolResultBg:"rgba(180, 142, 173, 0.08)",toolResultBorder:"#b48ead",toolResultText:"#b48ead",outputLineBg:"rgba(67, 76, 94, 0.3)",contextBarBg:"rgba(129, 161, 193, 0.25)",contextBarFill:"#81a1c1",taskLabelColor:"#ebcb8b"}},VU={id:"solarized-dark",name:"Solarized",description:"Precision-engineered contrast",colors:{bgPrimary:"#002b36",bgSecondary:"#073642",bgTertiary:"#094652",borderColor:"#586e75",textPrimary:"#93a1a1",textSecondary:"#839496",textMuted:"#657b83",accentBlue:"#268bd2",accentGreen:"#859900",accentOrange:"#cb4b16",accentRed:"#dc322f",accentPurple:"#6c71c4",accentCyan:"#2aa198",accentClaude:"#859900",accentClaudeLight:"#95a910",accentPink:"#d33682",accentYellow:"#b58900",msgUserBg:"rgba(42, 161, 152, 0.12)",msgUserBorder:"#2aa198",msgUserText:"#2aa198",msgAssistantBg:"rgba(133, 153, 0, 0.12)",msgAssistantBorder:"#859900",msgAssistantText:"#859900",toolUseBg:"rgba(203, 75, 22, 0.10)",toolUseBorder:"#cb4b16",toolUseText:"#cb4b16",toolUseName:"#b58900",toolResultBg:"rgba(108, 113, 196, 0.10)",toolResultBorder:"#6c71c4",toolResultText:"#6c71c4",outputLineBg:"rgba(7, 54, 66, 0.5)",contextBarBg:"rgba(38, 139, 210, 0.25)",contextBarFill:"#268bd2",taskLabelColor:"#b58900"}},GU={id:"monokai",name:"Monokai",description:"Neon jungle on warm charcoal",colors:{bgPrimary:"#272822",bgSecondary:"#1e1f1a",bgTertiary:"#3e3d32",borderColor:"#49483e",textPrimary:"#f8f8f2",textSecondary:"#cfcfc2",textMuted:"#75715e",accentBlue:"#66d9ef",accentGreen:"#a6e22e",accentOrange:"#fd971f",accentRed:"#f92672",accentPurple:"#ae81ff",accentCyan:"#66d9ef",accentClaude:"#a6e22e",accentClaudeLight:"#b6f23e",accentPink:"#f92672",accentYellow:"#e6db74",msgUserBg:"rgba(249, 38, 114, 0.10)",msgUserBorder:"#f92672",msgUserText:"#f92672",msgAssistantBg:"rgba(166, 226, 46, 0.10)",msgAssistantBorder:"#a6e22e",msgAssistantText:"#a6e22e",toolUseBg:"rgba(253, 151, 31, 0.08)",toolUseBorder:"#fd971f",toolUseText:"#fd971f",toolUseName:"#66d9ef",toolResultBg:"rgba(174, 129, 255, 0.08)",toolResultBorder:"#ae81ff",toolResultText:"#ae81ff",outputLineBg:"rgba(62, 61, 50, 0.3)",contextBarBg:"rgba(249, 38, 114, 0.25)",contextBarFill:"#f92672",taskLabelColor:"#fd971f"}},YU={id:"gruvbox",name:"Gruvbox",description:"Retro coffee shop warmth",colors:{bgPrimary:"#282828",bgSecondary:"#1d2021",bgTertiary:"#3c3836",borderColor:"#504945",textPrimary:"#ebdbb2",textSecondary:"#d5c4a1",textMuted:"#928374",accentBlue:"#83a598",accentGreen:"#b8bb26",accentOrange:"#fe8019",accentRed:"#fb4934",accentPurple:"#d3869b",accentCyan:"#8ec07c",accentClaude:"#b8bb26",accentClaudeLight:"#c8cb36",accentPink:"#d3869b",accentYellow:"#fabd2f",msgUserBg:"rgba(254, 128, 25, 0.10)",msgUserBorder:"#fe8019",msgUserText:"#fe8019",msgAssistantBg:"rgba(142, 192, 124, 0.10)",msgAssistantBorder:"#8ec07c",msgAssistantText:"#8ec07c",toolUseBg:"rgba(250, 189, 47, 0.08)",toolUseBorder:"#fabd2f",toolUseText:"#fabd2f",toolUseName:"#83a598",toolResultBg:"rgba(211, 134, 155, 0.08)",toolResultBorder:"#d3869b",toolResultText:"#d3869b",outputLineBg:"rgba(60, 56, 54, 0.4)",contextBarBg:"rgba(254, 128, 25, 0.25)",contextBarFill:"#fe8019",taskLabelColor:"#fabd2f"}},KU={id:"atom",name:"Atom",description:"Deep space exploration",colors:{bgPrimary:"#0c1014",bgSecondary:"#121820",bgTertiary:"#1a222c",borderColor:"#283040",textPrimary:"#d8e0f0",textSecondary:"#9ca8c0",textMuted:"#5a6880",accentBlue:"#5dade2",accentGreen:"#58d68d",accentOrange:"#f0b060",accentRed:"#ec7063",accentPurple:"#af7ac5",accentCyan:"#48c9b0",accentClaude:"#58d68d",accentClaudeLight:"#68e69d",accentPink:"#f1948a",accentYellow:"#f7dc6f",msgUserBg:"rgba(93, 173, 226, 0.10)",msgUserBorder:"#5dade2",msgUserText:"#5dade2",msgAssistantBg:"rgba(88, 214, 141, 0.10)",msgAssistantBorder:"#58d68d",msgAssistantText:"#58d68d",toolUseBg:"rgba(240, 176, 96, 0.08)",toolUseBorder:"#f0b060",toolUseText:"#f0b060",toolUseName:"#48c9b0",toolResultBg:"rgba(175, 122, 197, 0.08)",toolResultBorder:"#af7ac5",toolResultText:"#af7ac5",outputLineBg:"rgba(26, 34, 44, 0.5)",contextBarBg:"rgba(175, 122, 197, 0.25)",contextBarFill:"#af7ac5",taskLabelColor:"#f7dc6f"}},QU={id:"cyberpunk",name:"Cyberpunk",description:"Neon noir dystopia",colors:{bgPrimary:"#030308",bgSecondary:"#08080f",bgTertiary:"#101018",borderColor:"#181828",textPrimary:"#e8e8ff",textSecondary:"#a0a0c8",textMuted:"#5050a0",accentBlue:"#00f0ff",accentGreen:"#00ff9f",accentOrange:"#ff6600",accentRed:"#ff003c",accentPurple:"#bf00ff",accentCyan:"#00f0ff",accentClaude:"#00ff9f",accentClaudeLight:"#50ffbf",accentPink:"#ff00aa",accentYellow:"#fff000",msgUserBg:"rgba(255, 0, 170, 0.12)",msgUserBorder:"#ff00aa",msgUserText:"#ff00aa",msgAssistantBg:"rgba(0, 255, 159, 0.10)",msgAssistantBorder:"#00ff9f",msgAssistantText:"#00ff9f",toolUseBg:"rgba(191, 0, 255, 0.10)",toolUseBorder:"#bf00ff",toolUseText:"#bf00ff",toolUseName:"#00f0ff",toolResultBg:"rgba(0, 240, 255, 0.08)",toolResultBorder:"#00f0ff",toolResultText:"#00f0ff",outputLineBg:"rgba(191, 0, 255, 0.03)",contextBarBg:"rgba(255, 0, 170, 0.30)",contextBarFill:"#ff00aa",taskLabelColor:"#fff000"}},XU={id:"synthwave",name:"Synthwave",description:"Sunset over chrome horizon",colors:{bgPrimary:"#241b30",bgSecondary:"#1a1424",bgTertiary:"#2e2540",borderColor:"#4a3860",textPrimary:"#f8e8f8",textSecondary:"#c8a8d0",textMuted:"#7860a0",accentBlue:"#2de2e6",accentGreen:"#0abdc6",accentOrange:"#ff9e64",accentRed:"#ff3864",accentPurple:"#9d4edd",accentCyan:"#2de2e6",accentClaude:"#0abdc6",accentClaudeLight:"#2ad0d8",accentPink:"#f706cf",accentYellow:"#fede5d",msgUserBg:"rgba(247, 6, 207, 0.12)",msgUserBorder:"#f706cf",msgUserText:"#f706cf",msgAssistantBg:"rgba(45, 226, 230, 0.10)",msgAssistantBorder:"#2de2e6",msgAssistantText:"#2de2e6",toolUseBg:"rgba(255, 158, 100, 0.10)",toolUseBorder:"#ff9e64",toolUseText:"#ff9e64",toolUseName:"#fede5d",toolResultBg:"rgba(157, 78, 221, 0.10)",toolResultBorder:"#9d4edd",toolResultText:"#9d4edd",outputLineBg:"rgba(157, 78, 221, 0.05)",contextBarBg:"rgba(247, 6, 207, 0.25)",contextBarFill:"#f706cf",taskLabelColor:"#fede5d"}},JU={id:"abyss",name:"Abyss",description:"Pitch-black void, vivid accents",colors:{bgPrimary:"#08090c",bgSecondary:"#0e1014",bgTertiary:"#16181e",borderColor:"#242830",textPrimary:"#b0b4bc",textSecondary:"#808690",textMuted:"#4c5058",accentBlue:"#3d8ab8",accentGreen:"#3ea868",accentOrange:"#c07848",accentRed:"#b84848",accentPurple:"#8060b0",accentCyan:"#3ca8a8",accentClaude:"#3ea868",accentClaudeLight:"#50b878",accentPink:"#a85880",accentYellow:"#b8a840",msgUserBg:"#181c24",msgUserBorder:"#6a4e96",msgUserText:"#d0d4dc",msgAssistantBg:"#12161e",msgAssistantBorder:"#1c3838",msgAssistantText:"#a0a8b4",toolUseBg:"#161a22",toolUseBorder:"#3a2820",toolUseText:"#989ea8",toolUseName:"#c07848",toolResultBg:"#121824",toolResultBorder:"#202038",toolResultText:"#989ea8",outputLineBg:"#0a0c10",contextBarBg:"rgba(60, 68, 76, 0.25)",contextBarFill:"#4c5460",taskLabelColor:"#c07848"}},ZU={id:"obsidian-bloom",name:"Obsidian Bloom",description:"Ultra-dark graphite with subtle cool borders",colors:{bgPrimary:"#050608",bgSecondary:"#0a0b0f",bgTertiary:"#111319",borderColor:"#2a2f3a",textPrimary:"#c4cad4",textSecondary:"#9aa3b1",textMuted:"#67707d",accentBlue:"#8aa3c7",accentGreen:"#82a39a",accentOrange:"#b39479",accentRed:"#ad7d8a",accentPurple:"#9a8fbd",accentCyan:"#86a8b7",accentClaude:"#9ca6c9",accentClaudeLight:"#bcc3df",accentPink:"#aa92bb",accentYellow:"#b8ac8f",msgUserBg:"rgba(21, 26, 35, 0.92)",msgUserBorder:"#4c627f",msgUserText:"#b8c8df",msgAssistantBg:"rgba(22, 20, 32, 0.92)",msgAssistantBorder:"#5d5479",msgAssistantText:"#c2bcdb",toolUseBg:"rgba(28, 23, 20, 0.9)",toolUseBorder:"#6b5646",toolUseText:"#c8b3a1",toolUseName:"#b8ac8f",toolResultBg:"rgba(20, 23, 30, 0.9)",toolResultBorder:"#4e5a73",toolResultText:"#b0bdd2",outputLineBg:"rgba(10, 11, 15, 0.7)",contextBarBg:"rgba(94, 106, 126, 0.22)",contextBarFill:"#6f7f99",taskLabelColor:"#9ea6b8"}},e6={id:"catppuccin",name:"Catppuccin",description:"Cozy pastel mocha cafe",colors:{bgPrimary:"#1e1e2e",bgSecondary:"#181825",bgTertiary:"#313244",borderColor:"#45475a",textPrimary:"#cdd6f4",textSecondary:"#bac2de",textMuted:"#6c7086",accentBlue:"#89b4fa",accentGreen:"#a6e3a1",accentOrange:"#fab387",accentRed:"#f38ba8",accentPurple:"#cba6f7",accentCyan:"#94e2d5",accentClaude:"#a6e3a1",accentClaudeLight:"#b6f3b1",accentPink:"#f5c2e7",accentYellow:"#f9e2af",msgUserBg:"rgba(180, 190, 254, 0.10)",msgUserBorder:"#b4befe",msgUserText:"#b4befe",msgAssistantBg:"rgba(148, 226, 213, 0.10)",msgAssistantBorder:"#94e2d5",msgAssistantText:"#94e2d5",toolUseBg:"rgba(250, 179, 135, 0.08)",toolUseBorder:"#fab387",toolUseText:"#fab387",toolUseName:"#f9e2af",toolResultBg:"rgba(203, 166, 247, 0.08)",toolResultBorder:"#cba6f7",toolResultText:"#cba6f7",outputLineBg:"rgba(49, 50, 68, 0.4)",contextBarBg:"rgba(245, 194, 231, 0.25)",contextBarFill:"#f5c2e7",taskLabelColor:"#fab387"}},t6={id:"github-dark",name:"GitHub Dark",description:"Developer professional minimal",colors:{bgPrimary:"#0d1117",bgSecondary:"#161b22",bgTertiary:"#21262d",borderColor:"#30363d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#484f58",accentBlue:"#58a6ff",accentGreen:"#3fb950",accentOrange:"#d29922",accentRed:"#f85149",accentPurple:"#a371f7",accentCyan:"#79c0ff",accentClaude:"#3fb950",accentClaudeLight:"#56d364",accentPink:"#f778ba",accentYellow:"#e3b341",msgUserBg:"rgba(88, 166, 255, 0.08)",msgUserBorder:"#58a6ff",msgUserText:"#58a6ff",msgAssistantBg:"rgba(63, 185, 80, 0.08)",msgAssistantBorder:"#3fb950",msgAssistantText:"#3fb950",toolUseBg:"rgba(210, 153, 34, 0.08)",toolUseBorder:"#d29922",toolUseText:"#d29922",toolUseName:"#79c0ff",toolResultBg:"rgba(163, 113, 247, 0.08)",toolResultBorder:"#a371f7",toolResultText:"#a371f7",outputLineBg:"rgba(33, 38, 45, 0.5)",contextBarBg:"rgba(88, 166, 255, 0.25)",contextBarFill:"#58a6ff",taskLabelColor:"#d29922"}},n6={id:"one-dark",name:"One Dark",description:"Moonlit late night coding",colors:{bgPrimary:"#282c34",bgSecondary:"#21252b",bgTertiary:"#2c323c",borderColor:"#3e4451",textPrimary:"#abb2bf",textSecondary:"#828997",textMuted:"#5c6370",accentBlue:"#61afef",accentGreen:"#98c379",accentOrange:"#d19a66",accentRed:"#e06c75",accentPurple:"#c678dd",accentCyan:"#56b6c2",accentClaude:"#98c379",accentClaudeLight:"#a8d389",accentPink:"#e06c75",accentYellow:"#e5c07b",msgUserBg:"rgba(86, 182, 194, 0.10)",msgUserBorder:"#56b6c2",msgUserText:"#56b6c2",msgAssistantBg:"rgba(152, 195, 121, 0.10)",msgAssistantBorder:"#98c379",msgAssistantText:"#98c379",toolUseBg:"rgba(209, 154, 102, 0.08)",toolUseBorder:"#d19a66",toolUseText:"#d19a66",toolUseName:"#e5c07b",toolResultBg:"rgba(198, 120, 221, 0.08)",toolResultBorder:"#c678dd",toolResultText:"#c678dd",outputLineBg:"rgba(44, 50, 60, 0.5)",contextBarBg:"rgba(97, 175, 239, 0.25)",contextBarFill:"#61afef",taskLabelColor:"#d19a66"}},s6={id:"midnight-harbor",name:"Midnight Harbor",description:"Low-glare ocean twilight",colors:{bgPrimary:"#0e141d",bgSecondary:"#151d28",bgTertiary:"#1f2a38",borderColor:"#33465a",textPrimary:"#d9e2ed",textSecondary:"#aebdce",textMuted:"#7f93a8",accentBlue:"#7baed6",accentGreen:"#7fc3b8",accentOrange:"#cfa77f",accentRed:"#c9879c",accentPurple:"#9b9fd1",accentCyan:"#79bccc",accentClaude:"#8ea8d9",accentClaudeLight:"#b2c2e8",accentPink:"#c79fbe",accentYellow:"#d7c28f",msgUserBg:"rgba(123, 174, 214, 0.12)",msgUserBorder:"#7baed6",msgUserText:"#9cc3e2",msgAssistantBg:"rgba(142, 168, 217, 0.12)",msgAssistantBorder:"#8ea8d9",msgAssistantText:"#b2c2e8",toolUseBg:"rgba(207, 167, 127, 0.10)",toolUseBorder:"#cfa77f",toolUseText:"#ddbf9f",toolUseName:"#d7c28f",toolResultBg:"rgba(155, 159, 209, 0.10)",toolResultBorder:"#9b9fd1",toolResultText:"#b9bbe2",outputLineBg:"rgba(31, 42, 56, 0.5)",contextBarBg:"rgba(123, 174, 214, 0.24)",contextBarFill:"#7baed6",taskLabelColor:"#d7c28f"}},a6={id:"ember-noir",name:"Ember Noir",description:"Soft plum dusk with rose-indigo accents",colors:{bgPrimary:"#151118",bgSecondary:"#1d1723",bgTertiary:"#292132",borderColor:"#473b56",textPrimary:"#e7deed",textSecondary:"#c4b4d0",textMuted:"#93839f",accentBlue:"#88a9d6",accentGreen:"#8ab9ad",accentOrange:"#cf9b79",accentRed:"#cb8a9b",accentPurple:"#ae8ec8",accentCyan:"#86b8c6",accentClaude:"#9ca7df",accentClaudeLight:"#bcc3ea",accentPink:"#cd9fbc",accentYellow:"#d5bf93",msgUserBg:"rgba(203, 138, 155, 0.12)",msgUserBorder:"#cb8a9b",msgUserText:"#d7a6b3",msgAssistantBg:"rgba(156, 167, 223, 0.12)",msgAssistantBorder:"#9ca7df",msgAssistantText:"#bcc3ea",toolUseBg:"rgba(213, 191, 147, 0.10)",toolUseBorder:"#d5bf93",toolUseText:"#e0cfad",toolUseName:"#88a9d6",toolResultBg:"rgba(174, 142, 200, 0.10)",toolResultBorder:"#ae8ec8",toolResultText:"#c6aed8",outputLineBg:"rgba(41, 33, 50, 0.52)",contextBarBg:"rgba(203, 138, 155, 0.24)",contextBarFill:"#cb8a9b",taskLabelColor:"#d5bf93"}},r6={id:"classic",name:"Classic",description:"Original transparent style",colors:{bgPrimary:"#0d0d14",bgSecondary:"#14141e",bgTertiary:"#1c1c28",borderColor:"#2a2a3a",textPrimary:"#d0d0d8",textSecondary:"#8a8a98",textMuted:"#5a6a8a",accentBlue:"#5a8fd4",accentGreen:"#50fa7b",accentOrange:"#c89a5a",accentRed:"#c85a5a",accentPurple:"#9a80c0",accentCyan:"#8be9fd",accentClaude:"#50fa7b",accentClaudeLight:"#69ff94",accentPink:"#c87a9a",accentYellow:"#c8c87a",msgUserBg:"rgba(139, 233, 253, 0.12)",msgUserBorder:"transparent",msgUserText:"#8be9fd",msgAssistantBg:"rgba(80, 250, 123, 0.12)",msgAssistantBorder:"transparent",msgAssistantText:"#50fa7b",toolUseBg:"rgba(255, 184, 108, 0.05)",toolUseBorder:"transparent",toolUseText:"#8be9fd",toolUseName:"#ffb86c",toolResultBg:"rgba(80, 250, 123, 0.06)",toolResultBorder:"transparent",toolResultText:"#50fa7b",outputLineBg:"transparent",contextBarBg:"rgba(106, 154, 120, 0.25)",contextBarFill:"#6a9a78",taskLabelColor:"#8be9fd"}},Xs=[r6,JU,ZU,UU,X1,WU,qU,VU,GU,YU,KU,QU,XU,e6,t6,n6,s6,a6];function pu(t){return Xs.find(e=>e.id===t)||X1}const i6="classic";function lp(t){const e=document.documentElement,{colors:n}=t;e.style.setProperty("--bg-primary",n.bgPrimary),e.style.setProperty("--bg-secondary",n.bgSecondary),e.style.setProperty("--bg-tertiary",n.bgTertiary),e.style.setProperty("--border-color",n.borderColor),e.style.setProperty("--text-primary",n.textPrimary),e.style.setProperty("--text-secondary",n.textSecondary),e.style.setProperty("--text-muted",n.textMuted),e.style.setProperty("--accent-blue",n.accentBlue),e.style.setProperty("--accent-green",n.accentGreen),e.style.setProperty("--accent-orange",n.accentOrange),e.style.setProperty("--accent-red",n.accentRed),e.style.setProperty("--accent-purple",n.accentPurple),e.style.setProperty("--accent-cyan",n.accentCyan),e.style.setProperty("--accent-claude",n.accentClaude),e.style.setProperty("--accent-claude-light",n.accentClaudeLight),e.style.setProperty("--accent-pink",n.accentPink),e.style.setProperty("--accent-yellow",n.accentYellow),e.style.setProperty("--msg-user-bg",n.msgUserBg),e.style.setProperty("--msg-user-border",n.msgUserBorder),e.style.setProperty("--msg-user-text",n.msgUserText),e.style.setProperty("--msg-assistant-bg",n.msgAssistantBg),e.style.setProperty("--msg-assistant-border",n.msgAssistantBorder),e.style.setProperty("--msg-assistant-text",n.msgAssistantText),e.style.setProperty("--tool-use-bg",n.toolUseBg),e.style.setProperty("--tool-use-border",n.toolUseBorder),e.style.setProperty("--tool-use-text",n.toolUseText),e.style.setProperty("--tool-use-name",n.toolUseName),e.style.setProperty("--tool-result-bg",n.toolResultBg),e.style.setProperty("--tool-result-border",n.toolResultBorder),e.style.setProperty("--tool-result-text",n.toolResultText),e.style.setProperty("--output-line-bg",n.outputLineBg),e.style.setProperty("--context-bar-bg",n.contextBarBg),e.style.setProperty("--context-bar-fill",n.contextBarFill),e.style.setProperty("--task-label-color",n.taskLabelColor);try{localStorage.setItem("tide-theme",t.id)}catch{}}function Vx(){try{const t=localStorage.getItem("tide-theme");if(t&&Xs.some(e=>e.id===t))return t}catch{}return i6}function o6(){const t=Vx(),e=pu(t);lp(e)}const l6=b.memo(function({selectedAgent:e,selectedAgentId:n,sortedAgents:s,swipeOffset:a,viewMode:r,setViewMode:i,searchMode:c,toggleSearch:d,closeSearch:f,debugPanelOpen:h,setDebugPanelOpen:m,debuggerEnabled:x,setDebuggerEnabled:y,outputsLength:v,setContextConfirm:S,headerRef:A,isSnapshotView:k=!1,onSaveSnapshot:N,overviewPanelOpen:j=!1,setOverviewPanelOpen:E,agentInfoOpen:D=!1,onToggleAgentInfo:_,isFullscreen:B=!1,onToggleFullscreen:O,onNavigateBack:T,onNavigateForward:M,canNavigateBack:R=!1,canNavigateForward:F=!1,gitPanelOpen:$=!1,setGitPanelOpen:U,buildingsPanelOpen:L=!1,setBuildingsPanelOpen:z,workflowPanelOpen:W=!1,setWorkflowPanelOpen:V,hasWorkflow:Y=!1}){var oe,Le;const{t:P}=ht(["terminal","common"]),K=QO();Ir();const Q=_j(n),q=()=>{const te=ng.indexOf(r),pe=ng[(te+1)%ng.length];i(pe),Ja(pt.VIEW_MODE,pe)},be=()=>{const te=!h;m(te),te&&!x&&(y(!0),ps.setEnabled(!0))},ue=()=>{c?f():d()},Z=()=>{window.confirm(P("common:confirm.removeAgent",{name:e.name}))&&H.removeAgentFromServer(n)},de=e.currentTask||e.lastAssignedTask||(Q==null?void 0:Q.text),Ce=e.taskLabel||de,xe=(oe=K.lastReport)==null?void 0:oe.agentSummaries.find(te=>te.agentId===e.id||te.agentName===e.name),Ne={on_track:"#4aff9e",stalled:"#ff9e4a",blocked:"#ff4a4a",completed:"#4a9eff",idle:"#888"},Ge=(e.class==="boss"||e.isBoss)&&e.subordinateIds&&e.subordinateIds.length>0,X=mL(n),se=Pj(e.class in lo?null:e.class),Ee=(se==null?void 0:se.icon)||((Le=lo[e.class])==null?void 0:Le.icon)||"🤖",Ve=sr(),at=je.useMemo(()=>{var te;for(const pe of Ve.values())if((te=pe.assignedAgentIds)!=null&&te.includes(n))return pe;return null},[Ve,n]),[we,$e]=b.useState(!1),ie=b.useRef(null),[fe,Ue]=b.useState(!1),[it,ot]=b.useState(!1),[ce,J]=b.useState(()=>Vx()),ae=b.useRef(null),Se=P(r==="simple"?"terminal:header.simpleView":r==="chat"?"terminal:header.chatView":"terminal:header.advancedView"),ee=r==="simple"?"○":r==="chat"?"◐":"◉",ge=b.useCallback(()=>{$e(!1)},[]),Re=b.useCallback(()=>{Ue(!1),ot(!1)},[]),Fe=te=>{const pe=pu(te);lp(pe),J(te)};return b.useEffect(()=>{if(!we)return;const te=pe=>{ie.current&&!ie.current.contains(pe.target)&&ge()};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[we,ge]),b.useEffect(()=>{if(!fe)return;const te=pe=>{ae.current&&!ae.current.contains(pe.target)&&Re()};return document.addEventListener("mousedown",te),document.addEventListener("touchstart",te),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("touchstart",te)}},[fe,Re]),o.jsxs("div",{className:`guake-header ${s.length>1?"has-multiple-agents":""} ${a>.1?"swiping-right":""} ${a<-.1?"swiping-left":""}`,ref:A,style:at?{borderBottomColor:`color-mix(in srgb, ${at.color} 50%, var(--border-color))`}:void 0,children:[o.jsxs("div",{className:"guake-header-left",children:[o.jsxs("div",{className:"guake-header-title-row",children:[e.isDetached&&o.jsx(Jn,{content:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"tide-tooltip__title",children:"🔄 Reattaching Session..."}),o.jsxs("div",{className:"tide-tooltip__text",children:["This agent's Claude process is running independently. Tide Commander is automatically attempting to reattach to the existing session. If reattachment fails, send a new message to manually resume the session.",o.jsx("br",{}),o.jsx("br",{}),o.jsx("strong",{children:"Status:"})," Recovering session context and output history..."]})]}),position:"bottom",className:"tide-tooltip--detached",children:o.jsx("span",{className:"guake-detached-badge",title:"Agent is detached - reattaching...",children:o.jsx("span",{className:"guake-detached-spinner",children:"🔄"})})}),_?o.jsxs("button",{className:`guake-title-btn ${D?"active":""}`,onClick:_,title:P("terminal:header.showAgentInfo"),children:[o.jsx("span",{className:"guake-agent-avatar",children:Ee}),o.jsxs("span",{className:"guake-title-block",children:[o.jsxs("span",{className:"guake-title-main-row",children:[o.jsx("span",{className:"guake-title",children:e.name}),(e.taskLabel||de)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||de})]}),Ce&&o.jsx("span",{className:"guake-mobile-title-context",children:Ce})]}),o.jsx("span",{className:"guake-title-accessory",children:o.jsx("img",{src:e.provider==="codex"?"/assets/codex.png":e.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:e.provider,className:"guake-provider-icon",title:e.provider==="codex"?"Codex Agent":e.provider==="opencode"?"OpenCode Agent":"Claude Agent"})})]}):o.jsxs("div",{className:"guake-title-with-provider",children:[o.jsx("span",{className:"guake-agent-avatar",children:Ee}),o.jsxs("span",{className:"guake-title-block",children:[o.jsxs("span",{className:"guake-title-main-row",children:[o.jsx("span",{className:"guake-title",children:e.name}),(e.taskLabel||de)&&o.jsx("span",{className:"guake-title-task-chip",children:e.taskLabel||de})]}),Ce&&o.jsx("span",{className:"guake-mobile-title-context",children:Ce})]}),o.jsx("span",{className:"guake-title-accessory",children:o.jsx("img",{src:e.provider==="codex"?"/assets/codex.png":e.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:e.provider,className:"guake-provider-icon",title:e.provider==="codex"?"Codex Agent":e.provider==="opencode"?"OpenCode Agent":"Claude Agent"})})]})]}),o.jsxs("div",{className:"guake-header-meta",children:[xe&&o.jsx("span",{className:"guake-status-line",title:`${xe.statusDescription}
|
|
117
|
+
${xe.recentWorkSummary}`,children:o.jsx("span",{className:"guake-supervisor-badge",style:{color:Ne[xe.progress]||"#888"},children:xe.progress.replace("_"," ")})}),X.filter(te=>te.status==="spawning"||te.status==="working").length>0&&o.jsx("span",{className:"guake-subagents-indicator",children:X.filter(te=>te.status==="spawning"||te.status==="working").map(te=>o.jsxs("span",{className:"guake-subagent-badge active",title:`${te.name} (${te.subagentType}) - ${te.status}`,children:[o.jsx("span",{className:"guake-subagent-icon",children:"⑂"}),o.jsx("span",{className:"guake-subagent-name",children:te.name})]},te.id))})]})]}),o.jsxs("div",{className:"guake-actions",children:[o.jsxs("div",{className:"guake-action-cluster guake-action-cluster--compact hide-on-mobile",children:[!k&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"guake-icon-action guake-nav-btn",onClick:T,title:"Back (Alt+Left)",disabled:!R,children:o.jsx("span",{className:"guake-action-icon",children:"←"})}),o.jsx("button",{className:"guake-icon-action guake-nav-btn",onClick:M,title:"Forward (Alt+Right)",disabled:!F,children:o.jsx("span",{className:"guake-action-icon",children:"→"})})]}),!k&&E&&o.jsx("button",{className:`guake-icon-action guake-overview-toggle ${j?"active":""}`,onClick:()=>E(!j),title:P(j?"terminal:header.hideOverview":"terminal:header.showOverview"),children:o.jsx("span",{className:"guake-action-icon",children:"📊"})}),!k&&U&&o.jsx("button",{className:`guake-icon-action guake-git-toggle ${$?"active":""}`,onClick:()=>U(!$),title:$?"Hide Git Changes":"Show Git Changes",children:o.jsx("span",{className:"guake-action-icon",children:"🌿"})}),!k&&Y&&V&&o.jsx("button",{className:`guake-icon-action guake-workflow-toggle ${W?"active":""}`,onClick:()=>V(!W),title:W?"Hide Workflow":"Show Workflow",children:o.jsx("span",{className:"guake-action-icon",children:"🔄"})}),o.jsx("button",{className:`guake-icon-action guake-fullscreen-toggle ${B?"active":""}`,onClick:O,title:P(B?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen"),children:o.jsx("span",{className:"guake-action-icon",children:B?"🗗":"⛶"})}),o.jsx("button",{className:`guake-icon-action guake-search-toggle ${c?"active":""}`,onClick:ue,title:P("terminal:header.search"),children:o.jsx("span",{className:"guake-action-icon",children:"🔍"})}),o.jsx("button",{className:"guake-icon-action danger",onClick:()=>S("clear"),title:P("terminal:header.clearContext"),children:o.jsx("span",{className:"guake-action-icon",children:"🧹"})})]}),!k&&o.jsxs("div",{className:"guake-desktop-more hide-on-mobile",ref:ie,children:[o.jsx("button",{className:`guake-desktop-more-btn ${we?"active":""}`,onClick:()=>$e(!we),title:P("terminal:header.moreActions","More actions"),children:"⋮"}),we&&o.jsxs("div",{className:"guake-desktop-menu",children:[o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{q(),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:ee}),"View: ",Se]}),N&&v>0&&o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{N(),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"⭐"}),P("terminal:header.saveSnapshot")]}),z&&o.jsxs("button",{className:`guake-desktop-menu-item ${L?"active":""}`,onClick:()=>{z(!L),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"🏗️"}),L?"Hide Buildings":"Show Buildings"]}),o.jsxs("button",{className:`guake-desktop-menu-item ${h?"active":""}`,onClick:()=>{be(),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"🐛"}),P(h?"terminal:header.hideDebug":"terminal:header.showDebug")]}),o.jsx("div",{className:"guake-desktop-menu-divider"}),o.jsxs("button",{className:"guake-desktop-menu-item",onClick:()=>{S("collapse"),ge()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"📦"}),P("terminal:header.collapseContext")]}),Ge&&o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{S("clear-subordinates"),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"👑"}),P("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-desktop-menu-divider"}),o.jsxs("button",{className:"guake-desktop-menu-item danger",onClick:()=>{Z(),ge()},children:[o.jsx("span",{className:"guake-desktop-menu-icon",children:"❌"}),P("terminal:header.removeAgent")]})]})]}),!k&&o.jsxs("div",{className:"guake-mobile-more show-on-mobile",ref:ae,children:[o.jsx("button",{className:`guake-mobile-more-btn ${fe?"active":""}`,onClick:()=>Ue(!fe),title:P("terminal:header.moreActions","More actions"),children:"⋮"}),fe&&o.jsxs("div",{className:"guake-mobile-menu",children:[o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{T==null||T(),Re()},disabled:!R,children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"←"}),"Back"]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{M==null||M(),Re()},disabled:!F,children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"→"}),"Forward"]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{q(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:r==="simple"?"○":r==="chat"?"◐":"◉"}),P(r==="simple"?"terminal:header.simpleView":r==="chat"?"terminal:header.chatView":"terminal:header.advancedView")]}),v>0&&o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{H.clearOutputs(n),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🗑"}),P("terminal:header.clearOutput")]}),N&&v>0&&o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{N(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"⭐"}),P("terminal:header.saveSnapshot")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${B?"active":""}`,onClick:()=>{O==null||O(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:B?"🗗":"⛶"}),P(B?"terminal:header.exitFullscreen":"terminal:header.enterFullscreen")]}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{ue(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:c?"✕":"🔍"}),P("terminal:header.search")]}),E&&o.jsxs("button",{className:`guake-mobile-menu-item ${j?"active":""}`,onClick:()=>{E(!j),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📊"}),P(j?"terminal:header.hideOverview":"terminal:header.showOverview")]}),U&&o.jsxs("button",{className:`guake-mobile-menu-item ${$?"active":""}`,onClick:()=>{U(!$),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🌿"}),$?"Hide Git Changes":"Show Git Changes"]}),Y&&V&&o.jsxs("button",{className:`guake-mobile-menu-item ${W?"active":""}`,onClick:()=>{V(!W),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🔄"}),W?"Hide Workflow":"Show Workflow"]}),z&&o.jsxs("button",{className:`guake-mobile-menu-item ${L?"active":""}`,onClick:()=>{z(!L),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🏗️"}),L?"Hide Buildings":"Show Buildings"]}),o.jsxs("button",{className:`guake-mobile-menu-item ${h?"active":""}`,onClick:()=>{be(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🐛"}),P(h?"terminal:header.hideDebug":"terminal:header.showDebug")]}),o.jsxs("button",{className:`guake-mobile-menu-item ${it?"active":""}`,onClick:()=>ot(!it),children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🎨"}),P("terminal:themeSelector.selectTheme"),o.jsx("span",{className:"guake-mobile-theme-arrow",children:it?"▲":"▼"})]}),it&&o.jsx("div",{className:"guake-mobile-theme-list",children:Xs.map(te=>o.jsxs("button",{className:`guake-mobile-theme-option ${te.id===ce?"active":""}`,onClick:()=>Fe(te.id),children:[o.jsx("span",{className:"guake-mobile-theme-preview",style:{background:`linear-gradient(135deg, ${te.colors.bgPrimary} 0%, ${te.colors.bgSecondary} 50%, ${te.colors.accentPurple} 100%)`}}),o.jsx("span",{className:"guake-mobile-theme-name",children:te.name}),te.id===ce&&o.jsx("span",{className:"guake-mobile-theme-check",children:"✓"})]},te.id))}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item",onClick:()=>{S("collapse"),Re()},disabled:e.status!=="idle",children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"📦"}),P("terminal:header.collapseContext")]}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear"),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"🧹"}),P("terminal:header.clearContext")]}),Ge&&o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{S("clear-subordinates"),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"👑🗑️"}),P("terminal:header.clearAllSubordinates")]}),o.jsx("div",{className:"guake-mobile-menu-divider"}),o.jsxs("button",{className:"guake-mobile-menu-item danger",onClick:()=>{Z(),Re()},children:[o.jsx("span",{className:"guake-mobile-menu-icon",children:"❌"}),P("terminal:header.removeAgent")]})]})]}),o.jsx("button",{className:"guake-close-btn show-on-mobile",onClick:()=>H.setMobileView("3d"),title:P("terminal:header.closeTerminal"),children:"✕"})]})]})});function c6({searchInputRef:t,searchQuery:e,setSearchQuery:n,closeSearch:s,matchCount:a,currentMatch:r,navigateNext:i,navigatePrev:c,loadingFullHistory:d}){const{t:f}=ht(["terminal","common"]);return o.jsxs("div",{className:"guake-search",children:[o.jsx("input",{ref:t,type:"text",placeholder:f("terminal:header.searchPlaceholder"),value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"?(h.preventDefault(),s()):h.key==="Enter"&&(h.preventDefault(),h.shiftKey?c():i())}}),e.trim().length>=2&&o.jsx("span",{className:"guake-search-count",children:d?`${a>0?`${r+1} / ${a}`:"..."} loading`:a>0?`${r+1} / ${a}`:f("terminal:header.searchNoResults","No results")}),o.jsx("button",{className:"guake-search-nav",onClick:c,disabled:a===0,title:"Previous match (Shift+Enter)",children:"▲"}),o.jsx("button",{className:"guake-search-nav",onClick:i,disabled:a===0,title:"Next match (Enter)",children:"▼"}),o.jsx("button",{className:"guake-search-close",onClick:s,title:"Close search (Escape)",children:"✕"})]})}function u6({agent:t,content:e,isOpen:n,onClose:s}){const{t:a}=ht(["tools","common","terminal"]),r=b.useCallback(()=>{navigator.clipboard.writeText(e)},[e]),{handleMouseDown:i,handleClick:c}=Sa(s);return n?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal agent-response-modal",children:[o.jsxs("div",{className:"modal-header agent-response-modal-header",children:[o.jsxs("div",{className:"agent-response-modal-title",children:[o.jsx("span",{className:"agent-response-modal-icon",children:"📝"}),o.jsxs("span",{children:[t.name," - ",a("terminal:modals.rawOutput")]})]}),o.jsx("button",{className:"agent-response-modal-close",onClick:s,title:a("common:buttons.close"),children:"×"})]}),o.jsx("div",{className:"modal-body agent-response-modal-body",children:e?o.jsx("pre",{className:"agent-response-raw",children:e}):o.jsxs("div",{className:"agent-response-empty",children:[o.jsx("span",{className:"agent-response-empty-icon",children:"📭"}),o.jsx("span",{children:a("tools:response.noContent")})]})}),o.jsxs("div",{className:"modal-footer agent-response-modal-footer",children:[o.jsx("button",{className:"btn btn-primary",onClick:r,children:a("common:buttons.copy")}),o.jsx("button",{className:"btn btn-secondary",onClick:s,children:a("common:buttons.close")})]})]})})}):null}function d6({url:t,name:e,onClose:n}){const{handleMouseDown:s,handleClick:a}=Sa(n);return o.jsx(ir,{children:o.jsx("div",{className:"image-modal-overlay",onMouseDown:s,onClick:a,children:o.jsxs("div",{className:"image-modal",children:[o.jsxs("div",{className:"image-modal-header",children:[o.jsx("span",{className:"image-modal-title",children:e}),o.jsx("button",{className:"image-modal-close",onClick:n,children:"×"})]}),o.jsx("div",{className:"image-modal-content",children:o.jsx("img",{src:t,alt:e})})]})})})}function f6({state:t,onClose:e}){const{t:n}=ht(["terminal","common"]),{handleMouseDown:s,handleClick:a}=Sa(e);return o.jsx(ir,{children:o.jsx("div",{className:"bash-modal-overlay",onMouseDown:s,onClick:a,children:o.jsxs("div",{className:"bash-modal",children:[o.jsxs("div",{className:"bash-modal-header",children:[o.jsx("span",{className:"bash-modal-icon",children:"$"}),o.jsx("span",{className:"bash-modal-title",children:n("terminal:modals.terminalOutput")}),o.jsx("button",{className:"bash-modal-close",onClick:e,children:"×"})]}),o.jsx("div",{className:"bash-modal-command",children:o.jsx("pre",{dangerouslySetInnerHTML:{__html:uo(t.command,"bash")}})}),o.jsx("div",{className:`bash-modal-content ${t.isLive?"is-loading":""}`,children:o.jsx("pre",{dangerouslySetInnerHTML:{__html:kl(t.output)}})})]})})})}function p6({action:t,selectedAgentId:e,subordinateCount:n,onClose:s,onClearHistory:a}){const{t:r}=ht(["terminal","common"]),{handleMouseDown:i,handleClick:c}=Sa(s),d=()=>{e&&(t==="collapse"?H.collapseContext(e):t==="clear-subordinates"?H.clearAllSubordinatesContext(e):(H.clearContext(e),a())),s()},f=()=>r(t==="collapse"?"terminal:modals.collapseContext":t==="clear-subordinates"?"terminal:modals.clearAllSubordinatesContext":"terminal:modals.clearContext");return o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible guake-context-confirm-overlay",onMouseDown:i,onClick:c,children:o.jsxs("div",{className:"modal confirm-modal guake-context-confirm-modal",children:[o.jsx("div",{className:"modal-header",children:f()}),o.jsx("div",{className:"modal-body confirm-modal-body",children:t==="collapse"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.collapseConfirm")}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.collapseNote")})]}):t==="clear-subordinates"?o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.clearSubordinatesConfirm",{count:n})}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.clearSubordinatesNote")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{children:r("terminal:modals.clearConfirm")}),o.jsx("p",{className:"confirm-modal-note",children:r("terminal:modals.clearNote")})]})}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:s,children:r("common:buttons.cancel")}),o.jsx("button",{className:`btn ${t==="clear"||t==="clear-subordinates"?"btn-danger":"btn-primary"}`,onClick:d,autoFocus:!0,children:r(t==="collapse"?"common:buttons.collapse":t==="clear-subordinates"?"terminal:modals.clearAll":"terminal:modals.clearContext")})]})]})})})}function h6(){const t=dx(),e=Ml(),n=t?e.get(t):null;return n?o.jsx(Qj,{agent:n,isOpen:!!t,onClose:()=>H.closeContextModal(),onRefresh:()=>{t&&H.refreshAgentContext(t)}}):null}function m6(){const t=ux(),e=ZO(),n=eL();return t?o.jsx(l1,{isOpen:!!t,onClose:()=>H.clearFileViewerPath(),filePath:t,action:e?"modified":"read",editData:e||void 0,searchRoot:n||void 0}):null}function g6({agent:t,content:e,onClose:n}){return t?o.jsx(u6,{agent:t,content:e||"",isOpen:!!e,onClose:n}):null}function oA(t){if(!t)return"N/A";try{return new Date(t).toLocaleString()}catch{return"N/A"}}function b6({agent:t,isOpen:e,onClose:n}){var j,E,D,_,B;const{t:s}=ht(["terminal","common"]),{handleMouseDown:a,handleClick:r}=Sa(n),i=sL((t==null?void 0:t.id)||null),c=Pj((t==null?void 0:t.class)||null);if(!e||!t)return null;const d=t.provider==="codex"?t.codexModel||"gpt-5.3-codex":t.provider==="opencode"?t.opencodeModel||"minimax/MiniMax-M1-80k":t.model||"sonnet",f=((j=c==null?void 0:c.instructions)==null?void 0:j.trim())||"",h=((E=t.customInstructions)==null?void 0:E.trim())||"",m=f.length>0,x=h.length>0,y=m||x,v=m&&x,S=[f,h].filter(Boolean).join(`
|
|
118
|
+
|
|
119
|
+
`),A=Math.max(1,((D=t.contextStats)==null?void 0:D.contextWindow)||t.contextLimit||2e5),k=((_=t.contextStats)==null?void 0:_.totalTokens)||t.contextUsed||0,N=((B=t.contextStats)==null?void 0:B.usedPercent)||Math.round(k/A*100);return o.jsx(ir,{children:o.jsx("div",{className:"agent-info-modal-overlay",onMouseDown:a,onClick:r,children:o.jsxs("div",{className:"agent-info-modal",children:[o.jsxs("div",{className:"agent-info-modal-header",children:[o.jsxs("div",{className:"agent-info-modal-title",children:[o.jsx("span",{className:"icon",children:"ℹ️"}),o.jsx("span",{children:s("terminal:agentInfo.title",{name:t.name})})]}),o.jsx("button",{className:"agent-info-modal-close",onClick:n,children:"×"})]}),o.jsxs("div",{className:"agent-info-modal-body",children:[o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.runtime")}),o.jsxs("div",{className:"agent-info-grid",children:[o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.backend")}),o.jsxs("strong",{children:[o.jsx("img",{src:t.provider==="codex"?"/assets/codex.png":t.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:t.provider,className:"agent-info-provider-icon",title:t.provider==="codex"?"Codex Agent":t.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),t.provider==="codex"?"Codex":t.provider==="opencode"?"OpenCode":"Claude"]})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.model")}),o.jsx("strong",{children:d})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.status")}),o.jsx("strong",{children:t.status})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.class")}),o.jsx("strong",{children:t.class})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.permission")}),o.jsx("strong",{children:t.permissionMode})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.session")}),o.jsx("strong",{children:t.sessionId||s("terminal:agentInfo.notStarted")})]})]})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.promptAndInstructions")}),o.jsxs("div",{className:"agent-info-prompts",children:[v&&o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.customPrompt")}),o.jsx("pre",{children:S})]}),!y&&o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.customPrompt")}),o.jsx("strong",{className:"warn",children:s("terminal:agentInfo.notConfigured")})]}),o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.classPrompt")}),m?o.jsx("pre",{children:f}):o.jsx("strong",{children:s("terminal:agentInfo.none")})]}),o.jsxs("div",{className:"agent-info-prompt-block",children:[o.jsx("span",{children:s("terminal:agentInfo.agentPrompt")}),x?o.jsx("pre",{children:h}):o.jsx("strong",{children:s("terminal:agentInfo.none")})]})]})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.skills",{count:i.length})}),i.length===0?o.jsx("div",{className:"agent-info-empty",children:s("terminal:agentInfo.noSkills")}):o.jsx("div",{className:"agent-info-skills",children:i.map(O=>o.jsxs("div",{className:"agent-info-skill",children:[o.jsx("div",{className:"agent-info-skill-name",children:O.name}),o.jsx("div",{className:"agent-info-skill-desc",children:O.description})]},O.id))})]}),o.jsxs("section",{className:"agent-info-section",children:[o.jsx("h4",{children:s("terminal:agentInfo.diagnostics")}),o.jsxs("div",{className:"agent-info-grid",children:[o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.context")}),o.jsxs("strong",{children:[k.toLocaleString()," / ",A.toLocaleString()," (",N,"%)"]})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.tasksSent")}),o.jsx("strong",{children:t.taskCount})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.workingDir")}),o.jsx("strong",{children:t.cwd})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.lastActivity")}),o.jsx("strong",{children:oA(t.lastActivity)})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.created")}),o.jsx("strong",{children:oA(t.createdAt)})]}),o.jsxs("div",{className:"agent-info-item",children:[o.jsx("span",{children:s("terminal:agentInfo.detached")}),o.jsx("strong",{children:t.isDetached?s("terminal:agentInfo.yes"):s("terminal:agentInfo.no")})]})]})]})]})]})})})}function lA(t){const e=[];let n=0;try{JSON.parse(t)}catch(i){return e.push(o.jsxs("span",{className:"json-error",children:["[Invalid JSON: ",String(i).slice(0,50),"]"]},n++)),e.push(o.jsx("span",{children:t},n++)),e}const s=/("(?:\\.|[^"\\])*")\s*:|("(?:\\.|[^"\\])*")|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(\btrue\b|\bfalse\b)|(\bnull\b)|([{}[\],:])/g;let a=0,r;for(;(r=s.exec(t))!==null;){r.index>a&&e.push(o.jsx("span",{children:t.slice(a,r.index)},n++));const[i,c,d,f,h,m,x]=r;c?(e.push(o.jsx("span",{className:"json-key",children:c.slice(0,-1)},n++)),e.push(o.jsx("span",{className:"json-punct",children:":"},n++))):d?e.push(o.jsx("span",{className:"json-string",children:d},n++)):f?e.push(o.jsx("span",{className:"json-number",children:f},n++)):h?e.push(o.jsx("span",{className:"json-boolean",children:h},n++)):m?e.push(o.jsx("span",{className:"json-null",children:m},n++)):x&&e.push(o.jsx("span",{className:"json-punct",children:x},n++)),a=r.index+i.length}return a<t.length&&e.push(o.jsx("span",{children:t.slice(a)},n++)),e}function cA(t){const e=[],n=/\u001b\[([0-9;]*)m/g;let s={bold:!1,dim:!1},a=0,r=0;const i=f=>{if(f===0){s={bold:!1,dim:!1};return}if(f===1){s.bold=!0;return}if(f===2){s.dim=!0;return}if(f===22){s.bold=!1,s.dim=!1;return}if(f===39){s.color=void 0;return}const h={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"bright-black",91:"bright-red",92:"bright-green",93:"bright-yellow",94:"bright-blue",95:"bright-magenta",96:"bright-cyan",97:"bright-white"};h[f]&&(s.color=h[f])},c=()=>{const f=["ansi"];return s.color&&f.push(`ansi-fg-${s.color}`),s.bold&&f.push("ansi-bold"),s.dim&&f.push("ansi-dim"),f.join(" ")};let d;for(;(d=n.exec(t))!==null;){if(d.index>a){const h=t.slice(a,d.index);e.push(o.jsx("span",{className:c(),children:h},r++))}const f=(d[1]||"0").split(";").map(h=>h===""?0:Number(h)).filter(h=>Number.isFinite(h));f.length===0?i(0):f.forEach(i),a=n.lastIndex}return a<t.length&&e.push(o.jsx("span",{className:c(),children:t.slice(a)},r++)),e}const x6=({agentId:t,onClose:e})=>{const{t:n}=ht(["terminal","common","tools"]),[s,a]=b.useState("messages"),[r,i]=b.useState([]),[c,d]=b.useState([]),[f,h]=b.useState(null),[m,x]=b.useState(""),[y,v]=b.useState(!1),[S,A]=b.useState(!1),[k,N]=b.useState({total:0,sent:0,received:0,messageTypes:[]}),[j,E]=b.useState(new Set),[D,_]=b.useState(new Set),[B,O]=b.useState("all"),[T,M]=b.useState("all"),[R,F]=b.useState("all"),[$,U]=b.useState(!1),[L,z]=b.useState(""),[W,V]=b.useState(!0),Y=b.useRef(null),P=b.useRef(null),K=b.useCallback(()=>{const we=ps.getMessages(t);i([...we]),N(ps.getStats(t))},[t]),Q=b.useCallback(()=>{const we=ps.getLogs();d([...we])},[]),q=b.useCallback(async()=>{v(!0),x("");try{const we=await Pt(Ot(`/api/agents/${encodeURIComponent(t)}/process-output`)),$e=await we.json();if(!we.ok){h(null),x(($e==null?void 0:$e.error)||"Failed to load process output");return}h($e)}catch(we){h(null),x(we instanceof Error?we.message:"Failed to load process output")}finally{v(!1),A(!0)}},[t]);b.useEffect(()=>(K(),ps.subscribe($e=>{($e===t||$e==="all")&&K()})),[t,K]),b.useEffect(()=>(Q(),ps.subscribeLogs(()=>{Q()})),[Q]);const be=b.useMemo(()=>r.filter(we=>{if($){const $e=we.payload;if(!($e!=null&&$e.text)||typeof $e.text!="string")return!1}if(B!=="all"&&we.direction!==B||T!=="all"&&we.type!==T)return!1;if(L){const $e=L.toLowerCase(),ie=we.type.toLowerCase().includes($e),fe=JSON.stringify(we.payload).toLowerCase().includes($e);return ie||fe}return!0}),[r,B,T,$,L]),ue=b.useMemo(()=>c.filter(we=>{var $e;if(R!=="all"&&we.level!==R)return!1;if(L){const ie=L.toLowerCase(),fe=we.message.toLowerCase().includes(ie),Ue=(($e=we.source)==null?void 0:$e.toLowerCase().includes(ie))||!1,it=we.data?JSON.stringify(we.data).toLowerCase().includes(ie):!1;return fe||Ue||it}return!0}),[c,R,L]);b.useEffect(()=>{W&&Y.current&&s==="messages"&&(Y.current.scrollTop=Y.current.scrollHeight)},[be,W,s]),b.useEffect(()=>{W&&P.current&&s==="logs"&&(P.current.scrollTop=P.current.scrollHeight)},[ue,W,s]),b.useEffect(()=>{s==="process"&&!S&&!y&&q()},[s,S,y,q]),b.useEffect(()=>{h(null),x(""),v(!1),A(!1)},[t]);const Z=we=>{E($e=>{const ie=new Set($e);return ie.has(we)?ie.delete(we):ie.add(we),ie})},de=()=>{E(new Set(be.map(we=>we.id)))},Ce=()=>{E(new Set)},xe=we=>{navigator.clipboard.writeText(we.raw)},Ne=()=>{const we=be.map($e=>$e.raw).join(`
|
|
120
|
+
|
|
121
|
+
`);navigator.clipboard.writeText(we)},qe=()=>{ps.clearMessages(t)},Ge=()=>{ps.clearLogs()},X=()=>{if(!f)return;const we=[`agentId: ${f.agentId}`,`pid: ${f.pid}`,`source: ${f.source}`,`command: ${f.command}`,`exitCode: ${f.exitCode??"null"}`,`fetchedAt: ${new Date(f.fetchedAt).toISOString()}`,"","[stdout]",f.output||"(empty)","","[stderr]",f.errorOutput||"(empty)"].join(`
|
|
122
|
+
`);navigator.clipboard.writeText(we)},se=we=>{_($e=>{const ie=new Set($e);return ie.has(we)?ie.delete(we):ie.add(we),ie})},Ee=we=>{switch(we){case"debug":return{icon:"🔍",className:"log-debug"};case"info":return{icon:"ℹ️",className:"log-info"};case"warn":return{icon:"⚠️",className:"log-warn"};case"error":return{icon:"❌",className:"log-error"}}},Ve=we=>new Date(we).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),at=we=>we<1024?`${we}B`:we<1024*1024?`${(we/1024).toFixed(1)}KB`:`${(we/(1024*1024)).toFixed(1)}MB`;return o.jsxs("div",{className:"agent-debug-panel",children:[o.jsxs("div",{className:"agent-debug-header",children:[o.jsxs("div",{className:"agent-debug-title",children:[o.jsx("span",{className:"icon",children:"🐛"}),n("terminal:debug.title")]}),o.jsx("button",{className:"close-btn",onClick:e,title:n("common:buttons.close"),children:"✕"})]}),o.jsxs("div",{className:"agent-debug-tabs",children:[o.jsxs("button",{className:`tab ${s==="messages"?"active":""}`,onClick:()=>a("messages"),children:["📨 ",n("terminal:debug.messages")," (",k.total,")"]}),o.jsxs("button",{className:`tab ${s==="logs"?"active":""}`,onClick:()=>a("logs"),children:["📋 ",n("terminal:debug.logs")," (",c.length,")"]}),o.jsxs("button",{className:`tab ${s==="process"?"active":""}`,onClick:()=>a("process"),children:["🧪 ",n("terminal:debug.processOutput")]})]}),s==="messages"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-stats",children:[o.jsxs("span",{className:"stat stat-sent",children:["↑ ",k.sent]}),o.jsxs("span",{className:"stat stat-received",children:["↓ ",k.received]}),o.jsxs("span",{className:"stat",children:["Types: ",k.messageTypes.length]}),o.jsxs("button",{className:`text-only-toggle ${$?"active":""}`,onClick:()=>U(!$),title:n($?"terminal:debug.allMessages":"terminal:debug.textOnly"),children:["💬 ",n($?"terminal:debug.textOnly":"terminal:debug.allMessages")]})]}),o.jsxs("div",{className:"agent-debug-controls",children:[o.jsxs("select",{value:B,onChange:we=>O(we.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allDirections")}),o.jsx("option",{value:"sent",children:n("terminal:debug.sentOnly")}),o.jsx("option",{value:"received",children:n("terminal:debug.receivedOnly")})]}),o.jsxs("select",{value:T,onChange:we=>M(we.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allTypes")}),k.messageTypes.map(we=>o.jsx("option",{value:we,children:we},we))]}),o.jsx("input",{type:"text",placeholder:n("terminal:debug.search"),value:L,onChange:we=>z(we.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:de,className:"action-btn",title:n("tools:display.expandAll"),children:n("tools:display.expandAll")}),o.jsx("button",{onClick:Ce,className:"action-btn",title:n("tools:display.collapseAll"),children:n("tools:display.collapseAll")}),o.jsx("button",{onClick:Ne,className:"action-btn",title:n("terminal:debug.copyAll"),children:n("terminal:debug.copyAll")}),o.jsx("button",{onClick:qe,className:"action-btn clear-btn",title:n("common:buttons.clear"),children:n("common:buttons.clear")}),o.jsxs("label",{className:"auto-scroll-label",children:[o.jsx("input",{type:"checkbox",checked:W,onChange:we=>V(we.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages",ref:Y,children:be.length===0?o.jsx("div",{className:"no-messages",children:r.length===0?n("terminal:debug.noMessagesCaptured"):n("terminal:debug.noMessagesMatch")}):be.map(we=>{const $e=j.has(we.id),ie=we.payload,fe=ie!=null&&ie.text&&typeof ie.text=="string"?ie.text:"",Ue=we.type==="event"&&(ie==null?void 0:ie.type)==="tool_start",it=we.type==="event"&&(ie==null?void 0:ie.type)==="tool_result",ot=we.type==="output"&&(fe.startsWith("Using tool:")||fe.startsWith("Tool input:")||fe.startsWith("Tool result:")),ce=fe.startsWith("Using tool:"),J=fe.startsWith("Tool input:"),ae=fe.startsWith("Tool result:");let Se="",ee=null,ge="";if(ce)Se=fe.replace("Using tool:","").trim();else if(J)try{const ct=fe.replace("Tool input:","").trim();ee=JSON.parse(ct)}catch{}else ae&&(ge=fe.replace("Tool result:","").trim());const Fe=Ue||it||ot,oe=Ue||ce||J,Le=it||ae,te=(ie==null?void 0:ie.toolName)||Se,pe=(ie==null?void 0:ie.toolInput)||ee,ke=(ie==null?void 0:ie.toolOutput)||ge,Be=fe&&!ot,Ke=we.type==="event"?ie==null?void 0:ie.type:null,Ze=(()=>{var ct;if(we.type!=="event"||!ie)return null;switch(Ke){case"init":return ie.model?`model: ${ie.model}`:null;case"text":return ie.text?ie.text.slice(0,50)+(ie.text.length>50?"...":""):null;case"step_complete":const st=ie.tokens;return st?`${st.input||0} in / ${st.output||0} out`:null;case"error":return((ct=ie.errorMessage)==null?void 0:ct.slice(0,40))||null;case"thinking":return ie.text?`"${ie.text.slice(0,30)}..."`:null;default:return null}})(),et=oe&&pe?(()=>{if(!pe)return null;const ct=Object.keys(pe);if(ct.length===0)return null;const st=["file_path","path","pattern","command","content","query"];return ct.sort((Tt,he)=>{const _e=st.indexOf(Tt),We=st.indexOf(he);return _e===-1&&We===-1?0:_e===-1?1:We===-1?-1:_e-We}).slice(0,3).map(Tt=>{let he=pe[Tt];return typeof he=="string"?he.length>60&&(he=he.slice(0,60)+"..."):typeof he=="object"&&(he=JSON.stringify(he).slice(0,40)+"..."),{key:Tt,value:he}})})():null;return o.jsxs("div",{className:`debug-message debug-message-${we.direction} ${Be?"has-text-preview":""} ${Fe?"is-tool-event":""} ${oe?"tool-start":""} ${Le?"tool-result":""}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>Z(we.id),children:[o.jsx("span",{className:"expand-icon",children:$e?"▼":"▶"}),o.jsx("span",{className:`direction direction-${we.direction}`,children:we.direction==="sent"?"↑ SENT":"↓ RECEIVED"}),o.jsx("span",{className:"message-type",children:Fe?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tool-icon",children:oe?"🔧":"✅"}),oe?"tool_start":"tool_result"]}):Ke?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"event-base",children:we.type}),o.jsx("span",{className:"event-subtype",children:Ke})]}):we.type}),Fe&&te&&o.jsx("span",{className:"tool-name-inline",children:te}),!Fe&&Ze&&o.jsx("span",{className:"event-summary",children:Ze}),o.jsx("span",{className:"message-time",children:Ve(we.timestamp)}),o.jsx("span",{className:"message-size",children:at(we.size)}),o.jsx("button",{className:"copy-btn",onClick:ct=>{ct.stopPropagation(),xe(we)},title:"Copy message",children:"📋"})]}),$e&&o.jsxs("div",{className:"message-body",children:[oe&&(pe||J&&!ee)&&o.jsxs("div",{className:"tool-preview",children:[et&&et.length>0&&o.jsx("div",{className:"tool-inputs",children:et.map(({key:ct,value:st})=>o.jsxs("div",{className:"tool-input-item",children:[o.jsxs("span",{className:"tool-input-key",children:[ct,":"]}),o.jsx("span",{className:"tool-input-value",children:String(st)})]},ct))}),J&&!ee&&o.jsx("div",{className:"tool-raw-input",children:fe.replace("Tool input:","").trim().slice(0,200)})]}),Le&&ke&&o.jsx("div",{className:"tool-preview tool-result-preview",children:o.jsx("div",{className:"tool-output-preview",children:typeof ke=="string"?ke.slice(0,200)+(ke.length>200?"...":""):JSON.stringify(ke).slice(0,200)})}),Be&&!Fe&&o.jsx("div",{className:"message-text-preview expanded",children:o.jsx("span",{className:"text-content",children:ie.text})}),o.jsx("pre",{children:lA(JSON.stringify(we.payload,(ct,st)=>st===void 0?null:typeof st=="object"&&st!==null&&!(st instanceof Date)&&!Array.isArray(st)&&typeof st[Symbol.iterator]=="function"?Array.from(st):typeof st=="function"?`[Function: ${st.name||"anonymous"}]`:st,2))})]})]},we.id)})})]}),s==="logs"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-controls",children:[o.jsxs("select",{value:R,onChange:we=>F(we.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:n("terminal:debug.allLevels")}),o.jsx("option",{value:"debug",children:n("terminal:debug.debug")}),o.jsx("option",{value:"info",children:n("terminal:debug.info")}),o.jsx("option",{value:"warn",children:n("terminal:debug.warning")}),o.jsx("option",{value:"error",children:n("terminal:debug.error")})]}),o.jsx("input",{type:"text",placeholder:n("terminal:debug.searchLogs"),value:L,onChange:we=>z(we.target.value),className:"search-input"})]}),o.jsxs("div",{className:"agent-debug-actions",children:[o.jsx("button",{onClick:Ge,className:"action-btn clear-btn",title:n("terminal:debug.clearLogs"),children:n("terminal:debug.clearLogs")}),o.jsxs("label",{className:"auto-scroll-label",children:[o.jsx("input",{type:"checkbox",checked:W,onChange:we=>V(we.target.checked)}),o.jsx("span",{className:"toggle-switch"}),n("terminal:debug.autoScroll")]})]}),o.jsx("div",{className:"agent-debug-messages agent-debug-logs",ref:P,children:ue.length===0?o.jsx("div",{className:"no-messages",children:c.length===0?n("terminal:debug.noLogsYet"):n("terminal:debug.noLogsMatch")}):ue.map(we=>{const $e=D.has(we.id),ie=Ee(we.level);return o.jsxs("div",{className:`debug-message debug-log ${ie.className}`,children:[o.jsxs("div",{className:"message-header",onClick:()=>se(we.id),children:[o.jsx("span",{className:"expand-icon",children:$e?"▼":"▶"}),o.jsx("span",{className:"log-level-icon",children:ie.icon}),o.jsx("span",{className:"log-level",children:we.level.toUpperCase()}),we.source&&o.jsxs("span",{className:"log-source",children:["[",we.source,"]"]}),o.jsx("span",{className:"log-message",children:we.message}),o.jsx("span",{className:"message-time",children:Ve(we.timestamp)})]}),$e&&we.data!==void 0?o.jsx("div",{className:"message-body",children:o.jsx("pre",{children:o.jsx(o.Fragment,{children:lA(JSON.stringify(we.data,(fe,Ue)=>Ue===void 0?null:typeof Ue=="object"&&Ue!==null&&!(Ue instanceof Date)&&!Array.isArray(Ue)&&typeof Ue[Symbol.iterator]=="function"?Array.from(Ue):typeof Ue=="function"?`[Function: ${Ue.name||"anonymous"}]`:Ue,2))})})}):null]},we.id)})})]}),s==="process"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"agent-debug-actions process-actions",children:[o.jsx("button",{onClick:()=>{q()},className:"action-btn",title:"Refresh process output",disabled:y,children:n(y?"common:status.loading":"common:buttons.refresh")}),o.jsx("button",{onClick:X,className:"action-btn",title:"Copy process output",disabled:!f,children:n("terminal:debug.copyOutput")})]}),o.jsx("div",{className:"agent-debug-messages agent-debug-process-output",children:m?o.jsx("div",{className:"process-error",children:m}):f?o.jsxs("div",{className:"process-output-block",children:[o.jsxs("div",{className:"process-meta-grid",children:[o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.pid")}),o.jsx("span",{className:"meta-value",children:f.pid})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("tools:metadata.source")}),o.jsx("span",{className:"meta-value",children:f.source})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.exit")}),o.jsx("span",{className:"meta-value",children:f.exitCode??"null"})]}),o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.fetched")}),o.jsx("span",{className:"meta-value",children:new Date(f.fetchedAt).toLocaleString("en-US",{hour12:!1})})]})]}),o.jsxs("div",{className:"process-command",children:[o.jsx("span",{className:"meta-label",children:n("terminal:debug.command")}),o.jsx("code",{children:f.command})]}),o.jsx("div",{className:"process-stream-label",children:"stdout"}),o.jsx("pre",{className:"ansi-output",children:cA(f.output||"(empty)")}),o.jsx("div",{className:"process-stream-label",children:"stderr"}),o.jsx("pre",{className:"ansi-output",children:cA(f.errorOutput||"(empty)")})]}):o.jsx("div",{className:"no-messages",children:n(y?"terminal:debug.loadingProcessOutput":"terminal:debug.noProcessOutput")})})]})]})};function y6(t){return t.isDirectory?"":Kf[t.extension]||Kf.default}function Pp(t){return Kf[t]||Kf.default}function hV(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function v6(t,e){if(!e)return null;const n=t.toLowerCase().indexOf(e.toLowerCase());return n===-1?null:{start:n,end:n+e.length}}function Ug(t){if(t.length===0)return[];const e={isDirectory:!0,children:[],fileCount:0};for(const r of t){const i=r.path.split("/");let c=e;for(let d=0;d<i.length-1;d++){const f=i[d],h=i.slice(0,d+1).join("/");let m=c.children.find(x=>x.isDirectory&&x.name===f);m||(m={name:f,path:h,isDirectory:!0,children:[],fileCount:0},c.children.push(m)),c=m}c.children.push({name:r.name,path:r.path,isDirectory:!1,file:r,children:[],fileCount:1})}function n(r){for(r.children=r.children.map(n);r.isDirectory&&r.children.length===1&&r.children[0].isDirectory;){const i=r.children[0];r.name=r.name?r.name+"/"+i.name:i.name,r.path=i.path,r.children=i.children}return r}function s(r){return r.isDirectory?(r.fileCount=r.children.reduce((i,c)=>i+s(c),0),r.fileCount):1}function a(r){return[...r].sort((i,c)=>i.isDirectory&&!c.isDirectory?-1:!i.isDirectory&&c.isDirectory?1:i.name.toLowerCase().localeCompare(c.name.toLowerCase())).map(i=>(i.isDirectory&&(i.children=a(i.children)),i))}return e.children=e.children.map(n),s(e),e.children=a(e.children),e.children}function w6(t,e){for(const n of t)n.isDirectory&&(e.add(n.path),w6(n.children,e))}const k6=3,S6=3;function C6(t){const[e,n]=b.useState([]),[s,a]=b.useState(!1),[r,i]=b.useState(new Set),[c,d]=b.useState(new Set),f=b.useRef(e),h=b.useRef(c),m=b.useRef(r);b.useEffect(()=>{f.current=e},[e]),b.useEffect(()=>{h.current=c},[c]),b.useEffect(()=>{m.current=r},[r]);const x=b.useCallback(async()=>{if(t){a(!0);try{const N=await Pt(Ot(`/api/files/tree?path=${encodeURIComponent(t)}&depth=${k6}`)),j=await N.json();if(N.ok&&j.tree){const E=Mf(j.tree),D={name:j.name,path:t,isDirectory:!0,size:0,extension:"",children:E};n([D]);const _=new Set([t]);$b(E,_),d(_),i(new Set([t]))}}catch(N){console.error("[FileExplorer] Failed to load tree:",N),n([])}a(!1)}},[t]),y=b.useCallback(async N=>{try{const j=await Pt(Ot(`/api/files/tree?path=${encodeURIComponent(N)}&depth=${S6}`)),E=await j.json();if(j.ok&&E.tree){const D=Mf(E.tree);return n(_=>{const B=JSON.parse(JSON.stringify(_)),O=eu(B,N);return O&&(O.children=D),B}),d(_=>{const B=new Set(_);return B.add(N),$b(E.tree,B),B}),D}}catch(j){console.error("[FileExplorer] Failed to load children:",j)}return null},[]),v=b.useCallback(async N=>{await y(N)},[y]),S=b.useCallback((N,j)=>{if(!N||!j||N===j)return;const E=_=>_===N?j:_.startsWith(`${N}/`)?`${j}${_.slice(N.length)}`:_,D=_=>{const B=_.map(O=>{const T=E(O.path),M=O.children?D(O.children):void 0;return{...O,path:T,name:T.split("/").pop()||O.name,extension:O.isDirectory?"":A6(T),children:M}});return Mf(B)};n(_=>D(_)),d(_=>{const B=new Set;for(const O of _)B.add(E(O));return B})},[]),A=b.useCallback(async N=>{if(m.current.has(N))i(E=>{const D=new Set(E);return D.delete(N),D});else{i(D=>{const _=new Set(D);return _.add(N),_});let E=eu(f.current,N);for(;E&&E.isDirectory;){let D=E.children;if((!D||D.length===0)&&!h.current.has(E.path)&&(D=await y(E.path)||[]),!D||D.length===0)break;const _=D.filter(T=>T.isDirectory);if(D.some(T=>!T.isDirectory)||_.length!==1)break;const O=_[0];i(T=>{const M=new Set(T);return M.add(O.path),M}),E=O}}},[y]),k=b.useCallback(async N=>{var T;if(!N)return;const j=(t==null?void 0:t.replace(/\/+$/,""))||null,E=()=>new Promise(M=>{requestAnimationFrame(()=>M())}),D=async(M,R=20)=>{for(let F=0;F<R;F++){const $=eu(f.current,M);if($)return $;await E()}return null},_=[];if(j&&N.startsWith(j)){_.push(j);const R=N.substring(j.length).split("/").filter(Boolean);let F=j;for(const $ of R)F=`${F}/${$}`,_.push(F)}else _.push(N);for(const M of _){const R=await D(M);R!=null&&R.isDirectory&&(h.current.has(R.path)||(await y(R.path),await E()))}const B=new Set(m.current);let O=0;for(;O<_.length;){const M=_[O],R=eu(f.current,M);if(!(R!=null&&R.isDirectory)){O++;continue}let F=R;for(;F.children&&F.children.length===1&&((T=F.children[0])!=null&&T.isDirectory);)F=F.children[0];for(B.add(F.path);O<_.length;){if(_[O]===F.path){O++;break}O++}}i(B),await E()},[t,y]);return{tree:e,loading:s,expandedPaths:r,loadTree:x,reloadDirectory:v,renamePathInTree:S,togglePath:A,expandToPath:k,setExpandedPaths:i}}function A6(t){const e=t.lastIndexOf(".");return e===-1?"":t.slice(e).toLowerCase()}function eu(t,e){for(const n of t){if(n.path===e)return n;if(n.children){const s=eu(n.children,e);if(s)return s}}return null}function $b(t,e){for(const n of t)n.isDirectory&&n.children&&n.children.length>0&&(e.add(n.path),$b(n.children,e))}function j6(t){return[...t].sort((e,n)=>e.isDirectory&&!n.isDirectory?-1:!e.isDirectory&&n.isDirectory?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase()))}function Mf(t){return j6(t).map(n=>n.isDirectory&&n.children?{...n,children:Mf(n.children)}:n)}function uA(t){switch(t){case"modified":return"#c89a5a";case"added":return"#5cb88a";case"deleted":return"#c85a5a";case"untracked":return"#6ab8c8";case"renamed":return"#9a80c0";default:return}}function N6(t){return[...t].sort((e,n)=>e.isDirectory&&!n.isDirectory?-1:!e.isDirectory&&n.isDirectory?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase()))}function Hb(t){var s;if(!t.isDirectory)return{displayName:t.name,terminalNode:t,expansionPath:t.path};const e=[t.name];let n=t;for(;n.children&&n.children.length===1&&((s=n.children[0])!=null&&s.isDirectory);)n=n.children[0],e.push(n.name);return{displayName:e.join("/"),terminalNode:n,expansionPath:n.path}}function T6({text:t,query:e}){const n=v6(t,e);return n?o.jsxs(o.Fragment,{children:[t.slice(0,n.start),o.jsx("mark",{className:"search-highlight",children:t.slice(n.start,n.end)}),t.slice(n.end)]}):o.jsx(o.Fragment,{children:t})}function _6({node:t,depth:e,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c}){const d=b.useMemo(()=>Hb(t),[t]),f=s.has(d.expansionPath),h=n===t.path||n===d.expansionPath,m=uA(t.gitStatus),x=b.useMemo(()=>d.terminalNode.children?N6(d.terminalNode.children):[],[d]),y=S=>{S.stopPropagation(),t.isDirectory?r(d.expansionPath):a(t)},v=S=>{i&&(S.preventDefault(),S.stopPropagation(),i(S,d.terminalNode))};return o.jsxs("div",{className:"tree-node-wrapper",children:[o.jsxs("div",{className:`tree-node ${h?"selected":""} ${t.isDirectory?"directory":"file"} ${f?"expanded":""}`,style:{paddingLeft:`${e*16}px`},onClick:y,onContextMenu:v,"data-path":t.path,children:[t.isDirectory?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`tree-arrow ${f?"expanded":""}`,children:"▸"}),o.jsxs("span",{className:"tree-folder-icon-wrapper",children:[o.jsx("span",{className:"tree-folder-icon",style:{backgroundImage:`url('${f?"/assets/vscode-icons/default_folder_opened.svg":"/assets/vscode-icons/default_folder.svg"}')`},role:"img","aria-label":"folder"}),t.hasGitChanges&&o.jsx("span",{className:"tree-folder-git-dot",style:{backgroundColor:uA(t.gitStatus)||"#c89a5a"}})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tree-arrow-spacer"}),o.jsx("span",{className:"tree-icon",style:{backgroundImage:`url('${y6(t)}')`},role:"img","aria-label":"file"})]}),o.jsx("span",{className:"tree-name",style:m?{color:m}:void 0,children:o.jsx(T6,{text:d.displayName,query:c})})]}),t.isDirectory&&f&&x.length>0&&o.jsx("div",{className:"tree-children",children:x.map(S=>o.jsx(Gx,{node:S,depth:e+1,selectedPath:n,expandedPaths:s,onSelect:a,onToggle:r,onContextMenu:i,searchQuery:c},S.path))})]})}const Gx=b.memo(_6,(t,e)=>{if(t.node!==e.node||t.depth!==e.depth||t.searchQuery!==e.searchQuery||t.onContextMenu!==e.onContextMenu)return!1;const n=Hb(t.node).expansionPath,s=Hb(e.node).expansionPath,a=t.selectedPath===t.node.path||t.selectedPath===n,r=e.selectedPath===e.node.path||e.selectedPath===s;if(a!==r)return!1;if(t.node.isDirectory){const i=t.expandedPaths.has(n),c=e.expandedPaths.has(s);if(i!==c||c&&(t.expandedPaths!==e.expandedPaths||t.selectedPath!==e.selectedPath))return!1}return!0});Gx.displayName="TreeNodeItem";function Wg(t){const e=t.lastIndexOf(".")>=0?t.substring(t.lastIndexOf(".")):"";return Af(e)}function E6(t,e){if(e.type==="circle"){const a=t.x-e.center.x,r=t.z-e.center.z,i=Math.max(e.width,e.height)/2;return a*a+r*r<=i*i}const n=e.width/2,s=e.height/2;return t.x>=e.center.x-n&&t.x<=e.center.x+n&&t.z>=e.center.z-s&&t.z<=e.center.z+s}function bf(t){return t==="modified"||t==="renamed"||t==="deleted"||t==="conflict"}function J1({node:t,depth:e,expandedDirs:n,onToggleDir:s,onFileClick:a,onContextMenu:r,onDiscard:i,repoDir:c}){if(t.isDirectory){const m=n.has(t.path),x=m?"/assets/vscode-icons/default_folder_opened.svg":"/assets/vscode-icons/default_folder.svg";return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"guake-git-file guake-git-tree-dir",style:{paddingLeft:`${12+e*20}px`},onClick:()=>s(t.path),children:[o.jsx("span",{className:"guake-git-repo-arrow",style:{marginRight:4},children:m?"▼":"▶"}),o.jsx("img",{src:x,alt:"",className:"guake-git-file-icon guake-git-folder-icon"}),o.jsx("span",{className:"guake-git-file-name",children:t.name}),o.jsx("span",{className:"guake-git-repo-count",style:{marginLeft:"auto"},children:t.fileCount})]}),m&&t.children.map(y=>o.jsx(J1,{node:y,depth:e+1,expandedDirs:n,onToggleDir:s,onFileClick:a,onContextMenu:r,onDiscard:i,repoDir:c},y.path))]})}const d=t.file,f=s1[d.status],h=Pp(d.name);return o.jsxs("div",{className:"guake-git-file","data-status":d.status,style:{paddingLeft:`${28+e*20}px`},onClick:()=>a(d,c),onContextMenu:r?m=>r(m,d,c):void 0,title:d.path,children:[h&&o.jsx("img",{src:h,alt:"",className:"guake-git-file-icon"}),o.jsx("span",{className:"guake-git-file-name",children:d.name}),o.jsx("span",{className:"guake-git-file-status",style:{color:f.color,marginLeft:"auto"},title:f.label,children:f.icon}),i&&o.jsx("button",{className:"guake-git-discard-btn",title:d.status==="untracked"||d.status==="added"?"Delete file":"Discard changes",onClick:m=>i(m,d,c),children:"↩"})]})}function M6({agentId:t,agents:e,onClose:n,branchInfoMap:s,fetchRemote:a,fetchingDirs:r}){const{t:i}=ht(["terminal","common"]),c=sr(),[d,f]=b.useState([]),[h,m]=b.useState(!1),[x,y]=b.useState(new Set),[v,S]=b.useState(new Set),[A,k]=b.useState(null),[N,j]=b.useState(!1),[E,D]=b.useState(()=>ka(pt.GIT_PANEL_VIEW_MODE,"flat")==="tree"?"tree":"flat"),[_,B]=b.useState(()=>ka(pt.GIT_PANEL_MODE,"changes")==="explorer"?"explorer":"changes"),[O,T]=b.useState(()=>ea(pt.GIT_PANEL_FOLDER_IDX,0)),M=b.useCallback(ce=>{D(ce),Ja(pt.GIT_PANEL_VIEW_MODE,ce)},[]),R=b.useCallback(ce=>{B(ce),Ja(pt.GIT_PANEL_MODE,ce)},[]),F=b.useCallback(ce=>{T(ce),wa(pt.GIT_PANEL_FOLDER_IDX,ce)},[]),[$,U]=b.useState(null),[L,z]=b.useState(null),[W,V]=b.useState(null),Y=je.useRef(!1),P=je.useRef(t),K=b.useMemo(()=>{const ce=new Set,J=[];for(const Se of c.values())if(!(Se.archived||Se.directories.length===0)&&Se.assignedAgentIds.includes(t)){ce.add(Se.id);for(const ee of Se.directories)ee&&ee.trim()&&J.push(ee)}const ae=e.get(t);if(ae){for(const Se of c.values())if(!(Se.archived||Se.directories.length===0||ce.has(Se.id))&&E6({x:ae.position.x,z:ae.position.z},Se))for(const ee of Se.directories)ee&&ee.trim()&&J.push(ee)}return ae!=null&&ae.cwd&&!J.includes(ae.cwd)&&J.unshift(ae.cwd),[...new Set(J)]},[t,e,c]),Q=K.length>0?K[O]||K[0]:null,q=C6(_==="explorer"?Q:null);b.useEffect(()=>{_==="explorer"&&Q&&q.loadTree()},[_,Q]);const be=b.useMemo(()=>{if(q.tree.length===0||d.length===0||!Q)return q.tree;const ce=new Map;for(const ae of d)for(const Se of ae.gitStatus.files){const ee=Se.path.startsWith("/")?Se.path:`${ae.dir.replace(/\/$/,"")}/${Se.path}`;ce.set(ee,Se.status)}if(ce.size===0)return q.tree;const J=ae=>ae.map(Se=>{if(Se.isDirectory){const ge=Se.children?J(Se.children):void 0,Re=ge?ge.some(Fe=>Fe.gitStatus||Fe.hasGitChanges):!1;return Re||ge!==Se.children?{...Se,children:ge,hasGitChanges:Re}:Se}const ee=ce.get(Se.path);return ee?{...Se,gitStatus:ee}:Se});return J(q.tree)},[q.tree,d,Q]);b.useEffect(()=>{P.current!==t&&(P.current=t,Y.current=!1,f([]),y(new Set),S(new Set),k(null),F(0),U(null))},[t]);const ue=je.useRef(0),Z=b.useCallback(async()=>{if(K.length===0)return;const ce=++ue.current;m(!0);try{const J=[];if(await Promise.all(K.map(async ae=>{try{const Se=await Pt(Ot(`/api/files/git-status?path=${encodeURIComponent(ae)}`));if(Se.ok){const ee=await Se.json();if(ee.isGitRepo&&ee.files.length>0){const ge=ae.split("/").filter(Boolean).pop()||ae;J.push({dir:ae,dirName:ge,gitStatus:ee})}}}catch{}})),ce!==ue.current)return;J.sort((ae,Se)=>ae.dirName.localeCompare(Se.dirName)),f(J),!Y.current&&J.length>0&&(Y.current=!0,y(new Set(J.map(ae=>ae.dir))))}finally{ce===ue.current&&m(!1)}},[K]);b.useEffect(()=>{Z();const ce=setInterval(Z,15e3);return()=>clearInterval(ce)},[Z]);const de=b.useCallback(async()=>{K.length!==0&&(await Promise.all(K.map(ce=>a(ce))),await Z())},[K,a,Z]),Ce=b.useCallback(ce=>{y(J=>{const ae=new Set(J);return ae.has(ce)?ae.delete(ce):ae.add(ce),ae})},[]),xe=b.useCallback(ce=>{S(J=>{const ae=new Set(J);return ae.has(ce)?ae.delete(ce):ae.add(ce),ae})},[]),Ne=b.useCallback(async(ce,J)=>{const ae=ce.path.startsWith("/")?ce.path:`${J.replace(/\/$/,"")}/${ce.path}`;j(!0);try{if(bf(ce.status)){let Se="",ee="";if(ce.status!=="deleted")try{const ge=await Pt(Ot(`/api/files/read?path=${encodeURIComponent(ae)}`));if(ge.ok){const Re=await ge.json();Re.content!=null&&(ee=Re.content)}}catch{}try{const ge=await Pt(Ot(`/api/files/git-original?path=${encodeURIComponent(ae)}`));if(ge.ok){const Re=await ge.json();Re.content!=null&&(Se=Re.content)}}catch{}k({type:"diff",data:{filePath:ae,fileName:ce.name,originalContent:Se,modifiedContent:ee,language:Wg(ce.name)}})}else{let Se="";try{const ee=await Pt(Ot(`/api/files/read?path=${encodeURIComponent(ae)}`));if(ee.ok){const ge=await ee.json();ge.content!=null&&(Se=ge.content)}}catch{}k({type:"content",data:{filePath:ae,fileName:ce.name,content:Se,language:Wg(ce.name)},isNewFile:!0})}}catch{}finally{j(!1)}},[]),qe=b.useCallback(async ce=>{if(!ce.isDirectory){U(ce.path),j(!0);try{const J=ce.name,ae=Wg(J);if(ce.gitStatus&&bf(ce.gitStatus)){let Se="",ee="";if(ce.gitStatus!=="deleted")try{const ge=await Pt(Ot(`/api/files/read?path=${encodeURIComponent(ce.path)}`));if(ge.ok){const Re=await ge.json();Re.content!=null&&(ee=Re.content)}}catch{}try{const ge=await Pt(Ot(`/api/files/git-original?path=${encodeURIComponent(ce.path)}`));if(ge.ok){const Re=await ge.json();Re.content!=null&&(Se=Re.content)}}catch{}k({type:"diff",data:{filePath:ce.path,fileName:J,originalContent:Se,modifiedContent:ee,language:ae}})}else{let Se="";try{const ee=await Pt(Ot(`/api/files/read?path=${encodeURIComponent(ce.path)}`));if(ee.ok){const ge=await ee.json();ge.content!=null&&(Se=ge.content)}}catch{}k({type:"content",data:{filePath:ce.path,fileName:J,content:Se,language:ae},isNewFile:ce.gitStatus==="added"||ce.gitStatus==="untracked"})}}finally{j(!1)}}},[]),Ge=b.useMemo(()=>{const ce=[],J=(ae,Se,ee)=>{for(const ge of ae)if(ge.isDirectory)J(ge.children,Se,ee);else{const Re=Se.find(Fe=>Fe.path===ge.path);Re&&ce.push({file:Re,repoDir:ee})}};for(const ae of d)if(x.has(ae.dir))if(E==="tree"){const Se=Ug(ae.gitStatus.files);J(Se,ae.gitStatus.files,ae.dir)}else for(const Se of ae.gitStatus.files)ce.push({file:Se,repoDir:ae.dir});return ce},[d,E,x]),X=b.useCallback(async ce=>{if(!A)return;const J=A.data.filePath,ae=Ge.findIndex(({file:Re,repoDir:Fe})=>(Re.path.startsWith("/")?Re.path:`${Fe.replace(/\/$/,"")}/${Re.path}`)===J);if(ae<0)return;const Se=ae+ce;if(Se<0||Se>=Ge.length)return;const{file:ee,repoDir:ge}=Ge[Se];await Ne(ee,ge)},[A,Ge,Ne]),se=b.useMemo(()=>{if(!A)return-1;const ce=A.data.filePath;return Ge.findIndex(({file:J,repoDir:ae})=>(J.path.startsWith("/")?J.path:`${ae.replace(/\/$/,"")}/${J.path}`)===ce)},[A,Ge]),Ee=b.useCallback(()=>k(null),[]),Ve=b.useCallback(()=>z(null),[]),at=b.useCallback(async ce=>{try{const J=await Pt(Ot("/api/files/delete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ce.path})});if(J.ok){if(ce.status==="added")try{await Pt(Ot("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ce.path,status:"added"}],directory:ce.repoDir})})}catch{}}else{const ae=await J.json().catch(()=>({error:"Unknown error"}));console.error("Delete failed:",ae.error)}Z(),_==="explorer"&&q.loadTree()}catch(J){console.error("Delete request failed:",J)}finally{V(null)}},[Z,_,q]),[we,$e]=b.useState(null),ie=b.useCallback(async ce=>{try{await Pt(Ot("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:ce.path,status:ce.status}],directory:ce.repoDir})}),Z()}catch{}finally{$e(null)}},[Z]),fe=b.useCallback((ce,J,ae)=>{ce.stopPropagation();const Se=J.path.startsWith("/")?J.path:`${ae.replace(/\/$/,"")}/${J.path}`;J.status==="untracked"||J.status==="added"?V({path:Se,name:J.name,status:J.status,repoDir:ae}):$e({path:Se,name:J.name,status:J.status,repoDir:ae})},[]),Ue=b.useCallback((ce,J,ae)=>{ce.preventDefault(),ce.stopPropagation();const Se=J.path.startsWith("/")?J.path:`${ae.replace(/\/$/,"")}/${J.path}`,ee=[];ee.push({id:"view",label:bf(J.status)?"View Diff":"View File",icon:bf(J.status)?"📊":"📄",onClick:()=>Ne(J,ae)}),ee.push({id:"div1",label:"",divider:!0,onClick:()=>{}}),ee.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(Se)}}),ee.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(J.path)}}),J.status!=="deleted"&&(ee.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),ee.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Pt(Ot("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Se})})}catch{}}})),(J.status==="modified"||J.status==="deleted"||J.status==="renamed")&&(ee.push({id:"div3",label:"",divider:!0,onClick:()=>{}}),ee.push({id:"discard",label:"Discard Changes",icon:"↩️",danger:!0,onClick:async()=>{try{await Pt(Ot("/api/files/git-discard"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[{path:Se,status:J.status}],directory:ae})}),Z()}catch{}}})),J.status!=="deleted"&&(J.status==="modified"||J.status==="renamed"||ee.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),ee.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:Se,name:J.name,status:J.status,repoDir:ae})})),z({isOpen:!0,position:{x:ce.clientX,y:ce.clientY},actions:ee})},[Ne]),it=b.useCallback((ce,J)=>{ce.preventDefault(),ce.stopPropagation();const ae=[];if(J.isDirectory||(ae.push({id:"view",label:"View File",icon:"📄",onClick:()=>qe(J)}),ae.push({id:"div1",label:"",divider:!0,onClick:()=>{}})),ae.push({id:"copy-path",label:"Copy Full Path",icon:"🧷",onClick:()=>{navigator.clipboard.writeText(J.path)}}),Q){const Se=J.path.startsWith(Q)?J.path.slice(Q.replace(/\/$/,"").length+1):J.path;ae.push({id:"copy-rel",label:"Copy Relative Path",icon:"📋",onClick:()=>{navigator.clipboard.writeText(Se)}})}J.isDirectory||(ae.push({id:"div2",label:"",divider:!0,onClick:()=>{}}),ae.push({id:"open-editor",label:"Open in Editor",icon:"✏️",onClick:async()=>{try{await Pt(Ot("/api/files/open-in-editor"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:J.path})})}catch{}}}),ae.push({id:"div-del",label:"",divider:!0,onClick:()=>{}}),ae.push({id:"delete",label:"Delete File",icon:"🗑️",danger:!0,onClick:()=>V({path:J.path,name:J.name,status:J.gitStatus||"untracked",repoDir:Q||""})})),z({isOpen:!0,position:{x:ce.clientX,y:ce.clientY},actions:ae})},[qe,Q]),ot=d.reduce((ce,J)=>ce+J.gitStatus.files.length,0);return b.useEffect(()=>{if(!A&&!W&&!we)return;const ce=J=>{J.key==="Escape"&&(J.stopImmediatePropagation(),J.preventDefault(),we?$e(null):W?V(null):Ee())};return document.addEventListener("keydown",ce,!0),()=>document.removeEventListener("keydown",ce,!0)},[A,Ee,W,we]),Qt("guake-git-diff-modal",A!==null,Ee),Qt("guake-git-delete-confirm",W!==null,()=>V(null)),Qt("guake-git-discard-confirm",we!==null,()=>$e(null)),b.useEffect(()=>{if(E==="tree"&&v.size===0&&d.length>0){const ce=new Set;for(const J of d){const ae=Ug(J.gitStatus.files),Se=ee=>{for(const ge of ee)ge.isDirectory&&(ce.add(ge.path),Se(ge.children))};Se(ae)}S(ce)}},[E,d]),o.jsxs(o.Fragment,{children:[W&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:()=>V(null),children:o.jsxs("div",{className:"guake-git-delete-confirm",onClick:ce=>ce.stopPropagation(),children:[o.jsxs("p",{children:["Delete ",o.jsx("strong",{children:W.name}),"?"]}),o.jsx("p",{className:"guake-git-delete-path",children:W.path}),o.jsxs("div",{className:"guake-git-delete-actions",children:[o.jsx("button",{className:"guake-git-delete-cancel",onClick:()=>V(null),children:"Cancel"}),o.jsx("button",{className:"guake-git-delete-btn",onClick:()=>at(W),children:"Delete"})]})]})}),we&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:()=>$e(null),children:o.jsxs("div",{className:"guake-git-delete-confirm",onClick:ce=>ce.stopPropagation(),children:[o.jsxs("p",{children:["Discard changes to ",o.jsx("strong",{children:we.name}),"?"]}),o.jsx("p",{className:"guake-git-delete-path",children:we.path}),o.jsxs("div",{className:"guake-git-delete-actions",children:[o.jsx("button",{className:"guake-git-delete-cancel",onClick:()=>$e(null),children:"Cancel"}),o.jsx("button",{className:"guake-git-delete-btn",onClick:()=>ie(we),children:"Discard"})]})]})}),A&&o.jsx("div",{className:"guake-git-diff-modal-overlay",onClick:Ee,children:o.jsxs("div",{className:"guake-git-diff-modal",onClick:ce=>ce.stopPropagation(),children:[o.jsxs("div",{className:"guake-git-diff-modal-header",children:[_==="changes"&&o.jsxs("div",{className:"guake-git-diff-nav",children:[o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>X(-1),disabled:se<=0,title:"Previous file",children:"‹"}),o.jsx("button",{className:"guake-git-diff-nav-btn",onClick:()=>X(1),disabled:se<0||se>=Ge.length-1,title:"Next file",children:"›"}),se>=0&&o.jsxs("span",{className:"guake-git-diff-nav-counter",children:[se+1," / ",Ge.length]})]}),o.jsxs("span",{className:"guake-git-diff-filename",title:A.data.filePath,children:[A.data.filePath,A.type==="content"&&A.isNewFile&&o.jsx("span",{className:"guake-git-content-badge",children:"new file"})]}),o.jsx("button",{className:"guake-git-close",onClick:Ee,title:"Close (Esc)",children:"×"})]}),o.jsx("div",{className:"guake-git-diff-content",children:A.type==="diff"?o.jsx(Ob,{originalContent:A.data.originalContent,modifiedContent:A.data.modifiedContent,filename:A.data.fileName,language:A.data.language}):o.jsx(Ob,{originalContent:"",modifiedContent:A.data.content,filename:A.data.fileName,language:A.data.language,initialModifiedOnly:!0})})]})}),o.jsxs("div",{className:"guake-git-panel",children:[o.jsxs("div",{className:"guake-git-header",children:[o.jsx("div",{className:"guake-git-title",children:o.jsxs("div",{className:"guake-git-tabs",children:[o.jsxs("button",{className:`guake-git-tab ${_==="changes"?"active":""}`,onClick:()=>R("changes"),children:["🌿 Changes",ot>0&&o.jsx("span",{className:"guake-git-badge",children:ot})]}),o.jsx("button",{className:`guake-git-tab ${_==="explorer"?"active":""}`,onClick:()=>R("explorer"),children:"📁 Files"})]})}),o.jsxs("div",{className:"guake-git-header-actions",children:[o.jsx("button",{className:`guake-git-fetch-btn ${r.size>0?"fetching":""}`,onClick:de,title:"Git fetch",disabled:r.size>0,children:r.size>0?"⏳":"⇣"}),_==="changes"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:`guake-git-view-toggle ${E==="flat"?"active":""}`,onClick:()=>M("flat"),title:"Flat view",children:"☰"}),o.jsx("button",{className:`guake-git-view-toggle ${E==="tree"?"active":""}`,onClick:()=>M("tree"),title:"Tree view",children:"🌲"}),o.jsx("button",{className:"guake-git-refresh",onClick:Z,title:"Refresh",disabled:h,children:h?"⏳":"↻"})]}),_==="explorer"&&o.jsx("button",{className:"guake-git-refresh",onClick:()=>q.loadTree(),title:"Refresh",disabled:q.loading,children:q.loading?"⏳":"↻"}),o.jsx("button",{className:"guake-git-close",onClick:n,title:"Close",children:"×"})]})]}),o.jsxs("div",{className:"guake-git-body",children:[_==="changes"&&o.jsxs(o.Fragment,{children:[h&&d.length===0&&o.jsx("div",{className:"guake-git-loading",children:"Loading git status..."}),!h&&d.length===0&&o.jsx("div",{className:"guake-git-empty",children:"No git changes found"}),d.map(({dir:ce,dirName:J,gitStatus:ae})=>{const Se=s.get(ce);return o.jsxs("div",{className:"guake-git-repo",children:[o.jsxs("div",{className:`guake-git-repo-header ${x.has(ce)?"expanded":""}`,onClick:()=>Ce(ce),children:[o.jsx("span",{className:"guake-git-repo-arrow",children:x.has(ce)?"▼":"▶"}),o.jsx("span",{className:"guake-git-repo-name",children:J}),ae.branch&&o.jsxs("span",{className:"guake-git-repo-branch",children:["⎇ ",ae.branch]}),Se&&Se.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",Se.ahead]}),Se&&Se.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",Se.behind]}),o.jsx("span",{className:"guake-git-repo-count",children:ae.files.length})]}),x.has(ce)&&E==="flat"&&o.jsx("div",{className:"guake-git-file-list",children:ae.files.map(ee=>{const ge=s1[ee.status],Re=Pp(ee.name);return o.jsxs("div",{className:"guake-git-file","data-status":ee.status,onClick:()=>Ne(ee,ce),onContextMenu:Fe=>Ue(Fe,ee,ce),title:ee.path,children:[Re&&o.jsx("img",{src:Re,alt:"",className:"guake-git-file-icon"}),o.jsx("span",{className:"guake-git-file-name",children:ee.name}),o.jsx("span",{className:"guake-git-file-dir",children:ee.path.includes("/")?ee.path.substring(0,ee.path.lastIndexOf("/")):""}),o.jsx("span",{className:"guake-git-file-status",style:{color:ge.color},title:ge.label,children:ge.icon}),o.jsx("button",{className:"guake-git-discard-btn",title:ee.status==="untracked"||ee.status==="added"?"Delete file":"Discard changes",onClick:Fe=>fe(Fe,ee,ce),children:"↩"})]},ee.path)})}),x.has(ce)&&E==="tree"&&o.jsx("div",{className:"guake-git-file-list",children:Ug(ae.files).map(ee=>o.jsx(J1,{node:ee,depth:0,expandedDirs:v,onToggleDir:xe,onFileClick:Ne,onContextMenu:Ue,onDiscard:fe,repoDir:ce},ee.path))})]},ce)})]}),_==="explorer"&&o.jsxs(o.Fragment,{children:[K.length>1&&o.jsx("div",{className:"guake-git-folder-selector",children:K.map((ce,J)=>{const ae=ce.split("/").filter(Boolean).pop()||ce,Se=s.get(ce);return o.jsxs("button",{className:`guake-git-folder-btn ${J===O?"active":""}`,onClick:()=>F(J),title:ce,children:["📂 ",ae,Se&&o.jsxs("span",{className:"guake-git-folder-branch",children:[" ⎇ ",Se.branch]}),Se&&Se.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",children:["↑",Se.ahead]}),Se&&Se.behind>0&&o.jsxs("span",{className:"guake-branch-behind",children:["↓",Se.behind]})]},ce)})}),q.loading&&q.tree.length===0&&o.jsx("div",{className:"guake-git-loading",children:"Loading files..."}),!q.loading&&q.tree.length===0&&o.jsx("div",{className:"guake-git-empty",children:"No files found"}),o.jsx("div",{className:"guake-git-explorer-tree",children:be.map(ce=>o.jsx(Gx,{node:ce,depth:0,selectedPath:$,expandedPaths:q.expandedPaths,onSelect:qe,onToggle:q.togglePath,onContextMenu:it,searchQuery:""},ce.path))})]})]})]}),L&&o.jsx(fo,{isOpen:L.isOpen,position:L.position,worldPosition:{x:0,z:0},actions:L.actions,onClose:Ve})]})}const is={Read:"📖",Write:"✏️",Edit:"📝",Bash:"💻",Glob:"🔍",Grep:"🔎",Task:"📋",Agent:"🤖",WebFetch:"🌐",WebSearch:"🌍",TodoWrite:"✅",NotebookEdit:"📓",AskFollowupQuestion:"❓",AskUserQuestion:"❓",AttemptCompletion:"✨",ListFiles:"📂",SearchFiles:"🔎",ExecuteCommand:"⚙️",spawn_agent:"🧬",send_input:"📨",wait:"⏳",default:"⚡"},D6={Read:"tools:display.toolNames.read",Write:"tools:display.toolNames.write",Edit:"tools:display.toolNames.edit",Bash:"tools:display.toolNames.bash",Glob:"tools:display.toolNames.glob",Grep:"tools:display.toolNames.grep",Task:"tools:display.toolNames.task",Agent:"tools:display.toolNames.agent",WebFetch:"tools:display.toolNames.webFetch",WebSearch:"tools:display.toolNames.webSearch",TodoWrite:"tools:display.toolNames.todoWrite",NotebookEdit:"tools:display.toolNames.notebookEdit",AskFollowupQuestion:"tools:display.toolNames.askFollowupQuestion",AskUserQuestion:"tools:display.toolNames.askUserQuestion",AttemptCompletion:"tools:display.toolNames.attemptCompletion",ListFiles:"tools:display.toolNames.listFiles",SearchFiles:"tools:display.toolNames.searchFiles",ExecuteCommand:"tools:display.toolNames.executeCommand",spawn_agent:"tools:display.toolNames.spawnAgent",send_input:"tools:display.toolNames.sendInput",wait:"tools:display.toolNames.wait"};function Z1(t,e){const n=D6[t];return n&&e(n,{defaultValue:t})||t}function cp(t){return(typeof t=="string"?new Date(t):new Date(t)).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function eT(t,e){var n;try{const s=JSON.parse(e);switch(t){case"Read":case"Write":case"Edit":case"NotebookEdit":{const a=s.file_path||s.path||s.notebook_path;if(a)return a;break}case"Bash":{const a=s.command;if(a)return nT(a);break}case"Grep":{const a=s.pattern,r=s.path;if(a&&r)return`"${a}" in ${r}`;if(a)return`"${a}"`;break}case"Glob":{const a=s.pattern,r=s.path;if(a&&r)return`${a} in ${r}`;if(a)return a;break}case"WebFetch":{const a=s.url;if(a)return a;break}case"WebSearch":{const a=s.query;if(a)return`"${a}"`;break}case"Task":case"Agent":{const a=s.description,r=s.subagent_type;if(a)return r?`[${r}] ${a}`:a;if(s.prompt)return s.prompt;break}case"ExitPlanMode":case"EnterPlanMode":{const a=s.allowedPrompts;return Array.isArray(a)&&a.length>0?a.map(r=>r.prompt||r.tool||"").filter(Boolean).join(", "):t==="ExitPlanMode"&&typeof s.plan=="string"&&s.plan.trim().length>0?s.plan.trim():t==="ExitPlanMode"?"Plan ready":"Entering plan mode"}case"TodoWrite":{const a=s.todos;if(Array.isArray(a)&&a.length>0){const r=a.filter(f=>f.status==="completed").length,i=a.filter(f=>f.status==="in_progress").length,c=a.filter(f=>f.status==="pending").length,d=[];return r>0&&d.push(`${r} done`),i>0&&d.push(`${i} active`),c>0&&d.push(`${c} pending`),`${a.length} items (${d.join(", ")})`}break}case"AskUserQuestion":case"AskFollowupQuestion":{const a=s.questions||s.question;if(a){const r=Array.isArray(a)?(n=a[0])==null?void 0:n.question:a;if(r)return r}break}default:{for(const[,a]of Object.entries(s))if(typeof a=="string"&&a.length>0)return a;break}}}catch{}return null}function tT(t){if(!t.includes("curl")||!t.includes("/api/exec"))return null;const e=[],n=[/(?:-d|--data|--data-raw)\s+'((?:\\'|[^'])*)'/g,/(?:-d|--data|--data-raw)\s+"((?:\\"|[^"])*)"/g];for(const s of n){let a;for(;(a=s.exec(t))!==null;)a[1]&&e.push(a[1])}for(const s of e){const a=[s,s.replace(/\\"/g,'"'),s.replace(/\\'/g,"'"),s.replace(/\\"/g,'"').replace(/\\\\/g,"\\")];for(const r of a){const i=r.trim();if(!(!i.startsWith("{")||!i.endsWith("}")))try{const c=JSON.parse(i);if(typeof c.command=="string"&&c.command.length>0)return c.command}catch{}}}return null}function nT(t){return tT(t)||t}const dA=/(^|[\s("'`])((?:\.{1,2}\/|~\/|\/)?[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\.[A-Za-z0-9._-]+(?::\d+(?::\d+)?)?)/g;function R6(t){return!t||t.startsWith("-")||t.includes("://")||t.includes("*")?!1:t.includes(".")&&!t.endsWith(".")}function sT(t){if(!t)return[{text:""}];const e=[];let n=0;dA.lastIndex=0;let s;for(;(s=dA.exec(t))!==null;){const a=s[0],r=s[1]||"",i=s[2]||"",c=s.index;c>n&&e.push({text:t.slice(n,c)}),r&&e.push({text:r}),R6(i)?e.push({text:i,fileRef:i}):e.push({text:i}),n=c+a.length}return n<t.length&&e.push({text:t.slice(n)}),e.length>0?e:[{text:t}]}const up="tide-file://",O6=/(^|[\s(>])((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)(?=$|[\s),.;])/g,L6=/`((?:\.\.?\/|\/)?(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+(?:\.[A-Za-z0-9._-]+)+(?:#L\d+(?:C\d+)?)?(?::\d+(?::\d+)?)?)`/g,P6=/\.(com|org|net|io|dev|app|co|me|info|biz|us|uk|de|fr|jp|cn|ru|edu|gov|mil|int|xyz|tech|online|site|store|blog|cloud|ai|gg|tv|cc|sh|fm|to|ly|gl|so|is|it|at|nl|ch|se|no|fi|dk|be|cz|pl|pt|br|mx|ar|cl|in|au|nz|za|sg|hk|tw|kr|id|ph|th|vn|my)(?:[:/\s#?]|$)/i;function fA(t){if(!t||t.includes("://")||t.startsWith("www.")||t.includes("@"))return!1;const e=t.split("/")[0];return P6.test(e)?!1:t.includes(".")&&!t.endsWith(".")}function Df(t){if(!t||!t.includes("."))return t;const e=t.split(`
|
|
123
|
+
`);let n=!1;return e.map(a=>{if(a.trimStart().startsWith("```"))return n=!n,a;if(n)return a;const i=a.replace(L6,(c,d)=>{if(!fA(d))return c;const f=encodeURIComponent(d);return`[\`${d}\`](${up}${f})`});return i.replace(O6,(c,d,f,h)=>{const m=h+d.length,x=m>0?i[m-1]:"",y=m+f.length<i.length?i[m+f.length]:"";if(x==="("&&m>1&&i[m-2]==="]"||x==="["||y==="]"||!fA(f))return c;const v=encodeURIComponent(f);return`${d}[${f}](${up}${v})`})}).join(`
|
|
124
|
+
`)}function I6(t){if(!t||!t.startsWith(up))return null;const e=t.slice(up.length);if(!e)return null;try{return decodeURIComponent(e)}catch{return e}}function Ai(t){return t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t}function aT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=Ai(a[2].trim())),!/\brg\s+--files\b/.test(s)||!/\|\s*rg\b/.test(s))return null;const r=s.match(/\|\s*rg\b\s+(.+)$/);if(!r)return null;const i=r[1].trim();if(!i)return null;const c=i.replace(/^(?:-\S+\s+)*/,"").trim(),d=Ai(c||i);return d?{shellPrefix:n,commandBody:s,searchTerm:d}:null}function rT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);a&&(n=`${a[1]} -lc`,s=Ai(a[2].trim()));const r=/\bcurl\b[\s\S]*\/api\/notify\b/.test(s),i=/\bgdbus\b[\s\S]*org\.freedesktop\.Notifications\.Notify\b/.test(s);if(!r&&!i)return null;let c,d;const f=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(f){const h=Ai(f[1]).replace(/\\"/g,'"'),m=h.match(/"title"\s*:\s*"([^"]*)"/),x=h.match(/"message"\s*:\s*"([^"]*)"/);m!=null&&m[1]&&(c=m[1]),x!=null&&x[1]&&(d=x[1])}if(!c||!d){const h=s.match(/Notifications\.Notify[\s\S]*?\s'[^']*'\s+\d+\s+'[^']*'\s+'([^']*)'\s+'([^']*)'/);!c&&(h!=null&&h[1])&&(c=h[1]),!d&&(h!=null&&h[2])&&(d=h[2])}return{shellPrefix:n,commandBody:s,title:c,message:d,viaCurl:r,viaGdbus:i}}function iT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=Ai(a[2].trim())),!/\bcurl\b/.test(s)||!/PATCH/.test(s)||!/\/api\/agents\//.test(s))return null;const r=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(!r)return null;const c=Ai(r[1]).replace(/\\"/g,'"').match(/"taskLabel"\s*:\s*"([^"]*)"/);return c!=null&&c[1]?{shellPrefix:n,commandBody:s,taskLabel:c[1]}:null}function oT(t){const e=t.trim();if(!e)return null;let n,s=e;const a=e.match(/^(\S+)\s+-lc\s+([\s\S]+)$/);if(a&&(n=`${a[1]} -lc`,s=Ai(a[2].trim())),!/\bcurl\b/.test(s)||!/\/api\/agents\/.*\/report-task\b/.test(s))return null;let r="",i="completed";const c=s.match(/<<'?EOF'?\s*\n([\s\S]*?)\nEOF/);if(c)try{const d=JSON.parse(c[1].trim());r=d.summary||"",i=d.status==="failed"?"failed":"completed"}catch{}else{const d=s.match(/-d\s+((['"])([\s\S]*?)\2)/);if(d){const f=Ai(d[1]).replace(/\\"/g,'"'),h=f.match(/"summary"\s*:\s*"([^"]*)"/),m=f.match(/"status"\s*:\s*"([^"]*)"/);h&&(r=h[1]),(m==null?void 0:m[1])==="failed"&&(i="failed")}}return{shellPrefix:n,commandBody:s,summary:r,status:i}}async function Ip(t,e){const n=ji(),s=await fetch(`${Aa()}${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-Auth-Token":n},body:JSON.stringify(e)});if(!s.ok)throw new Error(`Bulk action failed: ${s.statusText}`);const a=await s.json(),r=a.failed||[];return{succeeded:a.deleted||a.stopped||a.cleared||a.moved||[],failed:r}}async function B6(t){return Ip("/api/agents/bulk/delete",{agentIds:t})}async function F6(t){return Ip("/api/agents/bulk/stop",{agentIds:t})}async function z6(t){return Ip("/api/agents/bulk/clear-context",{agentIds:t})}async function $6(t,e){return Ip("/api/agents/bulk/move-area",{agentIds:t,areaId:e})}function H6(t){return Array.from(t.values())}const U6={">1h":3600*1e3,">6h":360*60*1e3,">1d":1440*60*1e3,">3d":4320*60*1e3,">7d":10080*60*1e3,">30d":720*60*60*1e3};function W6(t){const e=Date.now()-t;return e<6e4?"<1m":e<36e5?`${Math.floor(e/6e4)}m`:e<864e5?`${Math.floor(e/36e5)}h`:`${Math.floor(e/864e5)}d`}function pA(t,e){for(const n of e)if(n.assignedAgentIds.includes(t.id))return n;return null}function q6({isOpen:t,onClose:e}){const n=xp(),s=sr(),a=H6(s),[r,i]=b.useState("all"),[c,d]=b.useState("any"),[f,h]=b.useState("all"),[m,x]=b.useState("all"),[y,v]=b.useState("all"),[S,A]=b.useState(""),[k,N]=b.useState(new Set),[j,E]=b.useState(null),[D,_]=b.useState(""),[B,O]=b.useState(null),[T,M]=b.useState(null),[R,F]=b.useState(!1);b.useEffect(()=>{t&&(N(new Set),O(null),M(null),E(null))},[t]);const $=b.useMemo(()=>{const Y=Date.now(),P=S.toLowerCase().trim();return n.filter(K=>{if(r!=="all"&&K.status!==r||c!=="any"&&Y-K.lastActivity<U6[c])return!1;if(f!=="all"){const Q=pA(K,a);if(f==="unassigned"){if(Q!==null)return!1}else if(!Q||Q.id!==f)return!1}if(m!=="all"&&K.provider!==m||y!=="all"&&(K.model||"sonnet")!==y)return!1;if(P){const Q=K.name.toLowerCase().includes(P),q=K.class.toLowerCase().includes(P);if(!Q&&!q)return!1}return!0})},[n,a,r,c,f,m,y,S]);b.useEffect(()=>{const Y=new Set($.map(P=>P.id));N(P=>{const K=new Set;for(const Q of P)Y.has(Q)&&K.add(Q);return K.size!==P.size?K:P})},[$]);const U=b.useCallback(Y=>{N(P=>{const K=new Set(P);return K.has(Y)?K.delete(Y):K.add(Y),K})},[]),L=b.useCallback(()=>{N(new Set($.map(Y=>Y.id)))},[$]),z=b.useCallback(()=>{N(new Set)},[]),W=b.useCallback(async Y=>{const P=Array.from(k);if(P.length!==0){F(!0),O(null),M(null);try{let K,Q="";switch(Y){case"delete":K=await B6(P),Q="Deleted",K.failed.length===0&&N(new Set);break;case"stop":K=await F6(P),Q="Stopped";break;case"clear-context":K=await z6(P),Q="Cleared context for";break;case"move-area":K=await $6(P,D||null),Q="Moved";break}K&&(K.failed.length>0?M(`${Q} ${K.succeeded.length} agent(s). Failed: ${K.failed.length}`):M(`${Q} ${K.succeeded.length} agent(s)`))}catch(K){O(K instanceof Error?K.message:"Action failed")}finally{F(!1),E(null)}}},[k,D]),V=b.useCallback(Y=>{Y.key==="Escape"&&(j?E(null):e())},[j,e]);return t?o.jsx(ir,{children:o.jsx("div",{className:`modal-overlay ${t?"visible":""}`,onClick:e,children:o.jsxs("div",{className:"bulk-manage-modal",onClick:Y=>Y.stopPropagation(),onKeyDown:V,children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{children:"Bulk Agent Management"}),o.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"✕"})]}),o.jsx("div",{className:"bulk-filters",children:o.jsxs("div",{className:"filter-row",children:[o.jsxs("select",{value:r,onChange:Y=>i(Y.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Status"}),o.jsx("option",{value:"idle",children:"Idle"}),o.jsx("option",{value:"working",children:"Working"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"stopped",children:"Stopped"})]}),o.jsxs("select",{value:c,onChange:Y=>d(Y.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"any",children:"Any Idle Time"}),o.jsx("option",{value:">1h",children:"> 1 hour"}),o.jsx("option",{value:">6h",children:"> 6 hours"}),o.jsx("option",{value:">1d",children:"> 1 day"}),o.jsx("option",{value:">3d",children:"> 3 days"}),o.jsx("option",{value:">7d",children:"> 7 days"}),o.jsx("option",{value:">30d",children:"> 30 days"})]}),o.jsxs("select",{value:f,onChange:Y=>h(Y.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Areas"}),o.jsx("option",{value:"unassigned",children:"Unassigned"}),a.map(Y=>o.jsx("option",{value:Y.id,children:Y.name},Y.id))]}),o.jsxs("select",{value:m,onChange:Y=>x(Y.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Providers"}),o.jsx("option",{value:"claude",children:"Claude"}),o.jsx("option",{value:"codex",children:"Codex"}),o.jsx("option",{value:"opencode",children:"OpenCode"})]}),o.jsxs("select",{value:y,onChange:Y=>v(Y.target.value),className:"bulk-filter-select",children:[o.jsx("option",{value:"all",children:"All Models"}),o.jsx("option",{value:"opus",children:"Opus"}),o.jsx("option",{value:"sonnet",children:"Sonnet"}),o.jsx("option",{value:"haiku",children:"Haiku"})]}),o.jsx("input",{type:"text",placeholder:"Search name/class...",value:S,onChange:Y=>A(Y.target.value),className:"bulk-filter-search"})]})}),o.jsxs("div",{className:"bulk-count-bar",children:[o.jsxs("span",{className:"bulk-count",children:[$.length," matched, ",k.size," selected"]}),o.jsxs("div",{className:"bulk-select-controls",children:[o.jsx("button",{className:"bulk-link-btn",onClick:L,children:"Select all"}),o.jsx("button",{className:"bulk-link-btn",onClick:z,children:"Select none"})]})]}),B&&o.jsxs("div",{className:"bulk-alert bulk-alert-error",children:[o.jsx("span",{className:"alert-icon",children:"!"}),B]}),T&&o.jsxs("div",{className:"bulk-alert bulk-alert-success",children:[o.jsx("span",{className:"alert-icon",children:"✓"}),T]}),o.jsx("div",{className:"bulk-agent-list",children:$.length===0?o.jsx("div",{className:"bulk-empty",children:"No agents match the current filters"}):o.jsxs("table",{className:"bulk-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{className:"col-check",children:o.jsx("input",{type:"checkbox",checked:k.size===$.length&&$.length>0,onChange:()=>k.size===$.length?z():L()})}),o.jsx("th",{className:"col-name",children:"Name"}),o.jsx("th",{className:"col-class",children:"Class"}),o.jsx("th",{className:"col-status",children:"Status"}),o.jsx("th",{className:"col-idle",children:"Idle"}),o.jsx("th",{className:"col-area",children:"Area"})]})}),o.jsx("tbody",{children:$.map(Y=>{const P=pA(Y,a);return o.jsxs("tr",{className:k.has(Y.id)?"selected":"",onClick:()=>U(Y.id),children:[o.jsx("td",{className:"col-check",children:o.jsx("input",{type:"checkbox",checked:k.has(Y.id),onChange:()=>U(Y.id),onClick:K=>K.stopPropagation()})}),o.jsx("td",{className:"col-name",children:Y.name}),o.jsx("td",{className:"col-class",children:Y.class}),o.jsx("td",{className:"col-status",children:o.jsx("span",{className:`bulk-status bulk-status-${Y.status}`,children:Y.status})}),o.jsx("td",{className:"col-idle",children:W6(Y.lastActivity)}),o.jsx("td",{className:"col-area",children:P?o.jsx("span",{className:"bulk-area-badge",style:{borderColor:P.color},children:P.name}):o.jsx("span",{className:"bulk-area-none",children:"--"})})]},Y.id)})})]})}),j&&o.jsx("div",{className:"bulk-confirm-overlay",children:o.jsxs("div",{className:"bulk-confirm-box",children:[o.jsx("p",{children:j==="delete"?`Delete ${k.size} agent(s)? This cannot be undone.`:`Clear context for ${k.size} agent(s)? This will restart their sessions.`}),o.jsxs("div",{className:"bulk-confirm-actions",children:[o.jsx("button",{className:"btn btn-secondary",onClick:()=>E(null),disabled:R,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:()=>W(j),disabled:R,children:R?"Working...":"Confirm"})]})]})}),o.jsxs("div",{className:"modal-footer bulk-footer",children:[o.jsxs("div",{className:"footer-buttons-left",children:[o.jsx("button",{className:"btn btn-danger",disabled:k.size===0||R,onClick:()=>E("delete"),children:"Delete Selected"}),o.jsx("button",{className:"btn btn-secondary",disabled:k.size===0||R,onClick:()=>E("clear-context"),children:"Clear Context"})]}),o.jsxs("div",{className:"footer-buttons-right",children:[o.jsx("button",{className:"btn btn-secondary",disabled:k.size===0||R,onClick:()=>W("stop"),children:"Stop Selected"}),o.jsxs("select",{value:D,onChange:Y=>_(Y.target.value),className:"bulk-filter-select",disabled:k.size===0||R,children:[o.jsx("option",{value:"",children:"Unassign area"}),a.map(Y=>o.jsx("option",{value:Y.id,children:Y.name},Y.id))]}),o.jsx("button",{className:"btn btn-primary",disabled:k.size===0||R,onClick:()=>W("move-area"),children:"Move to Area"})]})]})]})})}):null}const V6={working:"🟢",idle:"💤",waiting_input:"🟡",waiting_permission:"🟠",error:"🔴",stopped:"⚫"},hA={working:"overview.statusLabels.working",idle:"overview.statusLabels.idle",waiting_input:"overview.statusLabels.waitingInput",waiting_permission:"overview.statusLabels.waitingPermission",error:"overview.statusLabels.error",stopped:"overview.statusLabels.stopped"};function G6(t){const e=H.getState().agentOutputs.get(t);if(!e||e.length===0)return null;for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.isStreaming)continue;const a=s.text;if(!(a.startsWith("Using tool:")||a.startsWith("Tool input:")||a.startsWith("Tool result:")||a.startsWith("Bash output:"))&&!(a.startsWith("Tokens:")||a.startsWith("Cost:")||a.startsWith("Context:"))&&a.trim().length!==0)return s}return null}function Y6(t){const e=H.getState().agentOutputs.get(t);if(!e)return 0;let n=0;for(const s of e){if(s.isStreaming)continue;const a=s.text;a.startsWith("Using tool:")||a.startsWith("Tool input:")||a.startsWith("Tool result:")||a.startsWith("Bash output:")||a.startsWith("Tokens:")||a.startsWith("Cost:")||a.startsWith("Context:")||a.trim().length!==0&&n++}return n}function xf(t,e){const n=t.split(`
|
|
125
|
+
`)[0];return n.length>e?n.slice(0,e)+"...":n}function K6({activeAgentId:t,onClose:e,onSelectAgent:n,agentListRef:s,twoFingerState:a}){const{t:r}=ht(["terminal","common"]),i=xp(),[c]=bj(),d=b.useMemo(()=>c?i.filter(he=>{const _e=H.getAreaForAgent(he.id);return ax((_e==null?void 0:_e.id)??null)}):i,[i,c]),f=zj(),h=fx(),m=hL(),x=sr(),y=Oj();b.useEffect(()=>{for(const he of d)!H.hasHistoryBeenFetched(he.id)&&!H.isLoadingHistoryForAgent(he.id)&&H.requestAgentSupervisorHistory(he.id)},[d]);const v=b.useMemo(()=>ea(pt.AOP_CONFIG,{groupByArea:!0,sortMode:"recent",filterMode:"all",allExpanded:!1,sameAreaOnly:!1,showSubagents:!0,showRecentActivity:!0,visibleAreaIds:null}),[]),[S,A]=b.useState(()=>v.allExpanded?new Set(d.map(he=>he.id)):new Set),[k,N]=b.useState(new Set),[j,E]=b.useState(null),[D,_]=b.useState(""),[B,O]=b.useState(v.sortMode),[T,M]=b.useState(v.filterMode),[R,F]=b.useState(""),[$,U]=b.useState(v.groupByArea),[L,z]=b.useState(v.allExpanded),[W,V]=b.useState(v.sameAreaOnly),[Y,P]=b.useState(v.showSubagents),[K,Q]=b.useState(v.showRecentActivity),[q,be]=b.useState(v.visibleAreaIds?new Set(v.visibleAreaIds):null),[ue,Z]=b.useState(!1),[de,Ce]=b.useState(""),[xe,Ne]=b.useState(!1),qe=b.useRef(null),[Ge,X]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[se,Ee]=b.useState(()=>typeof window<"u"?window.matchMedia("(max-width: 768px)").matches:!1),[Ve,at]=b.useState(null),[we,$e]=b.useState(null),ie=b.useRef(null),fe=b.useRef(null),Ue=s||fe,it=b.useRef(!1),ot=b.useRef(new Map),ce=a||{hoveredAgentId:null};b.useEffect(()=>{if(typeof window>"u")return;const he=window.matchMedia("(max-width: 768px)"),_e=nt=>{X(nt),Ee(nt)};_e(he.matches);const We=nt=>_e(nt.matches);return he.addEventListener("change",We),()=>he.removeEventListener("change",We)},[]),b.useEffect(()=>{if(!ue){Ce("");return}const he=_e=>{qe.current&&!qe.current.contains(_e.target)&&(Z(!1),Ce(""))};return document.addEventListener("mousedown",he),()=>document.removeEventListener("mousedown",he)},[ue]),b.useEffect(()=>{const he=_e=>{var nt,_t;_e.altKey&&_e.shiftKey&&!_e.ctrlKey&&!_e.metaKey&&_e.code==="KeyF"&&(_e.preventDefault(),(nt=ie.current)==null||nt.focus(),(_t=ie.current)==null||_t.select())};return document.addEventListener("keydown",he,!0),()=>document.removeEventListener("keydown",he,!0)},[]),b.useEffect(()=>{wa(pt.AOP_CONFIG,{groupByArea:$,sortMode:B,filterMode:T,allExpanded:L,sameAreaOnly:W,showSubagents:Y,showRecentActivity:K,visibleAreaIds:q?Array.from(q):null})},[$,B,T,L,W,Y,K,q]);const J=b.useMemo(()=>{const he=[];for(const[,_e]of x)_e.archived||he.push({id:_e.id,name:_e.name,color:_e.color});return he.sort((_e,We)=>_e.name.localeCompare(We.name,void 0,{sensitivity:"base"})),he},[x]),ae=q===null,Se=b.useCallback(he=>{be(_e=>{if(_e===null){const nt=new Set(J.map(_t=>_t.id));return nt.add("__unassigned__"),nt.delete(he),nt}const We=new Set(_e);return We.has(he)?We.delete(he):We.add(he),We.size>=J.length+1?null:We})},[J]),ee=b.useCallback(()=>be(null),[]),ge=b.useMemo(()=>{const he=new Map;for(const _e of d){const We=H.getAreaForAgent(_e.id);!We||We.archived||he.set(_e.id,{color:We.color,name:We.name})}return he},[d,x]),Re=b.useMemo(()=>{const he=new Map;for(const _e of h){const We=he.get(_e.agentId)||[];We.push(_e),he.set(_e.agentId,We)}return he},[h]),Fe=b.useMemo(()=>{const he=new Map;for(const[,_e]of m){const We=he.get(_e.parentAgentId)||[];We.push(_e),he.set(_e.parentAgentId,We)}return he},[m]),oe=b.useMemo(()=>{const he=new Map;for(const _e of d){const We=H.getAreaForAgent(_e.id);!We||We.archived||he.set(_e.id,We.id)}return he},[d,x]),[Le,te]=b.useMemo(()=>{const he=oe.get(t)??null,_e=new Map;return[d.filter(nt=>{if(T==="working"&&nt.status!=="working"||T==="idle"&&nt.status!=="idle"||T==="error"&&nt.status!=="error"||W&&(oe.get(nt.id)??null)!==he)return!1;if(R){const _t=R.toLowerCase();if(nt.name.toLowerCase().includes(_t)||nt.id.includes(_t)||(nt.class||"").toLowerCase().includes(_t)||(nt.taskLabel||"").toLowerCase().includes(_t))return!0;const Bt=nt.lastAssignedTask||"";if(Bt.toLowerCase().includes(_t))return _e.set(nt.id,{type:"task",text:Bt}),!0;const Ct=H.getAgentSupervisorHistory(nt.id);for(const $t of Ct){const Vt=$t.analysis.recentWorkSummary,gt=$t.analysis.statusDescription;if(Vt.toLowerCase().includes(_t))return _e.set(nt.id,{type:"history",text:Vt}),!0;if(gt.toLowerCase().includes(_t))return _e.set(nt.id,{type:"history",text:gt}),!0}for(const $t of y)if($t.agentId===nt.id&&$t.filePath.toLowerCase().includes(_t))return _e.set(nt.id,{type:"file",text:$t.filePath}),!0;return!1}return!0}),_e]},[d,T,R,W,oe,t,y]),pe=b.useCallback((he,_e="__default__")=>{const We=new Set(he.map(ut=>ut.id)),nt=ot.current.get(_e),_t=!nt||nt.length!==he.length||nt.some(ut=>!We.has(ut)),Bt=ut=>{const ft=!!(ut.isBoss||ut.class==="boss");if(B==="name")return`${ft?"0":"1"}`;if(B==="status"){const cn=["working","waiting_input","waiting_permission","error","idle","stopped"].indexOf(ut.status),Dn=f.has(ut.id)?"0":"1";return`${ft?"0":"1"}-${cn}-${Dn}`}return`${ft?"0":"1"}`};let Ct=!1;if(nt&&!_t){const ut=ot.current.get(_e+"__buckets");if(ut)for(const ft of he){const Ft=nt.indexOf(ft.id);if(Ft>=0&&ut[Ft]!==Bt(ft)){Ct=!0;break}}else Ct=!0}let $t;if(_t||Ct||B==="recent")$t=[...he].sort((ut,ft)=>{var zs,Ia;const Ft=!!(ut.isBoss||ut.class==="boss"),cn=!!(ft.isBoss||ft.class==="boss");if(Ft!==cn)return Ft?-1:1;if(B==="name")return ut.name.localeCompare(ft.name);if(B==="status"){const $s=["working","waiting_input","waiting_permission","error","idle","stopped"],ra=$s.indexOf(ut.status)-$s.indexOf(ft.status);if(ra!==0)return ra;const ms=f.has(ut.id),Et=f.has(ft.id);if(ms!==Et)return ms?-1:1;if(ut.status==="working"&&ft.status==="working")return ut.name.localeCompare(ft.name);if(ut.status==="idle"&&ft.status==="idle"){const Zn=!!ut.taskLabel,Vn=!!ft.taskLabel;return Zn!==Vn?Zn?-1:1:(ft.lastActivity||0)-(ut.lastActivity||0)}return(ft.lastActivity||0)-(ut.lastActivity||0)}const Dn=((zs=(Re.get(ut.id)||[])[0])==null?void 0:zs.timestamp)||ut.lastActivity||0;return(((Ia=(Re.get(ft.id)||[])[0])==null?void 0:Ia.timestamp)||ft.lastActivity||0)-Dn});else{const ut=new Map(he.map(ft=>[ft.id,ft]));$t=nt.map(ft=>ut.get(ft)).filter(Boolean)}const Vt=$t.map(ut=>ut.id),gt=$t.map(ut=>Bt(ut));return ot.current.set(_e,Vt),ot.current.set(_e+"__buckets",gt),$t},[B,Re,f]),ke=b.useMemo(()=>{if(!$)return[{area:null,agents:pe(Le,"__flat__")}];const he=new Map,_e=[];for(const nt of Le){const _t=H.getAreaForAgent(nt.id);if(!_t||_t.archived){_e.push(nt);continue}const Bt=he.get(_t.id);Bt?Bt.push(nt):he.set(_t.id,[nt])}const We=[];for(const[nt,_t]of x){if(_t.archived||q&&!q.has(nt))continue;const Bt=he.get(nt)||[];Bt.length>0&&We.push({area:_t,agents:pe(Bt,`area_${nt}`)})}return _e.length>0&&(!q||q.has("__unassigned__"))&&We.push({area:null,agents:pe(_e,"__unassigned__")}),We},[x,Le,pe,$,q]),Be=b.useCallback(he=>{const _e=Ct=>f.has(Ct.id),We=he.findIndex(Ct=>_e(Ct)&&Ct.status!=="working"),nt=We>=0,_t=he.findIndex(Ct=>Ct.status==="idle"&&!_e(Ct)),Bt=_t>=0&&he.slice(0,_t).some(Ct=>Ct.status==="working"||_e(Ct));return he.map((Ct,$t)=>o.jsxs(je.Fragment,{children:[nt&&$t===We&&o.jsx("div",{className:"aop-status-separator aop-status-separator--unread",role:"separator","aria-label":"unread notifications",children:o.jsx("span",{children:"Unread notifications"})}),Bt&&$t===_t&&o.jsx("div",{className:"aop-status-separator",role:"separator","aria-label":"idle agents",children:o.jsx("span",{children:r("terminal:overview.statusLabels.idle")})}),o.jsx(Q6,{agent:Ct,isActive:Ct.id===t,isExpanded:S.has(Ct.id),isMobile:Ge,hasPendingRead:f.has(Ct.id),isTwoFingerHovered:ce.hoveredAgentId===Ct.id,showSubagents:Y,showRecentActivity:K,showAreaChip:!$,toolExecs:Re.get(Ct.id)||[],subagents:Fe.get(Ct.id)||[],areaInfo:ge.get(Ct.id),matchContext:te.get(Ct.id),onToggle:()=>ze(Ct.id),onSelect:()=>n(Ct.id),onClearContext:()=>H.clearContext(Ct.id),onContextMenu:Vt=>$e({agentId:Ct.id,position:Vt})})]},Ct.id))},[r,t,S,f,ce.hoveredAgentId,Y,K,$,Re,Fe,ge,te,n]),Ke=b.useMemo(()=>{const he={total:d.length,working:0,idle:0,error:0};for(const _e of d)_e.status==="working"?he.working++:_e.status==="error"?he.error++:_e.status==="idle"&&he.idle++;return he},[d]),ze=he=>{A(_e=>{const We=new Set(_e);return We.has(he)?We.delete(he):We.add(he),We})},Ze=he=>{N(_e=>{const We=new Set(_e);return We.has(he)?We.delete(he):We.add(he),We})},lt=()=>{A(new Set(d.map(he=>he.id))),z(!0)},et=()=>{A(new Set),z(!1)},ct=b.useCallback(he=>{window.dispatchEvent(new CustomEvent("tide:open-spawn-modal",{detail:{areaId:he.id,position:{x:he.center.x,z:he.center.z}}}))},[]),st=b.useCallback((he,_e)=>{at({areaId:he.id,position:_e})},[]),bt=b.useMemo(()=>{if(!Ve)return[];const he=x.get(Ve.areaId);return he?[{id:"spawn-agent",label:r("common:agentBar.newAgent"),icon:"+",onClick:()=>ct(he)}]:[]},[Ve,x,ct,r]),Tt=b.useMemo(()=>{if(!we)return[];const he=d.find(We=>We.id===we.agentId);if(!he)return[];const _e=S.has(he.id);return[{id:"toggle-expand",label:_e?r("terminal:overview.collapse",{defaultValue:"Collapse"}):r("terminal:overview.expand",{defaultValue:"Expand"}),icon:_e?"▾":"▸",onClick:()=>ze(he.id)},{id:"clear-context",label:r("terminal:overview.clearContext",{defaultValue:"Clear context"}),icon:"🧹",onClick:()=>H.clearContext(he.id)},{id:"remove-agent",label:r("terminal:overview.removeAgent",{defaultValue:"Remove agent"}),icon:"🗑",danger:!0,onClick:()=>H.removeAgent(he.id)}]},[we,d,S,r]);return b.useEffect(()=>{const he=Ue.current;if(!he)return;const _e=requestAnimationFrame(()=>{const We=he.querySelector(".aop-agent-card.active");if(!We)return;const nt=he.getBoundingClientRect(),_t=We.getBoundingClientRect(),Bt=_t.top-nt.top,Ct=he.scrollTop+Bt-(nt.height-_t.height)/2,$t=Math.max(0,Ct);Math.abs(he.scrollTop-$t)<2||(he.scrollTo({top:$t,behavior:it.current?"smooth":"auto"}),it.current=!0)});return()=>cancelAnimationFrame(_e)},[t]),o.jsxs("div",{className:`agent-overview-panel${Ge&&se?" mobile-filters-collapsed":""}`,children:[o.jsxs("div",{className:"aop-stats-row",children:[o.jsx("span",{className:"stat",children:r("terminal:overview.agents",{count:Ke.total})}),Ke.working>0&&o.jsxs("span",{className:"stat stat-working",children:["🟢 ",Ke.working]}),Ke.idle>0&&o.jsxs("span",{className:"stat stat-idle",children:["💤 ",Ke.idle]}),Ke.error>0&&o.jsxs("span",{className:"stat stat-error",children:["🔴 ",Ke.error]}),o.jsxs("div",{className:"aop-row-controls",children:[o.jsx("button",{type:"button",className:"aop-search-toggle",onClick:()=>{Ee(!1),requestAnimationFrame(()=>{var he;return(he=ie.current)==null?void 0:he.focus()})},title:"Search agents",children:"🔍"}),o.jsx("button",{type:"button",className:`aop-filters-toggle${se?" collapsed":""}`,onClick:()=>Ee(he=>!he),title:se?"Show filters":"Hide filters",children:se?"Filters":"Hide filters"}),o.jsxs("select",{value:T,onChange:he=>M(he.target.value),className:"filter-select",children:[o.jsx("option",{value:"all",children:r("terminal:overview.allStatus")}),o.jsx("option",{value:"working",children:r("terminal:overview.statusLabels.working")}),o.jsx("option",{value:"idle",children:r("terminal:overview.statusLabels.idle")}),o.jsx("option",{value:"error",children:r("terminal:overview.statusLabels.error")})]}),o.jsxs("select",{value:B,onChange:he=>O(he.target.value),className:"filter-select",children:[o.jsx("option",{value:"recent",children:r("terminal:overview.mostRecent")}),o.jsx("option",{value:"status",children:r("terminal:overview.byStatus")}),o.jsx("option",{value:"name",children:r("terminal:overview.byName")})]}),o.jsx("input",{ref:ie,type:"text",placeholder:r("terminal:overview.searchAgents"),value:R,onChange:he=>F(he.target.value),onKeyDown:he=>{he.key==="Enter"&&(he.nativeEvent.isComposing||R.trim().length!==0&&Le.length!==0&&(he.preventDefault(),n(Le[0].id),F("")))},className:"search-input"}),o.jsx("button",{className:"close-btn",onClick:e,title:r("common:buttons.close"),children:"✕"})]})]}),o.jsxs("div",{className:"aop-actions",children:[o.jsx("button",{onClick:lt,className:"action-btn",title:r("common:buttons.expand"),children:r("common:buttons.expand")}),o.jsx("button",{onClick:et,className:"action-btn",title:r("common:buttons.collapse"),children:r("common:buttons.collapse")}),o.jsx(xj,{}),o.jsx("button",{onClick:()=>U(he=>!he),className:`action-btn action-btn--toggle${$?" active":""}`,title:r("terminal:overview.areas"),children:r("terminal:overview.areas")}),$&&J.length>0&&o.jsxs("div",{className:"aop-area-filter",ref:qe,children:[o.jsxs("button",{className:`action-btn action-btn--toggle${ae?"":" active"}`,onClick:()=>Z(he=>!he),title:"Filter areas",children:[ae?"All areas":`${q.size} areas`,o.jsx("span",{className:"aop-area-filter-caret",children:ue?"▴":"▾"})]}),ue&&o.jsxs("div",{className:"aop-area-filter-dropdown",children:[J.length>=5&&o.jsx("div",{className:"aop-area-filter-search",children:o.jsx("input",{type:"text",placeholder:"Filter areas...",value:de,onChange:he=>Ce(he.target.value),onClick:he=>he.stopPropagation(),autoFocus:!0})}),(()=>{const he=de.toLowerCase().trim(),_e=he?J.filter(nt=>nt.name.toLowerCase().includes(he)):J,We=!he||"unassigned".includes(he);return o.jsxs(o.Fragment,{children:[!he&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"aop-area-filter-option",onClick:ee,children:[o.jsx("input",{type:"checkbox",checked:ae,readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:"#6272a4"}}),o.jsx("span",{children:"All"})]}),o.jsx("div",{className:"aop-area-filter-divider"})]}),_e.map(nt=>{const _t=ae||((q==null?void 0:q.has(nt.id))??!1);return o.jsxs("label",{className:"aop-area-filter-option",onClick:Bt=>{Bt.preventDefault(),Se(nt.id)},children:[o.jsx("input",{type:"checkbox",checked:_t,readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:nt.color}}),o.jsx("span",{className:"aop-area-filter-name",children:nt.name})]},nt.id)}),We&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"aop-area-filter-divider"}),o.jsxs("label",{className:"aop-area-filter-option",onClick:nt=>{nt.preventDefault(),Se("__unassigned__")},children:[o.jsx("input",{type:"checkbox",checked:ae||((q==null?void 0:q.has("__unassigned__"))??!1),readOnly:!0}),o.jsx("span",{className:"aop-area-filter-color",style:{background:"#6272a4"}}),o.jsx("span",{className:"aop-area-filter-name",children:"Unassigned"})]})]}),he&&_e.length===0&&!We&&o.jsx("div",{className:"aop-area-filter-empty",children:"No matching areas"})]})})()]})]}),o.jsx("button",{onClick:()=>V(he=>!he),className:`action-btn action-btn--toggle${W?" active":""}`,title:r("terminal:overview.sameAreaOnly"),children:r("terminal:overview.sameAreaOnly")}),o.jsx("button",{onClick:()=>P(he=>!he),className:`action-btn action-btn--toggle${Y?" active":""}`,title:"Subagents",children:"Subagents"}),o.jsx("button",{onClick:()=>Q(he=>!he),className:`action-btn action-btn--toggle${K?" active":""}`,title:r("terminal:overview.recentActivity"),children:"Activity"}),o.jsx("button",{onClick:()=>Ne(!0),className:"action-btn",title:"Bulk manage agents",children:"Bulk Manage"})]}),o.jsx("div",{className:"aop-agent-list",ref:Ue,children:ke.length===0?o.jsx("div",{className:"aop-empty",children:d.length===0?r("terminal:overview.noAgentsDeployed"):r("terminal:overview.noAgentsMatch")}):ke.map(he=>{var Bt,Ct,$t;const _e=((Bt=he.area)==null?void 0:Bt.id)||"__unassigned__",We=((Ct=he.area)==null?void 0:Ct.name)||($?r("terminal:overview.unassigned"):""),nt=(($t=he.area)==null?void 0:$t.color)||"#6272a4",_t=k.has(_e);return o.jsxs("div",{className:"aop-area-group",children:[$&&o.jsxs("div",{className:"aop-area-header",onClick:()=>Ze(_e),style:{borderLeftColor:nt},children:[o.jsx("span",{className:"aop-area-expand",children:_t?"▸":"▾"}),o.jsx("span",{className:"aop-area-color",style:{background:nt}}),o.jsx("span",{className:"aop-area-name",onContextMenu:Vt=>{he.area&&(Vt.preventDefault(),Vt.stopPropagation(),st(he.area,{x:Vt.clientX,y:Vt.clientY}))},children:We}),o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Hide area",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation(),Se(_e)},children:"◉"}),he.area&&o.jsx("button",{type:"button",className:"aop-area-eye-btn",title:"Edit area prompt",onClick:Vt=>{Vt.preventDefault(),Vt.stopPropagation();const gt=he.area;j===gt.id?E(null):(_(gt.prompt||""),E(gt.id))},children:"✎"}),he.area&&(()=>{const Vt=he.area;return o.jsx("button",{type:"button",className:"aop-area-add-btn",title:r("common:agentBar.newAgent"),onClick:gt=>{gt.preventDefault(),gt.stopPropagation();const ut=gt.currentTarget.getBoundingClientRect();st(Vt,{x:ut.left,y:ut.bottom+6})},children:"+"})})(),o.jsx("span",{className:"aop-area-count",children:he.agents.length})]}),j===_e&&he.area&&o.jsxs("div",{className:"aop-area-prompt-editor",onClick:Vt=>Vt.stopPropagation(),children:[o.jsx("textarea",{className:"aop-area-prompt-textarea",value:D,onChange:Vt=>_(Vt.target.value),placeholder:"System prompt for agents in this area...",rows:3,autoFocus:!0}),o.jsxs("div",{className:"aop-area-prompt-actions",children:[o.jsx("button",{className:"aop-area-prompt-save",onClick:()=>{H.updateArea(he.area.id,{prompt:D}),E(null)},children:"Save"}),o.jsx("button",{className:"aop-area-prompt-cancel",onClick:()=>E(null),children:"Cancel"})]})]}),(!$||!_t)&&o.jsx("div",{className:$?"aop-area-content":void 0,children:Be(he.agents)})]},_e)})}),o.jsx(fo,{isOpen:Ve!==null,position:(Ve==null?void 0:Ve.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:bt,onClose:()=>at(null)}),o.jsx(fo,{isOpen:we!==null,position:(we==null?void 0:we.position)??{x:0,y:0},worldPosition:{x:0,z:0},actions:Tt,onClose:()=>$e(null)}),o.jsx(q6,{isOpen:xe,onClose:()=>Ne(!1)})]})}function Q6({agent:t,isActive:e,isExpanded:n,isMobile:s,hasPendingRead:a,isTwoFingerHovered:r,showSubagents:i,showRecentActivity:c,showAreaChip:d,toolExecs:f,subagents:h,areaInfo:m,matchContext:x,onToggle:y,onSelect:v,onClearContext:S,onContextMenu:A}){const{t:k}=ht(["terminal","common"]),N=ar(),j=rr(t.class,N),E=t.isBoss||t.class==="boss",D=V6[t.status]||"❓",_=hA[t.status]?k(`terminal:${hA[t.status]}`):t.status,B=f.slice(0,s?4:8),O=G6(t.id),T=Y6(t.id),M=s?40:80,R=b.useMemo(()=>{var Ue,it,ot,ce,J,ae,Se;const ie=[],fe=new Set;for(const ee of h)ie.push({id:ee.id,name:ee.name,type:ee.subagentType,description:ee.description,status:ee.status,timestamp:ee.startedAt}),fe.add(ee.name);for(const ee of f){if(ee.toolName!=="Task"&&ee.toolName!=="Agent")continue;const Re=((Ue=ee.toolInput)==null?void 0:Ue.description)||((it=ee.toolInput)==null?void 0:it.name)||""||((ce=(ot=ee.toolInput)==null?void 0:ot.prompt)==null?void 0:ce.slice(0,40))||"Task";fe.has(Re)||(fe.add(Re),ie.push({id:`task-${ee.timestamp}`,name:Re,type:((J=ee.toolInput)==null?void 0:J.subagent_type)||"unknown",description:(Se=(ae=ee.toolInput)==null?void 0:ae.prompt)==null?void 0:Se.slice(0,100),status:"completed",timestamp:ee.timestamp}))}return ie.sort((ee,ge)=>ge.timestamp-ee.timestamp),ie},[h,f]),F=R.filter(ie=>ie.status==="working"||ie.status==="spawning"),$=i&&R.length>0,U=c&&B.length>0,L=$||U,z=t.contextLimit>0?t.contextUsed/t.contextLimit:0,W=Math.min(100,z*100),V=Math.min(1,Math.max(0,z)),P=`hsl(${Math.round((1-V)*120)} 80% 45% / 0.55)`,K=112,Q=56,[q,be]=b.useState(0),[ue,Z]=b.useState(!1),[de,Ce]=b.useState(!1),xe=b.useRef(0),Ne=b.useRef(0),qe=b.useRef(0),Ge=b.useRef(!1),X=b.useRef(!1),se=b.useRef(!1);b.useEffect(()=>{s||(be(0),Z(!1),Ce(!1))},[s]);const Ee=b.useCallback(()=>{if(se.current){se.current=!1;return}if(ue){be(0),Z(!1),se.current=!0;return}v()},[v,ue]),Ve=b.useCallback(ie=>{if(!s||ie.touches.length!==1)return;const fe=ie.touches[0];xe.current=fe.clientX,Ne.current=fe.clientY,qe.current=ue?K:0,Ge.current=!1,X.current=!1,Ce(!0)},[s,ue]),at=b.useCallback(ie=>{if(!s||!de||ie.touches.length!==1)return;const fe=ie.touches[0],Ue=fe.clientX-xe.current,it=fe.clientY-Ne.current;if(!Ge.current){if(Math.abs(Ue)<8&&Math.abs(it)<8)return;Ge.current=!0,X.current=Math.abs(Ue)>Math.abs(it)}if(!X.current)return;ie.preventDefault();const ot=Math.max(0,Math.min(K,qe.current-Ue));be(ot)},[s,de]),we=b.useCallback(()=>{if(!s||!de)return;if(Ce(!1),!X.current){ue||be(0);return}const ie=q>=Q,fe=ie!==ue||q!==(ie?K:0);Z(ie),be(ie?K:0),fe&&(se.current=!0)},[s,de,q,ue]),$e=b.useCallback(ie=>{ie.stopPropagation(),S(),Z(!1),be(0),se.current=!0},[S]);return o.jsxs("div",{className:`aop-agent-swipe${s?" swipe-enabled":""}${ue?" revealed":""}`,children:[s&&o.jsxs("button",{type:"button",className:"aop-swipe-clear-action",onClick:$e,title:k("terminal:overview.clearContext",{defaultValue:"Clear context"}),children:["🧹 ",k("terminal:overview.clearContext",{defaultValue:"Clear"})]}),o.jsxs("div",{className:`aop-agent-card ${E?"boss":""} ${e?"active":""} ${t.status} ${a?"unread":""}${r?" two-finger-hover":""}`,"data-agent-id":t.id,draggable:!0,onDragStart:ie=>{ie.dataTransfer.setData("application/x-agent-id",t.id),ie.dataTransfer.effectAllowed="copy",ie.currentTarget.style.opacity="0.5"},onDragEnd:ie=>{ie.currentTarget.style.opacity=""},onClick:Ee,onTouchStart:Ve,onTouchMove:at,onTouchEnd:we,onTouchCancel:we,style:s?{transform:`translateX(-${q}px)`,transition:de?"none":"transform 0.18s ease"}:void 0,children:[o.jsxs("div",{className:"aop-agent-header",onContextMenu:ie=>{ie.preventDefault(),ie.stopPropagation(),A({x:ie.clientX,y:ie.clientY})},children:[o.jsx("button",{type:"button",className:"aop-expand-icon","aria-label":n?"Collapse agent":"Expand agent",onClick:ie=>{ie.stopPropagation(),y()},children:n?"▾":"▸"}),o.jsx("span",{className:"aop-agent-status",title:_,children:D}),t.status==="working"&&o.jsx("span",{className:"aop-working-indicator","aria-label":k("terminal:overview.statusLabels.working"),title:k("terminal:overview.statusLabels.working")}),o.jsx("img",{src:t.provider==="codex"?"/assets/codex.png":t.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:t.provider,className:"aop-provider-icon",title:t.provider==="codex"?"Codex Agent":t.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),o.jsxs("span",{className:"aop-agent-name",title:k("terminal:overview.clickToSwitch"),style:m?{background:`${m.color}12`,borderColor:`${m.color}28`}:void 0,children:[E&&o.jsx("span",{className:"aop-boss-crown","aria-hidden":"true",children:"👑"}),t.name]}),o.jsx("span",{className:"aop-agent-class-icon",style:{color:`color-mix(in srgb, ${j.color} 60%, var(--text-muted))`},title:t.class||"agent",children:j.icon}),a&&o.jsx("span",{className:"aop-pending-read-indicator",title:"Pending read",children:"!"}),T>0&&o.jsx("span",{className:"aop-msg-count",title:k("terminal:overview.messages",{count:T}),children:T}),F.length>0&&o.jsxs("span",{className:"aop-subagent-count",title:F.map(ie=>`${ie.name}: ${ie.description||ie.type}`).join(`
|
|
126
|
+
`),children:["⑂",F.length]}),R.length>0&&F.length===0&&o.jsxs("span",{className:"aop-subagent-count",title:k("terminal:overview.subagentsCompleted",{count:R.length}),style:{opacity:.5},children:["⑂",R.length]}),t.class&&o.jsx("span",{className:"aop-agent-class",style:{color:`color-mix(in srgb, ${j.color} 65%, var(--text-muted))`,background:`${j.color}10`,borderColor:`${j.color}25`},children:t.class}),d&&m&&o.jsx("span",{className:"aop-area-chip",style:{background:`${m.color}10`,borderColor:`${m.color}25`,color:`color-mix(in srgb, ${m.color} 65%, var(--text-muted))`},children:m.name})]}),t.taskLabel&&o.jsxs("div",{className:"aop-task-label",title:t.taskLabel,children:[o.jsx("span",{className:"task-prefix",children:"📋"}),o.jsx("span",{className:"task-text",children:xf(t.taskLabel,M)})]}),O&&(n||O.isUserPrompt)&&o.jsxs("div",{className:`aop-last-message ${O.isUserPrompt?"user":"assistant"}`,title:O.text.split(`
|
|
127
|
+
`)[0],children:[o.jsx("span",{className:"lm-prefix",children:O.isUserPrompt?"▶":"◀"}),o.jsx("span",{className:"lm-text",children:xf(O.text,M)}),o.jsx("span",{className:"lm-time",children:cp(O.timestamp)})]}),x&&o.jsxs("div",{className:`aop-match-context aop-match-context--${x.type}`,title:x.text,children:[o.jsx("span",{className:"match-icon",children:x.type==="history"?"📜":x.type==="file"?"📄":"💬"}),o.jsx("span",{className:"match-label",children:x.type==="history"?"history":x.type==="file"?"file":"task"}),o.jsx("span",{className:"match-text",children:xf(x.text,M)})]}),n&&o.jsxs("div",{className:"aop-agent-body",children:[$&&o.jsxs("div",{className:"aop-subagents",children:[o.jsx("div",{className:"aop-section-label",children:k("terminal:overview.subagents",{count:R.length})}),R.map(ie=>o.jsxs("div",{className:`aop-subagent-item ${ie.status}`,children:[o.jsx("span",{className:"sub-icon",children:ie.status==="completed"?"✅":ie.status==="failed"?"❌":ie.status==="unknown"?"⬜":"⑂"}),o.jsx("span",{className:"sub-name",children:ie.name}),o.jsx("span",{className:"sub-type",children:ie.type}),ie.description&&o.jsx("span",{className:"sub-desc",title:ie.description,children:xf(ie.description,s?30:50)})]},ie.id))]}),U&&o.jsxs("div",{className:"aop-tool-timeline",children:[o.jsx("div",{className:"aop-section-label",children:k("terminal:overview.recentActivity")}),B.map((ie,fe)=>{var it,ot;const Ue=ie.toolInput&&(ie.toolInput.file_path||((it=ie.toolInput.command)==null?void 0:it.slice(0,40))||ie.toolInput.pattern||ie.toolInput.description||((ot=ie.toolInput.prompt)==null?void 0:ot.slice(0,50)))||"";return o.jsxs("div",{className:"aop-timeline-entry",children:[o.jsx("span",{className:"tl-time",children:cp(ie.timestamp)}),o.jsx("span",{className:"tl-icon",children:is[ie.toolName]||is.default}),o.jsx("span",{className:"tl-tool",children:ie.toolName}),Ue&&o.jsx("span",{className:"tl-param",children:Ue})]},`${ie.timestamp}-${fe}`)})]}),!L&&(i||c)&&o.jsx("div",{className:"aop-no-activity",children:k("terminal:overview.noToolActivity")})]}),t.contextLimit>0&&o.jsx("div",{className:"aop-context-bar",title:`${Math.round(z*100)}% context used (${Math.round(t.contextUsed/1e3)}k / ${Math.round(t.contextLimit/1e3)}k)`,children:o.jsx("div",{className:"aop-context-fill",style:{width:`${W}%`,backgroundColor:P}})})]})]})}function X6(t){if("type"in t&&"content"in t){const n=t;let s=n.content||"";return n._bashOutput&&(s+=" "+n._bashOutput),n._bashCommand&&(s+=" "+n._bashCommand),n.toolName&&(s+=" "+n.toolName),s}return t.text||""}function J6(t,e){if(e==="advanced")return!0;if("type"in t&&"content"in t){const a=t,r=a.content||"";return!(a.type==="user"&&(r.includes("<command-name>/cost</command-name>")||r.includes("<command-name>/compact</command-name>"))||a.type==="tool_result")}const n=t;if(e==="chat"){if(n.isUserPrompt)return!0;const a=n.text||"";return!(a.startsWith("Using tool:")||a.startsWith("Tool result:")||a.startsWith("Tool error:"))}return!(n.text||"").startsWith("Tool result:")}function Z6({selectedAgentId:t,isOpen:e,allItems:n,viewMode:s,hasMoreHistory:a,loadAllHistory:r,loadingMore:i}){const[c,d]=b.useState(!1),[f,h]=b.useState(""),[m,x]=b.useState(0),[y,v]=b.useState(null),[S,A]=b.useState(!1),k=b.useRef(null),N=b.useRef(!1);b.useEffect(()=>{if(!c){N.current=!1;return}if(!a){A(!1);return}i||N.current||(N.current=!0,A(!0),r().finally(()=>{A(!1)}))},[c,a,i,r]);const j=b.useMemo(()=>{if(!f.trim()||f.trim().length<2)return[];const T=f.trim().toLowerCase(),M=[];for(let R=0;R<n.length;R++)X6(n[R]).toLowerCase().includes(T)&&J6(n[R],s)&&M.push(R);return M},[n,f,s]);b.useEffect(()=>{if(j.length>0){const T=j.length-1;x(T),v(j[T])}else x(0),v(null)},[j]),b.useEffect(()=>{c&&k.current&&requestAnimationFrame(()=>{var T;(T=k.current)==null||T.focus()})},[c]);const E=b.useCallback(()=>{if(j.length===0)return;const T=(m+1)%j.length;x(T),v(j[T])},[m,j]),D=b.useCallback(()=>{if(j.length===0)return;const T=(m-1+j.length)%j.length;x(T),v(j[T])},[m,j]),_=b.useCallback(()=>{d(T=>(T&&(h(""),x(0),v(null),A(!1)),!T))},[]),B=b.useCallback(()=>{d(!1),h(""),x(0),v(null),A(!1)},[]);b.useEffect(()=>{c&&(h(""),x(0),v(null))},[t]),b.useEffect(()=>{const T=M=>{var R;(M.ctrlKey||M.metaKey)&&M.key==="f"&&e&&(M.preventDefault(),c?(R=k.current)==null||R.focus():d(!0))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,c]);const O=c&&f.trim().length>=2&&j.length>0?f.trim():void 0;return{searchMode:c,searchQuery:f,setSearchQuery:h,searchInputRef:k,toggleSearch:_,closeSearch:B,highlightQuery:O,matchIndices:j,currentMatch:m,navigateNext:E,navigatePrev:D,scrollToIndex:y,loadingFullHistory:S}}const e5=new Map,t5=[];function n5({selectedAgentId:t}){const[e,n]=b.useState(new Map),[s,a]=b.useState(new Map),[r,i]=b.useState(new Map),[c,d]=b.useState(new Map),f=b.useRef(new Map),h=b.useRef(0);b.useEffect(()=>{if(!t||e.has(t))return;const F=ka(`${pt.INPUT_TEXT_PREFIX}${t}`);F&&n(U=>new Map(U).set(t,F));const $=ka(`${pt.PASTED_TEXTS_PREFIX}${t}`);if($)try{const U=JSON.parse($),L=new Map(U);i(W=>new Map(W).set(t,L));const z=Math.max(0,...U.map(([W])=>W));f.current.set(t,z)}catch{}},[t,e]);const m=t&&e.get(t)||"",x=t&&s.get(t)||!1,y=(t?r.get(t):void 0)||e5,v=(t?c.get(t):void 0)||t5,S=m.includes(`
|
|
128
|
+
`),k=typeof window<"u"&&window.innerWidth<=768||x||S||m.length>50,N=b.useCallback(F=>{t&&(n($=>new Map($).set(t,F)),F?Ja(`${pt.INPUT_TEXT_PREFIX}${t}`,F):hk(`${pt.INPUT_TEXT_PREFIX}${t}`))},[t]),j=b.useCallback(F=>{t&&a($=>new Map($).set(t,F))},[t]),E=b.useCallback(F=>{t&&i($=>{const U=new Map($),L=$.get(t)||new Map,z=typeof F=="function"?F(L):F;if(U.set(t,z),z.size>0){const W=JSON.stringify(Array.from(z.entries()));Ja(`${pt.PASTED_TEXTS_PREFIX}${t}`,W)}else hk(`${pt.PASTED_TEXTS_PREFIX}${t}`);return U})},[t]),D=b.useCallback(F=>{t&&d($=>{const U=new Map($),L=$.get(t)||[],z=typeof F=="function"?F(L):F;return U.set(t,z),U})},[t]),_=b.useCallback(()=>{if(!t)return 0;const $=(f.current.get(t)||0)+1;return f.current.set(t,$),$},[t]),B=b.useCallback(()=>{t&&f.current.set(t,0)},[t]),O=b.useCallback(F=>{D($=>$.filter(U=>U.id!==F))},[D]),T=b.useCallback(async(F,$)=>{try{const U=$||(F instanceof File?F.name:""),L=encodeURIComponent(U),z=await Pt(Ot("/api/files/upload"),{method:"POST",headers:{"Content-Type":F.type||"application/octet-stream","X-Filename":L},body:F});if(!z.ok)return console.error("Upload failed:",await z.text()),null;const W=await z.json();return h.current+=1,{id:h.current,name:W.filename,path:W.absolutePath,isImage:W.isImage,size:W.size}}catch(U){return console.error("Upload error:",U),null}},[]),M=b.useCallback(F=>{let $=F;for(const[U,L]of y){const z=new RegExp(`\\[Pasted text #${U} \\+\\d+ lines\\]`,"g");$=$.replace(z,L)}return $},[y]),R=b.useCallback(()=>{const F=(m.match(/\n/g)||[]).length+1,$=Math.ceil(m.length/60),U=Math.max(F,$,2);return Math.min(U,10)},[m]);return b.useMemo(()=>({command:m,setCommand:N,forceTextarea:x,setForceTextarea:j,useTextarea:k,pastedTexts:y,setPastedTexts:E,incrementPastedCount:_,resetPastedCount:B,attachedFiles:v,setAttachedFiles:D,removeAttachedFile:O,uploadFile:T,expandPastedTexts:M,getTextareaRows:R}),[m,N,x,j,k,y,E,_,B,v,D,O,T,M,R])}const qg=10;function s5({totalMessages:t,isOpen:e,hasModalOpen:n=!1,scrollContainerRef:s,selectedAgentId:a,inputRef:r,textareaRef:i,useTextarea:c=!1}){const[d,f]=b.useState(-1),h=b.useRef(null);b.useEffect(()=>{h.current!==a&&(f(-1),h.current=a)},[a]);const m=b.useCallback(()=>{f(-1)},[]),x=b.useRef(null),y=D=>1-Math.pow(1-D,3),v=b.useCallback((D,_,B=200)=>{x.current&&cancelAnimationFrame(x.current);const O=D.scrollTop,T=_-O,M=performance.now(),R=F=>{const $=F-M,U=Math.min($/B,1),L=y(U);D.scrollTop=O+T*L,U<1?x.current=requestAnimationFrame(R):x.current=null};x.current=requestAnimationFrame(R)},[]),S=b.useCallback(D=>{if(!s.current)return;const _=s.current,B=_.querySelector(`[data-message-index="${D}"]`);if(B){const O=_.getBoundingClientRect(),T=B.getBoundingClientRect(),M=20;if(T.top<O.top+M){const R=_.scrollTop+(T.top-O.top)-M;v(_,R,180)}else if(T.bottom>O.bottom-M){const R=_.scrollTop+(T.bottom-O.bottom)+M;v(_,R,180)}}},[s,v]);b.useEffect(()=>()=>{x.current&&cancelAnimationFrame(x.current)},[]);const A=b.useCallback(()=>{t!==0&&f(D=>{let _;return D===-1?_=t-1:D>0?_=D-1:_=0,requestAnimationFrame(()=>S(_)),_})},[t,S]),k=b.useCallback(()=>{t!==0&&f(D=>{let _;if(D===-1)_=t-1;else if(D<t-1)_=D+1;else return-1;return requestAnimationFrame(()=>S(_)),_})},[t,S]),N=b.useCallback(()=>{t!==0&&f(D=>{let _;return D===-1?_=t-1:_=Math.max(0,D-qg),requestAnimationFrame(()=>S(_)),_})},[t,S]),j=b.useCallback(()=>{t!==0&&f(D=>{let _;if(D===-1)_=t-1;else{if(D+qg>=t)return-1;_=D+qg}return requestAnimationFrame(()=>S(_)),_})},[t,S]),E=b.useCallback(D=>d===D,[d]);return b.useEffect(()=>{const D=_=>{if(!e||n)return;const B=H.getShortcuts(),O=B.find(L=>L.id==="prev-message"),T=B.find(L=>L.id==="next-message"),M=B.find(L=>L.id==="page-up-messages"),R=B.find(L=>L.id==="page-down-messages"),F=B.find(L=>L.id==="activate-message");if(Cn(_,O)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),A();return}if(Cn(_,T)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),k();return}if(Cn(_,M)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),N();return}if(Cn(_,R)){_.preventDefault(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),j();return}if(_.key==="Escape"&&d!==-1){_.preventDefault(),m();return}const $=_.target,U=$.tagName==="INPUT"||$.tagName==="TEXTAREA"||$.isContentEditable;if(Cn(_,F)&&d!==-1&&!U){_.preventDefault();const L=s.current;if(!L)return;const z=L.querySelector(`[data-message-index="${d}"]`);if(!z)return;const W=[".clickable-path",".output-tool-use.bash-clickable",".clickable-bash",".history-view-md-btn"];for(const Y of W){const P=z.querySelector(Y);if(P){P.click();return}}const V=z.querySelector(".output-tool-use");V!=null&&V.classList.contains("bash-clickable")&&V.click();return}if(d!==-1&&!U){const L=Cn(_,O)||Cn(_,T)||Cn(_,M)||Cn(_,R),z=["Escape","Tab","Shift","Control","Alt","Meta","CapsLock"].includes(_.key),W=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(_.key),V=_.key.startsWith("F")&&_.key.length<=3;if(!L&&!z&&!W&&!V&&!_.ctrlKey&&!_.metaKey){const Y=c?i==null?void 0:i.current:r==null?void 0:r.current;if(Y){Y.focus(),f(-1);return}}}};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,n,A,k,N,j,m,d,r,i,c]),b.useEffect(()=>{d>=t&&t>0?f(t-1):t===0&&f(-1)},[t,d]),{selectedIndex:d,setSelectedIndex:f,clearSelection:m,navigatePrev:A,navigateNext:k,navigatePageUp:N,navigatePageDown:j,isSelected:E}}const mA=300;function a5(t){if(!t)return!1;if(t.startsWith("Using tool:"))return!0;if(t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Bash output:")||t.startsWith("Tokens:")||t.startsWith("Cost:"))return!1;if(t.startsWith("[thinking]"))return!0;if(t.startsWith("[raw]")||t.startsWith("Session started:")||t.startsWith("Session initialized"))return!1;const e=t.trim();return!(e.startsWith("{")&&['"file_path"','"command"','"pattern"','"path"','"content"','"old_string"','"new_string"','"query"','"url"','"prompt"','"notebook_path"','"description"','"offset"','"limit"'].some(s=>e.includes(s)))}function r5(t){if(!t||t.startsWith("Using tool:")||t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Tokens:")||t.startsWith("Cost:")||t.startsWith("[thinking]")||t.startsWith("[raw]")||t.startsWith("Session started:")||t.startsWith("Session initialized"))return!1;const e=t.trim();return!(e.startsWith("{")&&['"file_path"','"command"','"pattern"','"path"','"content"','"old_string"','"new_string"','"query"','"url"','"prompt"','"notebook_path"','"description"','"offset"','"limit"'].some(a=>e.includes(a))||[/^(let me|i'll|i will|now i|first,? i|i need to|i should|i'm going to)/i,/^(looking at|reading|checking|searching|exploring|examining|investigating)/i,/^(based on|from what|according to|it (looks|seems|appears))/i,/^(this (shows|indicates|suggests|means|is))/i,/^(the (code|file|function|class|component|implementation))/i,/^(now (let|i))/i].some(s=>s.test(e)))}function lT({outputs:t,viewMode:e}){return b.useMemo(()=>{if(e==="advanced")return t;if(e==="chat")return t.filter(s=>s.isUserPrompt?!0:s.text?r5(s.text):!1);const n=[];for(let s=0;s<t.length;s++){const a=t[s];if(a.isUserPrompt){n.push(a);continue}if(!a.text){n.push(a);continue}if(a.text.startsWith("Using tool:")){const r=a.text.replace("Using tool:","").trim();let i=null,c,d,f,h;for(let x=s+1;x<t.length&&x<=s+20;x++){const y=t[x];if(y.text.startsWith("Tool input:")){const v=y.text.replace("Tool input:","").trim();if(i=eT(r,v),r==="Edit")try{const S=JSON.parse(v);(S.old_string!==void 0||S.new_string!==void 0||S.unified_diff!==void 0)&&(c={oldString:S.old_string||"",newString:S.new_string||"",operation:typeof S.operation=="string"?S.operation:void 0,unifiedDiff:typeof S.unified_diff=="string"?S.unified_diff:void 0})}catch{}if(r==="TodoWrite")try{const S=JSON.parse(v);Array.isArray(S.todos)&&(d=v)}catch{}if(r==="Bash")try{const S=JSON.parse(v);S.command&&(h=S.command)}catch{}}if(r==="Bash"&&y.text.startsWith("Bash output:")&&(f=y.text.replace("Bash output:","").trim()),y.text.startsWith("Using tool:"))break}r==="Bash"&&i&&i.length>mA&&(i=i.substring(0,mA-3)+"...");const m=r==="Bash"&&!f;n.push({...a,_toolKeyParam:i||void 0,_editData:c,_todoInput:d,_bashOutput:f,_bashCommand:h,_isRunning:m});continue}a5(a.text)&&n.push(a)}return n},[t,e])}function cT({outputs:t,viewMode:e}){const n=b.useRef(0),s=b.useRef(0),a=lT({outputs:t,viewMode:e});if(t.length!==n.current||a.length!==s.current){const r=t.length>0?t[t.length-1]:null,i=r!=null&&r.text?r.text.slice(0,40):null;yu.info(`Filter: in=${t.length} out=${a.length} mode=${e}`,{inputLen:t.length,outputLen:a.length,viewMode:e,lastInput:i},"useFilteredOutputs"),n.current=t.length,s.current=a.length}return a}function i5(t){const e=t.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\uFE0F]+\s*/u,"").trim();if(!e)return null;const n=H.getState().agents;for(const[s,a]of n)if(a.name===e)return s;return null}function hu(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(hu).join(""):je.isValidElement(t)?hu(t.props.children):""}const o5=/\.(com|org|net|io|dev|app|co|me|info|biz|us|uk|de|fr|jp|cn|ru|edu|gov|mil|int|xyz|tech|online|site|store|blog|cloud|ai|gg|tv|cc|sh|fm|to|ly|gl|so|is|it|at|nl|ch|se|no|fi|dk|be|cz|pl|pt|br|mx|ar|cl|in|au|nz|za|sg|hk|tw|kr|id|ph|th|vn|my)$/i;function Yx(t){const e=t.split("/")[0].split("?")[0].split("#")[0];return o5.test(e)}function l5(t){return!t||t.startsWith("#")||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(t)||Yx(t)?!1:t.includes(".")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")}function c5(t){if(!t||t.includes(`
|
|
129
|
+
`))return!1;const e=t.trim();return!e||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||Yx(e)?!1:e.includes(".")&&(e.includes("/")||/^[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+$/.test(e))}const Bu=({onFileClick:t}={})=>({h1:({children:e})=>o.jsx("h1",{style:{fontSize:"1.4em",color:"var(--accent-pink)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h2:({children:e})=>o.jsx("h2",{style:{fontSize:"1.25em",color:"var(--accent-purple)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h3:({children:e})=>o.jsx("h3",{style:{fontSize:"1.15em",color:"var(--accent-cyan)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h4:({children:e})=>o.jsx("h4",{style:{fontSize:"1.1em",color:"var(--accent-green)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h5:({children:e})=>o.jsx("h5",{style:{fontSize:"1.05em",color:"var(--accent-yellow)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),h6:({children:e})=>o.jsx("h6",{style:{fontSize:"1em",color:"var(--accent-orange)",fontWeight:600,margin:"0.6em 0 0.3em"},children:e}),p:({children:e})=>o.jsx("p",{style:{margin:"0.4em 0"},children:e}),strong:({children:e})=>{const n=hu(e),s=i5(n);return s?o.jsx("strong",{className:"clickable-agent-name",style:{color:"var(--accent-orange)",fontWeight:600,cursor:"pointer"},onClick:a=>{a.stopPropagation(),H.selectAgent(s),H.setTerminalOpen(!0)},children:e}):o.jsx("strong",{style:{color:"var(--accent-orange)",fontWeight:600},children:e})},em:({children:e})=>o.jsx("em",{style:{color:"var(--accent-yellow)",fontStyle:"italic"},children:e}),del:({children:e})=>o.jsx("del",{style:{color:"var(--accent-red)",textDecoration:"line-through"},children:e}),code:({children:e,className:n})=>{if(n==null?void 0:n.includes("language-")){const a=(n==null?void 0:n.replace("language-",""))??"",r=hu(e);if(a&&j4(a)){const i=uo(r,a);return o.jsx("code",{className:n,style:{background:"none",padding:0,fontSize:"12px",lineHeight:1.5},dangerouslySetInnerHTML:{__html:i}})}return o.jsx("code",{style:{background:"none",padding:0,color:"var(--text-primary)",fontSize:"12px",lineHeight:1.5},children:e})}return o.jsx("code",{style:{background:"color-mix(in srgb, var(--bg-tertiary) 80%, transparent)",color:"var(--accent-green)",padding:"0.15em 0.4em",borderRadius:"3px",fontSize:"0.9em"},children:e})},pre:({children:e})=>o.jsx("pre",{style:{background:"color-mix(in srgb, var(--bg-primary) 90%, transparent)",border:"1px solid var(--border-color)",borderRadius:"6px",padding:"12px",margin:"0.6em 0",overflowX:"auto"},children:e}),ul:({children:e})=>o.jsx("ul",{style:{margin:"0.5em 0",paddingLeft:"1.5em",lineHeight:1.5},children:e}),ol:({children:e})=>o.jsx("ol",{style:{margin:"0.5em 0",paddingLeft:"1.5em",lineHeight:1.5},children:e}),li:({children:e})=>o.jsx("li",{style:{margin:"0.2em 0",paddingLeft:"0.3em"},children:e}),blockquote:({children:e})=>o.jsx("blockquote",{style:{borderLeft:"3px solid var(--accent-purple)",margin:"0.5em 0",padding:"0.5em 1em",background:"color-mix(in srgb, var(--accent-purple) 10%, transparent)",borderRadius:"0 4px 4px 0"},children:e}),a:({children:e,href:n})=>{const s=typeof n=="string"?n.trim():"",a=I6(s),r=hu(e).trim(),i=a||(s&&l5(s)?s:null)||((!s||s==="#")&&c5(r)?r:null);if(i&&t)return o.jsx("a",{href:"#",onClick:d=>{d.preventDefault(),d.stopPropagation(),t(i)},className:"clickable-path",title:`Open ${i}`,children:e});if(!s)return o.jsx("span",{children:e});const c=!s.includes("://")&&Yx(s)?`https://${s}`:s;return o.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent-cyan)",textDecoration:"underline"},children:e})},hr:()=>o.jsx("hr",{style:{border:"none",borderTop:"1px solid var(--border-color)",margin:"1em 0"}}),table:({children:e})=>o.jsx("table",{style:{width:"100%",borderCollapse:"collapse",margin:"0.6em 0",fontSize:"12px"},children:e}),th:({children:e})=>o.jsx("th",{style:{border:"1px solid var(--border-color)",padding:"6px 10px",textAlign:"left",background:"color-mix(in srgb, var(--bg-tertiary) 80%, transparent)",fontWeight:600,color:"var(--accent-pink)"},children:e}),td:({children:e})=>o.jsx("td",{style:{border:"1px solid var(--border-color)",padding:"6px 10px",textAlign:"left",background:"color-mix(in srgb, var(--bg-secondary) 50%, transparent)"},children:e}),input:({checked:e,type:n})=>n==="checkbox"?o.jsx("input",{type:"checkbox",checked:e,readOnly:!0,style:{marginRight:"0.5em",accentColor:"var(--accent-green)"}}):null});Bu();function Kx(t){const e=t.trimStart();if(!e.startsWith(vb))return{hasContext:!1,context:null,userMessage:t};const n=e.lastIndexOf(Kk);if(n===-1)return{hasContext:!1,context:null,userMessage:t};const s=e.slice(vb.length,n).trim(),a=e.slice(n+Kk.length).trim();return{hasContext:!0,context:s,userMessage:a}}function Qx(t){const e=t.replace(/\r\n/g,`
|
|
130
|
+
`).trim(),n="Follow all instructions below for this task.",s="## User Request",a=e.lastIndexOf(s);if(a!==-1){const h=e.slice(0,a).trim(),m=e.slice(a+s.length).trim();if(m)return{hasInstructions:h.length>0,instructions:h.length>0?h:null,userMessage:m}}let r=e;const i=[],c=[/^(?:You)?# AGENTS\.md instructions[^\n]*\n[\s\S]*?<\/INSTRUCTIONS>\s*/i,/^(?:You)?<environment_context>\s*[\s\S]*?<\/environment_context>\s*/i,/^(?:You)?Follow all instructions below for this task\.\s*/i];let d=!1,f=!0;for(;f;){f=!1;for(const h of c){const m=r.match(h);if(m){i.push(m[0].trim()),r=r.slice(m[0].length).trimStart(),d=!0,f=!0;break}}}return d&&r?{hasInstructions:!0,instructions:i.join(`
|
|
131
|
+
|
|
132
|
+
`),userMessage:r.trim()}:e.includes(n)?{hasInstructions:!1,instructions:null,userMessage:t}:{hasInstructions:!1,instructions:null,userMessage:t}}function uT(t){const e=t.match(/^\[DELEGATED TASK from boss "([^"]+)" \(([^)]+)\)\]\s*\n\n([\s\S]*?)\n\n---\nThis task was delegated by your boss agent\./);return e?{isDelegatedTask:!0,bossName:e[1],bossId:e[2],taskCommand:e[3].trim()}:{isDelegatedTask:!1,bossName:"",bossId:"",taskCommand:""}}function dT(t){const e=t.match(/^\[TASK REPORT from ([^(]+?)\s*\(([^)]+)\)\]\s*\n\nStatus:\s*(\w+)\nOriginal task:\s*([\s\S]*?)\n(?:\nSummary:\s*([\s\S]*?))?\n\nYou may review/);return e?{isTaskReport:!0,agentName:e[1].trim(),agentId:e[2].trim(),status:e[3].trim(),originalTask:e[4].trim(),summary:(e[5]||"").trim()}:{isTaskReport:!1,agentName:"",agentId:"",status:"",originalTask:"",summary:""}}function fT(t){const e=t.match(/<subagent_notification>\s*([\s\S]*?)\s*<\/subagent_notification>/);if(!e)return{hasNotification:!1,agentId:"",status:{},contentWithoutNotification:t};try{const n=JSON.parse(e[1].trim()),s=n.agent_id||"",a={};if(n.status&&typeof n.status=="object")for(const[i,c]of Object.entries(n.status))a[i]=typeof c=="string"?c:JSON.stringify(c);const r=t.replace(/<subagent_notification>\s*[\s\S]*?<\/subagent_notification>\s*/g,"").trim();return{hasNotification:!0,agentId:s,status:a,contentWithoutNotification:r}}catch{return{hasNotification:!1,agentId:"",status:{},contentWithoutNotification:t}}}function pT(t){const e=t.match(/```delegation\s*\n([\s\S]*?)\n```/);if(!e)return{hasDelegation:!1,delegations:[],contentWithoutBlock:t};try{const n=JSON.parse(e[1].trim()),a=(Array.isArray(n)?n:[n]).map(i=>({selectedAgentId:i.selectedAgentId||"",selectedAgentName:i.selectedAgentName||"Unknown",taskCommand:i.taskCommand||"",reasoning:i.reasoning||"",alternativeAgents:i.alternativeAgents||[],confidence:i.confidence||"medium"})),r=t.replace(/```delegation\s*\n[\s\S]*?\n```/,"").trim();return{hasDelegation:!0,delegations:a,contentWithoutBlock:r}}catch{return{hasDelegation:!1,delegations:[],contentWithoutBlock:t}}}function hT(t){const e=t.match(/```work-plan\s*\n([\s\S]*?)\n```/);if(!e)return{hasWorkPlan:!1,workPlan:null,contentWithoutBlock:t};try{const n=JSON.parse(e[1].trim()),s={name:n.name||"Unnamed Plan",description:n.description||"",phases:(n.phases||[]).map(r=>({id:r.id||"",name:r.name||"",execution:r.execution||"sequential",dependsOn:r.dependsOn||[],tasks:(r.tasks||[]).map(i=>({id:i.id||"",description:i.description||"",suggestedClass:i.suggestedClass||"builder",assignToAgent:i.assignToAgent||null,assignToAgentName:i.assignToAgentName||null,priority:i.priority||"medium",blockedBy:i.blockedBy||[]}))}))},a=t.replace(/```work-plan\s*\n[\s\S]*?\n```/,"").trim();return{hasWorkPlan:!0,workPlan:s,contentWithoutBlock:a}}catch{return{hasWorkPlan:!1,workPlan:null,contentWithoutBlock:t}}}function dp({context:t,defaultCollapsed:e=!0,onFileClick:n}){const{t:s}=ht(["tools"]),[a,r]=b.useState(e),i=Bu({onFileClick:n}),c=t.match(/# YOUR TEAM \((\d+) agents?\)/),d=c?parseInt(c[1],10):0;return o.jsxs("div",{className:`boss-context ${a?"collapsed":"expanded"}`,children:[o.jsxs("div",{className:"boss-context-header",onClick:()=>r(!a),children:[o.jsx("span",{className:"boss-context-icon",children:"👑"}),o.jsx("span",{className:"boss-context-label",children:s("tools:bossContext.teamContext",{count:d})}),o.jsx("span",{className:"boss-context-toggle",children:a?"▶":"▼"})]}),!a&&o.jsx("div",{className:"boss-context-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:i,children:t})})]})}function mT({delegation:t}){const{t:e}=ht(["tools"]),n={high:"#22c55e",medium:"#f59e0b",low:"#ef4444"},s={high:"✅",medium:"⚠️",low:"❓"};return o.jsxs("div",{className:"delegation-block",children:[o.jsxs("div",{className:"delegation-header",children:[o.jsx("span",{className:"delegation-icon",children:"📨"}),o.jsx("span",{className:"delegation-title",children:e("tools:delegation.taskDelegated")}),o.jsxs("span",{className:"delegation-confidence",style:{color:n[t.confidence]},children:[s[t.confidence]," ",t.confidence]})]}),o.jsxs("div",{className:"delegation-details",children:[o.jsxs("div",{className:"delegation-target",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.to")}),o.jsx("span",{className:"delegation-agent-name clickable-agent-name",onClick:()=>{H.selectAgent(t.selectedAgentId),H.setTerminalOpen(!0)},children:t.selectedAgentName})]}),t.taskCommand&&o.jsxs("div",{className:"delegation-task-command",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.task")}),o.jsx("span",{className:"delegation-command-text",children:t.taskCommand})]}),t.reasoning&&o.jsxs("div",{className:"delegation-reasoning",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.why")}),o.jsx("span",{className:"delegation-reason-text",children:t.reasoning})]}),t.alternativeAgents.length>0&&o.jsxs("div",{className:"delegation-alternatives",children:[o.jsx("span",{className:"delegation-label",children:e("tools:delegation.alternatives")}),o.jsx("span",{className:"delegation-alt-list",children:t.alternativeAgents.map((a,r)=>o.jsxs("span",{className:"delegation-alt-agent",children:[a.name,a.reason?` (${a.reason})`:""]},a.id||r))})]})]}),o.jsx("div",{className:"delegation-footer",children:o.jsxs("span",{className:"delegation-auto-forward",children:["↗️ ",e("tools:delegation.autoForwarding",{name:t.selectedAgentName})]})})]})}function u5({bossName:t,taskCommand:e}){const{t:n}=ht(["tools"]),[s,a]=b.useState(!1),r=e.length>60?e.slice(0,60)+"...":e;return o.jsxs("div",{className:`delegated-task-header ${s?"expanded":"compact"}`,children:[o.jsxs("div",{className:"delegated-task-badge",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegated-task-icon",children:"👑"}),o.jsxs("span",{className:"delegated-task-label",children:[n("tools:delegation.via")," ",o.jsx("strong",{children:t})]}),o.jsx("span",{className:"delegated-task-toggle",children:s?"▼":"▶"})]}),s&&o.jsx("div",{className:"delegated-task-command",children:e}),!s&&o.jsx("div",{className:"delegated-task-preview",children:r})]})}function gT({bossName:t,bossId:e,taskCommand:n}){const[s,a]=b.useState(!0),r=n.length>80?n.slice(0,80)+"...":n;return o.jsxs("div",{className:`delegated-task-message ${s?"expanded":"compact"}`,children:[o.jsxs("div",{className:"delegated-task-message-badge",onClick:()=>a(!s),children:[o.jsx("span",{className:"delegated-task-message-icon",children:"📋"}),o.jsxs("span",{className:"delegated-task-message-label",children:["Delegated by ",o.jsx("strong",{className:"clickable-agent-name",onClick:i=>{i.stopPropagation(),H.selectAgent(e),H.setTerminalOpen(!0)},children:t})]}),o.jsx("span",{className:"delegated-task-message-id",children:e.slice(0,8)}),o.jsx("span",{className:"delegated-task-message-toggle",children:s?"▼":"▶"})]}),s?o.jsx("div",{className:"delegated-task-message-command",children:n}):o.jsx("div",{className:"delegated-task-message-preview",children:r})]})}function bT({agentName:t,agentId:e,status:n,originalTask:s,summary:a}){const[r,i]=b.useState(!1),c=n==="COMPLETED";return o.jsxs("div",{className:`task-report-header ${r?"expanded":"compact"} status-${c?"completed":"failed"}`,children:[o.jsxs("div",{className:"task-report-badge",onClick:()=>i(!r),children:[o.jsx("span",{className:"task-report-icon",children:c?"✅":"❌"}),o.jsxs("span",{className:"task-report-label",children:[o.jsx("strong",{className:"clickable-agent-name",onClick:d=>{d.stopPropagation(),H.selectAgent(e),H.setTerminalOpen(!0)},children:t})," — Task ",c?"Completed":"Failed"]}),o.jsx("span",{className:"task-report-id",children:e.slice(0,8)}),o.jsx("span",{className:"task-report-toggle",children:r?"▼":"▶"})]}),a&&o.jsx("div",{className:"task-report-summary",children:a}),r&&o.jsx("div",{className:"task-report-details",children:o.jsxs("div",{className:"task-report-original-task",children:[o.jsx("span",{className:"task-report-detail-label",children:"Original task:"}),o.jsx("span",{className:"task-report-detail-value",children:s})]})})]})}function xT({agentId:t,status:e}){const n=Object.entries(e),s=n.some(([d])=>d==="errored"||d==="error"||d==="failed"),a=n.some(([d])=>d==="completed"),r=t.slice(-12),i=n.map(([,d])=>d).join("; "),c=i.replace(/Visit https?:\/\/[^\s]+/g,"").replace(/\s+/g," ").trim();return o.jsxs("div",{className:`subagent-notification ${s?"subagent-notification--error":a?"subagent-notification--completed":"subagent-notification--info"}`,children:[o.jsx("span",{className:"subagent-notification__icon",children:s?"⚠":a?"✓":"🧬"}),o.jsx("span",{className:"subagent-notification__label",children:"Subagent"}),o.jsx("span",{className:"subagent-notification__id",children:r}),o.jsx("span",{className:"subagent-notification__status",children:n.map(([d])=>d).join(", ")}),c&&o.jsx("span",{className:"subagent-notification__message",title:i,children:c})]})}const d5={high:"🔴",medium:"🟡",low:"🟢"},f5={scout:"🔍",builder:"🔨",debugger:"🐛",architect:"📐",warrior:"⚔️",support:"🛡️"};function yT({workPlan:t}){const{t:e}=ht(["tools"]),[n,s]=b.useState(new Set(t.phases.map(i=>i.id))),a=i=>{s(c=>{const d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d})},r=t.phases.reduce((i,c)=>i+c.tasks.length,0);return o.jsxs("div",{className:"work-plan-block",children:[o.jsxs("div",{className:"work-plan-header",children:[o.jsx("span",{className:"work-plan-icon",children:"📋"}),o.jsx("span",{className:"work-plan-title",children:t.name}),o.jsxs("span",{className:"work-plan-stats",children:[e("tools:workPlan.phases",{count:t.phases.length})," · ",e("tools:workPlan.tasks",{count:r})]})]}),t.description&&o.jsx("div",{className:"work-plan-description",children:t.description}),o.jsx("div",{className:"work-plan-phases",children:t.phases.map((i,c)=>o.jsxs("div",{className:`work-plan-phase ${n.has(i.id)?"expanded":"collapsed"}`,children:[o.jsxs("div",{className:"work-plan-phase-header",onClick:()=>a(i.id),children:[o.jsx("span",{className:"work-plan-phase-number",children:c+1}),o.jsx("span",{className:"work-plan-phase-name",children:i.name}),o.jsx("span",{className:`work-plan-phase-execution ${i.execution}`,children:i.execution==="parallel"?`⚡ ${e("tools:workPlan.parallel")}`:`→ ${e("tools:workPlan.sequential")}`}),i.dependsOn.length>0&&o.jsxs("span",{className:"work-plan-phase-depends",children:[e("tools:workPlan.dependsOn")," ",i.dependsOn.join(", ")]}),o.jsx("span",{className:"work-plan-phase-toggle",children:n.has(i.id)?"▼":"▶"})]}),n.has(i.id)&&o.jsx("div",{className:"work-plan-tasks",children:i.tasks.map(d=>o.jsxs("div",{className:`work-plan-task priority-${d.priority}`,children:[o.jsxs("div",{className:"work-plan-task-header",children:[o.jsx("span",{className:"work-plan-task-id",children:d.id}),o.jsx("span",{className:"work-plan-task-priority",title:`Priority: ${d.priority}`,children:d5[d.priority]}),o.jsxs("span",{className:"work-plan-task-class",title:`Suggested: ${d.suggestedClass}`,children:[f5[d.suggestedClass]||"👤"," ",d.suggestedClass]})]}),o.jsx("div",{className:"work-plan-task-description",children:d.description}),o.jsxs("div",{className:"work-plan-task-assignment",children:[o.jsx("span",{className:"work-plan-task-assignment-label",children:e("tools:workPlan.assignedTo")}),o.jsx("span",{className:`work-plan-task-agent ${d.assignToAgentName?"assigned":"auto"}`,children:d.assignToAgentName||e("tools:workPlan.autoAssign")})]}),d.blockedBy.length>0&&o.jsxs("div",{className:"work-plan-task-blocked",children:["⏳ ",e("tools:workPlan.blockedBy")," ",d.blockedBy.join(", ")]})]},d.id))})]},i.id))}),o.jsx("div",{className:"work-plan-footer",children:o.jsxs("span",{className:"work-plan-approval-hint",children:["💡 ",e("tools:workPlan.reviewHint")]})})]})}function p5({request:t,onApprove:e,onDeny:n}){const{t:s}=ht(["tools"]),a=is[t.tool]||is.default,r=c=>t.tool==="Bash"&&c.command?String(c.command):(t.tool==="Write"||t.tool==="Edit"||t.tool==="Read")&&c.file_path?String(c.file_path):t.tool==="WebFetch"&&c.url?String(c.url):t.tool,i=()=>{if(t.tool==="Write"||t.tool==="Edit"){const d=String(t.toolInput.file_path||"").split("/").slice(0,-1).join("/");return s("tools:permission.rememberAllowDir",{dir:d})}if(t.tool==="Bash"){const d=String(t.toolInput.command||"").split(/\s+/)[0];return s("tools:permission.rememberAllowCmd",{cmd:d})}return s("tools:permission.rememberAllowTool",{tool:t.tool})};return t.status!=="pending"?null:o.jsxs("div",{className:"permission-inline",children:[o.jsx("span",{className:"permission-inline-icon",children:a}),o.jsx("span",{className:"permission-inline-tool",children:t.tool}),o.jsx("span",{className:"permission-inline-target",children:r(t.toolInput)}),o.jsx("button",{className:"permission-inline-btn approve-remember",onClick:()=>e(!0),title:i(),children:"✓+"}),o.jsx("button",{className:"permission-inline-btn approve",onClick:()=>e(!1),title:s("tools:permission.approveOnce"),children:"✓"}),o.jsx("button",{className:"permission-inline-btn deny",onClick:n,title:s("tools:permission.deny"),children:"✕"})]})}function ol(t,e){return e?t.split(new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi")).map((s,a)=>s.toLowerCase()===e.toLowerCase()?o.jsx("mark",{className:"search-highlight",children:s},a):s):t}function Xx(t){const e=Aa();if(t.startsWith("http"))return t;if(t.startsWith("/uploads/"))return`${e}${t}`;if(t.includes("tide-commander-uploads")){const n=t.split("/").pop()||"image";return`${e}/uploads/${n}`}else return t}function vT(t){var s;const e=((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"",n={pdf:"file_type_pdf.svg",doc:"file_type_word.svg",docx:"file_type_word.svg",xls:"file_type_excel.svg",xlsx:"file_type_excel.svg",ppt:"file_type_powerpoint.svg",pptx:"file_type_powerpoint.svg",txt:"file_type_text.svg",md:"file_type_markdown.svg",js:"file_type_javascript_official.svg",jsx:"file_type_javascript_official.svg",ts:"file_type_typescript_official.svg",tsx:"file_type_typescript_official.svg",py:"file_type_python.svg",java:"file_type_java.svg",cpp:"file_type_cpp.svg",c:"file_type_cpp.svg",h:"file_type_cpp.svg",hpp:"file_type_cpp.svg",cs:"file_type_csharp.svg",go:"file_type_go.svg",rs:"file_type_rust.svg",php:"file_type_php.svg",rb:"file_type_ruby.svg",swift:"file_type_swift.svg",kt:"file_type_kotlin.svg",scala:"file_type_scala.svg",r:"file_type_r.svg",html:"file_type_html.svg",htm:"file_type_html.svg",css:"file_type_css.svg",scss:"file_type_scss.svg",sass:"file_type_sass.svg",less:"file_type_less.svg",json:"file_type_json_official.svg",yaml:"file_type_yaml_official.svg",yml:"file_type_yaml_official.svg",xml:"file_type_xml.svg",toml:"file_type_toml.svg",ini:"file_type_ini.svg",env:"file_type_dotenv.svg",sh:"file_type_shell.svg",bash:"file_type_shell.svg",zsh:"file_type_shell.svg",fish:"file_type_shell.svg",png:"file_type_image.svg",jpg:"file_type_image.svg",jpeg:"file_type_image.svg",gif:"file_type_image.svg",svg:"file_type_image.svg",webp:"file_type_image.svg",zip:"file_type_zip.svg",tar:"file_type_tar.svg",gz:"file_type_gzip.svg",rar:"file_type_rar.svg","7z":"file_type_zip.svg",mp3:"file_type_audio.svg",mp4:"file_type_video.svg",wav:"file_type_audio.svg",mov:"file_type_video.svg",mkv:"file_type_video.svg",flv:"file_type_video.svg",avi:"file_type_video.svg",default:"default_file.svg"};return n[e]||n.default}function pl(t,e,n){const s=/\[(Image|File):\s*([^\]]+)\]/g,a=[];let r=0,i;const c=Bu({onFileClick:n});for(;(i=s.exec(t))!==null;){if(i.index>r){const m=Df(t.slice(r,i.index));a.push(o.jsx("div",{className:"markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:c,children:m})},`text-${r}`))}const d=i[1]==="Image",f=i[2].trim(),h=f.split("/").pop()||(d?"image":"file");if(d){const m=Xx(f);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(m,h),title:Tn.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:m,alt:h,className:"image-reference-thumb"}),h]},`img-${i.index}`))}else{const m=vT(h);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(f),title:Tn.t("terminal:content.clickToViewFile",{path:f}),children:[o.jsx("img",{src:`/assets/vscode-icons/${m}`,alt:h,style:{width:"12px",height:"12px",display:"inline",marginRight:"4px"}}),h]},`file-${i.index}`))}r=i.index+i[0].length}if(r<t.length){const d=Df(t.slice(r));a.push(o.jsx("div",{className:"markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:c,children:d})},`text-${r}`))}return a.length===0?o.jsx("div",{className:"markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:c,children:Df(t)})}):o.jsx(o.Fragment,{children:a})}function mu(t,e,n){const s=/\[(Image|File):\s*([^\]]+)\]/g,a=[];let r=0,i;for(;(i=s.exec(t))!==null;){if(i.index>r){const h=t.slice(r,i.index);a.push(o.jsx("span",{className:"user-prompt-text",children:h},`text-${r}`))}const c=i[1]==="Image",d=i[2].trim(),f=d.split("/").pop()||(c?"image":"file");if(c){const h=Xx(d);a.push(o.jsxs("span",{className:"image-reference clickable",onClick:()=>e==null?void 0:e(h,f),title:Tn.t("terminal:content.clickToViewImage"),children:[o.jsx("img",{src:h,alt:f,className:"image-reference-thumb"}),f]},`img-${i.index}`))}else{const h=vT(f);a.push(o.jsxs("span",{className:"file-reference clickable",onClick:()=>n==null?void 0:n(d),title:Tn.t("terminal:content.clickToViewFile",{path:d}),children:[o.jsx("img",{src:`/assets/vscode-icons/${h}`,alt:f,style:{width:"12px",height:"12px",display:"inline",marginRight:"4px"}}),f]},`file-${i.index}`))}r=i.index+i[0].length}if(r<t.length){const c=t.slice(r);a.push(o.jsx("span",{className:"user-prompt-text",children:c},`text-${r}`))}return a.length===0?o.jsx("span",{className:"user-prompt-text",children:t}):o.jsx(o.Fragment,{children:a})}function h5({id:t,lineCount:e,fullText:n,onRemove:s}){const{t:a}=ht(["tools","common"]),[r,i]=b.useState(!1),c=d=>{d.stopPropagation(),i(!0)};return o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"pasted-text-chip",onClick:c,title:a("tools:pastedText.clickToView"),children:[o.jsx("span",{className:"pasted-text-chip-icon",children:"📋"}),o.jsx("span",{className:"pasted-text-chip-label",children:a("tools:pastedText.pastedNumber",{id:t})}),o.jsx("span",{className:"pasted-text-chip-count",children:a("tools:pastedText.lineCount",{count:e})}),o.jsx("button",{className:"pasted-text-chip-remove",onClick:d=>{d.stopPropagation(),s()},title:a("common:buttons.remove"),children:"×"})]}),r&&o.jsx(m5,{id:t,lineCount:e,content:n,onClose:()=>i(!1)})]})}function m5({id:t,lineCount:e,content:n,onClose:s}){const{t:a}=ht(["tools","common"]),{handleMouseDown:r,handleClick:i}=Sa(s),[c,d]=b.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(n),d(!0),setTimeout(()=>d(!1),2e3)}catch(h){console.error("Failed to copy:",h)}};return o.jsx("div",{className:"modal-overlay visible pasted-text-modal-overlay",onMouseDown:r,onClick:i,children:o.jsxs("div",{className:"modal pasted-text-modal",children:[o.jsxs("div",{className:"pasted-text-modal-header",children:[o.jsxs("div",{className:"pasted-text-modal-title",children:[o.jsx("span",{className:"pasted-text-modal-icon",children:"📋"}),o.jsx("span",{children:a("tools:pastedText.pastedTextTitle",{id:t})}),o.jsx("span",{className:"pasted-text-modal-count",children:a("tools:pastedText.lineCountFull",{count:e})})]}),o.jsxs("div",{className:"pasted-text-modal-actions",children:[o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:f,children:c?`✓ ${a("common:toast.copied")}`:a("common:buttons.copy")}),o.jsx("button",{className:"pasted-text-modal-close",onClick:s,children:"×"})]})]}),o.jsx("div",{className:"pasted-text-modal-body",children:o.jsx("pre",{className:"pasted-text-content",children:n})})]})})}const g5={language:"Spanish",model:"medium"};function wT(t={}){var v;const[e,n]=b.useState(!1),[s,a]=b.useState(!1),[r,i]=b.useState(null),c=b.useRef(null),d=b.useRef([]),f=b.useRef(null),h={...g5,...t},m=b.useCallback(async()=>{i(null);try{if(!window.isSecureContext){console.error("[STT] Not in secure context - microphone requires HTTPS"),i("Microphone requires HTTPS");return}const S=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,sampleRate:16e3}});f.current=S,d.current=[];const A=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg",""];let k="";for(const E of A)if(!E||MediaRecorder.isTypeSupported(E)){k=E;break}console.log("[STT] Using MIME type:",k||"browser default");const N={};k&&(N.mimeType=k);const j=new MediaRecorder(S,N);j.ondataavailable=E=>{E.data.size>0&&d.current.push(E.data)},c.current=j,j.start(100),n(!0),console.log("[STT] Recording started")}catch(S){console.error("[STT] Failed to start recording:",S),S instanceof Error?S.name==="NotAllowedError"||S.name==="PermissionDeniedError"?i("Microphone permission denied"):S.name==="NotFoundError"||S.name==="DevicesNotFoundError"?i("No microphone found"):S.name==="NotReadableError"||S.name==="TrackStartError"?i("Microphone in use by another app"):S.name==="OverconstrainedError"?i("Microphone constraints not supported"):i(`Microphone error: ${S.message}`):i("Failed to access microphone")}},[]),x=b.useCallback(async()=>!c.current||!e?null:new Promise(S=>{const A=c.current;A.onstop=async()=>{var j,E;f.current&&(f.current.getTracks().forEach(D=>D.stop()),f.current=null);const k=((j=d.current[0])==null?void 0:j.type)||"audio/webm",N=new Blob(d.current,{type:k});if(d.current=[],console.log("[STT] Recording stopped, audio size:",N.size),N.size<1e3){i("Recording too short"),n(!1),S(null);return}a(!0);try{const D=await b5(N);console.log("[STT] Sending audio for transcription...");const B=await(await Pt(Ot("/api/stt/transcribe"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({audio:D,language:h.language,model:h.model})})).json();B.success&&B.text?(console.log("[STT] Transcription:",B.text),(E=h.onTranscription)==null||E.call(h,B.text),S(B.text)):(console.error("[STT] Transcription failed:",B.error),i(B.error||"Transcription failed"),S(null))}catch(D){console.error("[STT] Failed to transcribe:",D),i("Failed to transcribe audio"),S(null)}finally{a(!1)}n(!1)},A.stop()}),[e,h]),y=b.useCallback(async()=>e?x():(await m(),null),[e,m,x]);return{recording:e,transcribing:s,error:r,startRecording:m,stopRecording:x,toggleRecording:y,supported:typeof navigator<"u"&&!!((v=navigator.mediaDevices)!=null&&v.getUserMedia)&&typeof MediaRecorder<"u"}}function b5(t){return new Promise((e,n)=>{const s=new FileReader;s.onloadend=()=>{const a=s.result.split(",")[1];e(a)},s.onerror=n,s.readAsDataURL(t)})}const x5=b.memo(function({agentId:e,isWorking:n,timestamp:s}){const{t:a}=ht(["terminal"]),[r,i]=b.useState(0);return b.useEffect(()=>{if(!n||!s){i(0);return}i(Date.now()-s);const c=setInterval(()=>{i(Date.now()-s)},1e3);return()=>clearInterval(c)},[n,s]),n?o.jsxs("div",{className:"guake-stop-bar",children:[o.jsx("span",{className:"guake-elapsed-timer",children:kT(r)}),o.jsxs("button",{className:"guake-stop-btn",onClick:()=>H.stopAgent(e),title:a("terminal:input.stopOperation"),children:[o.jsx("span",{className:"stop-icon",children:"■"}),o.jsx("span",{className:"stop-label",children:a("terminal:input.stop")})]})]}):null});function gA(t){const e={pdf:"file_type_pdf.svg",doc:"file_type_word.svg",docx:"file_type_word.svg",xls:"file_type_excel.svg",xlsx:"file_type_excel.svg",ppt:"file_type_powerpoint.svg",pptx:"file_type_powerpoint.svg",txt:"file_type_text.svg",md:"file_type_markdown.svg",js:"file_type_javascript_official.svg",jsx:"file_type_javascript_official.svg",ts:"file_type_typescript_official.svg",tsx:"file_type_typescript_official.svg",py:"file_type_python.svg",java:"file_type_java.svg",cpp:"file_type_cpp.svg",c:"file_type_cpp.svg",h:"file_type_cpp.svg",hpp:"file_type_cpp.svg",cs:"file_type_csharp.svg",go:"file_type_go.svg",rs:"file_type_rust.svg",php:"file_type_php.svg",rb:"file_type_ruby.svg",swift:"file_type_swift.svg",kt:"file_type_kotlin.svg",scala:"file_type_scala.svg",r:"file_type_r.svg",html:"file_type_html.svg",htm:"file_type_html.svg",css:"file_type_css.svg",scss:"file_type_scss.svg",sass:"file_type_sass.svg",less:"file_type_less.svg",json:"file_type_json_official.svg",yaml:"file_type_yaml_official.svg",yml:"file_type_yaml_official.svg",xml:"file_type_xml.svg",toml:"file_type_toml.svg",ini:"file_type_ini.svg",env:"file_type_dotenv.svg",sh:"file_type_shell.svg",bash:"file_type_shell.svg",zsh:"file_type_shell.svg",fish:"file_type_shell.svg",png:"file_type_image.svg",jpg:"file_type_image.svg",jpeg:"file_type_image.svg",gif:"file_type_image.svg",svg:"file_type_image.svg",webp:"file_type_image.svg",zip:"file_type_zip.svg",tar:"file_type_tar.svg",gz:"file_type_gzip.svg",rar:"file_type_rar.svg","7z":"file_type_zip.svg",mp3:"file_type_audio.svg",mp4:"file_type_video.svg",wav:"file_type_audio.svg",mov:"file_type_video.svg",mkv:"file_type_video.svg",flv:"file_type_video.svg",avi:"file_type_video.svg",default:"default_file.svg"};return e[t.toLowerCase()]||e.default}function kT(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),s=e%60;return`${n}:${s.toString().padStart(2,"0")}`}const bA=72,y5=128,v5=b.memo(function({selectedAgent:e,selectedAgentId:n,isOpen:s,command:a,setCommand:r,forceTextarea:i,setForceTextarea:c,useTextarea:d,attachedFiles:f,setAttachedFiles:h,removeAttachedFile:m,uploadFile:x,pastedTexts:y,expandPastedTexts:v,incrementPastedCount:S,setPastedTexts:A,resetPastedCount:k,handleInputFocus:N,handleInputBlur:j,pendingPermissions:E,showCompletion:D,completionElapsed:_,onImageClick:B,inputRef:O,textareaRef:T,isSnapshotView:M=!1,onClearHistory:R,onSendCommand:F,canSwipeClose:$=!1,onSwipeCloseOffsetChange:U,onSwipeClose:L}){const{t:z}=ht(["terminal","common"]),W=b.useRef(null),V=b.useRef(null),Y=O||W,P=T||V,K=b.useRef(null),Q=b.useRef(null),q=b.useRef(d),be=b.useRef(0),ue=b.useRef(null),Z=b.useRef({isTracking:!1,startY:0,startX:0}),[de,Ce]=b.useState(0),[xe,Ne]=b.useState("idle"),qe=Ir(),Ge=_j(n),X=e.status==="working",se=b.useCallback(()=>{const te=K.current,pe=d?P.current:Y.current;te==null||te.focus({preventScroll:!0}),pe==null||pe.focus({preventScroll:!0})},[Y,P,d]),{recording:Ee,transcribing:Ve,toggleRecording:at}=wT({language:"Spanish",model:"medium",onTranscription:te=>{te.trim()&&n&&H.sendCommand(n,te.trim())}}),we=b.useCallback(()=>{ue.current&&(clearTimeout(ue.current),ue.current=null)},[]),$e=b.useCallback((te="idle")=>{we(),Ce(0),Ne(te),U==null||U(0),te==="returning"&&(ue.current=setTimeout(()=>{Ne("idle"),ue.current=null},160))},[we,U]),ie=b.useCallback(te=>{if(!$||!L||window.innerWidth>768||te.touches.length!==1)return;we();const pe=te.touches[0];Z.current={isTracking:!0,startY:pe.clientY,startX:pe.clientX},Ne("idle"),Ce(0),U==null||U(0)},[$,L,we,U]),fe=b.useCallback(te=>{if(!Z.current.isTracking)return;const pe=te.touches[0],ke=pe.clientY-Z.current.startY,Be=Math.abs(pe.clientX-Z.current.startX);if(Be>48&&Be>Math.abs(ke)){Z.current.isTracking=!1,$e("returning");return}if(ke>=0){Ce(0),Ne("idle");return}const Ke=Math.min(y5,Math.abs(ke));Ke>8&&te.preventDefault(),Ce(Ke),Ne("dragging"),U==null||U(Ke)},[$e,U]),Ue=b.useCallback(()=>{if(Z.current.isTracking){if(Z.current.isTracking=!1,!$||!L){$e("returning");return}if(de>=bA){L();return}$e("returning")}},[$,L,de,$e,U]),it=b.useCallback(()=>{Z.current.isTracking=!1,$e("returning")},[$e]);b.useEffect(()=>()=>we(),[we]),b.useEffect(()=>{$||(Z.current.isTracking=!1,$e("idle"))},[$,$e]);const ot=te=>{be.current=te.target.selectionStart||te.target.value.length,r(te.target.value)};b.useEffect(()=>{const te=P.current;if(!te||!d)return;const ke=window.innerWidth<=768?200:180;requestAnimationFrame(()=>{te.style.height="0px",te.style.overflow="hidden";const Be=te.scrollHeight,Ke=Math.max(46,Math.min(Be,ke));te.style.height=`${Ke}px`,te.style.overflow=Ke>=ke?"auto":"hidden"})},[a,d]),b.useEffect(()=>{q.current!==d&&(q.current=d,requestAnimationFrame(()=>{const te=be.current;d&&P.current?(se(),P.current.setSelectionRange(te,te)):!d&&Y.current&&(se(),Y.current.setSelectionRange(te,te))}))},[se,Y,P,d]);const ce=b.useRef(!1);b.useEffect(()=>{const te=ce.current;ce.current=s;const pe=typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches,ke=H.consumeSwipeSelectionFlag(),Be=H.consumeDirectClickSelectionFlag();if(s&&(!te||n)&&!(pe&&(ke||Be))){const ze=setTimeout(()=>{se()},50);return()=>clearTimeout(ze)}},[s,se,n]);const J=te=>{const pe=new RegExp(`\\[Pasted text #${te} \\+\\d+ lines\\]\\s*`,"g");r(a.replace(pe,"").trim()),A(ke=>{const Be=new Map(ke);return Be.delete(te),Be})},Se=(()=>{const te=/\[Pasted text #(\d+) \+(\d+) lines\]/g,pe=[];let ke;for(;(ke=te.exec(a))!==null;)pe.push({id:parseInt(ke[1],10),lineCount:parseInt(ke[2],10)});return pe})(),ee=()=>{var ke,Be;if(!a.trim()&&f.length===0||!n)return;if(a.trim()==="/clear"&&f.length===0){H.clearContext(n),R(),r(""),c(!1),A(new Map),h([]),k();return}let te=v(a.trim());if(f.length>0){const Ke=f.map(ze=>ze.isImage?`[Image: ${ze.path}]`:`[File: ${ze.path}]`).join(`
|
|
133
|
+
`);te?te=`${te}
|
|
134
|
+
|
|
135
|
+
${Ke}`:te=Ke}H.sendCommand(n,te),F==null||F(),r(""),c(!1),A(new Map),h([]),k(),window.innerWidth<=768&&((ke=Y.current)==null||ke.blur(),(Be=P.current)==null||Be.blur())},ge=te=>{const pe=window.innerWidth<=768;if(te.key==="Enter"){if(pe){d||(te.preventDefault(),c(!0),setTimeout(()=>{r(a+`
|
|
136
|
+
`)},0));return}if(te.shiftKey){d||(te.preventDefault(),c(!0));return}te.preventDefault(),ee()}},Re=te=>{},Fe=te=>{te.button===1&&(te.preventDefault(),te.stopPropagation())},oe=async te=>{const pe=te.clipboardData.items;for(const et of pe){if(et.type.startsWith("image/")){te.preventDefault();const ct=et.getAsFile();if(ct){const st=await x(ct);st&&h(bt=>[...bt,st])}return}if(et.kind==="file"){te.preventDefault();const ct=et.getAsFile();if(ct){const st=await x(ct);st&&h(bt=>[...bt,st])}return}}const ke=te.clipboardData.files;if(ke.length>0){te.preventDefault();for(const et of ke){const ct=await x(et);ct&&h(st=>[...st,ct])}return}const Be=te.clipboardData.getData("text"),Ke=!Be.includes(`
|
|
137
|
+
`),ze=/^[/~][^\s]*$|^[A-Za-z]:\\[^\s]*$/.test(Be.trim()),Ze=/\.[a-zA-Z0-9]{1,5}$/.test(Be.trim());if(Ke&&ze&&Ze){te.preventDefault();try{const et=await fetch("/api/files/by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:Be.trim()})});if(et.ok){const ct=await et.blob(),st=Be.trim().split(/[/\\]/).pop()||"file",bt=await x(ct,st);bt&&h(Tt=>[...Tt,bt]);return}}catch{}r(a+Be);return}const lt=(Be.match(/\n/g)||[]).length+1;if(lt>5){te.preventDefault();const et=S();A(We=>new Map(We).set(et,Be));const ct=`[Pasted text #${et} +${lt} lines]`,st=te.target,bt=st.selectionStart||0,Tt=st.selectionEnd||0,he=a.slice(0,bt)+ct+a.slice(Tt),_e=bt+ct.length;be.current=_e,r(he),d?requestAnimationFrame(()=>{P.current&&P.current.setSelectionRange(_e,_e)}):c(!0)}},Le=async te=>{const pe=te.target.files;if(pe){for(const ke of pe){const Be=await x(ke);Be&&h(Ke=>[...Ke,Be])}Q.current&&(Q.current.value="")}};return o.jsxs(o.Fragment,{children:[E.length>0&&o.jsx("div",{className:"permission-bar",children:E.map(te=>o.jsx(p5,{request:te,onApprove:pe=>H.respondToPermissionRequest(te.id,!0,void 0,pe),onDeny:()=>H.respondToPermissionRequest(te.id,!1)},te.id))}),Se.length>0&&o.jsx("div",{className:"guake-pasted-texts",children:Se.map(({id:te,lineCount:pe})=>{const ke=y.get(te)||"";return o.jsx(h5,{id:te,lineCount:pe,fullText:ke,onRemove:()=>J(te)},te)})}),f.length>0&&o.jsx("div",{className:"guake-attachments",children:f.map(te=>{var Ke;const pe=te.isImage?Xx(te.path):null,ke=((Ke=te.name.split(".").pop())==null?void 0:Ke.toLowerCase())||"",Be=["pdf","doc","docx","xls","xlsx","ppt","pptx"].includes(ke);return o.jsxs("div",{className:`guake-attachment ${te.isImage?"is-image clickable":""} ${Be?"is-document":""}`,onClick:()=>{te.isImage&&B(pe,te.name)},children:[te.isImage&&pe?o.jsx("img",{src:pe,alt:te.name,className:"guake-attachment-thumb"}):o.jsx("img",{src:`/assets/vscode-icons/${gA(ke)}`,alt:te.name,className:"guake-attachment-icon",style:{width:"24px",height:"24px"}}),o.jsxs("div",{className:"guake-attachment-info",children:[o.jsxs("div",{className:"guake-attachment-name-row",children:[o.jsx("img",{src:`/assets/vscode-icons/${gA(ke)}`,alt:ke,className:"guake-attachment-type-icon",style:{width:"11px",height:"11px"}}),o.jsx("span",{className:"guake-attachment-name",title:te.path,children:te.name})]}),o.jsxs("span",{className:"guake-attachment-size",children:["(",Math.round(te.size/1024),"KB)"]})]}),o.jsx("button",{className:"guake-attachment-remove",onClick:ze=>{ze.stopPropagation(),m(te.id)},title:z("terminal:input.removeAttachment"),children:"×"})]},te.id)})}),o.jsx("div",{className:`guake-input-wrapper ${e.status==="working"?"has-stop-btn is-working":""} ${D?"is-completed":""} ${M?"is-snapshot-view":""}`,children:o.jsxs("div",{className:`guake-input-swipe-shell ${xe!=="idle"?"swipe-close-active":""} ${de>=bA?"swipe-close-ready":""}`,onTouchStart:ie,onTouchMove:fe,onTouchEnd:Ue,onTouchCancel:it,children:[!M&&(()=>{const te=e.contextStats,pe=te?te.totalTokens:e.contextUsed||0,ke=te?te.contextWindow:e.contextLimit||2e5,Be=te?te.usedPercent:Math.round(pe/ke*100),Ke=Math.max(0,Math.min(100,Be)),ze=Math.max(0,100-Ke),Ze=Ke>=80?"#ff4a4a":Ke>=60?"#ff9e4a":Ke>=40?"#ffd700":"#4aff9e",lt=(pe/1e3).toFixed(1),et=(ke/1e3).toFixed(1);return o.jsxs("div",{className:"mobile-context-bar show-on-mobile",onClick:()=>H.setContextModalAgentId(n),children:[o.jsx("span",{className:"mobile-context-bar-fill",style:{width:`${Math.min(100,Ke)}%`,backgroundColor:Ze}}),o.jsxs("span",{className:"mobile-context-bar-text",children:[o.jsxs("span",{style:{color:Ze},children:[lt,"k/",et,"k"]}),o.jsxs("span",{className:"mobile-context-bar-pct",children:["(",ze,"% free)"]})]})]})})(),o.jsx(x5,{agentId:n,isWorking:X,timestamp:Ge==null?void 0:Ge.timestamp}),D&&_!==null&&o.jsx("div",{className:"guake-completion-time",children:kT(_)}),o.jsxs("div",{className:`guake-input ${d?"guake-input-expanded":""}`,children:[o.jsx("input",{ref:Q,type:"file",multiple:!0,onChange:Le,style:{display:"none"},accept:"*"}),o.jsxs("div",{ref:K,className:"guake-input-container",tabIndex:-1,onAuxClick:Fe,children:[o.jsx("button",{className:"guake-attach-btn",onClick:()=>{var te;return(te=Q.current)==null?void 0:te.click()},title:z("terminal:input.attachOrPaste"),children:"📎"}),qe.experimentalTTS&&o.jsx("button",{className:`guake-mic-btn ${Ee?"recording":""} ${Ve?"transcribing":""}`,onClick:at,title:z(Ee?"terminal:input.stopRecording":Ve?"terminal:input.transcribing":"terminal:input.voiceInput"),disabled:Ve,children:Ve?"⏳":Ee?"🔴":"🎤"}),d?o.jsx("textarea",{ref:P,placeholder:z("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ot,onKeyDown:ge,onPaste:oe,onMouseDown:Re,onFocus:N,onBlur:j}):o.jsx("input",{ref:Y,type:"text",placeholder:z("terminal:input.placeholder",{agent:e.name}),value:a,onChange:ot,onKeyDown:ge,onPaste:oe,onMouseDown:Re,onFocus:N,onBlur:j}),o.jsx("button",{onClick:ee,disabled:!a.trim()&&f.length===0,title:z("terminal:input.send"),children:"➤"})]})]})]})})]})});function w5(t){var i;const e=t.split(`
|
|
138
|
+
`),n=[];let s=null,a=0,r=0;for(const c of e){if(c.startsWith("diff --git")||c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ ")||c.startsWith("new file mode")||c.startsWith("deleted file mode")||c.startsWith("old mode")||c.startsWith("new mode")||c.startsWith("similarity index")||c.startsWith("rename from")||c.startsWith("rename to")||c.startsWith("Binary files"))continue;const d=c.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(d){s={header:((i=d[5])==null?void 0:i.trim())||"",oldStart:parseInt(d[1],10),oldCount:parseInt(d[2]??"1",10),newStart:parseInt(d[3],10),newCount:parseInt(d[4]??"1",10),lines:[]},a=s.oldStart,r=s.newStart,n.push(s);continue}if(s){if(c.startsWith("+"))s.lines.push({type:"added",content:c.slice(1),newNum:r}),r++;else if(c.startsWith("-"))s.lines.push({type:"removed",content:c.slice(1),oldNum:a}),a++;else if(c.startsWith(" ")||c==="")s.lines.push({type:"context",content:c.startsWith(" ")?c.slice(1):c,oldNum:a,newNum:r}),a++,r++;else if(c.startsWith("\\"))continue}}return n}function k5(t,e){const n=t.split(`
|
|
139
|
+
`),s=e.split(`
|
|
140
|
+
`),a=n.length,r=s.length,i=Array(a+1).fill(null).map(()=>Array(r+1).fill(0));for(let v=1;v<=a;v++)for(let S=1;S<=r;S++)n[v-1]===s[S-1]?i[v][S]=i[v-1][S-1]+1:i[v][S]=Math.max(i[v-1][S],i[v][S-1]);const c=[];let d=a,f=r;for(;d>0||f>0;)d>0&&f>0&&n[d-1]===s[f-1]?(c.push({type:"equal",origIdx:d-1,modIdx:f-1}),d--,f--):f>0&&(d===0||i[d][f-1]>=i[d-1][f])?(c.push({type:"insert",modIdx:f-1}),f--):d>0&&(c.push({type:"delete",origIdx:d-1}),d--);c.reverse();const h=[],m=[];let x=0,y=0;for(const v of c)if(v.type==="equal"){const S=n[v.origIdx];h.push({num:v.origIdx+1,text:S,type:"unchanged"}),m.push({num:v.modIdx+1,text:S,type:"unchanged"})}else if(v.type==="delete"){const S=n[v.origIdx];h.push({num:v.origIdx+1,text:S,type:"removed"}),y++}else{const S=s[v.modIdx];m.push({num:v.modIdx+1,text:S,type:"added"}),x++}return{leftLines:h,rightLines:m,stats:{added:x,removed:y}}}function ST({content:t,onFileClick:e}){const{t:n}=ht(["tools","common","terminal"]),s=b.useRef(null),a=b.useRef(null),r=b.useRef(null),i=b.useCallback(c=>{const d=s.current,f=a.current;if(!d||!f||r.current&&r.current!==c)return;r.current=c;const h=c==="left"?d:f,m=c==="left"?f:d;m.scrollTop=h.scrollTop,m.scrollLeft=h.scrollLeft,requestAnimationFrame(()=>{r.current=null})},[]);b.useEffect(()=>{const c=s.current,d=a.current;if(!c||!d)return;const f=()=>i("left"),h=()=>i("right");return c.addEventListener("scroll",f),d.addEventListener("scroll",h),()=>{c.removeEventListener("scroll",f),d.removeEventListener("scroll",h)}},[i]);try{const c=JSON.parse(t),{file_path:d,old_string:f,new_string:h,replace_all:m,unified_diff:x}=c;if(!d)return o.jsx("pre",{className:"output-input-content",children:t});const y=d.split("/").pop()||d;if(x){const k=w5(x),N={added:0,removed:0};for(const j of k)for(const E of j.lines)E.type==="added"&&N.added++,E.type==="removed"&&N.removed++;return o.jsxs("div",{className:"edit-tool-diff",children:[o.jsxs("div",{className:"edit-tool-header",children:[o.jsx("span",{className:"edit-tool-file clickable",onClick:()=>e==null?void 0:e(d,{oldString:f||"",newString:h||"",unifiedDiff:x}),title:n("terminal:history.openFileWithDiff",{path:d}),children:y}),o.jsx("span",{className:"edit-tool-path",children:d}),o.jsxs("div",{className:"edit-tool-stats",children:[N.added>0&&o.jsxs("span",{className:"edit-stat added",children:["+",N.added]}),N.removed>0&&o.jsxs("span",{className:"edit-stat removed",children:["-",N.removed]})]}),m&&o.jsx("span",{className:"edit-tool-badge",children:n("tools:diff.replaceAll")})]}),o.jsxs("div",{className:"edit-tool-unified",children:[k.map((j,E)=>o.jsxs("div",{className:"diff-hunk",children:[o.jsxs("div",{className:"diff-hunk-header",children:[o.jsxs("span",{className:"diff-hunk-range",children:["@@ -",j.oldStart,",",j.oldCount," +",j.newStart,",",j.newCount," @@"]}),j.header&&o.jsx("span",{className:"diff-hunk-context",children:j.header})]}),j.lines.map((D,_)=>o.jsxs("div",{className:`diff-line diff-line-${D.type}`,children:[o.jsx("span",{className:"diff-line-num diff-line-num-old",children:D.type!=="added"?D.oldNum:""}),o.jsx("span",{className:"diff-line-num diff-line-num-new",children:D.type!=="removed"?D.newNum:""}),o.jsx("span",{className:"diff-line-marker",children:D.type==="added"?"+":D.type==="removed"?"-":" "}),o.jsx("span",{className:"diff-line-content",children:D.content||" "})]},_))]},E)),k.length===0&&o.jsx("div",{className:"diff-empty",children:"No changes detected"})]})]})}const{leftLines:v,rightLines:S,stats:A}=k5(f||"",h||"");return o.jsxs("div",{className:"edit-tool-diff",children:[o.jsxs("div",{className:"edit-tool-header",children:[o.jsx("span",{className:"edit-tool-file clickable",onClick:()=>e==null?void 0:e(d,{oldString:f||"",newString:h||""}),title:n("terminal:history.openFileWithDiff",{path:d}),children:y}),o.jsx("span",{className:"edit-tool-path",children:d}),o.jsxs("div",{className:"edit-tool-stats",children:[A.added>0&&o.jsxs("span",{className:"edit-stat added",children:["+",A.added]}),A.removed>0&&o.jsxs("span",{className:"edit-stat removed",children:["-",A.removed]})]}),m&&o.jsx("span",{className:"edit-tool-badge",children:n("tools:diff.replaceAll")})]}),o.jsxs("div",{className:"edit-tool-panels",children:[o.jsxs("div",{className:"edit-panel edit-panel-original",children:[o.jsx("div",{className:"edit-panel-header",children:o.jsx("span",{className:"edit-panel-label",children:n("tools:diff.original")})}),o.jsxs("div",{className:"edit-panel-content",ref:s,children:[v.map((k,N)=>o.jsxs("div",{className:`edit-line edit-line-${k.type}`,children:[o.jsx("span",{className:"edit-line-num",children:k.num}),o.jsx("span",{className:"edit-line-content",children:k.text||" "})]},N)),v.length===0&&o.jsxs("div",{className:"edit-line edit-line-empty",children:[o.jsx("span",{className:"edit-line-num",children:"-"}),o.jsx("span",{className:"edit-line-content edit-empty-text",children:n("common:status.empty")})]})]})]}),o.jsxs("div",{className:"edit-panel edit-panel-modified",children:[o.jsx("div",{className:"edit-panel-header",children:o.jsx("span",{className:"edit-panel-label",children:n("tools:diff.modified")})}),o.jsxs("div",{className:"edit-panel-content",ref:a,children:[S.map((k,N)=>o.jsxs("div",{className:`edit-line edit-line-${k.type}`,children:[o.jsx("span",{className:"edit-line-num",children:k.num}),o.jsx("span",{className:"edit-line-content",children:k.text||" "})]},N)),S.length===0&&o.jsxs("div",{className:"edit-line edit-line-empty",children:[o.jsx("span",{className:"edit-line-num",children:"-"}),o.jsx("span",{className:"edit-line-content edit-empty-text",children:n("common:status.empty")})]})]})]})]})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function CT({content:t,onFileClick:e}){try{const n=JSON.parse(t),{file_path:s,offset:a,limit:r}=n;if(!s)return o.jsx("pre",{className:"output-input-content",children:t});const i=s.split("/").pop()||s,c=a!==void 0&&r!==void 0,d=()=>{c?e==null||e(s,{highlightRange:{offset:a,limit:r}}):e==null||e(s)};return o.jsxs("div",{className:"read-tool-input",children:[o.jsxs("span",{className:"read-tool-file clickable",onClick:d,title:`Open ${s}${c?" (with highlighted lines)":""}`,children:["📄 ",i]}),o.jsx("span",{className:"read-tool-path",children:s}),(a!==void 0||r!==void 0)&&o.jsxs("span",{className:"read-tool-range",children:[a!==void 0&&`offset: ${a}`,a!==void 0&&r!==void 0&&", ",r!==void 0&&`limit: ${r}`]})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function fp({content:t}){const{t:e}=ht(["tools"]);try{const s=JSON.parse(t).todos;if(!Array.isArray(s)||s.length===0)return o.jsx("pre",{className:"output-input-content",children:t});const a={completed:s.filter(r=>r.status==="completed").length,in_progress:s.filter(r=>r.status==="in_progress").length,pending:s.filter(r=>r.status==="pending").length};return o.jsxs("div",{className:"todo-tool-input",children:[o.jsxs("div",{className:"todo-tool-header",children:[o.jsxs("span",{className:"todo-tool-title",children:["📋 ",e("tools:todoList.title")]}),o.jsxs("div",{className:"todo-tool-stats",children:[a.completed>0&&o.jsxs("span",{className:"todo-stat completed",children:["✓ ",a.completed]}),a.in_progress>0&&o.jsxs("span",{className:"todo-stat in-progress",children:["► ",a.in_progress]}),a.pending>0&&o.jsxs("span",{className:"todo-stat pending",children:["○ ",a.pending]})]})]}),o.jsx("div",{className:"todo-tool-list",children:s.map((r,i)=>o.jsxs("div",{className:`todo-item todo-${r.status}`,children:[o.jsx("span",{className:"todo-status-icon",children:r.status==="completed"?"✓":r.status==="in_progress"?"►":"○"}),o.jsx("span",{className:"todo-content",children:r.content})]},i))})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function AT({content:t}){const[e,n]=b.useState(null);try{const a=JSON.parse(t).questions;return!Array.isArray(a)||a.length===0?o.jsx("pre",{className:"output-input-content",children:t}):o.jsx("div",{className:"ask-question-input",children:a.map((r,i)=>o.jsxs("div",{className:"ask-question-block",children:[o.jsxs("div",{className:"ask-question-header",children:[r.header&&o.jsx("span",{className:"ask-question-badge",children:r.header}),o.jsx("span",{className:"ask-question-text",children:r.question}),r.multiSelect&&o.jsx("span",{className:"ask-question-multi",children:"multi"})]}),r.options&&r.options.length>0&&o.jsx("div",{className:"ask-question-options",children:r.options.map((c,d)=>{const f=i*100+d,h=e===f;return o.jsxs("div",{className:`ask-question-option ${h?"expanded":""}`,onClick:()=>n(h?null:f),children:[o.jsxs("div",{className:"ask-option-row",children:[o.jsx("span",{className:"ask-option-number",children:d+1}),o.jsx("span",{className:"ask-option-label",children:c.label}),c.markdown&&o.jsx("span",{className:"ask-option-preview-hint",children:h?"▼":"▶"})]}),c.description&&o.jsx("div",{className:"ask-option-desc",children:c.description}),c.markdown&&h&&o.jsx("pre",{className:"ask-option-markdown",children:c.markdown})]},d)})})]},i))})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function Ub({content:t}){const[e,n]=b.useState(!1);try{const s=JSON.parse(t),a=typeof s.plan=="string"?s.plan.trim():"";if(!a)return o.jsx("pre",{className:"output-input-content",children:t});const r=a.match(/^#+\s+(.+)$/m),i=((r==null?void 0:r[1])||a.split(`
|
|
141
|
+
`).find(c=>c.trim().length>0)||"Plan ready").trim();return o.jsxs("div",{className:"plan-tool-input",children:[o.jsxs("div",{className:"plan-tool-header",children:[o.jsx("span",{className:"plan-tool-title",children:"🗺 Plan"}),o.jsx("button",{type:"button",className:"plan-tool-toggle",onClick:()=>n(c=>!c),title:e?"Collapse plan":"Expand plan",children:e?"▼ Hide":"▶ Show"})]}),e?o.jsx("div",{className:"plan-tool-markdown markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],children:a})}):o.jsx("div",{className:"plan-tool-collapsed-preview",children:i})]})}catch{return o.jsx("pre",{className:"output-input-content",children:t})}}function S5(t){return Array.isArray(t)?t.map(e=>String(e).trim()).filter(e=>e.length>0):typeof t=="string"?t.split(",").map(e=>e.trim()).filter(e=>e.length>0):[]}function C5(t){return Object.entries(t).filter(([,e])=>e!==void 0).map(([e,n])=>({key:e,value:typeof n=="string"?n:JSON.stringify(n)}))}function jT(t){const e=t.match(/(?:^|[\s,;])select\s*:\s*([^\n;]+)/i),n=t.match(/(?:^|[\s,;])fallback\s*:\s*([^\n;]+)/i),s=t.match(/(?:^|[\s,;])(?:show|show_hide|hide)\s*:\s*([^\n;]+)/i);return{selectedTools:e?e[1].split(",").map(r=>r.trim()).filter(Boolean):[],fallback:n?n[1].trim():null,showHide:s?s[1].trim():null}}function A5(t){const e=typeof t.tool=="string"?t.tool.toLowerCase():"",n=typeof t.type=="string"?t.type.toLowerCase():"",s=typeof t.label=="string"?t.label.toLowerCase():"";let a=S5(t.select??t.selected??t.selected_tools??t.tools),r=t.fallback??t.use_fallback??t.fallbackMode,i=t.show??t.show_hide??t.showHidden??t.hide;const c=t.query_params??t.query??t.params??t.arguments,d=Object.values(t).filter(x=>typeof x=="string").map(x=>x).join(" ; "),f=jT(d);if(a.length===0&&f.selectedTools.length>0&&(a=f.selectedTools),r===void 0&&f.fallback!==null&&(r=f.fallback),i===void 0&&f.showHide!==null&&(i=f.showHide),!(e.includes("toolsearch")||n.includes("toolsearch")||s.includes("toolsearch")||a.length>0||c!==void 0))return null;const m=c&&typeof c=="object"&&!Array.isArray(c)?C5(c):[];return{selectedTools:a,fallback:r!==void 0?String(r):null,showHide:i!==void 0?String(i):null,queryParams:m}}function j5(t){const e=jT(t),n=t.match(/(?:^|\s)(?:query|params|query_params)\s*:\s*(.+)$/i);if(e.selectedTools.length===0&&!n)return null;const s=[];return n&&n[1].split(/[;,]/).map(a=>a.trim()).filter(Boolean).forEach(a=>{const r=a.match(/^([^:=]+)\s*[:=]\s*(.+)$/);r?s.push({key:r[1].trim(),value:r[2].trim()}):s.push({key:"query",value:a})}),{selectedTools:e.selectedTools,fallback:e.fallback,showHide:e.showHide,queryParams:s}}function NT(t){try{const e=JSON.parse(t);if(e&&typeof e=="object"&&!Array.isArray(e))return A5(e)}catch{}return j5(t)}function TT(t){return NT(t)!==null}function pp({content:t,agentName:e}){const[n,s]=b.useState(!1),a=NT(t);if(!a)return o.jsx("pre",{className:"output-input-content",children:t});const r=a.selectedTools.length>0?a.selectedTools.slice(0,4).join(", "):"-",c=a.selectedTools.length>4?`${r} +${a.selectedTools.length-4}`:r;return o.jsxs("div",{className:"toolsearch-input",children:[o.jsxs("div",{className:"toolsearch-header",children:[o.jsx("span",{className:"toolsearch-badge",children:"⚡ ToolSearch"}),e&&o.jsx("span",{className:"toolsearch-agent",children:e}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Tools: ",c]}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Fallback: ",a.fallback??"-"]}),o.jsxs("span",{className:"toolsearch-meta-pill",children:["Show/Hide: ",a.showHide??"-"]}),o.jsx("button",{type:"button",className:"toolsearch-toggle",onClick:()=>s(d=>!d),title:n?"Hide details":"Show details",children:n?"▼ Hide":"▶ Show"})]}),n?o.jsxs("div",{className:"toolsearch-query-block",children:[o.jsx("div",{className:"toolsearch-tools",children:a.selectedTools.length>0?a.selectedTools.map(d=>o.jsx("span",{className:"toolsearch-tool-chip",children:d},d)):o.jsx("span",{className:"toolsearch-empty",children:"No selected tools"})}),o.jsx("div",{className:"toolsearch-query-title",children:"Query Parameters"}),a.queryParams.length>0?o.jsx("div",{className:"toolsearch-query-list",children:a.queryParams.map((d,f)=>o.jsxs("div",{className:"toolsearch-query-row",children:[o.jsx("span",{className:"toolsearch-query-key",children:d.key}),o.jsx("span",{className:"toolsearch-query-value",children:d.value})]},`${d.key}-${f}`))}):o.jsx("div",{className:"toolsearch-empty",children:"No query parameters provided"})]}):o.jsx("div",{className:"toolsearch-preview",children:"Collapsed"})]})}function xA({toolName:t,content:e}){const[n,s]=b.useState(!1);if(!e||e.trim()==="{}")return null;const a=e.length>220?`${e.slice(0,220)}...`:e;return o.jsxs("div",{className:"unknown-tool-input",children:[o.jsx("div",{className:"unknown-tool-header",children:o.jsx("button",{type:"button",className:"unknown-tool-toggle",onClick:()=>s(r=>!r),title:n?"Collapse details":"Expand details",children:n?"▼ Hide":"▶ Show"})}),n?o.jsx("pre",{className:"output-input-content",children:e}):o.jsx("pre",{className:"unknown-tool-preview",children:a})]})}function Jx(){const[t,e]=b.useState(!1),n=b.useRef(null),s=b.useCallback(async i=>{if(!i.trim()){console.warn("[TTS] No text to speak");return}n.current&&(n.current.pause(),n.current=null),console.log("[TTS] Requesting audio from server (auto-detect language):",i.substring(0,100)+"..."),e(!0);try{const c=await Pt(Ot("/api/tts/speak"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:i})});if(!c.ok){const m=await c.json();console.error("[TTS] Server error:",m),e(!1);return}const d=await c.blob(),f=URL.createObjectURL(d),h=new Audio(f);n.current=h,h.onended=()=>{e(!1),URL.revokeObjectURL(f),n.current=null},h.onerror=m=>{console.error("[TTS] Audio playback error:",m),e(!1),URL.revokeObjectURL(f),n.current=null},await h.play(),console.log("[TTS] Playing audio in browser")}catch(c){console.error("[TTS] Failed to get audio:",c),e(!1)}},[]),a=b.useCallback(()=>{n.current&&(n.current.pause(),n.current=null),e(!1)},[]),r=b.useCallback(i=>{console.log("[TTS] Toggle called, currently speaking:",t),t?a():s(i)},[t,s,a]);return{speak:s,stop:a,toggle:r,speaking:t,supported:!0}}function N5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}function T5(t){const e=t.content.slice(0,50),n=`H${t.type[0].toUpperCase()}`;let s=0;for(let a=0;a<e.length;a++)s=(s<<5)-s+e.charCodeAt(a),s|=0;return`${n}:${(s>>>0).toString(16).slice(0,6)}`}const _T=b.memo(function({message:e,agentId:n,highlight:s,simpleView:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var Ne,qe;const{t:f}=ht(["tools","common","terminal"]),[h,m]=b.useState(new Set),[x,y]=b.useState(!1),v=Mj(),S=Ir(),{type:A,content:k,toolName:N,timestamp:j,_bashOutput:E,_bashCommand:D}=e,_=ru(k,v),{toggle:B,speaking:O}=Jx(),T=Bu({onFileClick:i?Ge=>i(Ge):void 0}),M=n?(Ne=H.getState().agents.get(n))==null?void 0:Ne.name:null,R=n?(qe=H.getState().agents.get(n))==null?void 0:qe.provider:void 0,F=R==="codex"?"Codex":R==="opencode"?"OpenCode":"Claude",U=A==="tool_use"&&(N==="Task"||N==="Agent")&&e.toolInput&&(e.toolInput.name||e.toolInput.description)||null||M,L=j?cp(new Date(j).getTime()):"",z=j?new Date(j).getTime():0,W=T5(e);if(A==="assistant"&&!_.trim())return o.jsxs("div",{className:"output-line output-empty-message",children:[L&&o.jsx("span",{className:"output-timestamp",title:`${z} | ${W}`,children:L}),o.jsxs("span",{className:"history-role",children:[R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon"}),F]}),o.jsx("span",{className:"empty-message-label",children:f("terminal:history.emptyMessage","empty message")})]});if(_.startsWith("This session is being continued from a previous conversation that ran out of context"))return o.jsxs("div",{className:`output-line output-session-continuation ${x?"expanded":""}`,onClick:()=>y(!x),title:f("terminal:history.clickToExpandCollapse"),children:[L&&o.jsx("span",{className:"output-timestamp",title:`${z} | ${W}`,children:L}),o.jsx("span",{className:"session-continuation-icon",children:"🔗"}),o.jsx("span",{className:"session-continuation-label",children:f("tools:display.sessionContinued")}),o.jsx("span",{className:"session-continuation-toggle",children:x?"▼":"▶"}),x&&o.jsx("div",{className:"session-continuation-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:T,children:_})})]});const Y=_.trimStart().startsWith(vb),P=!Y&&_.includes("<local-command-stdout>")&&_.includes("Context Usage");if(!Y&&(_.includes("## Context Usage")||_.includes("Context Usage")&&_.includes("Tokens:")&&_.includes("Free space")||P)){const Ge=_.match(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/),X=Ge?Ge[1]:_,se=X.match(/\*?\*?Tokens:\*?\*?\s*([\d.]+)k?\s*\/\s*([\d.]+)k?\s*\((\d+)%\)/),Ve=(ie=>{const fe=new RegExp(`\\|\\s*${ie}\\s*\\|\\s*([\\d.]+)k?\\s*\\|\\s*([\\d.]+)%`,"i"),Ue=X.match(fe);if(Ue)return{tokens:Ue[1]+"k",percent:Ue[2]+"%"};const it=new RegExp(`${ie}\\s+([\\d.]+)k?\\s+([\\d.]+)%`,"i"),ot=X.match(it);return ot?{tokens:ot[1]+"k",percent:ot[2]+"%"}:null})("Messages"),at=se?parseInt(se[3]):0,we=100-at,$e=()=>{n&&H.setContextModalAgentId(n)};return o.jsxs("div",{className:"output-line output-context-stats",style:{cursor:n?"pointer":"default"},onClick:$e,title:n?f("terminal:history.clickForContextStats"):void 0,children:[L&&o.jsxs("span",{className:"output-timestamp context-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{className:"context-debug-hash",children:["[",W,"]"]})]}),o.jsx("span",{className:"context-icon",children:"📊"}),o.jsx("span",{className:"context-label",children:f("terminal:history.contextLabel")}),o.jsx("div",{className:"context-bar",children:o.jsx("div",{className:"context-bar-fill",style:{width:`${at}%`}})}),o.jsx("span",{className:"context-tokens",children:se?`${se[1]}k/${se[2]}k`:"?"}),o.jsxs("span",{className:"context-free",children:["(",f("terminal:history.percentFree",{percent:we.toFixed(0)}),")"]}),Ve&&o.jsx("span",{className:"context-msgs",children:f("terminal:history.msgsLabel",{tokens:Ve.tokens})})]})}if(!Y&&(_.includes("<local-command-caveat>")||_.includes("<command-name>/context</command-name>")||_.includes("<command-name>/cost</command-name>")||_.includes("<command-name>/compact</command-name>")))return null;const Q=A==="user"?Kx(_):null,q=Ge=>{if(!Ge)return null;let X=Ge;if(X.includes("<persisted-output>")){X=X.replace(/<\/?persisted-output>/g,"").trim();const $e=X.match(/Preview \(first [^)]+\):\s*([\s\S]*)/);if($e)X=$e[1].trim();else{const ie=X.indexOf("{");ie!==-1&&(X=X.slice(ie))}}const se=$e=>{try{const ie=JSON.parse($e);if(ie&&typeof ie=="object"&&typeof ie.output=="string")return ie.output.split(`
|
|
142
|
+
`).filter(fe=>fe.length>0)}catch{}return null},Ee=se(X);if(Ee)return Ee;const Ve=X.indexOf("{"),at=X.lastIndexOf("}");if(Ve!==-1&&at>Ve){const $e=se(X.slice(Ve,at+1));if($e)return $e}const we=X.match(/"output"\s*:\s*"([\s\S]*)/);if(we){let $e=we[1];const ie=$e.match(/","(?:duration|exitCode|taskId|success)":/);ie&&ie.index!==void 0&&($e=$e.slice(0,ie.index)),$e=$e.replace(/\.\.\.\s*$/,"");try{$e=JSON.parse(`"${$e}"`)}catch{$e=$e.replace(/\\u([0-9a-fA-F]{4})/g,(Ue,it)=>String.fromCharCode(parseInt(it,16))).replace(/\\n/g,`
|
|
143
|
+
`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}const fe=$e.split(`
|
|
144
|
+
`).filter(Ue=>Ue.length>0);if(fe.length>0)return fe}return null};if(A==="tool_use"){const Ge=is[N||""]||is.default,X=N?Z1(N,f):"",se=e.toolInput?JSON.stringify(e.toolInput):_;if(a){let Ee=N&&se?eT(N,se):null;N==="Bash"&&Ee&&Ee.length>300&&(Ee=Ee.substring(0,297)+"...");const at=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(N||""),we=Ee&&(at||Ee.startsWith("/")||Ee.includes("/")),$e=at&&we&&i,ie=N==="Bash"&&c,fe=D||Ee||"",Ue=ie&&fe?aT(fe):null,it=ie&&fe?rT(fe):null,ot=ie&&fe?iT(fe):null,ce=ie&&fe?oT(fe):null,J=()=>{if($e&&Ee){if(N==="Edit"&&se)try{const Fe=JSON.parse(se);if(Fe.old_string!==void 0||Fe.new_string!==void 0||Fe.unified_diff!==void 0){i(Ee,{oldString:Fe.old_string||"",newString:Fe.new_string||"",operation:typeof Fe.operation=="string"?Fe.operation:void 0,unifiedDiff:typeof Fe.unified_diff=="string"?Fe.unified_diff:void 0});return}}catch{}if(N==="Read"&&se)try{const Fe=JSON.parse(se);if(Fe.offset!==void 0&&Fe.limit!==void 0){i(Ee,{highlightRange:{offset:Fe.offset,limit:Fe.limit}});return}}catch{}i(Ee)}},ae=()=>{ie&&fe&&c(fe,E||f("tools:display.noOutputAvailable"))},Se=()=>{var Le;if(!Ee)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:uo(Ee,"bash")}});const Fe=n?(Le=H.getState().agents.get(n))==null?void 0:Le.cwd:void 0;return sT(Ee).map((te,pe)=>{if(!te.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:uo(te.text,"bash")}},`cmd-${pe}`);const ke=jp(te.fileRef,Fe);return o.jsx("span",{className:"clickable-path",onClick:Be=>{Be.stopPropagation(),i(ke.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:te.text},`cmd-file-${pe}`)})},ee=ie?f("tools:display.clickToViewOutput"):$e?f("tools:display.clickToViewFile"):void 0,ge=/\bcurl\b[\s\S]*\/api\/exec\b/.test(fe);let Re=null;if(ge&&E){const Fe=q(E);Fe&&Fe.length>0&&(Re={output:Fe})}if(N==="TodoWrite"&&se)return o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-todo-inline",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X}),o.jsx(fp,{content:se})]});if((N==="AskUserQuestion"||N==="AskFollowupQuestion")&&se){let Fe=!1;try{const oe=JSON.parse(se);Fe=Array.isArray(oe.questions)&&oe.questions.length>0}catch{}if(Fe)return o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-ask-question-inline",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X}),o.jsx(AT,{content:se})]})}return N==="ExitPlanMode"&&se?o.jsxs("div",{className:"output-line output-tool-use output-tool-simple output-plan-inline",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X}),o.jsx(Ub,{content:se})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use output-tool-simple ${ie?"clickable-bash":""} ${it?"bash-notify-use":""}`,onClick:ie?ae:void 0,style:ie?{cursor:"pointer"}:void 0,title:ie?f("tools:display.clickToViewOutput"):void 0,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X}),ie&&it?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:ae,title:it.commandBody,style:{cursor:"pointer"},children:[it.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:it.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),it.title&&o.jsx("span",{className:"bash-notify-title",children:it.title}),it.message&&o.jsx("span",{className:"bash-notify-message",children:it.message})]}):ie&&ot?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:ae,title:ot.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:ot.taskLabel})]}):ie&&ce?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:ae,title:ce.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${ce.status==="failed"?"status-failed":"status-completed"}`,children:ce.status==="failed"?"❌ report":"✅ report"}),ce.summary&&o.jsx("span",{className:"bash-report-task-summary",children:ce.summary})]}):ie&&Ue?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:ae,title:Ue.commandBody,style:{cursor:"pointer"},children:[Ue.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:Ue.shellPrefix}),o.jsx("span",{className:"bash-search-chip",children:"search"}),o.jsx("span",{className:"bash-search-term",children:Ue.searchTerm})]}):Ee&&o.jsxs("span",{className:`output-tool-param ${$e?"clickable-path":""}`,onClick:$e?J:void 0,title:ee,style:$e?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[at&&we&&(()=>{const Fe=N5(Ee),oe=Fe?Pp(Fe):"";return oe?o.jsx("img",{className:"output-tool-file-icon",src:oe,alt:""}):null})(),ie?Se():Ee]})]}),ge&&Re&&o.jsx("div",{className:"exec-task-output-container",children:o.jsx("div",{className:"exec-task-inline status-completed",children:(()=>{const Fe=`history-curl-${j}`,oe=h.has(Fe),Le=Re.output.slice(-6),te=Re.output.length>6,pe=oe?Re.output:Le;return o.jsxs(o.Fragment,{children:[te&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>m(ke=>{const Be=new Set(ke);return Be.has(Fe)?Be.delete(Fe):Be.add(Fe),Be}),children:[o.jsx("span",{className:"exec-task-toggle-arrow",children:oe?"▼":"▶"}),o.jsx("span",{className:"exec-task-toggle-text",children:oe?f("tools:skills.hide"):f("tools:skills.showAll",{count:Re.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsx("pre",{className:"exec-task-inline-output",children:pe.map((ke,Be)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:kl(ke)}},Be))})})]})})()})})]})}return N==="Edit"&&se?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(ST,{content:se,onFileClick:i})})]}):N==="Read"&&se?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(CT,{content:se,onFileClick:i})})]}):N==="TodoWrite"&&se?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(fp,{content:se})})]}):N==="ExitPlanMode"&&se?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(Ub,{content:se})})]}):N==="ToolSearch"&&se?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(pp,{content:se,agentName:U})})]}):se&&TT(se)?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"})]}),o.jsx("div",{className:"output-line output-tool-input",children:o.jsx(pp,{content:se,agentName:U})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"output-line output-tool-use",children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),U&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${U}`,children:U}),o.jsx("span",{className:"output-tool-icon",children:Ge}),o.jsx("span",{className:"output-tool-name",children:X})]}),se&&o.jsx("div",{className:"output-line output-tool-input",children:o.jsx("pre",{className:"output-input-content",children:ol(se,s)})})]})}if(A==="tool_result"){if(a)return null;const Ge=_.toLowerCase().includes("error")||_.toLowerCase().includes("failed");if(N==="Bash"){const X=Ge||_.toLowerCase().includes("command not found")||_.toLowerCase().includes("permission denied"),se=_.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${X?"is-error":""}`,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("div",{className:"bash-output-container",children:[o.jsxs("div",{className:"bash-output-header",children:[o.jsx("span",{className:"bash-output-icon",children:"$"}),o.jsx("span",{className:"bash-output-label",children:f("tools:display.terminalOutput")}),se&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:kl(_)}})]})]})}return o.jsxs("div",{className:`output-line output-tool-result ${Ge?"is-error":""}`,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsx("span",{className:"output-result-icon",children:Ge?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:ol(_,s)})]})}const be=A==="user",ue=!be&&/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(_),Z=be?"history-line history-user":ue?"history-line history-system":"history-line history-assistant",de=ue?f("tools:display.system"):F;if(be&&Q){const X=Qx(Q.userMessage).userMessage,se=uT(X.trim());if(se.isDelegatedTask)return o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsx("span",{className:"history-content",children:o.jsx(gT,{bossName:se.bossName,bossId:se.bossId,taskCommand:se.taskCommand})})]});const Ee=dT(X.trim());if(Ee.isTaskReport)return o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-content",children:[Q.hasContext&&Q.context&&o.jsx(dp,{context:Q.context,onFileClick:i?at=>i(at):void 0},`boss-${j||_.slice(0,50)}`),o.jsx(bT,{agentName:Ee.agentName,agentId:Ee.agentId,status:Ee.status,originalTask:Ee.originalTask,summary:Ee.summary})]})]});const Ve=fT(X.trim());return Ve.hasNotification?o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-content",children:[o.jsx(xT,{agentId:Ve.agentId,status:Ve.status}),Ve.contentWithoutNotification&&o.jsx("span",{className:"user-prompt-text",children:s?o.jsx("div",{children:ol(Ve.contentWithoutNotification,s)}):mu(Ve.contentWithoutNotification,r,i)})]})]}):o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsx("span",{className:"history-role history-role-chip",children:f("common:labels.you")}),o.jsxs("span",{className:"history-content user-prompt-text",children:[Q.hasContext&&Q.context&&o.jsx(dp,{context:Q.context,onFileClick:i?at=>i(at):void 0},`boss-${j||_.slice(0,50)}`),s?o.jsx("div",{children:ol(X,s)}):mu(X,r,i)]})]})}const Ce=pT(_),xe=hT(Ce.contentWithoutBlock);return Ce.hasDelegation||xe.hasWorkPlan?o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:"history-role",children:[!ue&&R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon",title:R==="codex"?f("terminal:history.codexAgent"):R==="opencode"?"OpenCode Agent":f("terminal:history.claudeAgent")}),de]}),o.jsxs("span",{className:"history-content markdown-content",children:[s?o.jsx("div",{children:ol(xe.contentWithoutBlock,s)}):pl(xe.contentWithoutBlock,r,i),xe.hasWorkPlan&&xe.workPlan&&o.jsx(yT,{workPlan:xe.workPlan}),Ce.hasDelegation&&Ce.delegations.map((Ge,X)=>o.jsx(mT,{delegation:Ge},`del-${X}`))]}),o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ge=>{Ge.stopPropagation(),B(_)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ge=>{Ge.stopPropagation(),d(_)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]}):o.jsxs("div",{className:Z,children:[L&&o.jsxs("span",{className:"output-timestamp",title:`${z} | ${W}`,children:[L," ",o.jsxs("span",{style:{fontSize:"9px",color:"#888",fontFamily:"monospace"},children:["[",W,"]"]})]}),o.jsxs("span",{className:`history-role ${be?"history-role-chip":""}`,children:[!be&&!ue&&R&&o.jsx("img",{src:R==="codex"?"/assets/codex.png":R==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"history-role-icon",title:R==="codex"?f("terminal:history.codexAgent"):R==="opencode"?"OpenCode Agent":f("terminal:history.claudeAgent")}),be?f("common:labels.you"):de]}),o.jsx("span",{className:`history-content ${be?"user-prompt-text":"markdown-content"}`,children:s?o.jsx("div",{children:ol(_,s)}):be?mu(_,r,i):pl(_,r,i)}),!be&&o.jsxs("div",{className:"message-action-btns",children:[S.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:Ge=>{Ge.stopPropagation(),B(_)},title:f(O?"terminal:history.stopSpeaking":"terminal:history.speakSpanish"),children:O?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:Ge=>{Ge.stopPropagation(),d(_)},title:f("terminal:history.viewAsMarkdown"),children:"📄"})]})]})});function _5(t){const e=t.split("/").pop()||t,n=e.lastIndexOf(".");return n<=0?"":e.slice(n).toLowerCase()}const E5=b.memo(function({entries:e,isWorking:n}){const[s,a]=b.useState(!1),r=b.useRef(null);b.useEffect(()=>{n&&s&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[e.length,n,s]);const i=s?e:e.slice(-3);return o.jsxs("div",{className:"subagent-stream-panel",children:[o.jsxs("div",{className:"subagent-stream-toggle",onClick:()=>a(!s),children:[o.jsx("span",{className:"stream-toggle-arrow",children:s?"▼":"▶"}),o.jsx("span",{children:s?"Hide stream":`Stream (${e.length} events)`})]}),(s||e.length<=3)&&o.jsxs("div",{className:"subagent-stream-list",ref:r,children:[i.map((c,d)=>o.jsxs("div",{className:`subagent-stream-entry entry-${c.type}${c.isError?" entry-error":""}`,children:[c.type==="text"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:"🤖"}),o.jsx("span",{className:"stream-entry-text",children:c.text})]}),c.type==="tool_use"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:is[c.toolName||""]||is.default}),o.jsx("span",{className:"stream-entry-tool",children:c.toolName}),c.toolKeyParam&&o.jsx("span",{className:"stream-entry-param",children:c.toolKeyParam})]}),c.type==="tool_result"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"stream-entry-icon",children:c.isError?"✗":"✓"}),o.jsx("span",{className:"stream-entry-result",children:c.resultPreview})]})]},d)),n&&o.jsx("span",{className:"subagent-cursor",children:"▌"})]})]})});function M5(t){const e=t.text.slice(0,50),n=`${t.isUserPrompt?"U":""}${t.isStreaming?"S":"F"}${t.isDelegation?"D":""}`;let s=0;for(let a=0;a<e.length;a++)s=(s<<5)-s+e.charCodeAt(a),s|=0;return`${n}:${(s>>>0).toString(16).slice(0,6)}`}function D5({output:t,debugHash:e,agentId:n,onClose:s}){const{t:a}=ht(["tools","common"]),r=b.useRef(null);b.useEffect(()=>{const A=k=>{r.current&&!r.current.contains(k.target)&&s()};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[s]);const i=A=>{navigator.clipboard.writeText(A)},d=new Date(t.timestamp).toISOString();let f="assistant";t.isUserPrompt?f="user":t.text.startsWith("Using tool:")?f="tool_use":t.text.startsWith("Tool input:")?f="tool_input":t.text.startsWith("Tool result:")?f="tool_result":t.text.startsWith("Bash output:")?f="bash_output":t.text.startsWith("Tokens:")||t.text.startsWith("Cost:")?f="stats":t.text.startsWith("[thinking]")?f="thinking":t.skillUpdate&&(f="skill_update");const h=t.uuid?"server":t.isUserPrompt?"client (user)":"client/system",m=()=>{const A={uuid:t.uuid||null,hash:e,type:f,timestamp:t.timestamp,iso:d,agentId:n||null,isStreaming:t.isStreaming,source:h,textLen:t.text.length,textPreview:t.text.slice(0,120)};t.isDelegation&&(A.isDelegation=!0),t.toolName&&(A.toolName=t.toolName),t.toolInput&&(A.toolInput=t.toolInput),t.toolOutput&&(A.toolOutputLen=t.toolOutput.length),t.subagentName&&(A.subagentName=t.subagentName),t.isUserPrompt&&(A.isUserPrompt=!0),t.skillUpdate&&(A.skillUpdate=t.skillUpdate),navigator.clipboard.writeText(JSON.stringify(A,null,2))},x=n?H.getState().agentOutputs.get(n):null,y=x?x.indexOf(t):-1,v=x?x.length:0,S=[{label:"UUID",value:t.uuid||"(none)",mono:!0},{label:"Hash",value:e,mono:!0},{label:"Type",value:f},{label:"Source",value:h},{label:"Agent",value:n||"(none)",mono:!0},{label:"Time",value:d,mono:!0},{label:"Epoch",value:String(t.timestamp),mono:!0},{label:"Index",value:y>=0?`${y} / ${v}`:"(unknown)",mono:!0},{label:"Text",value:`[${t.text.length} chars] ${t.text.slice(0,120)}`,mono:!0}];return t.isStreaming&&S.push({label:"State",value:"streaming"}),t.isDelegation&&S.push({label:"Flag",value:"delegation"}),t.toolName&&S.push({label:"Tool",value:t.toolName}),t.toolInput&&S.push({label:"ToolIn",value:JSON.stringify(t.toolInput).slice(0,200),mono:!0}),t.toolOutput&&S.push({label:"ToolOut",value:`[${t.toolOutput.length} chars] ${t.toolOutput.slice(0,120)}`,mono:!0}),t.subagentName&&S.push({label:"Subagent",value:t.subagentName}),o.jsxs("div",{className:"msg-meta-tooltip",ref:r,children:[o.jsxs("div",{className:"msg-meta-tooltip__header",children:[o.jsx("span",{children:a("tools:metadata.messageInfo")}),o.jsxs("div",{className:"msg-meta-tooltip__actions",children:[o.jsx("button",{className:"msg-meta-tooltip__copy-all",onClick:m,title:a("tools:metadata.copyAllAsJSON"),children:"JSON"}),o.jsx("button",{className:"msg-meta-tooltip__close",onClick:s,children:"×"})]})]}),o.jsx("div",{className:"msg-meta-tooltip__body",children:S.map(({label:A,value:k,mono:N})=>o.jsxs("div",{className:"msg-meta-tooltip__row",children:[o.jsx("span",{className:"msg-meta-tooltip__label",children:A}),o.jsx("span",{className:`msg-meta-tooltip__value ${N?"mono":""}`,onClick:()=>i(k),title:a("tools:metadata.clickToCopy"),children:k})]},A))})]})}function Fn({output:t,timeStr:e,debugHash:n,agentId:s}){const{t:a}=ht(["tools"]),[r,i]=b.useState(!1),c=b.useCallback(f=>{f.stopPropagation(),i(h=>!h)},[]),d=b.useCallback(()=>i(!1),[]);return o.jsxs("span",{className:"output-timestamp-wrapper",children:[o.jsx("span",{className:"output-timestamp output-timestamp--clickable",onClick:c,title:a("tools:metadata.clickForMessageInfo"),children:e}),r&&o.jsx(D5,{output:t,debugHash:n,agentId:s||null,onClose:d})]})}const Zx=b.memo(function({output:e,agentId:n,execTasks:s=[],subagents:a,onImageClick:r,onFileClick:i,onBashClick:c,onViewMarkdown:d}){var we,$e,ie;const{t:f}=ht(["tools","common"]),h=Mj(),m=Ir(),[x,y]=b.useState(new Set),{text:v,isStreaming:S,isUserPrompt:A,timestamp:k,skillUpdate:N,_toolKeyParam:j,_editData:E,_todoInput:D,_bashOutput:_,_bashCommand:B,_isRunning:O}=e,T=ru(v,h),M=e.toolName,R=e.toolInput,F=e.toolOutput;let $=j;if(!$&&R&&typeof R=="object"){const fe=R;if(M==="Glob"&&fe.pattern)$=fe.path?`${fe.pattern} in ${fe.path}`:fe.pattern;else if(M==="Grep"&&fe.pattern)$=fe.path?`"${fe.pattern}" in ${fe.path}`:`"${fe.pattern}"`;else if((M==="AskUserQuestion"||M==="AskFollowupQuestion")&&fe.questions){const Ue=fe.questions;Array.isArray(Ue)&&((we=Ue[0])!=null&&we.question)&&($=Ue[0].question)}else if((M==="Task"||M==="Agent")&&typeof fe.description=="string"){const Ue=fe.description,it=fe.subagent_type;$=it?`[${it}] ${Ue}`:Ue}else if(M==="ExitPlanMode"||M==="EnterPlanMode"){const Ue=fe.allowedPrompts;Array.isArray(Ue)&&Ue.length>0?$=Ue.map(it=>it.prompt||it.tool||"").filter(Boolean).join(", "):M==="ExitPlanMode"&&typeof fe.plan=="string"&&fe.plan.trim().length>0?$=fe.plan.trim():$=M==="ExitPlanMode"?"Plan ready":"Entering plan mode"}else if(M==="spawn_agent"||M==="send_input"||M==="wait"){const Ue=fe.prompt,it=fe.receiver_thread_ids;Ue?$=Ue.length>100?Ue.slice(0,97)+"...":Ue:it&&it.length>0?$=`waiting on ${it.length} thread(s)`:M==="wait"&&($="waiting for subagents")}else if(M==="TodoWrite"&&Array.isArray(fe.todos)){const Ue=fe.todos,it=Ue.filter(ae=>ae.status==="completed").length,ot=Ue.filter(ae=>ae.status==="in_progress").length,ce=Ue.filter(ae=>ae.status==="pending").length,J=[];it>0&&J.push(`${it} done`),ot>0&&J.push(`${ot} active`),ce>0&&J.push(`${ce} pending`),$=`${Ue.length} items (${J.join(", ")})`}else if($=fe.file_path||fe.path||fe.notebook_path||fe.command||fe.pattern||fe.url||fe.query||fe.description,!$)try{const Ue=JSON.stringify(fe);Ue&&Ue!=="{}"&&($=Ue.length>200?Ue.slice(0,197)+"...":Ue)}catch{}}const U=n?($e=H.getState().agents.get(n))==null?void 0:$e.name:null,L=e.subagentName||U,z=n?(ie=H.getState().agents.get(n))==null?void 0:ie.provider:void 0,W=z==="codex"?"Codex":z==="opencode"?"OpenCode":"Claude",[V,Y]=b.useState(!1),[P,K]=b.useState(!1),{toggle:Q,speaking:q}=Jx(),be=cp(k||Date.now()),ue=M5(e);if(N)return o.jsxs("div",{className:"output-line output-skill-update",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx("span",{className:"skill-update-icon",children:"🔄"}),o.jsx("span",{className:"skill-update-label",children:f("tools:skills.skillsUpdated")}),o.jsx("span",{className:"skill-update-list",children:N.skills.map((fe,Ue)=>o.jsxs("span",{className:"skill-update-item",title:fe.description,children:[fe.name,Ue<N.skills.length-1?", ":""]},fe.name))})]});if(T.startsWith("This session is being continued from a previous conversation that ran out of context"))return o.jsxs("div",{className:`output-line output-session-continuation ${V?"expanded":""}`,onClick:()=>Y(!V),title:"Click to expand/collapse",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx("span",{className:"session-continuation-icon",children:"🔗"}),o.jsx("span",{className:"session-continuation-label",children:f("tools:display.sessionContinued")}),o.jsx("span",{className:"session-continuation-toggle",children:V?"▼":"▶"}),V&&o.jsx("div",{className:"session-continuation-content",children:pl(T,r,i)})]});const de=n?H.getLastDelegationReceived(n):null;if(A){const fe=T.trim();if(fe==="/context"||fe==="/cost"||fe==="/compact")return null;const Ue=Kx(T),it=Qx(Ue.userMessage),ot=it.userMessage,ce=uT(ot.trim());if(ce.isDelegatedTask)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(gT,{bossName:ce.bossName,bossId:ce.bossId,taskCommand:ce.taskCommand})]});const J=dT(ot.trim());if(J.isTaskReport)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),Ue.hasContext&&Ue.context&&o.jsx(dp,{context:Ue.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),o.jsx(bT,{agentName:J.agentName,agentId:J.agentId,status:J.status,originalTask:J.originalTask,summary:J.summary})]});const ae=fT(ot.trim());if(ae.hasNotification)return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(xT,{agentId:ae.agentId,status:ae.status}),ae.contentWithoutNotification&&o.jsx("span",{className:"history-content user-prompt-text",children:mu(ae.contentWithoutNotification,r,i)})]});const Se=de&&T.trim()===de.taskCommand.trim();return o.jsxs("div",{className:"output-line output-user",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),Se?o.jsx(u5,{bossName:de.bossName,taskCommand:de.taskCommand}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"output-role output-role-chip output-role-user-chip",children:f("common:labels.you")}),Ue.hasContext&&Ue.context&&o.jsx(dp,{context:Ue.context,onFileClick:i},`boss-stream-${T.slice(0,50)}`),mu(it.userMessage,r,i)]})]})}if(T.startsWith("Using tool:")){const fe=T.replace("Using tool:","").trim(),Ue=Z1(fe,f),it=is[fe]||is.default,ot=new Set(["Bash","Read","Write","Edit","Glob","Grep","NotebookEdit","Task","Agent","TodoWrite","AskUserQuestion","AskFollowupQuestion","ExitPlanMode","EnterPlanMode","web_search","ToolSearch","spawn_agent","send_input","wait"]),ce=D||(fe==="TodoWrite"&&R&&typeof R=="object"&&Array.isArray(R.todos)?JSON.stringify(R):void 0);if(fe==="TodoWrite"&&ce)return o.jsxs("div",{className:`output-line output-tool-use output-todo-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:it}),o.jsx("span",{className:"output-tool-name",children:Ue}),o.jsx(fp,{content:ce})]});const J=(fe==="AskUserQuestion"||fe==="AskFollowupQuestion")&&R&&typeof R=="object"&&Array.isArray(R.questions)?JSON.stringify(R):void 0;if((fe==="AskUserQuestion"||fe==="AskFollowupQuestion")&&J)return o.jsxs("div",{className:`output-line output-tool-use output-ask-question-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:it}),o.jsx("span",{className:"output-tool-name",children:Ue}),o.jsx(AT,{content:J})]});const ae=fe==="ExitPlanMode"&&R&&typeof R=="object"&&typeof R.plan=="string"?JSON.stringify(R):void 0;if(fe==="ExitPlanMode"&&ae)return o.jsxs("div",{className:`output-line output-tool-use output-plan-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:it}),o.jsx("span",{className:"output-tool-name",children:Ue}),o.jsx(Ub,{content:ae})]});const Se=fe==="ToolSearch"&&R&&typeof R=="object"?JSON.stringify(R):void 0;if(fe==="ToolSearch"&&Se)return o.jsxs("div",{className:`output-line output-tool-use output-toolsearch-inline ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx("span",{className:"output-tool-icon",children:"⚡"}),o.jsx("span",{className:"output-tool-name",children:"ToolSearch"}),o.jsx(pp,{content:Se,agentName:L})]});if(["spawn_agent","send_input","wait"].includes(fe)){const gt=R,ut=gt==null?void 0:gt.prompt,ft=gt==null?void 0:gt.receiver_thread_ids,Ft=ut?ut.length>120?ut.slice(0,117)+"...":ut:void 0,cn=fe==="spawn_agent"?"Spawn Agent":fe==="send_input"?"Send Input":"Wait";return o.jsxs("div",{className:`output-line output-tool-use output-collab-tool output-collab-${fe} ${S?"output-streaming":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:it}),o.jsx("span",{className:"output-tool-name collab-tool-name",children:cn}),ft&&ft.length>0&&o.jsx("span",{className:"collab-thread-ids",children:ft.map(Dn=>Dn.slice(-8)).join(", ")}),Ft&&o.jsx("span",{className:"collab-prompt-preview",title:ut,children:Ft})]})}const ge=R&&typeof R=="object"?JSON.stringify(R,null,2):void 0,Fe=["Read","Edit","Write","Glob","Grep","NotebookEdit"].includes(fe),oe=R&&typeof R=="object"?R:null,Le=oe?(typeof oe.file_path=="string"?oe.file_path:void 0)||(typeof oe.path=="string"?oe.path:void 0)||(typeof oe.notebook_path=="string"?oe.notebook_path:void 0):void 0,te=j||Le,pe=!!te&&(Fe||te.startsWith("/")||te.includes("/")),ke=Fe&&pe&&i,Be=fe==="Edit"&&oe?{oldString:String(oe.old_string??""),newString:String(oe.new_string??""),operation:typeof oe.operation=="string"?oe.operation:void 0}:void 0,Ke=fe==="Read"&&oe&&typeof oe.offset=="number"&&typeof oe.limit=="number"?{highlightRange:{offset:oe.offset,limit:oe.limit}}:void 0,ze=fe==="Bash"&&c,Ze=!!_||!!F,lt=B||j||$||"",et=nT(lt),ct=/\bcurl\b[\s\S]*\/api\/exec\b/.test(lt),st=k?new Date(k).getTime():0,bt=ct?tT(lt):null,Tt=ct&&s.length>0?(()=>{if(bt){const ut=s.filter(ft=>ft.command===bt);if(ut.length>0)return[ut.reduce((Ft,cn)=>cn.startedAt>Ft.startedAt?cn:Ft)]}const gt=s.filter(ut=>ut.startedAt>=st&&ut.startedAt<=st+5e3);return gt.length>0?[gt.reduce((ft,Ft)=>Ft.startedAt>ft.startedAt?Ft:ft)]:[]})():[],he=!!(ze&&ct&&Tt.length>0),_e=(fe==="Task"||fe==="Agent")&&a&&e.uuid?(()=>{for(const[,gt]of a)if(gt.toolUseId===e.uuid)return gt})():void 0,We=ze&<?aT(lt):null,nt=ze&<?rT(lt):null,_t=ze&<?iT(lt):null,Bt=ze&<?oT(lt):null,Ct=gt=>{if(gt.stopPropagation(),ke&&te){const ut=E||Be;fe==="Edit"&&ut?i(te,ut):fe==="Read"&&Ke?i(te,Ke):i(te)}},$t=()=>{if(ze&<){const gt=O?f("tools:display.running"):_||f("tools:display.noOutputCaptured");c(lt,gt)}},Vt=()=>{var ft;if(!et)return null;if(!i)return o.jsx("span",{dangerouslySetInnerHTML:{__html:uo(et,"bash")}});const gt=n?(ft=H.getState().agents.get(n))==null?void 0:ft.cwd:void 0;return sT(et).map((Ft,cn)=>{if(!Ft.fileRef)return o.jsx("span",{dangerouslySetInnerHTML:{__html:uo(Ft.text,"bash")}},`cmd-${cn}`);const Dn=jp(Ft.fileRef,gt);return o.jsx("span",{className:"clickable-path",onClick:ss=>{ss.stopPropagation(),i(Dn.path)},title:f("tools:display.clickToViewFile"),style:{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"},children:Ft.text},`cmd-file-${cn}`)})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`output-line output-tool-use ${S?"output-streaming":""} ${ze?"bash-clickable":""} ${nt?"bash-notify-use":""}`,onClick:ze?$t:void 0,title:ze?f("tools:display.clickToViewOutput"):void 0,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-icon",children:it}),o.jsx("span",{className:"output-tool-name",children:Ue}),ze&<&&(nt?o.jsxs("span",{className:"output-tool-param bash-command bash-notify-param",onClick:$t,title:nt.commandBody,style:{cursor:"pointer"},children:[nt.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:nt.shellPrefix}),o.jsx("span",{className:"bash-notify-chip",children:"notify"}),nt.title&&o.jsx("span",{className:"bash-notify-title",children:nt.title}),nt.message&&o.jsx("span",{className:"bash-notify-message",children:nt.message})]}):_t?o.jsxs("span",{className:"output-tool-param bash-command bash-task-label-param",onClick:$t,title:_t.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:"bash-task-label-chip",children:"📋 task"}),o.jsx("span",{className:"bash-task-label-value",children:_t.taskLabel})]}):Bt?o.jsxs("span",{className:"output-tool-param bash-command bash-report-task-param",onClick:$t,title:Bt.commandBody,style:{cursor:"pointer"},children:[o.jsx("span",{className:`bash-report-task-chip ${Bt.status==="failed"?"status-failed":"status-completed"}`,children:Bt.status==="failed"?"❌ report":"✅ report"}),Bt.summary&&o.jsx("span",{className:"bash-report-task-summary",children:Bt.summary})]}):We?o.jsxs("span",{className:"output-tool-param bash-command bash-search-param",onClick:$t,title:We.commandBody,style:{cursor:"pointer"},children:[We.shellPrefix&&o.jsx("span",{className:"bash-search-shell",children:We.shellPrefix}),o.jsx("span",{className:"bash-search-chip",children:"search"}),o.jsx("span",{className:"bash-search-term",children:We.searchTerm})]}):o.jsx("span",{className:"output-tool-param bash-command",onClick:$t,title:f("tools:display.clickToViewOutput"),style:{cursor:"pointer",fontFamily:"monospace",fontSize:"0.9em",color:"#888"},children:Vt()})),!ze&&$&&o.jsxs("span",{className:`output-tool-param ${ke?"clickable-path":""}`,onClick:ke?Ct:void 0,title:ke?f(fe==="Edit"&&(E||Be)?"tools:display.clickToViewDiff":"tools:display.clickToViewFile"):void 0,style:ke?{cursor:"pointer",textDecoration:"underline",textDecorationStyle:"dotted"}:void 0,children:[Fe&&pe&&(()=>{const gt=_5(te),ut=gt?Pp(gt):"";return ut?o.jsx("img",{className:"output-tool-file-icon",src:ut,alt:""}):null})(),$]}),ze&&!O&&o.jsx("span",{className:"bash-output-indicator",children:s.some(gt=>gt.status==="completed")?"✅":Ze?"📄":"💻"}),S&&o.jsx("span",{className:"output-tool-loading",children:"..."})]}),!ot.has(fe)&&ge&&o.jsxs("div",{className:"output-line output-tool-input output-tool-input-fallback",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(xA,{toolName:fe,content:ge})]}),he&&o.jsx("div",{className:"exec-task-output-container",children:Tt.map(gt=>{const ut=x.has(gt.taskId),ft=gt.output.slice(-6),Ft=gt.output.length>6,cn=ut?gt.output:ft;return o.jsxs("div",{className:`exec-task-inline status-${gt.status}`,children:[Ft&&o.jsxs("div",{className:"exec-task-toggle",onClick:()=>y(Dn=>{const ss=new Set(Dn);return ss.has(gt.taskId)?ss.delete(gt.taskId):ss.add(gt.taskId),ss}),children:[o.jsx("span",{className:"exec-task-toggle-arrow",children:ut?"▼":"▶"}),o.jsx("span",{className:"exec-task-toggle-text",children:ut?f("tools:skills.hide"):f("tools:skills.showAll",{count:gt.output.length})})]}),o.jsx("div",{className:"exec-task-inline-terminal",children:o.jsxs("pre",{className:"exec-task-inline-output",children:[cn.map((Dn,ss)=>o.jsx("div",{dangerouslySetInnerHTML:{__html:kl(Dn)}},ss)),gt.status==="running"&&o.jsx("span",{className:"exec-task-cursor",children:"▌"})]})})]},gt.taskId)})}),_e&&(_e.status==="working"||_e.activities&&_e.activities.length>0||_e.stats)&&o.jsx("div",{className:"subagent-activity-container",children:o.jsxs("div",{className:`subagent-activity-inline status-${_e.status}`,children:[o.jsxs("div",{className:"subagent-activity-header",children:[o.jsx("span",{className:"subagent-type-badge",children:_e.subagentType}),o.jsx("span",{className:"subagent-elapsed",children:_e.completedAt?`${((_e.completedAt-_e.startedAt)/1e3).toFixed(0)}s`:`${((Date.now()-_e.startedAt)/1e3).toFixed(0)}s`})]}),_e.activities&&_e.activities.length>0&&o.jsxs("div",{className:"subagent-activity-list",children:[_e.activities.slice(-8).map((gt,ut)=>o.jsxs("div",{className:"subagent-activity-item",children:[o.jsx("span",{className:"activity-icon",children:is[gt.toolName]||is.default}),o.jsx("span",{className:"activity-tool",children:gt.toolName}),o.jsx("span",{className:"activity-desc",children:gt.description.length>80?gt.description.slice(0,77)+"...":gt.description})]},ut)),_e.status==="working"&&o.jsx("span",{className:"subagent-cursor",children:"▌"})]}),_e.stats&&o.jsxs("div",{className:"subagent-stats-bar",children:[o.jsxs("span",{children:[(_e.stats.durationMs/1e3).toFixed(0),"s"]}),o.jsxs("span",{children:[(_e.stats.tokensUsed/1e3).toFixed(1),"K tokens"]}),o.jsxs("span",{children:[_e.stats.toolUseCount," tools"]})]}),_e.streamEntries&&_e.streamEntries.length>0&&o.jsx(E5,{entries:_e.streamEntries,isWorking:_e.status==="working"})]})})]})}if(T.startsWith("Tool input:")){const fe=T.replace("Tool input:","").trim();if(TT(fe))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(pp,{content:fe,agentName:L})]});try{const Ue=JSON.parse(fe);if(Ue.file_path&&(Ue.old_string!==void 0||Ue.new_string!==void 0))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(ST,{content:fe,onFileClick:i})]});if(Ue.file_path&&Ue.old_string===void 0&&Ue.new_string===void 0)return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(CT,{content:fe,onFileClick:i})]});if(Array.isArray(Ue.todos))return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(fp,{content:fe})]})}catch{}return o.jsxs("div",{className:"output-line output-tool-input",children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx(xA,{toolName:M||"UnknownTool",content:fe})]})}if(T.startsWith("Tool result:")){const fe=T.replace("Tool result:","").trim(),Ue=fe.toLowerCase().includes("error")||fe.toLowerCase().includes("failed");return o.jsxs("div",{className:`output-line output-tool-result ${Ue?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsx("span",{className:"output-result-icon",children:Ue?"❌":"✓"}),o.jsx("pre",{className:"output-result-content",children:fe})]})}if(T.startsWith("Bash output:")){const fe=T.replace("Bash output:","").trim(),Ue=fe.toLowerCase().includes("error")||fe.toLowerCase().includes("failed")||fe.toLowerCase().includes("command not found")||fe.toLowerCase().includes("permission denied"),it=fe.includes("... (truncated,");return o.jsxs("div",{className:`output-line output-bash-result ${Ue?"is-error":""}`,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsxs("div",{className:"bash-output-container",children:[o.jsxs("div",{className:"bash-output-header",children:[o.jsx("span",{className:"bash-output-icon",children:"$"}),o.jsx("span",{className:"bash-output-label",children:f("tools:display.terminalOutput")}),it&&o.jsx("span",{className:"bash-output-truncated",children:f("tools:display.truncated")})]}),o.jsx("pre",{className:"bash-output-content",dangerouslySetInnerHTML:{__html:kl(fe)}})]})]})}if(T.includes("## Context Usage")||T.includes("Context Usage")&&T.includes("Tokens:")&&T.includes("Free space")||T.includes("<local-command-caveat>")||T.includes("<command-name>/context</command-name>")||T.includes("<command-name>/cost</command-name>")||T.includes("<command-name>/compact</command-name>"))return null;const xe=T.startsWith("[thinking]"),Ne=xe?T.replace(/^\[thinking\]\s*/,""):"",qe=xe?(Ne||"(processing)").replace(/\*+/g,"").replace(/\s+/g," ").trim():"",Ge=/^\s*(?:[\u{1F300}-\u{1FAFF}\u2600-\u27BF]\s*)?\[System\]/u.test(T),X=!!(e.subagentName&&F&&/^[✅❌]\s*Subagent\s/.test(T));let se="output-line",Ee=!0,Ve=!1;if(T.startsWith("Session started:")||T.startsWith("Session initialized")?(se+=" output-session",Ee=!1):T.startsWith("Tokens:")||T.startsWith("Cost:")?(se+=" output-stats",Ee=!1):xe?(se+=" output-thinking output-tool-use",Ee=!1):T.startsWith("[raw]")?(se+=" output-raw",Ee=!1):Ge?se+=" output-text output-system markdown-content":(se+=" output-text output-claude markdown-content",Ve=!0),S&&(se+=" output-streaming"),Ve&&!S){const fe=pT(T),Ue=hT(fe.contentWithoutBlock);if(fe.hasDelegation||Ue.hasWorkPlan)return o.jsxs("div",{className:se,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),o.jsxs("span",{className:"output-role",children:[z&&o.jsx("img",{src:z==="codex"?"/assets/codex.png":z==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:z==="codex"?"Codex Agent":z==="opencode"?"OpenCode Agent":"Claude Agent"}),W]}),o.jsx("div",{className:"markdown-content",children:pl(Ue.contentWithoutBlock,r,i)}),Ue.hasWorkPlan&&Ue.workPlan&&o.jsx(yT,{workPlan:Ue.workPlan}),fe.hasDelegation&&fe.delegations.map((it,ot)=>o.jsx(mT,{delegation:it},`del-${ot}`)),o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:it=>{it.stopPropagation(),Q(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:it=>{it.stopPropagation(),d(F||T)},title:"View as Markdown",children:"📄"})]})]})}const at=Ve?W:Ge?f("tools:display.system"):null;return o.jsxs("div",{className:se,children:[o.jsx(Fn,{output:e,timeStr:be,debugHash:ue,agentId:n}),at&&o.jsxs("span",{className:"output-role",children:[Ve&&z&&o.jsx("img",{src:z==="codex"?"/assets/codex.png":z==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:"",className:"output-role-icon",title:z==="codex"?"Codex Agent":z==="opencode"?"OpenCode Agent":"Claude Agent"}),at]}),Ee?o.jsx("div",{className:"markdown-content",children:pl(T,r,i)}):xe?o.jsxs(o.Fragment,{children:[L&&o.jsx("span",{className:"output-agent-badge",title:`Agent: ${L}`,children:L}),o.jsx("span",{className:"output-tool-name output-thinking-label",children:f(z==="codex"?"tools:display.codexThinking":"tools:display.thinking")}),o.jsx("span",{className:"output-tool-param output-thinking-content",title:qe,children:qe})]}):T,X&&F&&o.jsxs("div",{className:"subagent-result-section",children:[o.jsxs("button",{className:"subagent-result-toggle",onClick:fe=>{fe.stopPropagation(),K(!P)},children:[o.jsx("span",{className:"subagent-result-arrow",children:P?"▼":"▶"}),P?"Hide result":"Show result"]}),P&&o.jsx("div",{className:"subagent-result-content markdown-content",children:pl(F,r,i)})]}),Ve&&!S&&o.jsxs("div",{className:"message-action-btns",children:[m.experimentalTTS&&o.jsx("button",{className:"history-speak-btn",onClick:fe=>{fe.stopPropagation(),Q(T)},title:q?"Stop speaking":"Speak (Spanish)",children:q?"🔊":"🔈"}),d&&o.jsx("button",{className:"history-view-md-btn",onClick:fe=>{fe.stopPropagation(),d(F||T)},title:"View as Markdown",children:"📄"})]})]})}),ll={user:60,assistant:120,tool_use:40,tool_result:80,default:60};function R5(t){var n,s;if("type"in t)return ll[t.type]||ll.default;const e=t;return e.isUserPrompt?ll.user:(n=e.text)!=null&&n.startsWith("Using tool:")?ll.tool_use:(s=e.text)!=null&&s.startsWith("Tool result:")?ll.tool_result:ll.assistant}const O5=b.memo(function({item:e,isHistory:n,agentId:s,execTasks:a,subagents:r,simpleView:i,isSelected:c,messageIndex:d,searchHighlight:f,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y}){return o.jsx("div",{"data-message-index":d,className:`message-nav-wrapper ${c?"message-selected":""}`,children:n?o.jsx(_T,{message:e,agentId:s,simpleView:i,highlight:f,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y}):o.jsx(Zx,{output:e,agentId:s,execTasks:a,subagents:r,onImageClick:h,onFileClick:m,onBashClick:x,onViewMarkdown:y})})}),L5=b.memo(function({historyMessages:e,liveOutputs:n,agentId:s,execTasks:a=[],subagents:r,viewMode:i,searchHighlight:c,searchActiveIndex:d,selectedMessageIndex:f,isMessageSelected:h,onImageClick:m,onFileClick:x,onBashClick:y,onViewMarkdown:v,scrollContainerRef:S,onScrollTopReached:A,isLoadingMore:k,hasMore:N,shouldAutoScroll:j,onUserScroll:E,pinToBottom:D=!1,onPinCancel:_,isLoadingHistory:B}){const O=b.useMemo(()=>[...e,...n],[e,n]),T=e.length,M=b.useRef(!1),R=b.useRef(O.length),F=b.useRef(!1),$=b.useRef(O.length);$.current=O.length;const U=b.useRef(0),L=u1({count:O.length,getScrollElement:()=>S.current,estimateSize:K=>R5(O[K]),overscan:10,initialRect:{width:500,height:800},measureElement:K=>K.getBoundingClientRect().height});b.useEffect(()=>()=>{L.elementsCache.clear()},[L]);const z=b.useCallback(()=>{const K=S.current;if(!K)return;const Q=$.current;Q<=0||(L.scrollToIndex(Q-1,{align:"end"}),K.scrollTop=K.scrollHeight)},[S,L]);b.useLayoutEffect(()=>{D&&(B||O.length!==0&&(M.current=!0,F.current=!0,z()))},[D,B,O.length,z]),b.useEffect(()=>{if(!D){M.current=!1,F.current=!1;return}if(B||O.length===0)return;let K;const Q=()=>{M.current=!0,z(),K=requestAnimationFrame(Q)};return K=requestAnimationFrame(Q),()=>cancelAnimationFrame(K)},[D,B,O.length,z]),b.useEffect(()=>{if(j&&O.length!==0){if(O.length<=R.current){R.current=O.length;return}R.current=O.length,M.current=!0,z(),requestAnimationFrame(()=>{M.current=!1})}},[O.length,j,z]);const W=L.getTotalSize();b.useEffect(()=>{const K=U.current;U.current=W,j&&(D||W<=K||W-K<2||(M.current=!0,z(),requestAnimationFrame(()=>{M.current=!1})))},[W,j,D,z]);const V=b.useCallback(()=>{if(!S.current)return;const{scrollTop:K,scrollHeight:Q,clientHeight:q}=S.current;D&&!M.current&&(_==null||_()),!(Q-K-q<150)&&!M.current&&!F.current&&E&&E(),K<200&&N&&!k&&A&&A()},[N,k,A,E,S,D,_]);b.useEffect(()=>{const K=S.current;if(K)return K.addEventListener("scroll",V,{passive:!0}),()=>K.removeEventListener("scroll",V)},[V,S]),b.useEffect(()=>{const K=S.current;if(!K)return;const Q=new ResizeObserver(()=>{M.current=!0,K.dispatchEvent(new Event("scroll")),requestAnimationFrame(()=>{M.current=!1})});return Q.observe(K),()=>Q.disconnect()},[S]),b.useEffect(()=>{if(f!==null&&f>=0&&f<O.length){M.current=!0,L.scrollToIndex(f,{align:"center"});const K=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(K)}},[f,L,O.length]),b.useEffect(()=>{if(d!=null&&d>=0&&d<O.length){M.current=!0,L.scrollToIndex(d,{align:"center"});const K=setTimeout(()=>{M.current=!1},100);return()=>clearTimeout(K)}},[d,L,O.length]);const Y=L.getVirtualItems(),P=i!=="advanced";return o.jsx("div",{style:{height:`${L.getTotalSize()}px`,width:"100%",position:"relative"},children:Y.map(K=>{const Q=O[K.index],q=K.index<T;return o.jsx("div",{"data-index":K.index,ref:L.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${K.start}px)`},children:o.jsx(O5,{item:Q,isHistory:q,agentId:s,execTasks:a,subagents:r,simpleView:P,isSelected:h(K.index),messageIndex:K.index,searchHighlight:c,onImageClick:m,onFileClick:x,onBashClick:y,onViewMarkdown:v})},K.key)})})});function P5({progress:t,defaultExpanded:e=!1,onAgentClick:n,onDismiss:s,onFileClick:a,onBashClick:r}){const[i,c]=b.useState(null),d=b.useRef(t.status),f=i!==null?!i:e;b.useEffect(()=>{d.current!==t.status&&(d.current==="working"&&(t.status==="completed"||t.status==="failed")&&c(!1),d.current=t.status)},[t.status]);const h={working:"#4a9eff",completed:"#22c55e",failed:"#ef4444"},m={working:"⚙️",completed:"✅",failed:"❌"},{t:x}=ht(["tools"]),y=b.useMemo(()=>Bu({onFileClick:a?N=>a(N):void 0}),[a]),v={working:x("tools:progress.workingOn"),completed:x("tools:progress.taskFinished"),failed:x("tools:progress.taskFailed")},S=t.taskDescription.length>80?t.taskDescription.slice(0,80)+"...":t.taskDescription,A=()=>{const N=t.completedAt||Date.now(),j=Math.floor((N-t.startedAt)/1e3);if(j<60)return`${j}s`;const E=Math.floor(j/60),D=j%60;return`${E}m ${D}s`},k=()=>{c(f)};return o.jsxs("div",{className:`agent-progress-indicator status-${t.status} ${f?"expanded":"collapsed"}`,children:[o.jsxs("div",{className:"agent-progress-header",onClick:k,children:[o.jsx("span",{className:"agent-progress-status-icon",style:{color:h[t.status]},children:m[t.status]}),o.jsx("span",{className:"agent-progress-agent-name",onClick:N=>{n&&(N.stopPropagation(),n(t.agentId))},children:t.agentName}),o.jsx("span",{className:"agent-progress-status-text",style:{color:h[t.status]},children:v[t.status]}),o.jsx("span",{className:"agent-progress-elapsed",children:A()}),s&&o.jsx("span",{className:"agent-progress-dismiss",title:"Dismiss",onClick:N=>{N.stopPropagation(),s(t.agentId)},children:"×"}),o.jsx("span",{className:"agent-progress-toggle",children:f?"▼":"▶"})]}),!f&&o.jsx("div",{className:"agent-progress-task-preview",children:S}),f&&o.jsxs("div",{className:"agent-progress-expanded",children:[o.jsx("div",{className:"agent-progress-task-full",children:o.jsx("div",{className:"markdown-content",children:o.jsx(Mr,{remarkPlugins:[Dr],components:y,children:Df(t.taskDescription)})})}),t.output.length>0&&o.jsx("div",{className:"agent-progress-output-section",children:o.jsx(I5,{output:t.output,agentId:t.agentId,maxHeight:200,onFileClick:a,onBashClick:r})})]})]})}function I5({output:t,agentId:e,maxHeight:n=200,onFileClick:s,onBashClick:a}){const r=b.useRef(null),c=lT({outputs:t,viewMode:"simple"});return b.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[c]),c.length===0?null:o.jsx("div",{ref:r,className:"agent-progress-output",style:{maxHeight:`${n}px`},children:c.map((d,f)=>o.jsx(Zx,{output:d,agentId:e,onFileClick:s,onBashClick:a},`progress-${f}`))})}const yA=1e4,B5=3e4,F5=12e4;function Vg(t){const e=Kx(t);return Qx(e.userMessage).userMessage.trim().replace(/\r\n/g,`
|
|
145
|
+
`)}function yf(t){return t.trim().replace(/\r\n/g,`
|
|
146
|
+
`)}function z5(t){return t.startsWith("Using tool:")||t.startsWith("Tool input:")||t.startsWith("Tool result:")||t.startsWith("Bash output:")||t.startsWith("Session started:")||t.startsWith("[thinking]")||t.startsWith("Tokens:")||t.startsWith("Cost:")||t.startsWith("Context (estimated from Codex turn usage):")||t.startsWith("🔄 [System]")||t.startsWith("📋 [System]")||t.startsWith("[System]")}const vA=b.memo(b.forwardRef(function({agentId:e,agent:n,viewMode:s,isOpen:a,isSnapshotView:r,currentSnapshot:i,onImageClick:c,onFileClick:d,onBashClick:f,onViewMarkdown:h,keyboard:m,canSwipeClose:x,onSwipeCloseOffsetChange:y,onSwipeClose:v,hasModalOpen:S},A){var Be,Ke;const{t:k}=ht(["terminal","common"]),N=Ij(),j=Bj(),E=lx(),D=Tj(e),_=VO(e),B=!!(n!=null&&n.sessionId)&&!r,O=(n==null?void 0:n.class)==="boss"||(n==null?void 0:n.isBoss),T=rL(!r&&O?e:null),M=b.useMemo(()=>Array.from(T.values()).filter(ze=>ze.status==="working"),[T]),R=b.useMemo(()=>Array.from(T.values()).filter(ze=>ze.status==="completed"||ze.status==="failed").map(ze=>ze.agentId),[T]),[F,$]=b.useState(!0),U=iL(r?null:e),L=gL(r?null:e),z=JO(),W=b.useMemo(()=>r||!e?[]:Array.from(z.values()).filter(ze=>ze.agentId===e&&ze.status==="pending"),[r,e,z]),V=b.useRef(null),Y=b.useRef(null),P=b.useRef(null),K=b.useMemo(()=>r&&i?i.outputs.map(ze=>({text:ze.text||"",timestamp:ze.timestamp,isStreaming:!1,isUserPrompt:!1})):D,[r,i,D]),Q=Sj({selectedAgentId:e,hasSessionId:B,reconnectCount:N,historyRefreshTrigger:j,lastPrompts:E,outputScrollRef:V}),q=n5({selectedAgentId:e}),be=b.useMemo(()=>{const{history:ze}=Q,Ze=new Map;for(const et of ze)et.type==="tool_result"&&et.toolUseId&&Ze.set(et.toolUseId,et.content);return(et=>et.map(ct=>{if(ct.type==="tool_use"&&ct.toolName==="Bash"&&ct.toolUseId){const st=Ze.get(ct.toolUseId);let bt;try{bt=(ct.toolInput||(ct.content?JSON.parse(ct.content):{})).command}catch{}return{...ct,_bashOutput:st,_bashCommand:bt}}return ct}))(ze)},[Q.history]),ue=cT({outputs:K,viewMode:s}),Z=b.useMemo(()=>{const ze=[],Ze=new Set,lt=new Set;let et=null,ct=0;for(const st of be){if(st.type==="assistant"){const _e=st.uuid?`uuid:${st.uuid}:${yf(st.content)}`:`sig:${st.timestamp}:${yf(st.content)}`;if(Ze.has(_e))continue;Ze.add(_e),ze.push(st);continue}if(st.type!=="user"){ze.push(st);continue}const bt=Vg(st.content),Tt=st.uuid?`uuid:${st.uuid}:${bt}`:null;if(Tt&<.has(Tt))continue;const he=st.timestamp?new Date(st.timestamp).getTime():0;et===bt&&Math.abs(he-ct)<=yA||(ze.push(st),Tt&<.add(Tt),et=bt,ct=he)}return ze},[be]),de=b.useMemo(()=>{const ze=new Map,Ze=new Set,lt=new Map;for(const bt of Z){const Tt=bt.timestamp?new Date(bt.timestamp).getTime():0;if(bt.type==="user"){const We=Vg(bt.content),nt=ze.get(We)??0;Tt>nt&&ze.set(We,Tt);continue}if(bt.type!=="assistant")continue;bt.uuid&&Ze.add(bt.uuid);const he=yf(bt.content),_e=lt.get(he)??0;Tt>_e&<.set(he,Tt)}const et=[];let ct=null,st=0;for(const bt of ue){if(!bt.isUserPrompt){if(!bt.isStreaming&&!z5(bt.text)){if(bt.uuid&&Ze.has(bt.uuid))continue;const We=yf(bt.text),nt=bt.timestamp||0,_t=lt.get(We);if(_t&&Math.abs(nt-_t)<=F5)continue}et.push(bt);continue}const Tt=Vg(bt.text),he=bt.timestamp||0,_e=ze.get(Tt);_e&&he>=_e&&he-_e<=B5||ct===Tt&&Math.abs(he-st)<=yA||(et.push(bt),ct=Tt,st=he)}return et},[ue,Z]),Ce=b.useMemo(()=>[...Z,...de],[Z,de]),xe=Z6({selectedAgentId:e,isOpen:a,allItems:Ce,viewMode:s,hasMoreHistory:Q.hasMore,loadAllHistory:Q.loadAllHistory,loadingMore:Q.loadingMore}),Ne=Z.length+de.length,qe=s5({totalMessages:Ne,isOpen:a,hasModalOpen:S||xe.searchMode,scrollContainerRef:V,selectedAgentId:e,inputRef:Y,textareaRef:P,useTextarea:q.useTextarea}),[Ge,X]=b.useState(!1),[se,Ee]=b.useState(null),Ve=b.useRef(null),at=b.useRef(null);b.useEffect(()=>{const ze=n==null?void 0:n.status;if(Ve.current==="working"&&ze==="idle"){at.current&&clearTimeout(at.current);const lt=E.get(e);Ee(lt!=null&<.timestamp?Date.now()-lt.timestamp:null),X(!0),at.current=setTimeout(()=>{X(!1),Ee(null),at.current=null},4e3)}else ze==="working"&&(at.current&&(clearTimeout(at.current),at.current=null),X(!1),Ee(null));return Ve.current=ze||null,()=>{at.current&&clearTimeout(at.current)}},[n==null?void 0:n.status]),b.useEffect(()=>{if(!e||!O||r||R.length===0)return;const ze=window.setTimeout(()=>{R.forEach(Ze=>{H.clearAgentTaskProgress(e,Ze)})},300);return()=>window.clearTimeout(ze)},[e,O,r,R]);const[we,$e]=b.useState(!0),ie=b.useRef(!1),fe=b.useRef(!1),Ue=b.useRef(!1),it=b.useCallback(()=>{Ue.current||(ie.current=!0,$e(!1))},[]),[ot,ce]=b.useState(!1),J=b.useCallback(()=>ce(!1),[]),ae=b.useCallback(()=>{ie.current=!1,$e(!0)},[]);b.useEffect(()=>{$e(!0),ie.current=!1,fe.current=!0,Ue.current=!0;const ze=setTimeout(()=>{Ue.current=!1},3e3);return()=>clearTimeout(ze)},[e]);const Se=b.useRef(Q.handleScroll);Se.current=Q.handleScroll;const ee=b.useCallback(()=>{if(!V.current||m.keyboardScrollLockRef.current)return;const{scrollTop:ze,scrollHeight:Ze,clientHeight:lt}=V.current,et=Ze-ze-lt<150;Ue.current||(ie.current=!et,et&&$e(!0)),Se.current(m.keyboardScrollLockRef)},[V,m.keyboardScrollLockRef]),ge=D.length>0&&((Ke=(Be=D[D.length-1])==null?void 0:Be.text)==null?void 0:Ke.length)||0;b.useEffect(()=>{m.keyboardScrollLockRef.current||ie.current||requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight)})},[D.length,ge,m.keyboardScrollLockRef,V]);const[Re,Fe]=b.useState(!1),[oe,Le]=b.useState(!1),te=b.useRef(null);b.useLayoutEffect(()=>{const ze=te.current;ze!==null&&ze!==e?(Fe(!1),Q.hasCachedHistory(e)||Le(!0)):e||Fe(!1),te.current=e},[e]),b.useEffect(()=>{if(!oe||Q.fetchingHistory)return;const ze=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),Le(!1)});return()=>cancelAnimationFrame(ze)},[oe,Q.fetchingHistory,Q.historyLoadVersion]),b.useEffect(()=>{if(!fe.current||!e||oe||Q.fetchingHistory)return;let ze=0,Ze=0;return ze=requestAnimationFrame(()=>{Ze=requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=V.current.scrollHeight),fe.current=!1})}),()=>{cancelAnimationFrame(ze),cancelAnimationFrame(Ze)}},[e,oe,Q.fetchingHistory,Q.historyLoadVersion]);const pe=b.useRef(!1);b.useEffect(()=>{pe.current=!0,ce(!0)},[e,N]),b.useEffect(()=>{Q.fetchingHistory&&(pe.current=!0,ce(!0))},[Q.fetchingHistory]),b.useEffect(()=>{if(!ot||!a||Q.fetchingHistory)return;const ze=V.current;if(!ze)return;let Ze=null;const lt=performance.now();let et=0,ct=-1;const st=()=>{const{scrollTop:Tt,scrollHeight:he,clientHeight:_e}=ze;return he-Tt-_e<=2},bt=()=>{const Tt=performance.now(),he=ze.scrollHeight,_e=Math.abs(he-ct)<=1,We=st();if(_e&&We?et+=1:et=0,ct=he,et>=3){ce(!1),Ze=null;return}if(Tt-lt>8e3){ce(!1),Ze=null;return}Ze=requestAnimationFrame(bt)};return Ze=requestAnimationFrame(bt),()=>{Ze!==null&&cancelAnimationFrame(Ze)}},[ot,a,Q.fetchingHistory,Q.historyLoadVersion]);const ke=b.useRef(!1);return b.useEffect(()=>{ke.current&&!ot&&pe.current&&(pe.current=!1,Fe(!0)),ke.current=ot},[ot]),b.useEffect(()=>{if(!a||!pe.current||ot||Q.fetchingHistory)return;const ze=requestAnimationFrame(()=>{pe.current&&(pe.current=!1,Fe(!0))});return()=>cancelAnimationFrame(ze)},[Q.historyLoadVersion,a,ot,Q.fetchingHistory]),b.useEffect(()=>{if(!xe.searchMode)return;const ze=Ze=>{Ze.key==="Escape"&&(Ze.stopImmediatePropagation(),xe.closeSearch())};return document.addEventListener("keydown",ze,!0),()=>document.removeEventListener("keydown",ze,!0)},[xe.searchMode,xe.closeSearch]),b.useEffect(()=>()=>m.cleanup(),[e,m]),b.useImperativeHandle(A,()=>({outputScrollRef:V,inputRef:Y,textareaRef:P,historyLoader:{loadingHistory:Q.loadingHistory,fetchingHistory:Q.fetchingHistory,historyLoadVersion:Q.historyLoadVersion,loadingMore:Q.loadingMore,hasMore:Q.hasMore,totalCount:Q.totalCount,loadMoreHistory:Q.loadMoreHistory,clearHistory:Q.clearHistory,hasCachedHistory:Q.hasCachedHistory,history:Q.history},search:xe,terminalInput:{uploadFile:q.uploadFile,setAttachedFiles:q.setAttachedFiles,useTextarea:q.useTextarea},getDedupedHistory:()=>Z,getDedupedOutputs:()=>de,outputsLength:Z.length+de.length}),[Q,xe,q,Z,de]),o.jsxs(o.Fragment,{children:[xe.searchMode&&o.jsx(c6,{searchInputRef:xe.searchInputRef,searchQuery:xe.searchQuery,setSearchQuery:xe.setSearchQuery,closeSearch:xe.closeSearch,matchCount:xe.matchIndices.length,currentMatch:xe.currentMatch,navigateNext:xe.navigateNext,navigatePrev:xe.navigatePrev,loadingFullHistory:xe.loadingFullHistory}),o.jsx("div",{className:"guake-output",ref:V,onScroll:ee,children:o.jsxs("div",{className:`guake-history-content ${Re?"fade-in":""}`,children:[oe&&o.jsxs("div",{className:"guake-empty loading",children:[k("terminal:empty.loadingConversation"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]}),!oe&&Q.loadingHistory&&Q.history.length===0&&D.length===0&&o.jsxs("div",{className:"guake-empty loading",children:[k("terminal:empty.loadingConversation"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]}),!oe&&!Q.loadingHistory&&Q.history.length===0&&K.length===0&&n.status!=="working"&&o.jsx("div",{className:"guake-empty",children:k("terminal:empty.noOutput")}),!oe&&Q.hasMore&&!xe.searchMode&&o.jsx("div",{className:"guake-load-more",children:Q.loadingMore?o.jsx("span",{children:k("terminal:empty.loadingOlder")}):o.jsx("button",{onClick:Q.loadMoreHistory,children:k("terminal:empty.loadMore",{count:Q.totalCount-Q.history.length})})}),!oe&&o.jsx(L5,{historyMessages:Z,liveOutputs:de,agentId:e,execTasks:U,subagents:L,viewMode:s,searchHighlight:xe.highlightQuery,searchActiveIndex:xe.scrollToIndex,selectedMessageIndex:qe.selectedIndex,isMessageSelected:qe.isSelected,onImageClick:c,onFileClick:d,onBashClick:f,onViewMarkdown:h,scrollContainerRef:V,onScrollTopReached:Q.loadMoreHistory,isLoadingMore:Q.loadingMore,hasMore:Q.hasMore,shouldAutoScroll:we,onUserScroll:it,pinToBottom:ot,onPinCancel:J,isLoadingHistory:Q.fetchingHistory},e),!oe&&_&&o.jsxs("div",{className:"compacting-indicator",children:[o.jsx("div",{className:"compacting-bar",children:o.jsx("div",{className:"compacting-bar-fill"})}),o.jsx("span",{className:"compacting-label",children:"Compacting context..."})]}),!oe&&O&&M.length>0&&o.jsxs("div",{className:`agent-progress-container ${F?"collapsed":"expanded"}`,children:[o.jsxs("div",{className:"agent-progress-container-header",onClick:()=>$(ze=>!ze),role:"button",tabIndex:0,onKeyDown:ze=>{(ze.key==="Enter"||ze.key===" ")&&(ze.preventDefault(),$(Ze=>!Ze))},children:[o.jsx("span",{className:"progress-crown",children:"👑"}),o.jsx("span",{children:k("terminal:empty.subordinateProgress")}),o.jsx("span",{className:"progress-count",children:k("terminal:empty.activeCount",{count:M.length})}),o.jsx("span",{className:"agent-progress-container-toggle",children:F?"▶":"▼"})]}),!F&&M.map(ze=>o.jsx(P5,{progress:ze,defaultExpanded:ze.status==="working",onAgentClick:Ze=>{H.selectAgent(Ze),H.setTerminalOpen(!0)},onDismiss:Ze=>{H.clearAgentTaskProgress(e,Ze)},onFileClick:d,onBashClick:f},ze.agentId))]})]})}),o.jsx(v5,{selectedAgent:n,selectedAgentId:e,isOpen:a,command:q.command,setCommand:q.setCommand,forceTextarea:q.forceTextarea,setForceTextarea:q.setForceTextarea,useTextarea:q.useTextarea,attachedFiles:q.attachedFiles,setAttachedFiles:q.setAttachedFiles,removeAttachedFile:q.removeAttachedFile,uploadFile:q.uploadFile,pastedTexts:q.pastedTexts,expandPastedTexts:q.expandPastedTexts,incrementPastedCount:q.incrementPastedCount,setPastedTexts:q.setPastedTexts,resetPastedCount:q.resetPastedCount,handleInputFocus:m.handleInputFocus,handleInputBlur:m.handleInputBlur,pendingPermissions:W,showCompletion:Ge,completionElapsed:se,onImageClick:c,inputRef:Y,textareaRef:P,isSnapshotView:r,onClearHistory:Q.clearHistory,onSendCommand:ae,canSwipeClose:x,onSwipeCloseOffsetChange:y,onSwipeClose:v})]})})),$5=b.memo(function({agentId:e,onClose:n}){const s=ix(e),{t:a}=ht("terminal");return o.jsxs("div",{className:"split-pane-header",children:[o.jsx("span",{className:"split-pane-agent-name",title:(s==null?void 0:s.name)||e,children:(s==null?void 0:s.name)||e}),o.jsx("button",{type:"button",className:"split-pane-close",onClick:n,title:a("overview.close",{defaultValue:"Close pane"}),children:"✕"})]})}),H5=b.memo(function(e){const{activeAgentId:n,activeAgent:s,paneRef:a,viewMode:r,isOpen:i,isSnapshotView:c,currentSnapshot:d,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,onSaveSnapshot:v,canSwipeClose:S,onSwipeCloseOffsetChange:A,onSwipeClose:k,hasModalOpen:N}=e,j=xL(),E=yL(),D=Ml(),[_,B]=b.useState(!1),{t:O}=ht("terminal"),T=b.useCallback(V=>{H.removeSplitPane(V)},[]),M=b.useCallback(V=>{V.dataTransfer.types.includes("application/x-agent-id")&&(V.preventDefault(),V.dataTransfer.dropEffect="copy",B(!0))},[]),R=b.useCallback(V=>{V.currentTarget.contains(V.relatedTarget)||B(!1)},[]),F=b.useCallback(V=>{V.preventDefault(),B(!1);const Y=V.dataTransfer.getData("application/x-agent-id");Y&&H.addSplitPane(Y)},[]),$=b.useMemo(()=>j.filter(V=>D.has(V)),[j,D]),U=$.length>0,L=E==="horizontal",z=L?"horizontal":"vertical",W=b.useCallback(()=>{H.toggleSplitOrientation()},[]);return U?o.jsxs("div",{className:`split-terminal-layout multi ${L?"orientation-horizontal":"orientation-vertical"} ${_?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:F,children:[o.jsx("div",{className:"split-toolbar",children:o.jsx("button",{type:"button",className:"split-orientation-toggle",onClick:W,title:L?O("split.switchVertical",{defaultValue:"Switch to vertical split"}):O("split.switchHorizontal",{defaultValue:"Switch to horizontal split"}),children:o.jsx("span",{className:`split-orientation-icon ${L?"horizontal":"vertical"}`,children:L?"⬜⬜":`⬜
|
|
147
|
+
⬜`})})}),o.jsx("div",{className:`split-panes-container ${L?"horizontal":"vertical"}`,children:$.map((V,Y)=>{const P=D.get(V);if(!P)return null;const K=V===n;return o.jsxs(je.Fragment,{children:[Y>0&&o.jsx("div",{className:`guake-split-divider ${z}`}),o.jsxs("div",{className:"split-terminal-pane",children:[o.jsx($5,{agentId:V,onClose:()=>T(V)}),o.jsx(vA,{ref:K?a:void 0,agentId:V,agent:P,viewMode:r,isOpen:i,isSnapshotView:!1,currentSnapshot:null,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,hasModalOpen:N})]})]},V)})})]}):o.jsx("div",{className:`split-terminal-layout single ${_?"drop-zone-active":""}`,onDragOver:M,onDragLeave:R,onDrop:F,children:o.jsx(vA,{ref:a,agentId:n,agent:s,viewMode:r,isOpen:i,isSnapshotView:c,currentSnapshot:d,onImageClick:f,onFileClick:h,onBashClick:m,onViewMarkdown:x,keyboard:y,onSaveSnapshot:v,canSwipeClose:S,onSwipeCloseOffsetChange:A,onSwipeClose:k,hasModalOpen:N})})}),U5={running:"🟢",stopped:"⚫",error:"🔴",unknown:"❓",starting:"🟡",stopping:"🟠"};function Gg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(0)}KB`:t<1024*1024*1024?`${(t/1024/1024).toFixed(0)}MB`:`${(t/1024/1024/1024).toFixed(1)}GB`}function wA(t){const e=t.replace(/\/$/,"").split("/");return e.length<=2?t:`.../${e.slice(-2).join("/")}`}function Yg(t){const e=window.location.protocol,n=window.location.hostname;return`${e}//${n}:${t}`}function W5({agentId:t,onClose:e}){const{t:n}=ht(["terminal","common"]),s=cx(),a=sr(),[r,i]=b.useState(null),c=b.useMemo(()=>H.getAreaForAgent(t),[t,a]),d=b.useMemo(()=>{if(!c)return[];const k=[];for(const N of s.values())H.isPositionInArea(N.position,c)&&k.push(N);return k.sort((N,j)=>N.status==="running"&&j.status!=="running"?-1:N.status!=="running"&&j.status==="running"?1:N.name.localeCompare(j.name)),k},[c,s]),f=b.useCallback(k=>{H.selectBuilding(k),window.dispatchEvent(new CustomEvent("tide:building-action",{detail:{buildingId:k}}))},[]),h=b.useCallback((k,N)=>{H.sendBuildingCommand(k,N)},[]),m=b.useCallback((k,N)=>{k.preventDefault(),k.stopPropagation(),i({buildingId:N,position:{x:k.clientX,y:k.clientY}})},[]),x=b.useCallback(()=>{i(null)},[]),y=b.useCallback(()=>{if(!c)return{x:0,z:0};const k=()=>(Math.random()-.5)*2;return{x:c.center.x+k(),z:c.center.z+k()}},[c]),v=b.useCallback(()=>{if(!c)return;const k=y();window.dispatchEvent(new CustomEvent("tide:building-create",{detail:{position:k}}))},[c,y]),S=b.useMemo(()=>{var _;if(!r)return[];const k=H.getState().buildings.get(r.buildingId);if(!k)return[];const N=[],j=k.type==="server"||k.type==="docker"||k.type==="terminal",E=k.status==="running",D=k.type==="boss";if(N.push({id:"open",label:k.type==="database"?"Open Database":k.type==="folder"?"Open Folder":k.type==="boss"?"View Boss Logs":k.type==="terminal"?"Open Terminal":k.type==="server"&&((_=k.pm2)!=null&&_.enabled)?"View PM2 Logs":"Open",icon:k.type==="database"?"🗄️":k.type==="folder"?"📁":k.type==="terminal"?"💻":"👁️",onClick:()=>f(k.id)}),j&&(E||N.push({id:"start",label:"Start",icon:"▶",onClick:()=>H.sendBuildingCommand(k.id,"start")}),E&&(N.push({id:"restart",label:"Restart",icon:"🔄",onClick:()=>H.sendBuildingCommand(k.id,"restart")}),N.push({id:"stop",label:"Stop",icon:"⏹",onClick:()=>H.sendBuildingCommand(k.id,"stop")}))),D&&k.subordinateBuildingIds&&k.subordinateBuildingIds.length>0&&(N.push({id:"start-all",label:"Start All Subordinates",icon:"🚀",onClick:()=>{for(const B of k.subordinateBuildingIds)H.sendBuildingCommand(B,"start")}}),N.push({id:"stop-all",label:"Stop All Subordinates",icon:"⏸️",onClick:()=>{for(const B of k.subordinateBuildingIds)H.sendBuildingCommand(B,"stop")}}),N.push({id:"restart-all",label:"Restart All Subordinates",icon:"♻️",onClick:()=>{for(const B of k.subordinateBuildingIds)H.sendBuildingCommand(B,"restart")}})),j&&N.push({id:"health-check",label:"Health Check",icon:"🩺",onClick:()=>H.sendBuildingCommand(k.id,"healthCheck")}),N.push({id:"divider-edit",label:"",divider:!0,onClick:()=>{}}),N.push({id:"edit",label:"Edit Building",icon:"✏️",onClick:()=>{window.dispatchEvent(new CustomEvent("tide:building-edit",{detail:{buildingId:k.id}}))}}),N.push({id:"clone",label:"Clone Building",icon:"📋",onClick:()=>{const B=y();H.createBuilding({name:`${k.name} (Copy)`,type:k.type,style:k.style,color:k.color,scale:k.scale,position:B,cwd:k.cwd,folderPath:k.folderPath,commands:k.commands,pm2:k.pm2,docker:k.docker,database:k.database,terminal:k.terminal,urls:k.urls,subordinateBuildingIds:k.subordinateBuildingIds})}}),k.urls&&k.urls.length>0)for(const B of k.urls)N.push({id:`url-${B.label}`,label:B.label,icon:"🔗",onClick:()=>window.open(B.url,"_blank","noopener,noreferrer")});return N.push({id:"divider-danger",label:"",divider:!0,onClick:()=>{}}),N.push({id:"delete",label:"Delete Building",icon:"🗑️",danger:!0,onClick:()=>H.deleteBuilding(k.id)}),N},[r,s,f,y]),A=b.useCallback(k=>{const N=[];if(k.pm2Status){const j=k.pm2Status;j.ports&&j.ports.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Ports"}),o.jsx("span",{className:"detail-value detail-ports",children:j.ports.map((E,D)=>o.jsxs("a",{className:"guake-building-port-link",href:Yg(E),target:"_blank",rel:"noopener noreferrer",onClick:_=>_.stopPropagation(),title:`Open :${E} in browser`,children:[":",E,D<j.ports.length-1?" ":""]},E))})]},"pm2-ports"))}if(k.dockerStatus){const j=k.dockerStatus,E=[];if(j.status&&E.push(o.jsx("span",{className:"detail-value",children:j.status},"st")),j.health&&j.health!=="none"){const D=j.health==="healthy"?"detail-ok":j.health==="unhealthy"?"detail-err":"";E.push(o.jsx("span",{className:`detail-value ${D}`,children:j.health},"h"))}if(j.memory!==void 0){const D=j.memoryLimit?`${Gg(j.memory)}/${Gg(j.memoryLimit)}`:Gg(j.memory);E.push(o.jsx("span",{className:"detail-value",children:D},"mem"))}j.cpu!==void 0&&E.push(o.jsxs("span",{className:"detail-value",children:[j.cpu.toFixed(1),"%"]},"cpu")),E.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Docker"}),E]},"docker")),j.image&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Image"}),o.jsx("span",{className:"detail-value detail-mono",children:j.image})]},"docker-img")),j.ports&&j.ports.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Ports"}),o.jsx("span",{className:"detail-value detail-ports",children:j.ports.map((D,_)=>o.jsxs("a",{className:"guake-building-port-link",href:Yg(D.host),target:"_blank",rel:"noopener noreferrer",onClick:B=>B.stopPropagation(),title:`Open :${D.host} in browser`,children:[D.host,":",D.container,_<j.ports.length-1?" ":""]},`${D.host}-${D.container}`))})]},"docker-ports")),j.services&&j.services.length>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Services"}),o.jsxs("span",{className:"detail-value",children:[j.services.length," svc"]})]},"docker-svc"))}if(k.type==="database"&&k.database){const j=k.database,E=j.activeConnectionId?j.connections.find(D=>D.id===j.activeConnectionId):j.connections[0];E&&(N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:E.engine.toUpperCase()}),o.jsxs("span",{className:"detail-value detail-mono",children:[E.host,":",E.port]})]},"db-conn")),(j.activeDatabase||E.database)&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"DB"}),o.jsx("span",{className:"detail-value",children:j.activeDatabase||E.database})]},"db-name"))),j.connections.length>1&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Connections"}),o.jsx("span",{className:"detail-value",children:j.connections.length})]},"db-count"))}if(k.type==="boss"&&k.subordinateBuildingIds&&k.subordinateBuildingIds.length>0){const j=k.subordinateBuildingIds;let E=0,D=0;for(const B of j){const O=s.get(B);(O==null?void 0:O.status)==="running"&&E++,(O==null?void 0:O.status)==="error"&&D++}const _=[];_.push(`${E}/${j.length} up`),D>0&&_.push(`${D} err`),N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Subs"}),o.jsx("span",{className:`detail-value ${D>0?"detail-err":E===j.length?"detail-ok":""}`,children:_.join(", ")})]},"boss-subs"))}if(k.terminalStatus){const j=k.terminalStatus;N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Terminal"}),o.jsx("span",{className:"detail-value detail-ports",children:j.port?o.jsxs("a",{className:"guake-building-port-link",href:Yg(j.port),target:"_blank",rel:"noopener noreferrer",onClick:E=>E.stopPropagation(),title:`Open :${j.port} in browser`,children:[":",j.port]}):o.jsx("span",{children:"—"})})]},"terminal")),j.tmuxSession&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Session"}),o.jsx("span",{className:"detail-value detail-mono",children:j.tmuxSession})]},"terminal-session"))}return k.type==="folder"&&k.folderPath&&(N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Path"}),o.jsx("span",{className:"detail-value detail-mono",title:k.folderPath,children:wA(k.folderPath)})]},"folder-path")),k.gitChangesCount!==void 0&&k.gitChangesCount>0&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Git"}),o.jsxs("span",{className:"detail-value detail-warn",children:[k.gitChangesCount," changes"]})]},"folder-git"))),k.cwd&&k.type!=="folder"&&!k.pm2Status&&!k.dockerStatus&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label",children:"Dir"}),o.jsx("span",{className:"detail-value detail-mono",title:k.cwd,children:wA(k.cwd)})]},"cwd")),k.lastError&&k.status==="error"&&N.push(o.jsxs("div",{className:"guake-building-detail",children:[o.jsx("span",{className:"detail-label detail-err",children:"Err"}),o.jsx("span",{className:"detail-value detail-err detail-ellipsis",title:k.lastError,children:k.lastError.length>40?k.lastError.slice(0,40)+"...":k.lastError})]},"error")),N},[s]);return o.jsxs("div",{className:"guake-buildings-panel",children:[o.jsxs("div",{className:"guake-buildings-header",children:[o.jsxs("div",{className:"guake-buildings-title",children:[o.jsx("span",{className:"guake-buildings-icon",children:"🏗️"}),o.jsx("span",{children:(c==null?void 0:c.name)||n("terminal:buildings.title",{defaultValue:"Buildings"})}),o.jsx("span",{className:"guake-buildings-count",children:d.length})]}),o.jsxs("div",{className:"guake-buildings-header-actions",children:[c&&o.jsx("button",{className:"guake-buildings-add",onClick:v,title:"Add building to area",children:"+"}),o.jsx("button",{className:"guake-buildings-close",onClick:e,title:n("common:buttons.close"),children:"✕"})]})]}),o.jsx("div",{className:"guake-buildings-body",children:c?d.length===0?o.jsx("div",{className:"guake-buildings-empty",children:n("terminal:buildings.noBuildings",{defaultValue:"No buildings in this area"})}):d.map(k=>{var _,B;const N=CL[k.type],j=U5[k.status]||"❓",E=k.type==="server"||k.type==="docker"||k.type==="terminal",D=k.status==="running";return o.jsxs("div",{className:`guake-building-item ${k.status}`,onClick:()=>f(k.id),onContextMenu:O=>m(O,k.id),children:[o.jsxs("div",{className:"guake-building-row",children:[o.jsx("span",{className:"guake-building-type-icon",title:N.description,children:N.icon}),o.jsx("span",{className:"guake-building-name",children:k.name}),o.jsx("span",{className:"guake-building-status",title:k.status,children:j})]}),A(k),k.urls&&k.urls.length>0&&o.jsx("div",{className:"guake-building-urls",children:k.urls.map((O,T)=>o.jsxs("a",{className:"guake-building-link",href:O.url,target:"_blank",rel:"noopener noreferrer",onClick:M=>M.stopPropagation(),children:["🔗 ",O.label]},T))}),E&&o.jsxs("div",{className:"guake-building-actions",children:[!D&&o.jsx("button",{className:"guake-building-action start",onClick:O=>{O.stopPropagation(),h(k.id,"start")},title:"Start",children:"▶"}),D&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"guake-building-action restart",onClick:O=>{O.stopPropagation(),h(k.id,"restart")},title:"Restart",children:"🔄"}),o.jsx("button",{className:"guake-building-action stop",onClick:O=>{O.stopPropagation(),h(k.id,"stop")},title:"Stop",children:"⏹"}),k.type==="terminal"&&((_=k.terminalStatus)==null?void 0:_.url)&&o.jsx("button",{className:"guake-building-action terminal-below",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-terminal",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"terminal",direction:"horizontal"}}))},title:"Open terminal below (right-click to split)",children:"⬇"}),k.type==="server"&&((B=k.pm2)==null?void 0:B.enabled)&&o.jsx("button",{className:"guake-building-action terminal-below",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-pm2-logs",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"pm2-logs",direction:"horizontal"}}))},title:"Show logs below (right-click to split)",children:"📜"}),k.type==="database"&&k.database&&o.jsx("button",{className:"guake-building-action-btn",onClick:O=>{O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:open-bottom-database",{detail:{buildingId:k.id}}))},onContextMenu:O=>{O.preventDefault(),O.stopPropagation(),window.dispatchEvent(new CustomEvent("tide:split-bottom-panel",{detail:{buildingId:k.id,type:"database",direction:"horizontal"}}))},title:"Show database below (right-click to split)",children:"🗄️"})]})]})]},k.id)}):o.jsx("div",{className:"guake-buildings-empty",children:n("terminal:buildings.noArea",{defaultValue:"Agent is not in an area"})})}),o.jsx(fo,{isOpen:r!==null,position:(r==null?void 0:r.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:S,onClose:x})]})}const Kg={action:"#cba6f7",wait:"#f9e2af",decision:"#89b4fa",end:"#a6e3a1"},hp={running:"#a6e3a1",paused:"#f9e2af",completed:"#89b4fa",failed:"#f38ba8",cancelled:"#6c7086"};function q5(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function V5(t){return new Date(t).toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function G5({agentId:t,onClose:e}){const[n,s]=b.useState([]),[a,r]=b.useState([]),[i,c]=b.useState(!0),[d,f]=b.useState(null),h=b.useRef(null),m=b.useCallback(async()=>{try{const[k,N]=await Promise.all([Pt(Ot("/api/workflows/definitions")),Pt(Ot("/api/workflows/instances"))]);if(k.ok){const j=await k.json();s(j)}if(N.ok){const j=await N.json();r(j.instances||j||[])}}catch{}finally{c(!1)}},[]);b.useEffect(()=>(m(),h.current=setInterval(m,1e4),()=>{h.current&&clearInterval(h.current)}),[m]);const x=n.filter(k=>k.states.some(N=>{var j;return((j=N.action)==null?void 0:j.type)==="agent_task"&&N.action.agentId===t})),y=new Set(x.map(k=>k.id)),v=a.filter(k=>y.has(k.workflowDefId)||k.agentId===t).sort((k,N)=>k.status==="running"&&N.status!=="running"?-1:N.status==="running"&&k.status!=="running"?1:N.updatedAt-k.updatedAt);b.useEffect(()=>{if(v.length===0){f(null);return}v.find(N=>N.id===d)||f(v[0].id)},[v,d]);const S=v.find(k=>k.id===d)??null,A=S?n.find(k=>k.id===S.workflowDefId)??null:null;return o.jsxs("div",{className:"guake-git-panel",children:[o.jsxs("div",{className:"guake-git-header",children:[o.jsxs("div",{className:"guake-git-title",children:[o.jsx("span",{style:{padding:"0 12px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:"Workflow"}),v.length>0&&o.jsx("span",{style:xt.headerBadge,children:v.length})]}),o.jsxs("div",{className:"guake-git-header-actions",children:[o.jsx("button",{className:"guake-git-refresh",onClick:m,title:"Refresh",disabled:i,children:i?"⏳":"↻"}),o.jsx("button",{className:"guake-git-close",onClick:e,title:"Close",children:"×"})]})]}),o.jsxs("div",{className:"guake-git-body",style:{display:"flex",flexDirection:"column",gap:0},children:[i&&v.length===0&&o.jsx("div",{style:xt.emptyState,children:o.jsx("span",{style:xt.loadingText,children:"Loading workflows..."})}),!i&&v.length===0&&o.jsxs("div",{style:xt.emptyState,children:[o.jsx("span",{style:xt.emptyIcon,children:"⊘"}),o.jsx("span",{children:"No workflow instances for this agent"})]}),v.length>0&&o.jsx("div",{style:xt.instanceList,children:v.map(k=>{const N=k.id===d,j=n.find(D=>D.id===k.workflowDefId),E=j==null?void 0:j.states.find(D=>D.id===k.currentStateId);return o.jsxs("button",{onClick:()=>f(k.id),style:{...xt.instanceRow,...N?xt.instanceRowSelected:{}},children:[o.jsxs("div",{style:xt.instanceRowTop,children:[o.jsx("span",{style:{...xt.statusDot,backgroundColor:hp[k.status]||"#6c7086"}}),o.jsx("span",{style:xt.instanceName,children:k.workflowName}),o.jsx("span",{style:{...xt.instanceStatus,color:hp[k.status]||"#6c7086"},children:k.status})]}),o.jsxs("div",{style:xt.instanceRowBottom,children:[o.jsx("span",{style:xt.instanceState,children:(E==null?void 0:E.name)||k.currentStateId}),o.jsx("span",{style:xt.instanceTime,children:V5(k.updatedAt)})]})]},k.id)})}),S&&A&&o.jsx(Y5,{definition:A,instance:S,onRefresh:m})]})]})}function Y5({definition:t,instance:e,onRefresh:n}){const s=t.states.find(i=>i.id===e.currentStateId),[a,r]=b.useState("states");return o.jsxs("div",{style:xt.instanceView,children:[o.jsxs("div",{style:xt.statusBar,children:[o.jsx("span",{style:{...xt.statusBadge,color:hp[e.status]||"#6c7086",borderColor:hp[e.status]||"#6c7086"},children:e.status}),o.jsxs("span",{style:xt.currentLabel,children:["Current: ",o.jsx("strong",{children:(s==null?void 0:s.name)||e.currentStateId})]})]}),o.jsx(K5,{definition:t,instance:e,onRefresh:n}),o.jsx("div",{style:xt.tabs,children:["states","timeline","variables"].map(i=>o.jsx("button",{onClick:()=>r(i),style:{...xt.tab,...a===i?xt.tabActive:{}},children:i==="states"?"States":i==="timeline"?"Timeline":"Variables"},i))}),o.jsxs("div",{style:xt.tabContent,children:[a==="states"&&o.jsx(Q5,{definition:t,currentStateId:e.currentStateId}),a==="timeline"&&o.jsx(X5,{definition:t,instance:e}),a==="variables"&&o.jsx(J5,{variables:e.variables})]})]})}function K5({definition:t,instance:e,onRefresh:n}){const[s,a]=b.useState([]),[r,i]=b.useState(!1),[c,d]=b.useState(null),[f,h]=b.useState(null),m=b.useCallback(async()=>{if(e.status!=="running"){a([]);return}i(!0);try{const y=await Pt(Ot(`/api/workflows/instances/${e.id}/available-transitions`));if(y.ok){const S=((await y.json()).transitions||[]).map(A=>{const k=t.states.find(N=>N.id===A.targetStateId);return{...A,targetStateName:k==null?void 0:k.name}});a(S)}}catch{}finally{i(!1)}},[e.id,e.status,t]);b.useEffect(()=>{m()},[m,e.currentStateId]);const x=b.useCallback(async y=>{d(y),h(null);try{const v=await Pt(Ot(`/api/workflows/instances/${e.id}/transition`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetStateId:y,reason:"Transitioned via UI panel"})});if(v.ok)setTimeout(()=>{m(),n()},500);else{const S=await v.json().catch(()=>({error:"Transition failed"}));h(S.error||"Transition failed")}}catch{h("Network error")}finally{d(null)}},[e.id,m,n]);return e.status!=="running"?null:r&&s.length===0?o.jsx("div",{style:xt.transitionSection,children:o.jsx("span",{style:xt.loadingText,children:"Loading transitions..."})}):s.length===0?null:o.jsxs("div",{style:xt.transitionSection,children:[o.jsx("div",{style:xt.transitionLabel,children:"Available Transitions"}),o.jsx("div",{style:xt.transitionButtons,children:s.map(y=>o.jsxs("button",{onClick:()=>x(y.targetStateId),disabled:c!==null,style:{...xt.transitionBtn,opacity:c===y.targetStateId?.6:1},title:`${y.name} → ${y.targetStateName||y.targetStateId}`,children:[c===y.targetStateId?"...":y.name,o.jsxs("span",{style:xt.transitionArrow,children:["→"," ",y.targetStateName||y.targetStateId]})]},y.id))}),f&&o.jsx("div",{style:xt.transitionError,children:f})]})}function Q5({definition:t,currentStateId:e}){return o.jsx("div",{style:xt.stateList,children:t.states.map(n=>{const s=n.id===e;return o.jsxs("div",{style:{...xt.stateItem,...s?xt.stateItemCurrent:{}},children:[o.jsxs("div",{style:xt.stateHeader,children:[o.jsx("span",{style:{...xt.stateTypeBadge,backgroundColor:`${Kg[n.type]}22`,color:Kg[n.type],borderColor:`${Kg[n.type]}44`},children:n.type}),o.jsx("span",{style:xt.stateName,children:n.name}),s&&o.jsx("span",{style:xt.currentBadge,children:"CURRENT"})]}),n.description&&o.jsx("div",{style:xt.stateDescription,children:n.description}),n.transitions.length>0&&o.jsx("div",{style:xt.stateTransitions,children:n.transitions.map(a=>{var r;return o.jsxs("span",{style:xt.transitionChip,children:[a.name," ","→"," ",((r=t.states.find(i=>i.id===a.targetStateId))==null?void 0:r.name)||a.targetStateId]},a.id)})})]},n.id)})})}function X5({definition:t,instance:e}){return!e.history||e.history.length===0?o.jsx("div",{style:xt.emptyState,children:"No timeline events yet"}):o.jsx("div",{style:xt.timeline,children:(e.history??[]).map((n,s)=>{const a=t.states.find(i=>i.id===n.toStateId),r=n.fromStateId?t.states.find(i=>i.id===n.fromStateId):null;return o.jsxs("div",{style:xt.timelineEntry,children:[o.jsx("div",{style:xt.timelineDot}),o.jsxs("div",{style:xt.timelineContent,children:[o.jsxs("div",{style:xt.timelineHeader,children:[o.jsx("span",{style:xt.timelineTime,children:q5(n.timestamp)}),n.transitionName&&o.jsxs("span",{style:xt.timelineTransition,children:["via ",n.transitionName]})]}),o.jsxs("div",{style:xt.timelineStates,children:[r&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:xt.timelineStateName,children:r.name}),o.jsx("span",{style:xt.timelineArrow,children:"→"})]}),o.jsx("span",{style:{...xt.timelineStateName,fontWeight:600},children:(a==null?void 0:a.name)||n.toStateId})]}),n.details&&o.jsx("div",{style:xt.timelineDetails,children:n.details})]})]},s)})})}function J5({variables:t}){const e=Object.entries(t);if(e.length===0)return o.jsx("div",{style:xt.emptyState,children:"No variables set"});const n=e.filter(([a])=>!a.startsWith("wi_")),s=e.filter(([a])=>a.startsWith("wi_"));return o.jsxs("div",{style:xt.variablesSection,children:[n.length>0&&o.jsxs("div",{style:xt.varGroup,children:[o.jsx("div",{style:xt.varGroupLabel,children:"Variables"}),n.map(([a,r])=>o.jsxs("div",{style:xt.varRow,children:[o.jsx("span",{style:xt.varKey,children:a}),o.jsx("span",{style:xt.varValue,children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]}),s.length>0&&o.jsxs("div",{style:xt.varGroup,children:[o.jsx("div",{style:xt.varGroupLabel,children:"Internal"}),s.map(([a,r])=>o.jsxs("div",{style:xt.varRow,children:[o.jsx("span",{style:{...xt.varKey,opacity:.6},children:a}),o.jsx("span",{style:{...xt.varValue,opacity:.6},children:typeof r=="object"?JSON.stringify(r):String(r??"")})]},a))]})]})}const xt={headerBadge:{fontSize:10,fontWeight:700,background:"var(--accent-color, #cba6f7)",color:"#1e1e2e",borderRadius:8,padding:"0 5px",marginLeft:6,minWidth:16,textAlign:"center",lineHeight:"16px"},instanceList:{display:"flex",flexDirection:"column",gap:2,padding:"4px 4px 0",maxHeight:180,overflowY:"auto",flexShrink:0,borderBottom:"1px solid var(--border-color, #313244)"},instanceRow:{display:"flex",flexDirection:"column",gap:2,padding:"5px 8px",border:"1px solid transparent",borderRadius:4,background:"transparent",cursor:"pointer",textAlign:"left",width:"100%",color:"inherit"},instanceRowSelected:{background:"rgba(203, 166, 247, 0.08)",border:"1px solid var(--accent-color, #cba6f7)"},instanceRowTop:{display:"flex",alignItems:"center",gap:6},instanceRowBottom:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:12},statusDot:{display:"inline-block",width:7,height:7,borderRadius:"50%",flexShrink:0},instanceName:{fontSize:11,fontWeight:600,color:"var(--text-primary, #cdd6f4)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},instanceStatus:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.3px",flexShrink:0},instanceState:{fontSize:10,color:"var(--text-secondary, #a6adc8)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},instanceTime:{fontSize:9,color:"var(--text-secondary, #a6adc8)",opacity:.7,flexShrink:0,whiteSpace:"nowrap"},emptyState:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,padding:24,color:"var(--text-secondary, #a6adc8)",fontSize:12},emptyIcon:{fontSize:20,opacity:.5},loadingText:{fontSize:11,color:"var(--text-secondary, #a6adc8)",fontStyle:"italic"},instanceView:{display:"flex",flexDirection:"column",flex:1,minHeight:0},statusBar:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},statusBadge:{fontSize:10,fontWeight:700,textTransform:"uppercase",border:"1px solid",borderRadius:4,padding:"1px 6px",letterSpacing:"0.5px"},currentLabel:{fontSize:12,color:"var(--text-secondary, #a6adc8)"},transitionSection:{padding:"8px 12px",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},transitionLabel:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:"var(--text-secondary, #a6adc8)",marginBottom:6,letterSpacing:"0.5px"},transitionButtons:{display:"flex",flexDirection:"column",gap:4},transitionBtn:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"6px 10px",border:"1px solid var(--accent-color, #cba6f7)",borderRadius:4,background:"transparent",color:"var(--accent-color, #cba6f7)",cursor:"pointer",fontSize:12,fontWeight:500,transition:"background 0.15s"},transitionArrow:{fontSize:10,opacity:.7,fontWeight:400},transitionError:{fontSize:11,color:"#f38ba8",marginTop:4},tabs:{display:"flex",borderBottom:"1px solid var(--border-color, #313244)",flexShrink:0},tab:{flex:1,padding:"6px 8px",border:"none",borderBottom:"2px solid transparent",background:"transparent",color:"var(--text-secondary, #a6adc8)",cursor:"pointer",fontSize:11,fontWeight:500,textAlign:"center"},tabActive:{color:"var(--text-primary, #cdd6f4)",borderBottomColor:"var(--accent-color, #cba6f7)"},tabContent:{flex:1,overflow:"auto",minHeight:0},stateList:{display:"flex",flexDirection:"column",gap:2,padding:4},stateItem:{padding:"6px 8px",borderRadius:4,border:"1px solid transparent"},stateItemCurrent:{border:"1px solid var(--accent-color, #cba6f7)",background:"rgba(203, 166, 247, 0.08)",boxShadow:"0 0 8px rgba(203, 166, 247, 0.15)"},stateHeader:{display:"flex",alignItems:"center",gap:6},stateTypeBadge:{fontSize:9,fontWeight:700,textTransform:"uppercase",border:"1px solid",borderRadius:3,padding:"0 4px",letterSpacing:"0.3px"},stateName:{fontSize:12,fontWeight:500,color:"var(--text-primary, #cdd6f4)"},currentBadge:{fontSize:8,fontWeight:700,color:"#cba6f7",background:"rgba(203, 166, 247, 0.15)",borderRadius:3,padding:"1px 4px",marginLeft:"auto",letterSpacing:"0.5px"},stateDescription:{fontSize:11,color:"var(--text-secondary, #a6adc8)",marginTop:3,paddingLeft:2},stateTransitions:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},transitionChip:{fontSize:9,color:"var(--text-secondary, #a6adc8)",background:"var(--surface-1, #313244)",borderRadius:3,padding:"1px 5px"},timeline:{padding:"4px 8px"},timelineEntry:{display:"flex",gap:8,paddingBottom:10,position:"relative"},timelineDot:{width:8,height:8,borderRadius:"50%",background:"var(--accent-color, #cba6f7)",flexShrink:0,marginTop:3},timelineContent:{flex:1,minWidth:0},timelineHeader:{display:"flex",alignItems:"center",gap:6,marginBottom:2},timelineTime:{fontSize:10,color:"var(--text-secondary, #a6adc8)",fontFamily:"monospace"},timelineTransition:{fontSize:10,color:"#89b4fa",fontStyle:"italic"},timelineStates:{display:"flex",alignItems:"center",gap:4,fontSize:11,color:"var(--text-primary, #cdd6f4)"},timelineStateName:{fontWeight:400},timelineArrow:{color:"var(--text-secondary, #a6adc8)",fontSize:10},timelineDetails:{fontSize:10,color:"var(--text-secondary, #a6adc8)",marginTop:2,whiteSpace:"pre-wrap",wordBreak:"break-word"},variablesSection:{padding:4},varGroup:{marginBottom:8},varGroupLabel:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:"var(--text-secondary, #a6adc8)",padding:"4px 8px",letterSpacing:"0.5px"},varRow:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8,padding:"3px 8px",borderRadius:3},varKey:{fontSize:11,fontFamily:"monospace",color:"#cba6f7",flexShrink:0},varValue:{fontSize:11,fontFamily:"monospace",color:"var(--text-primary, #cdd6f4)",textAlign:"right",wordBreak:"break-all"}},Z5=b.memo(function(){const{t:e}=ht(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(()=>Vx()),[i,c]=b.useState(-1),d=b.useRef(null),f=b.useRef(null),h=Xs.findIndex(S=>S.id===a);b.useEffect(()=>{if(!n)return;const S=A=>{d.current&&!d.current.contains(A.target)&&s(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n]),b.useEffect(()=>{n&&c(h)},[n,h]);const m=S=>{const A=S==="next"?(h+1)%Xs.length:(h-1+Xs.length)%Xs.length,k=Xs[A],N=pu(k.id);lp(N),r(k.id)},x=S=>{n||(S.key==="ArrowUp"||S.key==="ArrowLeft"?(S.preventDefault(),m("prev")):S.key==="ArrowDown"||S.key==="ArrowRight"?(S.preventDefault(),m("next")):(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),s(!0)))};b.useEffect(()=>{if(!n)return;const S=A=>{var k,N;A.key==="Escape"?(s(!1),(k=f.current)==null||k.focus()):A.key==="ArrowDown"?(A.preventDefault(),c(j=>(j+1)%Xs.length)):A.key==="ArrowUp"?(A.preventDefault(),c(j=>(j-1+Xs.length)%Xs.length)):A.key==="Enter"&&i>=0&&(A.preventDefault(),y(Xs[i].id),(N=f.current)==null||N.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[n,i]);const y=S=>{const A=pu(S);lp(A),r(S),s(!1)},v=pu(a);return o.jsxs("div",{className:"theme-selector",ref:d,children:[o.jsxs("button",{ref:f,className:"theme-selector-trigger",onClick:()=>s(!n),onKeyDown:x,title:e("terminal:themeSelector.themeTitle",{name:v.name}),children:[o.jsx("span",{className:"theme-selector-icon",children:"🎨"}),o.jsx("span",{className:"theme-selector-name",children:v.name}),o.jsx("span",{className:"theme-selector-arrow",children:n?"▲":"▼"})]}),n&&o.jsxs("div",{className:"theme-selector-dropdown",onMouseDown:S=>S.stopPropagation(),onClick:S=>S.stopPropagation(),children:[o.jsx("div",{className:"theme-selector-header",children:e("terminal:themeSelector.selectTheme")}),o.jsx("div",{className:"theme-selector-list",children:Xs.map((S,A)=>o.jsxs("button",{className:`theme-selector-option ${S.id===a?"active":""} ${A===i?"highlighted":""}`,onClick:k=>{k.stopPropagation(),y(S.id)},onMouseDown:k=>k.stopPropagation(),onMouseEnter:()=>c(A),children:[o.jsx("span",{className:"theme-option-preview",style:{background:`linear-gradient(135deg, ${S.colors.bgPrimary} 0%, ${S.colors.bgSecondary} 50%, ${S.colors.accentPurple} 100%)`}}),o.jsxs("span",{className:"theme-option-info",children:[o.jsx("span",{className:"theme-option-name",children:S.name}),o.jsx("span",{className:"theme-option-desc",children:S.description})]}),S.id===a&&o.jsx("span",{className:"theme-option-check",children:"✓"})]},S.id))})]})]})}),kA=48,eW=49,tW=50,SA=48,nW={background:"#1a1a2e",foreground:"#f8f8f2",cursor:"#f8f8f2",cursorAccent:"#1a1a2e",selectionBackground:"#44475a",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"};function sW(t,e){let n=null;const s=(...a)=>{n&&clearTimeout(n),n=setTimeout(()=>t(...a),e)};return s.cancel=()=>{n&&clearTimeout(n)},s}const Gt=(...t)=>console.log("[TerminalEmbed]",...t);function CA(t){var e;Gt("copyToClipboard called, text:",t.slice(0,50)),Gt("navigator.clipboard available:",!!navigator.clipboard),Gt("document.hasFocus:",document.hasFocus()),(e=navigator.clipboard)!=null&&e.writeText?navigator.clipboard.writeText(t).then(()=>Gt("clipboard.writeText SUCCESS"),n=>{Gt("clipboard.writeText FAILED:",(n==null?void 0:n.message)||n),AA(t)}):(Gt("navigator.clipboard not available, using fallback"),AA(t))}function AA(t){const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.left="-9999px",e.style.opacity="0",document.body.appendChild(e),e.focus(),e.select();try{const n=document.execCommand("copy");Gt("execCommand fallback:",n?"SUCCESS":"FAILED")}catch(n){Gt("execCommand fallback error",n)}document.body.removeChild(e)}const Wb=b.memo(function({terminalUrl:e,visible:n}){const s=b.useRef(null),a=b.useRef(null),r=b.useRef(null),i=b.useRef(null),c=b.useRef(!1),d=b.useRef(new TextEncoder),f=b.useCallback(m=>{const x=i.current;if(!x||x.readyState!==WebSocket.OPEN)return;const y=d.current.encode(m),v=new Uint8Array(y.length+1);v[0]=SA,v.set(y,1),x.send(v)},[]),h=b.useCallback((m,x)=>{const y=i.current;!y||y.readyState!==WebSocket.OPEN||y.send("1"+JSON.stringify({columns:m,rows:x}))},[]);return b.useEffect(()=>{if(Gt("useEffect fired",{visible:n,init:c.current,hasContainer:!!s.current,terminalUrl:e}),!n||c.current||!s.current)return;c.current=!0;let m=!1,x=null,y=null,v=null,S=null,A=null,k=null;return(async()=>{Gt("Lazy-loading xterm.js modules...");const[N,j,E,D]=await Promise.all([vt(()=>import("./xterm-BqvuqXEL.js"),[]),vt(()=>import("./addon-fit-YJmn1quW.js"),[]),vt(()=>import("./addon-clipboard-Ckztrdv4.js"),[]),vt(()=>import("./addon-web-links-BWjmmSgS.js"),[])]);if(m){Gt("Destroyed after module load, aborting");return}if(await vt(()=>Promise.resolve({}),__vite__mapDeps([16])),Gt("Modules loaded, xterm exports:",Object.keys(N)),m||!s.current)return;const _=N.Terminal,B=j.FitAddon,O=E.ClipboardAddon,T=D.WebLinksAddon;x=new _({theme:nW,fontSize:13,scrollback:5e3,fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Menlo', 'Monaco', 'Courier New', monospace",cursorBlink:!0,allowProposedApi:!0,disableStdin:!1,rightClickSelectsWord:!1}),a.current=x,y=new B,r.current=y,x.loadAddon(y),x.loadAddon(new O),x.loadAddon(new T),x.attachCustomKeyEventHandler(V=>!(V.ctrlKey&&V.key==="c"&&x.hasSelection()||V.ctrlKey&&V.key==="v"||V.ctrlKey&&V.shiftKey&&V.key==="C"||V.ctrlKey&&V.shiftKey&&V.key==="V"));const M=s.current.getBoundingClientRect();Gt("Container dimensions before open:",{w:M.width,h:M.height}),x.open(s.current),y.fit(),Gt("Terminal opened, cols:",x.cols,"rows:",x.rows),x.onSelectionChange(()=>{Gt(">>> onSelectionChange FIRED",{hasSelection:x.hasSelection()});const V=x.hasSelection()?x.getSelection():"";V&&(Gt("onSelectionChange copying text:",V.slice(0,50)),CA(V))}),s.current.addEventListener("mousedown",V=>{Gt("mousedown",{button:V.button,shiftKey:V.shiftKey,metaKey:V.metaKey,ctrlKey:V.ctrlKey})}),s.current.addEventListener("mouseup",V=>{Gt("mouseup",{button:V.button,shiftKey:V.shiftKey,hasSel:x.hasSelection()})}),Gt("Registering OSC 52 handler"),x.parser.registerOscHandler(52,V=>{Gt(">>> OSC 52 received",{dataLength:V.length,data:V.slice(0,80)});const Y=V.split(";"),P=Y.length>1?Y.slice(1).join(";"):Y[0];if(P)try{const K=Uint8Array.from(atob(P),q=>q.charCodeAt(0)),Q=new TextDecoder().decode(K);Gt("OSC 52 decoded:",Q.slice(0,50)),CA(Q)}catch{}return!1}),k=V=>V.preventDefault(),s.current.addEventListener("contextmenu",k),x.onData(V=>f(V)),x.onBinary(V=>{const Y=i.current;if(!Y||Y.readyState!==WebSocket.OPEN)return;const P=new Uint8Array(V.length+1);P[0]=SA;for(let K=0;K<V.length;K++)P[K+1]=V.charCodeAt(K);Y.send(P)}),S=sW(()=>{y&&x&&(y.fit(),h(x.cols,x.rows))},100),A=new ResizeObserver(()=>S()),A.observe(s.current);const R=e.endsWith("/")?e.slice(0,-1):e,F=fb(`${R}/token`);Gt("Fetching ttyd token from:",F);let $="";try{const V=await fetch(F);if(Gt("Token response status:",V.status,"content-type:",V.headers.get("content-type")),V.ok){const Y=await V.text();Gt("Token raw response:",Y);try{$=JSON.parse(Y).token||""}catch{$=Y.trim()}Gt("Parsed ttyd token:",$?$.slice(0,16)+"...":"(empty)")}else Gt("Token fetch failed:",V.status,V.statusText)}catch(V){Gt("Token fetch error:",V)}if(m)return;const U=window.location.protocol==="https:"?"wss:":"ws:",L=fb(`${R}/ws`),z=`${U}//${window.location.host}${L}`;Gt("Connecting WebSocket to:",z),v=new WebSocket(z,["tty"]),v.binaryType="arraybuffer",i.current=v,v.onopen=()=>{if(Gt("WebSocket OPEN"),x&&y){y.fit();const V=JSON.stringify({AuthToken:$,columns:x.cols,rows:x.rows});Gt("Sending init message (as binary):",V),v.send(d.current.encode(V))}};let W=0;v.onmessage=V=>{if(x){if(W++,W<=5){const Y=V.data instanceof ArrayBuffer?"ArrayBuffer":typeof V.data,P=V.data instanceof ArrayBuffer?V.data.byteLength:V.data.length;if(Gt(`WS message #${W}: type=${Y} size=${P}`),V.data instanceof ArrayBuffer){const K=new Uint8Array(V.data).slice(0,20);Gt(` First bytes: [${Array.from(K).join(", ")}]`)}}if(V.data instanceof ArrayBuffer){const Y=new Uint8Array(V.data);if(Y.length<1)return;const P=Y[0];P===kA?x.write(Y.subarray(1)):P===eW?Gt("Received SET_TITLE"):P===tW?Gt("Received SET_PREFS:",new TextDecoder().decode(Y.subarray(1))):Gt("Unknown binary cmd:",P,"char:",String.fromCharCode(P))}else typeof V.data=="string"&&(W<=5&&Gt("String message, first char code:",V.data.charCodeAt(0)),V.data.charCodeAt(0)===kA&&x.write(V.data.slice(1)))}},v.onclose=V=>{Gt("WebSocket CLOSED, code:",V.code,"reason:",V.reason,"wasClean:",V.wasClean,"totalMessages:",W),x&&!m&&x.write(`\r
|
|
148
|
+
\x1B[90m[Terminal disconnected]\x1B[0m\r
|
|
149
|
+
`)},v.onerror=V=>{Gt("WebSocket ERROR:",V)},x.onResize(({cols:V,rows:Y})=>h(V,Y))})(),()=>{var N;m=!0,c.current=!1,S==null||S.cancel(),A==null||A.disconnect(),k&&((N=s.current)==null||N.removeEventListener("contextmenu",k)),v&&v.readyState<=WebSocket.OPEN&&v.close(),i.current=null,x==null||x.dispose(),a.current=null,r.current=null}},[n,e,f,h]),b.useEffect(()=>{n&&r.current&&a.current&&requestAnimationFrame(()=>{var m;(m=r.current)==null||m.fit(),a.current&&h(a.current.cols,a.current.rows)})},[n,h]),o.jsx("div",{ref:s,className:"guake-bottom-terminal-embed",style:{display:n?void 0:"none"}})}),aW=128,rW=95;function iW(t,e){if(e.type==="rectangle"&&e.width&&e.height){const n=e.width/2,s=e.height/2;return t.x>=e.center.x-n&&t.x<=e.center.x+n&&t.z>=e.center.z-s&&t.z<=e.center.z+s}if(e.type==="circle"&&e.radius){const n=t.x-e.center.x,s=t.z-e.center.z;return n*n+s*s<=e.radius*e.radius}return!1}let oW=1;function vf(){return`bp-${oW++}`}const lW=b.memo(function({buildingId:e,filterText:n,maxRetention:s}){const{streamingBuildingLogs:a}=Ts(),r=a.get(e)||"",i=b.useRef(null),c=b.useRef(!1),d=b.useRef(0),f=n.trim().toLowerCase(),h=30,m=b.useCallback(()=>{const j=i.current;if(!j)return;const E=j.scrollTop+j.clientHeight>=j.scrollHeight-h;c.current=!E},[]),x=b.useMemo(()=>jj(r,s),[r,s]);b.useLayoutEffect(()=>{const j=i.current;if(!j)return;const E=d.current,D=j.scrollHeight;if(c.current){const _=E-D;_>0&&(j.scrollTop=Math.max(0,j.scrollTop-_))}else j.scrollTop=D;d.current=j.scrollHeight},[x,f]);const y=b.useMemo(()=>x?f?x.split(`
|
|
150
|
+
`).filter(j=>j.toLowerCase().includes(f)).join(`
|
|
151
|
+
`):x:"",[x,f]),v=b.useMemo(()=>y?y.split(`
|
|
152
|
+
`):[],[y]),S=b.useMemo(()=>v.map(j=>kl(j||" ")),[v]),A=b.useMemo(()=>x?f&&!y?"No log lines match the current filter.":null:"Waiting for logs...",[x,f,y]),k=u1({count:S.length,getScrollElement:()=>i.current,estimateSize:()=>20,overscan:12,measureElement:j=>j.getBoundingClientRect().height}),N=k.getVirtualItems();return o.jsx("div",{ref:i,className:"guake-bottom-pm2-logs",onScroll:m,children:A?o.jsx("div",{className:"guake-bottom-pm2-logs-empty",children:A}):o.jsx("div",{className:"guake-bottom-pm2-logs-inner",style:{height:k.getTotalSize()},children:N.map(j=>o.jsx("div",{ref:k.measureElement,className:"guake-bottom-pm2-log-line","data-index":j.index,style:{transform:`translateY(${j.start}px)`},dangerouslySetInnerHTML:{__html:S[j.index]}},j.key))})})});b.memo(function({src:e,title:n}){const s=b.useRef(null),[a,r]=b.useState(!1),[i,c]=b.useState(null);b.useEffect(()=>{r(!1),c(null);const h=setTimeout(()=>c(e),400);return()=>clearTimeout(h)},[e]);const d=b.useCallback(()=>{var m;const h=s.current;if(h){document.activeElement===h&&h.blur();try{(m=h.contentWindow)==null||m.blur()}catch{}}},[]),f=b.useCallback(()=>{const h=document.querySelector(".guake-input-container"),m=h==null?void 0:h.querySelector("textarea, input");h==null||h.focus({preventScroll:!0}),m==null||m.focus({preventScroll:!0})},[]);return b.useEffect(()=>{if(!i)return;const h=Date.now(),m=()=>{Date.now()-h>1500||(d(),f())};return window.addEventListener("focus",m,!0),document.addEventListener("focusin",m,!0),()=>{window.removeEventListener("focus",m,!0),document.removeEventListener("focusin",m,!0)}},[f,d,i]),o.jsxs(o.Fragment,{children:[!a&&o.jsx("div",{className:"guake-bottom-terminal-starting",children:o.jsx("span",{children:"Loading terminal..."})}),o.jsx("iframe",{ref:s,src:i??void 0,className:`guake-bottom-terminal-iframe${a?"":" iframe-loading"}`,title:n,allow:"clipboard-read; clipboard-write",loading:"lazy",tabIndex:-1,onLoad:()=>{r(!0),d(),f()}})]})});const cW=b.memo(function({onSaveSnapshot:e}={}){var cr,ur,$l,wo,Hl,Wr,ca,ko,qr,Ta,So,_i,Ul;const{t:n}=ht(["terminal","common"]),s=Ml(),a=ox(),r=Dj(),i=Rj(),c=ux(),d=dx(),f=dL(),h=!!f,m=b.useMemo(()=>f?{id:f.agentId,name:f.agentName,class:f.agentClass,status:"idle",provider:"claude",position:{x:0,y:0,z:0},cwd:f.cwd,permissionMode:"interactive",tokensUsed:0,contextUsed:0,contextLimit:2e5,taskCount:0,createdAt:f.createdAt,lastActivity:f.createdAt}:null,[f]),x=Array.from(a),v=x.length===1?x[0]:null,A=(ix(v)||null)??(h?m:null),k=v??(h?(f==null?void 0:f.agentId)??null:null),N=sr(),j=cx(),E=b.useMemo(()=>{if(!k)return null;const ne=new Set,Te=[];for(const Ie of N.values())Ie.archived||Ie.directories.length===0||Ie.assignedAgentIds.includes(k)&&(ne.add(Ie.id),Te.push(Ie));const ye=s.get(k);if(ye)for(const Ie of N.values())Ie.archived||Ie.directories.length===0||ne.has(Ie.id)||iW({x:ye.position.x,z:ye.position.z},Ie)&&(ne.add(Ie.id),Te.push(Ie));return Te.length===0?null:Te.flatMap(Ie=>Ie.directories.filter(mt=>mt&&mt.trim().length>0).map(mt=>({areaId:Ie.id,areaName:Ie.name,dir:mt})))},[k,N,s]),D=b.useMemo(()=>{var ye;if(!k)return[];const ne=H.getAreaForAgent(k);if(!ne)return[];const Te=[];for(const Ie of j.values())Ie.type==="terminal"&&H.isPositionInArea(Ie.position,ne)&&Te.push({id:Ie.id,name:Ie.name,hasUrl:!!((ye=Ie.terminalStatus)!=null&&ye.url)});return Te},[k,j,N]),_=b.useMemo(()=>{var ye;if(!k)return[];const ne=H.getAreaForAgent(k);if(!ne)return[];const Te=[];for(const Ie of j.values())Ie.type==="server"&&((ye=Ie.pm2)!=null&&ye.enabled)&&H.isPositionInArea(Ie.position,ne)&&Te.push({id:Ie.id,name:Ie.name});return Te},[k,j,N]),B=b.useMemo(()=>{if(!k)return[];const ne=H.getAreaForAgent(k);if(!ne)return[];const Te=[];for(const ye of j.values())ye.type==="database"&&ye.database&&H.isPositionInArea(ye.position,ne)&&Te.push({id:ye.id,name:ye.name});return Te},[k,j,N]),{branches:O,fetchRemote:T,fetchingDirs:M}=HU(E),{terminalHeight:R,terminalRef:F,handleResizeStart:$}=PU(),{mobileOverviewHeight:U,handleResizeMouseDown:L,handleResizeTouchStart:z}=FU(),W=LU(),[V,Y]=b.useState(()=>{const ne=Qb(pt.SIDE_PANEL_WIDTH,420);return Math.max(280,Math.min(700,ne))}),P=b.useRef(null),K=b.useCallback((ne,Te)=>{ne.preventDefault(),P.current={startX:ne.clientX,startW:V},document.body.style.cursor="ew-resize",document.body.style.userSelect="none",H.setTerminalResizing(!0);let ye=V;const Ie=Mt=>{if(!P.current)return;const fn=Mt.clientX-P.current.startX,rn=Te==="left"?-fn:fn;ye=Math.max(280,Math.min(700,P.current.startW+rn)),Y(ye)},mt=()=>{P.current=null,document.body.style.cursor="",document.body.style.userSelect="",H.setTerminalResizing(!1),document.removeEventListener("mousemove",Ie),document.removeEventListener("mouseup",mt),Xb(pt.SIDE_PANEL_WIDTH,ye)};document.addEventListener("mousemove",Ie),document.addEventListener("mouseup",mt)},[V]),Q=b.useRef(null),q=b.useRef(null),[be,ue]=b.useState(()=>{const ne=ka(pt.VIEW_MODE);return ne==="simple"||ne==="chat"||ne==="advanced"?ne:ka(pt.ADVANCED_VIEW)==="true"?"advanced":"simple"}),[Z,de]=b.useState(()=>bi(pt.TERMINAL_FULLSCREEN,!1)),[Ce,xe]=b.useState(null),[Ne,qe]=b.useState(null),[Ge,X]=b.useState(null),[se,Ee]=b.useState(null),[Ve,at]=b.useState(!1);Qt("guake-image-modal",Ce!==null,()=>xe(null)),Qt("guake-bash-modal",Ne!==null,()=>qe(null)),Qt("guake-response-modal",se!==null,()=>Ee(null)),Qt("guake-context-confirm",Ge!==null,()=>X(null)),Qt("guake-agent-info",Ve,()=>at(!1));const[we,$e]=b.useState(!1),[ie,fe]=b.useState(()=>ps.isEnabled()),[Ue,it]=b.useState(()=>bi(pt.GIT_PANEL_OPEN,!1)),ot=b.useCallback(ne=>{it(ne),xi(pt.GIT_PANEL_OPEN,ne)},[]),[ce,J]=b.useState(()=>bi(pt.BUILDINGS_PANEL_OPEN,!1)),ae=b.useCallback(ne=>{J(ne),xi(pt.BUILDINGS_PANEL_OPEN,ne)},[]),[Se,ee]=b.useState(()=>bi(pt.WORKFLOW_PANEL_OPEN,!1)),ge=b.useCallback(ne=>{ee(ne),xi(pt.WORKFLOW_PANEL_OPEN,ne)},[]),[Re,Fe]=b.useState(!1);b.useEffect(()=>{if(!k){Fe(!1);return}let ne=!1;return(async()=>{try{const Te=await Pt(Ot("/api/workflows/definitions"));if(ne||!Te.ok)return;const Ie=(await Te.json()).some(mt=>mt.states.some(Mt=>{var fn,rn;return((fn=Mt.action)==null?void 0:fn.type)==="agent_task"&&((rn=Mt.action)==null?void 0:rn.agentId)===k}));ne||Fe(Ie)}catch{ne||Fe(!1)}})(),()=>{ne=!0}},[k]);const oe=bL(),Le=b.useCallback(ne=>H.setOverviewPanelOpen(ne),[]),[te,pe]=b.useState([]),[ke,Be]=b.useState({}),[Ke,ze]=b.useState(()=>Aj()),[Ze,lt]=b.useState(()=>{try{return localStorage.getItem("tide:bottom-split-direction")==="vertical"?"vertical":"horizontal"}catch{return"horizontal"}}),[et,ct]=b.useState(()=>{try{const ne=localStorage.getItem("tide:bottom-terminal-height");return ne?Math.max(120,Math.min(600,Number(ne))):250}catch{return 250}}),st=b.useRef(null),[bt,Tt]=b.useState([1]),he=b.useRef(null),_e=b.useRef(null),[We,nt]=b.useState(null),[_t,Bt]=b.useState(null),Ct=b.useMemo(()=>te.filter(ne=>ne.areaId===_t),[te,_t]),$t=b.useMemo(()=>new Set(Ct.map(ne=>ne.buildingId)),[Ct]),Vt=b.useRef(new Map);b.useEffect(()=>{try{const ne=localStorage.getItem("tide:bottom-panels-v2");if(ne){const Te=JSON.parse(ne);Vt.current=new Map(Te.map(([ye,Ie])=>[ye,Ie.map(mt=>({id:mt.id??vf(),type:mt.type,buildingId:mt.buildingId}))]))}else{const Te=localStorage.getItem("tide:bottom-terminals");if(Te){const ye=JSON.parse(Te);for(const[Ie,mt]of ye)Vt.current.set(Ie,[{id:vf(),type:"terminal",buildingId:mt}])}}}catch{}},[]);const gt=b.useCallback(ne=>{if(!k)return;const Te=H.getAreaForAgent(k);if(Te)try{ne.length>0?Vt.current.set(Te.id,ne.map(Ie=>({id:Ie.id,type:Ie.type,buildingId:Ie.buildingId}))):Vt.current.delete(Te.id);const ye=Array.from(Vt.current.entries());localStorage.setItem("tide:bottom-panels-v2",JSON.stringify(ye))}catch{}},[k]),ut=b.useCallback(()=>{if(!k)return null;const ne=H.getAreaForAgent(k);return(ne==null?void 0:ne.id)??null},[k]),ft=b.useCallback((ne,Te)=>{const ye=ut();Be({}),pe(Ie=>{for(const rn of Ie)rn.areaId===ye&&rn.type==="pm2-logs"&&H.stopLogStreaming(rn.buildingId);const mt=Ie.filter(rn=>rn.areaId!==ye),Mt={id:vf(),type:Te,buildingId:ne,areaId:ye??void 0},fn=[...mt,Mt];return gt([Mt]),fn})},[gt,ut]),Ft=b.useCallback((ne,Te,ye)=>{const Ie=ut();lt(ye);try{localStorage.setItem("tide:bottom-split-direction",ye)}catch{}pe(mt=>{const Mt=mt.filter($n=>$n.areaId===Ie);if(Mt.length>=4||Mt.some($n=>$n.buildingId===ne))return mt;const fn={id:vf(),type:Te,buildingId:ne,areaId:Ie??void 0},rn=[...mt,fn];return gt(Mt.concat(fn)),rn})},[gt,ut]),cn=b.useCallback(ne=>{Be(Te=>{if(!(ne in Te))return Te;const ye={...Te};return delete ye[ne],ye}),pe(Te=>{const ye=Te.find(Mt=>Mt.id===ne);(ye==null?void 0:ye.type)==="pm2-logs"&&H.stopLogStreaming(ye.buildingId);const Ie=Te.filter(Mt=>Mt.id!==ne),mt=ye==null?void 0:ye.areaId;return mt&>(Ie.filter(Mt=>Mt.areaId===mt)),Ie})},[gt]);b.useCallback(()=>{Be({}),pe(ne=>{for(const Te of ne)Te.type==="pm2-logs"&&H.stopLogStreaming(Te.buildingId);return gt([]),[]})},[gt]),b.useEffect(()=>{if(!k){Bt(null);return}const ne=H.getAreaForAgent(k);if(!ne){Bt(null);return}Bt(ne.id),pe(Te=>{if(Te.filter(Mt=>Mt.areaId===ne.id).length>0)return Te;const Ie=Vt.current.get(ne.id);if(!Ie||Ie.length===0)return Te;const mt=Ie.map(Mt=>({id:Mt.id,type:Mt.type,buildingId:Mt.buildingId,areaId:ne.id}));return[...Te,...mt]})},[k]),b.useEffect(()=>{const ne=Te=>{const ye=Te.detail;ye!=null&&ye.buildingId&&ft(ye.buildingId,"terminal")};return window.addEventListener("tide:open-bottom-terminal",ne),()=>window.removeEventListener("tide:open-bottom-terminal",ne)},[ft]),b.useEffect(()=>{const ne=Te=>{const ye=Te.detail;ye!=null&&ye.buildingId&&ft(ye.buildingId,"pm2-logs")};return window.addEventListener("tide:open-bottom-pm2-logs",ne),()=>window.removeEventListener("tide:open-bottom-pm2-logs",ne)},[ft]),b.useEffect(()=>{const ne=Te=>{const ye=Te.detail;ye!=null&&ye.buildingId&&ft(ye.buildingId,"database")};return window.addEventListener("tide:open-bottom-database",ne),()=>window.removeEventListener("tide:open-bottom-database",ne)},[ft]),b.useEffect(()=>{const ne=Te=>{const ye=Te.detail;ye!=null&&ye.buildingId&&(ye!=null&&ye.type)&&(ye!=null&&ye.direction)&&(Ct.length===0?ft(ye.buildingId,ye.type):Ft(ye.buildingId,ye.type,ye.direction))};return window.addEventListener("tide:split-bottom-panel",ne),()=>window.removeEventListener("tide:split-bottom-panel",ne)},[Ct.length,ft,Ft]),b.useEffect(()=>{Tt(ne=>ne.length===Ct.length?ne:Ct.length<=1?[1]:(Ct.length>ne.length,Array(Ct.length).fill(1)))},[Ct.length]);const Dn=b.useCallback((ne,Te)=>{var $n;ne.preventDefault();const ye=Ze==="horizontal";he.current={index:Te,startPos:ye?ne.clientX:ne.clientY,startRatios:[...bt]},document.body.style.cursor=ye?"col-resize":"row-resize",document.body.style.userSelect="none";const Ie=($n=_e.current)==null?void 0:$n.querySelectorAll("iframe");Ie==null||Ie.forEach(ls=>ls.style.pointerEvents="none");const mt=_e.current,Mt=mt?ye?mt.offsetWidth:mt.offsetHeight:1,fn=ls=>{const Ss=he.current;if(!Ss||!mt)return;const zu=(ye?ls.clientX:ls.clientY)-Ss.startPos,$u=Ss.startRatios.reduce((Fp,zp)=>Fp+zp,0),Hu=zu/Mt*$u,ql=[...Ss.startRatios],Co=.1*$u;ql[Te]=Math.max(Co,Ss.startRatios[Te]+Hu),ql[Te+1]=Math.max(Co,Ss.startRatios[Te+1]-Hu),Tt(ql)},rn=()=>{he.current=null,document.body.style.cursor="",document.body.style.userSelect="",Ie==null||Ie.forEach(ls=>ls.style.pointerEvents=""),document.removeEventListener("mousemove",fn),document.removeEventListener("mouseup",rn)};document.addEventListener("mousemove",fn),document.addEventListener("mouseup",rn)},[Ze,bt]),ss=b.useRef(new Set);b.useEffect(()=>{const ne=new Set(te.filter(Te=>Te.type==="pm2-logs").map(Te=>Te.buildingId));for(const Te of ne)ss.current.has(Te)||H.startLogStreaming(Te,200);ss.current=ne},[te]);const zs=b.useRef(new Set);b.useEffect(()=>{var ye;const ne=te.filter(Ie=>Ie.type==="terminal");for(const Ie of ne){const mt=j.get(Ie.buildingId);!!((ye=mt==null?void 0:mt.terminalStatus)!=null&&ye.url)?zs.current.add(Ie.buildingId):zs.current.has(Ie.buildingId)&&(zs.current.delete(Ie.buildingId),cn(Ie.id))}const Te=new Set(ne.map(Ie=>Ie.buildingId));for(const Ie of zs.current)Te.has(Ie)||zs.current.delete(Ie)},[te,j,cn]);const Ia=b.useCallback(ne=>{ne.preventDefault(),st.current={startY:ne.clientY,startH:et};let Te=et;const ye=mt=>{if(!st.current)return;const Mt=st.current.startY-mt.clientY;Te=Math.max(120,Math.min(600,st.current.startH+Mt)),ct(Te)},Ie=()=>{st.current=null,document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ie);try{localStorage.setItem("tide:bottom-terminal-height",String(Te))}catch{}};document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ie)},[et]),[$s,ra]=b.useState(!1),ms=b.useRef(0),Et=r&&A!==null,Zn=b.useRef([]),Vn=b.useRef(-1),kn=b.useRef(!1),$r=b.useRef(!1),Hr=b.useRef(!1),gs=b.useRef(null),[ia,Pl]=b.useState(!1),[Ur,bo]=b.useState(!1),Hs=b.useCallback(()=>{const ne=Zn.current,Te=Vn.current;Pl(Te>0),bo(Te>=0&&Te<ne.length-1)},[]),ja=b.useCallback(ne=>{const Te=Zn.current;if(Te.length===0)return;let ye=Vn.current+ne;for(;ye>=0&&ye<Te.length;){const Ie=Te[ye];if(s.has(Ie)){kn.current=!0,Vn.current=ye,Hs(),H.selectAgent(Ie);return}ye+=ne}},[s,Hs]),oa=b.useCallback(()=>{ja(-1)},[ja]),os=b.useCallback(()=>{ja(1)},[ja]),as=b.useCallback((ne,Te)=>{if(typeof window>"u")return;const ye=window.history.state,mt={...typeof ye=="object"&&ye!==null?ye:{},__guakeAgentNav:{agentId:ne}};Te==="replace"?window.history.replaceState(mt,"",window.location.href):window.history.pushState(mt,"",window.location.href)},[]),xo=b.useCallback(()=>{de(ne=>{const Te=!ne;return xi(pt.TERMINAL_FULLSCREEN,Te),Te})},[]),me=zU({agents:s,selectedAgentId:k,isOpen:Et,overviewPanelOpen:oe,loadingHistory:((cr=Q.current)==null?void 0:cr.historyLoader.fetchingHistory)??!1,hasModalOpen:!!(Ce||Ne||se||c||d),outputRef:((ur=Q.current)==null?void 0:ur.outputScrollRef)??{current:null}});b.useEffect(()=>{const ne=F.current;if(!ne||!Et)return;const Te=Ie=>{Ie.button===3?(Ie.preventDefault(),Ie.stopPropagation(),oa()):Ie.button===4&&(Ie.preventDefault(),Ie.stopPropagation(),os())},ye=Ie=>{(Ie.button===3||Ie.button===4)&&Ie.preventDefault()};return ne.addEventListener("mouseup",Te),ne.addEventListener("mousedown",ye),()=>{ne.removeEventListener("mouseup",Te),ne.removeEventListener("mousedown",ye)}},[Et,oa,os]);const tt=b.useCallback(ne=>{H.setLastSelectionViaDirectClick(!0),H.selectAgent(ne)},[]),At=typeof window<"u"&&window.innerWidth<=768&&oe&&Et,en=sR({gestureRef:(($l=Q.current)==null?void 0:$l.outputScrollRef)??{current:null},agentListRef:q,enabled:At,onSelect:tt});b.useEffect(()=>{we&&!ie&&(fe(!0),ps.setEnabled(!0))},[we,ie]),b.useEffect(()=>{Et||at(!1)},[Et]),b.useEffect(()=>{var Te;if(!(Ne!=null&&Ne.isLive)||!Ne.command)return;const ne=((Te=Q.current)==null?void 0:Te.getDedupedHistory())??[];for(const ye of ne)if(ye._bashCommand===Ne.command&&ye._bashOutput){qe({command:Ne.command,output:ye._bashOutput,isLive:!1});return}},[Ne]);const Pn=b.useCallback((ne,Te)=>{xe({url:ne,name:Te})},[]),zt=b.useCallback((ne,Te)=>{const ye=jp(ne,A==null?void 0:A.cwd),Ie=ye.line?{...Te||{},targetLine:ye.line}:Te;H.setFileViewerPath(ye.path,Ie,A==null?void 0:A.cwd)},[A==null?void 0:A.cwd]),jt=b.useCallback((ne,Te)=>{qe({command:ne,output:Te,isLive:Te==="Running..."})},[]),jn=b.useCallback(ne=>{Ee(ne)},[]),ws=b.useCallback(()=>{at(ne=>!ne)},[]),[On,ks]=b.useState(0),[Ba,la]=b.useState(!1),Bp=b.useCallback(()=>{typeof window>"u"||window.innerWidth>768||(la(!0),ks(aW),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),setTimeout(()=>{H.setMobileView("3d"),la(!1),ks(0)},rW))},[]),Fu=b.useCallback(ne=>{Ba||ks(ne)},[Ba]);b.useEffect(()=>{ks(0),la(!1)},[k]),b.useEffect(()=>{if(!k){Zn.current=[],Vn.current=-1,Hs(),Hr.current=!1,gs.current=null;return}const ne=Zn.current;if(kn.current){kn.current=!1,Hs();return}const Te=Vn.current;if(Te>=0&&ne[Te]===k){Hs();return}const ye=Te<ne.length-1?ne.slice(0,Te+1):ne.slice();ye.push(k),ye.length>100&&ye.shift(),Zn.current=ye,Vn.current=ye.length-1,Hs()},[k,Hs]),b.useEffect(()=>{if(!(!Et||!k)){if(!Hr.current){as(k,"replace"),Hr.current=!0,gs.current=k;return}if($r.current){$r.current=!1,gs.current=k;return}gs.current!==k&&(as(k,"push"),gs.current=k)}},[Et,k,as]),b.useEffect(()=>{if(!Et)return;const ne=Te=>{var Mt,fn;const ye=(fn=(Mt=Te.state)==null?void 0:Mt.__guakeAgentNav)==null?void 0:fn.agentId;if(!ye||typeof ye!="string"||!s.has(ye)||ye===v)return;$r.current=!0,kn.current=!0;const Ie=Zn.current,mt=Ie.lastIndexOf(ye);mt>=0?Vn.current=mt:(Ie.push(ye),Vn.current=Ie.length-1),Hs(),H.selectAgent(ye)};return window.addEventListener("popstate",ne),()=>window.removeEventListener("popstate",ne)},[Et,s,v,Hs]),b.useEffect(()=>{Et&&v&&H.clearUnseenForAgent(v)},[Et,v]);const Il=b.useRef(null);b.useLayoutEffect(()=>{const ne=Il.current;ne!==null&&ne!==v&&H.getState().currentSnapshot&&H.setCurrentSnapshot(null),Il.current=v},[v]),b.useEffect(()=>{const ne=Te=>{if(Te.key==="`"&&!Te.ctrlKey&&!Te.altKey&&A){const ye=Te.target;ye.tagName!=="INPUT"&&ye.tagName!=="TEXTAREA"&&(Te.preventDefault(),H.toggleTerminal())}};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[A]),b.useEffect(()=>{if(!Et)return;const ne=Te=>{Te.altKey&&(Te.key!=="ArrowLeft"&&Te.key!=="ArrowRight"||(Te.key==="ArrowLeft"&&ia?(Te.preventDefault(),oa()):Te.key==="ArrowRight"&&Ur&&(Te.preventDefault(),os())))};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[Et,ia,Ur,oa,os]),b.useEffect(()=>{const ne=Te=>{var ye;Te.key==="Escape"&&(c?(Te.stopImmediatePropagation(),H.clearFileViewerPath()):d?(Te.stopImmediatePropagation(),H.closeContextModal()):se?(Te.stopImmediatePropagation(),Ee(null)):Ne?(Te.stopImmediatePropagation(),qe(null)):Ce?(Te.stopImmediatePropagation(),xe(null)):(ye=Q.current)!=null&&ye.search.searchMode&&(Te.stopImmediatePropagation(),Q.current.search.closeSearch()))};return document.addEventListener("keydown",ne,!0),()=>document.removeEventListener("keydown",ne,!0)},[Ce,Ne,se,c,d]);const yo=b.useRef(Et),Ti=b.useRef(!1);b.useEffect(()=>{yo.current=Et},[Et]),b.useEffect(()=>{if(window.innerWidth<=768)return;const Te=mt=>{var $n;if(!(mt instanceof Element))return!1;const Mt=($n=F.current)==null?void 0:$n.contains(mt),fn=mt.closest(".agent-bar"),rn=!!mt.closest(".modal-overlay, .modal, .image-modal-overlay, .image-modal, .bash-modal-overlay, .bash-modal, .agent-info-modal-overlay, .agent-info-modal, .agent-response-modal, .pasted-text-modal-overlay, .pasted-text-modal, .file-viewer-overlay, .file-viewer-modal, .context-view-modal, .guake-context-confirm-overlay, .guake-context-confirm-modal, .pm2-logs-modal-overlay, .pm2-logs-modal, .database-panel-modal, .context-menu, .guake-git-diff-modal-overlay, .guake-git-delete-confirm");return!!Mt||!!fn||rn},ye=mt=>{if(!yo.current){Ti.current=!1;return}if(ZD("terminal")){Ti.current=!1;return}Ti.current=!Te(mt.target)},Ie=mt=>{Ti.current&&(Te(mt.target)||H.setTerminalOpen(!1),Ti.current=!1)};return document.addEventListener("mousedown",ye,!0),document.addEventListener("mouseup",Ie,!0),()=>{document.removeEventListener("mousedown",ye,!0),document.removeEventListener("mouseup",Ie,!0)}},[]),b.useEffect(()=>{const ne=()=>{document.hidden&&W.cleanup()};return document.addEventListener("visibilitychange",ne),()=>document.removeEventListener("visibilitychange",ne)},[W]),b.useEffect(()=>()=>W.cleanup(),[k,W]);const Bl=typeof window<"u"&&window.innerWidth<=768;if(!A)return Bl&&i==="terminal"&&a.size===0?o.jsx("div",{ref:F,className:`guake-terminal open ${Z?"fullscreen":""}`,style:{"--terminal-height":`${R}%`},children:o.jsx("div",{className:"guake-content",children:o.jsx("div",{className:"guake-output",style:{display:"flex",alignItems:"center",justifyContent:"center",color:"#6272a4"},children:o.jsxs("div",{style:{textAlign:"center"},children:[o.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"👆"}),o.jsx("div",{style:{fontSize:"16px"},children:n("terminal:empty.tapAgent")}),o.jsx("div",{style:{fontSize:"14px",marginTop:"8px",opacity:.7},children:n("terminal:empty.switchTo3D")})]})})})}):Bl&&i==="terminal"&&a.size>0?o.jsx("div",{ref:F,className:`guake-terminal open ${Z?"fullscreen":""}`,style:{"--terminal-height":`${R}%`},children:o.jsx("div",{className:"guake-content",children:o.jsx("div",{className:"guake-output",style:{display:"flex",alignItems:"center",justifyContent:"center",color:"#6272a4"},children:o.jsxs("div",{className:"guake-empty loading",children:[n("terminal:empty.loadingTerminal"),o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]})]})})})}):null;if(!k)return null;const vo=ne=>{ne.preventDefault(),ne.stopPropagation(),ms.current++,ne.dataTransfer.types.includes("Files")&&ra(!0)},Na=ne=>{ne.preventDefault(),ne.stopPropagation()},Fl=ne=>{ne.preventDefault(),ne.stopPropagation(),ms.current--,ms.current===0&&ra(!1)},zl=async ne=>{var ye,Ie;ne.preventDefault(),ne.stopPropagation(),ms.current=0,ra(!1);const Te=ne.dataTransfer.files;if(Te.length)for(const mt of Te){const Mt=await((ye=Q.current)==null?void 0:ye.terminalInput.uploadFile(mt));Mt&&((Ie=Q.current)==null||Ie.terminalInput.setAttachedFiles(fn=>[...fn,Mt]))}};return o.jsxs("div",{ref:F,className:`guake-terminal ${Et?"open":"collapsed"} ${Z&&Et?"fullscreen":""} ${we&&Et?"with-debug-panel":""} ${Ue&&Et?"with-git-panel":""} ${ce&&Et?"with-buildings-panel":""} ${Se&&Et?"with-workflow-panel":""} ${oe&&Et?"with-overview-panel":""} ${$s?"drag-over":""} ${On>0?"mobile-swipe-close-active":""} ${Ba?"mobile-swipe-close-closing":""}`,style:{"--terminal-height":`${R}%`,"--mobile-swipe-close-offset":`${On}px`,"--guake-side-panel-width":`${V}px`,...U>0?{"--guake-mobile-overview-height":`${U}px`}:{}},onDragEnter:vo,onDragOver:Na,onDragLeave:Fl,onDrop:zl,children:[o.jsxs("div",{className:"guake-drop-overlay",children:[o.jsx("div",{className:"drop-border"}),o.jsx("span",{className:"drop-icon",children:"📎"}),o.jsx("span",{className:"drop-label",children:n("terminal:input.dropToAttach")})]}),!h&&we&&Et&&k&&o.jsx(x6,{agentId:k,onClose:()=>$e(!1)}),!h&&Ue&&Et&&k&&o.jsx(M6,{agentId:k,agents:s,onClose:()=>ot(!1),branchInfoMap:O,fetchRemote:T,fetchingDirs:M}),!h&&ce&&Et&&k&&o.jsx(W5,{agentId:k,onClose:()=>ae(!1)}),!h&&Se&&Et&&k&&o.jsx(G5,{agentId:k,onClose:()=>ge(!1)}),!h&&(we||Ue||ce||Se)&&Et&&o.jsx("div",{className:"guake-side-panel-resize right",onMouseDown:ne=>K(ne,"right")}),!h&&oe&&Et&&k&&o.jsx(K6,{activeAgentId:k,onClose:()=>Le(!1),onSelectAgent:ne=>{H.setLastSelectionViaDirectClick(!0),H.selectAgent(ne)},agentListRef:q,twoFingerState:en}),!h&&oe&&Et&&k&&o.jsx("div",{className:"guake-side-panel-resize left",onMouseDown:ne=>K(ne,"left")}),!h&&oe&&Et&&k&&o.jsx("div",{className:"aop-resize-handle",onMouseDown:L,onTouchStart:z}),o.jsxs("div",{className:"guake-content",children:[o.jsx(l6,{selectedAgent:A,selectedAgentId:k,sortedAgents:me.sortedAgents,swipeOffset:me.swipeOffset,viewMode:be,setViewMode:ue,searchMode:((wo=Q.current)==null?void 0:wo.search.searchMode)??!1,toggleSearch:((Hl=Q.current)==null?void 0:Hl.search.toggleSearch)??(()=>{}),closeSearch:((Wr=Q.current)==null?void 0:Wr.search.closeSearch)??(()=>{}),debugPanelOpen:we,setDebugPanelOpen:$e,debuggerEnabled:ie,setDebuggerEnabled:fe,gitPanelOpen:Ue,setGitPanelOpen:ot,buildingsPanelOpen:ce,setBuildingsPanelOpen:ae,workflowPanelOpen:Se,setWorkflowPanelOpen:ge,hasWorkflow:Re,overviewPanelOpen:oe,setOverviewPanelOpen:Le,agentInfoOpen:Ve,onToggleAgentInfo:ws,isFullscreen:Z,onToggleFullscreen:xo,onNavigateBack:oa,onNavigateForward:os,canNavigateBack:ia,canNavigateForward:Ur,outputsLength:((ca=Q.current)==null?void 0:ca.outputsLength)??0,setContextConfirm:X,headerRef:me.headerRef,onSaveSnapshot:h?void 0:e,isSnapshotView:h}),o.jsxs("div",{className:`guake-swipe-container ${me.swipeAnimationClass}`,style:me.swipeOffset!==0?{transform:`translateX(${me.swipeOffset*40}%)`}:void 0,children:[me.sortedAgents.length>1&&me.swipeOffset!==0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`swipe-indicator left ${me.swipeOffset>.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-icon",children:"←"}),o.jsx("span",{className:"indicator-name",children:(ko=me.nextAgent)==null?void 0:ko.name})]}),o.jsxs("div",{className:`swipe-indicator right ${me.swipeOffset<-.3?"visible":""}`,children:[o.jsx("span",{className:"indicator-name",children:(qr=me.prevAgent)==null?void 0:qr.name}),o.jsx("span",{className:"indicator-icon",children:"→"})]})]}),me.sortedAgents.length>1&&me.sortedAgents.length<=8&&me.swipeOffset!==0&&o.jsx("div",{className:`swipe-dots ${Math.abs(me.swipeOffset)>.1?"visible":""}`,children:me.sortedAgents.map((ne,Te)=>o.jsx("div",{className:`swipe-dot ${Te===me.currentAgentIndex?"active":""}`},ne.id))}),o.jsx(H5,{activeAgentId:k,activeAgent:A,paneRef:Q,viewMode:be,isOpen:Et,isSnapshotView:h,currentSnapshot:f,onImageClick:Pn,onFileClick:zt,onBashClick:jt,onViewMarkdown:jn,keyboard:W,onSaveSnapshot:h?void 0:e,canSwipeClose:Bl&&i==="terminal"&&!((Ta=Q.current)!=null&&Ta.search.searchMode)&&!((So=Q.current)!=null&&So.historyLoader.fetchingHistory),onSwipeCloseOffsetChange:Fu,onSwipeClose:Bp,hasModalOpen:!!(Ce||Ne||se||c)})]}),o.jsxs("div",{className:"guake-agent-status-bar",children:[!h&&(A==null?void 0:A.isDetached)&&o.jsx(Jn,{content:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"tide-tooltip__title",children:["🔄 ",n("terminal:empty.reattachingSessionTitle")]}),o.jsxs("div",{className:"tide-tooltip__text",children:[n("terminal:empty.reattachingSessionDesc"),o.jsx("br",{}),o.jsx("br",{}),o.jsxs("strong",{children:[n("common:labels.status"),":"]})," ",n("terminal:empty.reattachingSessionStatus")]})]}),position:"top",className:"tide-tooltip--detached",children:o.jsxs("span",{className:"guake-detached-badge",title:n("terminal:empty.reattachingBadge"),children:[o.jsx("span",{className:"guake-detached-spinner",children:"🔄"})," ",n("terminal:empty.reattaching")]})}),(A==null?void 0:A.cwd)&&o.jsxs("span",{className:"guake-agent-cwd",title:A.cwd,children:["📁 ",A.cwd.split("/").filter(Boolean).slice(-2).join("/")||A.cwd]}),E&&E.map(({areaId:ne,areaName:Te,dir:ye})=>{const Ie=O.get(ye),mt=M.has(ye);return o.jsxs("span",{className:"guake-agent-area-dir",title:`${Te}: ${ye}${Ie?` (${Ie.branch}${Ie.ahead?` ↑${Ie.ahead}`:""}${Ie.behind?` ↓${Ie.behind}`:""})`:""}`,onClick:()=>H.openFileExplorerForAreaFolder(ne,ye),children:["📂 ",ye.split("/").filter(Boolean).pop()||ye,Ie&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"guake-agent-area-branch",children:[" ⎇ ",Ie.branch]}),Ie.ahead>0&&o.jsxs("span",{className:"guake-branch-ahead",title:`${Ie.ahead} ahead`,children:["↑",Ie.ahead]}),Ie.behind>0&&o.jsxs("span",{className:"guake-branch-behind",title:`${Ie.behind} behind`,children:["↓",Ie.behind]}),o.jsx("span",{className:`guake-area-fetch-btn ${mt?"fetching":""}`,title:"Git fetch",onClick:Mt=>{Mt.stopPropagation(),T(ye)},children:mt?"⏳":"⇣"})]})]},`${ne}:${ye}`)}),!h&&A&&(()=>{const ne=A.contextStats,Te=!!ne,ye=ne?ne.totalTokens:A.contextUsed||0,Ie=ne?ne.contextWindow:A.contextLimit||2e5,mt=ne?ne.usedPercent:Math.round(ye/Ie*100),Mt=Math.max(0,Math.min(100,mt)),fn=Math.max(0,100-Mt),rn=Mt>=80?"#ff4a4a":Mt>=60?"#ff9e4a":Mt>=40?"#ffd700":"#4aff9e",$n=(ye/1e3).toFixed(1),ls=(Ie/1e3).toFixed(1);return o.jsxs("span",{className:"guake-agent-context",onClick:()=>H.setContextModalAgentId(k),title:n(Te?"terminal:context.clickToViewStats":"terminal:context.clickToFetchStats"),children:[o.jsx("span",{className:"context-icon",children:"📊"}),o.jsxs("span",{className:"context-label",children:[n("terminal:agentInfo.context"),":"]}),o.jsx("span",{className:"context-bar-mini",children:o.jsx("span",{className:"context-bar-mini-fill",style:{width:`${Math.min(100,Mt)}%`,backgroundColor:rn}})}),o.jsxs("span",{className:"context-tokens",style:{color:rn},children:[$n,"k/",ls,"k"]}),o.jsxs("span",{className:"context-free",children:["(",n("terminal:context.percentFree",{percent:fn}),")"]}),!Te&&o.jsx("span",{className:"context-warning",title:n("terminal:context.clickToFetchStats"),children:"⚠️"})]})})(),o.jsxs("span",{className:"guake-status-right",children:[D.length>0&&o.jsx("span",{className:"guake-status-terminals",children:D.map(ne=>{const Te=$t.has(ne.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Te?"active":""} ${ne.hasUrl?"":"offline"}`,title:`${Te?"Hide":"Show"} terminal: ${ne.name}${ne.hasUrl?"":" (starting...)"}`,onClick:()=>{if(Te){const ye=te.find(Ie=>Ie.buildingId===ne.id);ye&&cn(ye.id)}else ne.hasUrl||H.sendBuildingCommand(ne.id,"start"),ft(ne.id,"terminal")},onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),$t.has(ne.id)||nt({position:{x:ye.clientX,y:ye.clientY},buildingId:ne.id,type:"terminal"})},children:"💻"},ne.id)})}),_.length>0&&o.jsx("span",{className:"guake-status-terminals",children:_.map(ne=>{const Te=$t.has(ne.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Te?"active":""}`,title:`${Te?"Hide":"Show"} logs: ${ne.name}`,onClick:()=>{if(Te){const ye=te.find(Ie=>Ie.buildingId===ne.id);ye&&cn(ye.id)}else ft(ne.id,"pm2-logs")},onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),$t.has(ne.id)||nt({position:{x:ye.clientX,y:ye.clientY},buildingId:ne.id,type:"pm2-logs"})},children:"📜"},ne.id)})}),B.length>0&&o.jsx("span",{className:"guake-status-terminals",children:B.map(ne=>{const Te=$t.has(ne.id);return o.jsx("button",{className:`guake-status-terminal-btn ${Te?"active":""}`,title:`${Te?"Hide":"Show"} database: ${ne.name}`,onClick:()=>{if(Te){const ye=te.find(Ie=>Ie.buildingId===ne.id);ye&&cn(ye.id)}else ft(ne.id,"database")},onContextMenu:ye=>{ye.preventDefault(),ye.stopPropagation(),$t.has(ne.id)||nt({position:{x:ye.clientX,y:ye.clientY},buildingId:ne.id,type:"database"})},children:"🗄️"},ne.id)})}),o.jsx(Z5,{})]})]}),(()=>{const ne=[];return We&&(ne.push({id:"open",label:"Open",icon:"⬇",onClick:()=>ft(We.buildingId,We.type)}),Ct.length>0&&(ne.push({id:"split-right",label:"Split Right",icon:"↔",onClick:()=>Ft(We.buildingId,We.type,"horizontal")}),ne.push({id:"split-below",label:"Split Below",icon:"↕",onClick:()=>Ft(We.buildingId,We.type,"vertical")}))),o.jsx(ir,{children:o.jsx(fo,{isOpen:We!==null,position:(We==null?void 0:We.position)||{x:0,y:0},worldPosition:{x:0,z:0},actions:ne,onClose:()=>nt(null)})})})(),Ct.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"guake-bottom-terminal-resize",onMouseDown:Ia}),o.jsx("div",{ref:_e,className:`guake-bottom-panels-container ${Ze}`,style:{height:et},onWheel:ne=>ne.stopPropagation(),children:Ct.map((ne,Te)=>{const ye=j.get(ne.buildingId);if(!ye)return null;const Ie=bt[Te]??1,mt=(()=>{var Mt;if(ne.type==="terminal")return(Mt=ye.terminalStatus)!=null&&Mt.url?o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ie},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",ye.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ne.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(Wb,{terminalUrl:ye.terminalStatus.url,visible:!0})]},ne.id):o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ie},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["💻 ",ye.name," (starting...)"]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ne.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx("div",{className:"guake-bottom-terminal-starting",children:o.jsx("span",{children:"Starting terminal..."})})]},ne.id);if(ne.type==="pm2-logs"){const fn=ke[ne.id]||"";return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ie},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["📜 ",ye.name]}),o.jsxs("div",{className:"guake-bottom-terminal-controls",children:[o.jsx("input",{type:"text",className:"guake-bottom-terminal-filter",value:fn,onChange:rn=>{const $n=rn.target.value;Be(ls=>{if(!$n.trim()){if(!(ne.id in ls))return ls;const Ss={...ls};return delete Ss[ne.id],Ss}return{...ls,[ne.id]:$n}})},placeholder:"Filter logs","aria-label":`Filter logs for ${ye.name}`,spellCheck:!1}),o.jsx("select",{className:"guake-bottom-terminal-retention",value:Ke===null?"unlimited":String(Ke),onChange:rn=>{const $n=rn.target.value==="unlimited"?null:Number(rn.target.value);ze($n),MO($n)},"aria-label":`Max log retention for ${ye.name}`,children:EO.map(rn=>o.jsx("option",{value:rn===null?"unlimited":String(rn),children:rn===null?"Unlimited":`${rn.toLocaleString()} lines`},rn===null?"unlimited":rn))}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>H.clearStreamingLogs(ne.buildingId),title:"Clear logs",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2M19 6l-1 14a2 2 0 01-2 2H8a2 2 0 01-2-2L5 6"})})}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>H.sendBuildingCommand(ne.buildingId,"restart"),title:"Restart",children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M1 4v6h6"}),o.jsx("path",{d:"M3.51 15a9 9 0 105.64-11.36L3 10"})]})}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ne.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),o.jsx(lW,{buildingId:ne.buildingId,filterText:fn,maxRetention:Ke})]},ne.id)}return o.jsxs("div",{className:"guake-bottom-panel",style:{flex:Ie},children:[o.jsxs("div",{className:"guake-bottom-terminal-header",children:[o.jsxs("span",{className:"guake-bottom-terminal-title",children:["🗄️ ",ye.name]}),o.jsx("button",{className:"guake-bottom-terminal-close",onClick:()=>cn(ne.id),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(OU,{building:ye})]},ne.id)})();return Te>0?o.jsxs(je.Fragment,{children:[o.jsx("div",{className:`guake-split-divider ${Ze}`,onMouseDown:Mt=>Dn(Mt,Te-1)}),mt]},ne.id):mt})})]}),te.filter(ne=>ne.areaId!==_t&&ne.type==="terminal").map(ne=>{var ye;const Te=j.get(ne.buildingId);return(ye=Te==null?void 0:Te.terminalStatus)!=null&&ye.url?o.jsx(Wb,{terminalUrl:Te.terminalStatus.url,visible:!1},ne.id):null})]}),Et&&!Z&&o.jsx("div",{className:"guake-resize-handle",onMouseDown:$,title:n("common:rightPanel.dragToResize")}),!(Et&&Z)&&o.jsxs("div",{className:"guake-handle",onClick:()=>{Et&&H.toggleTerminal()},onDoubleClick:()=>{Et||H.toggleTerminal()},style:{top:Et?`min(${R}%, calc(100vh - 72px))`:"0"},children:[o.jsx("span",{className:"guake-handle-icon",children:Et?"▲":"▼"}),o.jsx("span",{className:"guake-handle-text",children:A.name})]}),Ce&&o.jsx(d6,{url:Ce.url,name:Ce.name,onClose:()=>xe(null)}),Ne&&o.jsx(f6,{state:Ne,onClose:()=>qe(null)}),Ge&&o.jsx(p6,{action:Ge,selectedAgentId:k,subordinateCount:((_i=A==null?void 0:A.subordinateIds)==null?void 0:_i.length)||0,onClose:()=>X(null),onClearHistory:((Ul=Q.current)==null?void 0:Ul.historyLoader.clearHistory)??(()=>{})}),o.jsx(h6,{}),o.jsx(m6,{}),o.jsx(b6,{agent:A,isOpen:Ve,onClose:()=>at(!1)}),!h&&o.jsx(g6,{agent:A,content:se,onClose:()=>Ee(null)})]})});function uW(t){return t.trim().replace(/^v/i,"")}function jA(t){const n=uW(t).match(/^(\d+(?:\.\d+)*)(?:-([0-9A-Za-z.-]+))?/);if(!n)return null;const s=n[1].split(".").map(r=>Number.parseInt(r,10));if(s.some(Number.isNaN))return null;const a=n[2]?n[2].split("."):[];return{core:s,prerelease:a}}function dW(t,e){if(t.length===0&&e.length===0)return 0;if(t.length===0)return 1;if(e.length===0)return-1;const n=Math.max(t.length,e.length);for(let s=0;s<n;s+=1){const a=t[s],r=e[s];if(a===void 0)return-1;if(r===void 0)return 1;const i=/^\d+$/.test(a)?Number.parseInt(a,10):null,c=/^\d+$/.test(r)?Number.parseInt(r,10):null;if(i!==null&&c!==null){if(i>c)return 1;if(i<c)return-1;continue}if(i!==null)return-1;if(c!==null)return 1;const d=a.localeCompare(r);if(d!==0)return d>0?1:-1}return 0}function fW(t,e){const n=jA(t),s=jA(e);if(!n||!s)return null;const a=Math.max(n.core.length,s.core.length);for(let r=0;r<a;r+=1){const i=n.core[r]??0,c=s.core[r]??0;if(i>c)return 1;if(i<c)return-1}return dW(n.prerelease,s.prerelease)}function pW(t,e){const n=fW(t,e);return n===null?"unknown":n<0?"behind":n>0?"ahead":"equal"}async function hW(t,e={}){const{timeoutMs:n=5e3,fetchImpl:s=fetch}=e;try{const a=new AbortController,r=setTimeout(()=>a.abort(),n),i=Date.now(),c=await s(`https://registry.npmjs.org/${encodeURIComponent(t)}/latest?t=${i}`,{signal:a.signal,headers:{Accept:"application/json"}});if(clearTimeout(r),!c.ok)return null;const d=await c.json();return typeof d.version=="string"?d.version:null}catch{return null}}async function mW(t,e,n={}){const s=await hW(t,n);return s?{currentVersion:e,latestVersion:s,relation:pW(e,s)}:{currentVersion:e,latestVersion:null,relation:"unknown"}}const gW="tide-commander",Qg="1.41.0";function bW(){const[t,e]=b.useState({currentVersion:Qg,latestVersion:null,relation:"unknown",isChecking:!1}),n=b.useCallback(async()=>{e(a=>({...a,isChecking:!0}));const s=await mW(gW,Qg);e({currentVersion:Qg,latestVersion:s.latestVersion,relation:s.relation,isChecking:!1})},[]);return b.useEffect(()=>{n()},[n]),{...t,refresh:n}}const xW=b.memo(function({agent:e,currentIndex:n,agentIndex:s,isTouchInput:a,isTouchDragEnabled:r,isSelected:i,hasUnseenOutput:c,isDragging:d,isDragOver:f,customClasses:h,onDragStart:m,onDragEnd:x,onDragOver:y,onDragEnter:v,onDragLeave:S,onDrop:A,onAgentClick:k,onAgentDoubleClick:N,onTouchStart:j,onTouchMove:E,onTouchEnd:D,onTouchCancel:_,onHoverEnter:B,onHoverLeave:O,onItemRef:T}){const M=b.useMemo(()=>rr(e.class,h),[e.class,h]),R=!a||r,F=b.useCallback($=>{T(e.id,$)},[e.id,T]);return o.jsxs("div",{ref:F,className:`agent-bar-item ${i?"selected":""} ${e.status} ${e.isBoss?"is-boss":""} ${d?"dragging":""} ${f?"drag-over":""} ${r?"touch-drag-enabled":""}`,draggable:R,onDragStart:$=>m($,e),onDragEnd:x,onDragOver:$=>y($,s),onDragEnter:$=>v($,s),onDragLeave:S,onDrop:$=>A($,s),onTouchStart:$=>j($,e.id),onTouchMove:E,onTouchEnd:D,onTouchCancel:_,onClick:$=>k(e,$),onDoubleClick:()=>N(e),onMouseEnter:()=>B(e),onMouseLeave:O,title:a?`${e.name} (${n+1}) - Long press to reorder`:`${e.name} (${n+1}) - Drag to reorder within group`,children:[o.jsxs("div",{className:"agent-bar-avatar",children:[o.jsx("span",{className:"agent-bar-icon",children:M.icon}),o.jsx("span",{className:"agent-bar-status",style:{backgroundColor:Yb(e.status)}}),c&&o.jsx("span",{className:"agent-bar-notification-badge",title:"New output available - click to view"}),e.status==="idle"&&e.lastActivity>0&&o.jsx("span",{className:"agent-bar-idle-clock",style:{color:Gb(e.lastActivity)},title:Kb(e.lastActivity),children:"⏱"})]}),o.jsxs("span",{className:"agent-bar-hotkey",title:`Ctrl+${n+1}`,children:["^",n+1]})]})}),yW=b.memo(function({onFocusAgent:e,onSpawnClick:n,onSpawnBossClick:s,onNewBuildingClick:a,onNewAreaClick:r}){const{t:i}=ht(["common"]),c=Ml(),d=sr(),f=ox(),h=qO(),m=lx(),x=Ir(),y=ar(),v=zj(),[S]=bj(),[A,k]=b.useState(!1);uj("AgentBar");const N=b.useRef(null),j=b.useRef(null),E=b.useRef(null),D=b.useRef(new Map);b.useEffect(()=>{{k(!1);return}},[x.experimental2DView]),b.useEffect(()=>{const ke=j.current;if(!ke)return;const Be=Ke=>{ke.scrollWidth<=ke.clientWidth||(Ke.preventDefault(),Math.abs(Ke.deltaX)>Math.abs(Ke.deltaY)?ke.scrollLeft+=Ke.deltaX:ke.scrollLeft+=Ke.deltaY)};return ke.addEventListener("wheel",Be,{passive:!1}),()=>ke.removeEventListener("wheel",Be)},[]);const[_,B]=b.useState(null),[O,T]=b.useState(new Map),[M,R]=b.useState(null),[F,$]=b.useState(null),U=b.useRef(0),[L,z]=b.useState(null),W=b.useRef(null),V=b.useRef(null),Y=b.useRef(null),P=b.useRef(null),K=350,Q=8,q=b.useMemo(()=>typeof window>"u"?!1:"ontouchstart"in window||window.matchMedia("(pointer: coarse)").matches,[]),be=b.useMemo(()=>Array.from(c.values()).filter(ke=>{if(H.isAgentInArchivedArea(ke.id))return!1;if(S){const Be=H.getAreaForAgent(ke.id);if(!ax((Be==null?void 0:Be.id)??null))return!1}return!0}).sort((ke,Be)=>(ke.createdAt||0)-(Be.createdAt||0)),[c,d,S]),{orderedAgents:ue,moveAgent:Z}=mO(be),de=ue,Ce=b.useMemo(()=>{const ke=new Map;for(const Be of de)ke.set(Be.id,H.getAreaForAgent(Be.id));return ke},[de,d]),xe=b.useMemo(()=>{const ke=new Map;for(const Ke of de){const ze=Ce.get(Ke.id)||null,Ze=(ze==null?void 0:ze.id)||null;ke.has(Ze)||ke.set(Ze,{area:ze,agents:[]}),ke.get(Ze).agents.push(Ke)}const Be=Array.from(ke.values());return Be.sort((Ke,ze)=>{var Ze,lt;return!Ke.area&&ze.area?1:Ke.area&&!ze.area?-1:!Ke.area&&!ze.area?0:(((Ze=Ke.area)==null?void 0:Ze.name)||"").localeCompare(((lt=ze.area)==null?void 0:lt.name)||"")}),Be},[de,Ce]),Ne=b.useRef(e);Ne.current=e;const qe=b.useRef(M);qe.current=M;const Ge=b.useRef(de);Ge.current=de;const X=b.useRef(Ce);X.current=Ce;const se=b.useRef(Z);se.current=Z,b.useEffect(()=>{const ke=new Map(O);let Be=!1;for(const Ke of de){const ze=O.get(Ke.id);Ke.currentTool?(!ze||ze.tool!==Ke.currentTool)&&(ke.set(Ke.id,{tool:Ke.currentTool,key:Date.now()}),Be=!0):ze&&setTimeout(()=>{T(Ze=>{const lt=new Map(Ze);return lt.delete(Ke.id),lt})},1500)}Be&&T(ke)},[de.map(ke=>ke.currentTool).join(",")]),b.useEffect(()=>{const ke=h;if(!ke)return;const Be=D.current.get(ke),Ke=j.current;Be&&Ke&&requestAnimationFrame(()=>{const ze=Be.getBoundingClientRect(),Ze=Ke.getBoundingClientRect(),et=ze.left-Ze.left+Ke.scrollLeft+ze.width/2,ct=Ke.clientWidth;Ke.scrollTo({left:et-ct/2,behavior:"smooth"})})},[h]);const Ee=b.useCallback((ke,Be)=>{if(Y.current===ke.id){Y.current=null,Be.preventDefault(),Be.stopPropagation();return}H.setLastSelectionViaDirectClick(!0),Be.shiftKey?H.addToSelection(ke.id):H.selectAgent(ke.id),H.setTerminalOpen(!0)},[]),Ve=b.useCallback(ke=>{var Be;(Be=Ne.current)==null||Be.call(Ne,ke.id),H.setTerminalOpen(!0)},[]),at=b.useCallback(()=>B(null),[]),we=b.useCallback((ke,Be)=>{Be?D.current.set(ke,Be):D.current.delete(ke)},[]),$e=b.useCallback((ke,Be)=>{R(Be),z(Be.id),ke.dataTransfer.effectAllowed="move",ke.dataTransfer.setData("text/plain",Be.id),requestAnimationFrame(()=>{ke.target.classList.add("dragging")})},[]),ie=b.useCallback(ke=>{R(null),$(null),z(null),U.current=0,ke.target.classList.remove("dragging")},[]),fe=b.useCallback((ke,Be)=>{ke.preventDefault();const Ke=qe.current;if(Ke){const ze=X.current.get(Ke.id),Ze=Ge.current[Be],lt=Ze?X.current.get(Ze.id):null,et=(ze==null?void 0:ze.id)??null,ct=(lt==null?void 0:lt.id)??null;ke.dataTransfer.dropEffect=et===ct?"move":"none"}else ke.dataTransfer.dropEffect="move"},[]),Ue=b.useCallback((ke,Be)=>{ke.preventDefault(),U.current++;const Ke=qe.current;if(Ke){const ze=X.current.get(Ke.id),Ze=Ge.current[Be],lt=Ze?X.current.get(Ze.id):null,et=(ze==null?void 0:ze.id)??null,ct=(lt==null?void 0:lt.id)??null;$(et===ct?Be:null)}else $(Be)},[]),it=b.useCallback(ke=>{U.current--,U.current===0&&$(null)},[]),ot=b.useCallback((ke,Be)=>{ke.preventDefault();const Ke=qe.current;if(!Ke)return;const ze=Ge.current,Ze=X.current,lt=ze.findIndex(et=>et.id===Ke.id);if(lt!==-1&<!==Be){const et=Ze.get(Ke.id),ct=ze[Be],st=ct?Ze.get(ct.id):null,bt=(et==null?void 0:et.id)??null,Tt=(st==null?void 0:st.id)??null;bt===Tt&&se.current(lt,Be)}R(null),$(null),z(null),U.current=0},[]),ce=b.useCallback(()=>{W.current&&(clearTimeout(W.current),W.current=null)},[]),J=b.useCallback(()=>{P.current&&(clearTimeout(P.current),P.current=null)},[]),ae=b.useCallback((ke,Be)=>{if(!q||ke.touches.length!==1)return;ce(),J(),z(null);const Ke=ke.touches[0];V.current={agentId:Be,x:Ke.clientX,y:Ke.clientY},W.current=setTimeout(()=>{z(Be),Y.current=Be,W.current=null},K)},[ce,J,q]),Se=b.useCallback(ke=>{if(!q||ke.touches.length!==1)return;const Be=V.current;if(!Be||!W.current)return;const Ke=ke.touches[0],ze=Ke.clientX-Be.x,Ze=Ke.clientY-Be.y;Math.sqrt(ze*ze+Ze*Ze)>Q&&(ce(),V.current=null)},[ce,q]),ee=b.useCallback(()=>{ce(),V.current=null,qe.current||z(null),J(),P.current=setTimeout(()=>{Y.current=null,P.current=null},450)},[ce,J]);b.useEffect(()=>()=>{ce(),J()},[ce,J]);const ge=ke=>{const Be=`common:status.${ke}`;return i(Be,{defaultValue:i("common:status.unknown")})},{currentVersion:Re,latestVersion:Fe,relation:oe,isChecking:Le}=bW(),te=Re;let pe=0;return o.jsxs("div",{className:"agent-bar",ref:N,children:[o.jsxs("div",{className:"agent-bar-scroll",ref:j,children:[o.jsxs("div",{className:"agent-bar-version",title:Fe?`Tide Commander v${te} (npm: v${Fe})`:`Tide Commander v${te}`,children:[o.jsxs("span",{children:["v",te]}),oe==="behind"&&Fe?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-behind",title:`Behind npm latest v${Fe}`,children:["npm v",Fe]}):oe==="ahead"&&Fe?o.jsxs("span",{className:"agent-bar-version-badge agent-bar-version-badge-ahead",title:`Ahead of npm latest v${Fe}`,children:["npm v",Fe]}):null,oe==="behind"?o.jsx("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"agent-bar-version-status agent-bar-version-status-behind",title:i("common:agentBar.behindNpmTooltip",{defaultValue:"Current version is behind npm latest"}),children:i("common:agentBar.behindNpm",{defaultValue:"(behind npm)"})}):oe==="ahead"?o.jsx("span",{className:"agent-bar-version-status agent-bar-version-status-ahead",title:i("common:agentBar.aheadNpmTooltip",{defaultValue:"Current version is newer than npm latest"}),children:i("common:agentBar.aheadNpm",{defaultValue:"(ahead of npm)"})}):oe==="equal"?o.jsx("a",{href:"https://github.com/deivid11/tide-commander/releases",target:"_blank",rel:"noopener noreferrer",className:"agent-bar-version-status",children:i("common:agentBar.updated")}):Le?o.jsx("span",{className:"agent-bar-version-status",children:i("common:agentBar.checkingNpm",{defaultValue:"(checking npm)"})}):o.jsx("span",{className:"agent-bar-version-status",children:i("common:agentBar.unknownNpm",{defaultValue:"(npm unknown)"})}),A&&o.jsx(Jn,{content:"Refresh 3D Scene (HMR changes pending)",position:"bottom",children:o.jsx("button",{className:"agent-bar-hmr-refresh",onClick:kj,children:"↻"})})]}),o.jsxs("div",{className:"agent-bar-list",ref:E,children:[o.jsx(Jn,{content:i("common:agentBar.spawnNewAgent"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn",onClick:n,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"+"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newAgent")})]})}),o.jsx(Jn,{content:i("common:agentBar.spawnBoss"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-boss-btn",onClick:s,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"👑"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newBoss")})]})}),o.jsx(Jn,{content:i("common:agentBar.addNewBuilding"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-building-btn",onClick:a,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"🏢"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newBuilding")})]})}),o.jsx(Jn,{content:i("common:agentBar.drawNewArea"),position:"bottom",children:o.jsxs("button",{className:"agent-bar-spawn-btn agent-bar-area-btn",onClick:r,children:[o.jsx("span",{className:"agent-bar-spawn-icon",children:"🔲"}),o.jsx("span",{className:"agent-bar-spawn-label",children:i("common:agentBar.newArea")})]})}),xe.map(ke=>{var ze,Ze,lt,et,ct;const Be=ke.agents,Ke=!ke.area;return o.jsxs("div",{className:`agent-bar-group ${Ke?"unassigned":""}`,style:{borderColor:((ze=ke.area)==null?void 0:ze.color)||void 0,background:ke.area?`${ke.area.color}15`:void 0},children:[o.jsx("div",{className:"agent-bar-area-label",children:o.jsx("span",{className:"agent-bar-area-name",style:{color:((Ze=ke.area)==null?void 0:Ze.color)||"#888"},children:((lt=ke.area)==null?void 0:lt.name)||i("common:agentBar.unassigned")})}),((et=ke.area)==null?void 0:et.directories)&&ke.area.directories.length>0&&o.jsx("div",{className:"agent-bar-folders",children:ke.area.directories.map((st,bt)=>o.jsxs("div",{className:"agent-bar-folder-item",onClick:Tt=>{Tt.stopPropagation(),H.openFileExplorer(st)},children:[o.jsx("span",{className:"agent-bar-folder-icon",children:"📁"}),o.jsxs("div",{className:"agent-bar-folder-tooltip",children:[o.jsx("div",{className:"agent-bar-folder-tooltip-path",children:st}),o.jsx("div",{className:"agent-bar-folder-tooltip-hint",children:i("common:agentBar.clickToOpen")})]})]},bt))}),Be.map(st=>{const bt=pe++,Tt=de.findIndex(he=>he.id===st.id);return o.jsx(xW,{agent:st,currentIndex:bt,agentIndex:Tt,isTouchInput:q,isTouchDragEnabled:L===st.id,isSelected:f.has(st.id),hasUnseenOutput:v.has(st.id),isDragging:(M==null?void 0:M.id)===st.id,isDragOver:F===Tt,customClasses:y,onDragStart:$e,onDragEnd:ie,onDragOver:fe,onDragEnter:Ue,onDragLeave:it,onDrop:ot,onAgentClick:Ee,onAgentDoubleClick:Ve,onTouchStart:ae,onTouchMove:Se,onTouchEnd:ee,onTouchCancel:ee,onHoverEnter:B,onHoverLeave:at,onItemRef:we},st.id)})]},((ct=ke.area)==null?void 0:ct.id)||"unassigned")})]})]}),Array.from(O.entries()).map(([ke,Be])=>{const Ke=D.current.get(ke);if(!Ke)return null;const ze=Ke.getBoundingClientRect(),Ze=is[Be.tool]||is.default;return o.jsxs("div",{className:"agent-bar-tool-bubble",title:Be.tool,style:{position:"fixed",left:ze.left+ze.width/2,bottom:window.innerHeight-ze.top+8},children:[o.jsx("span",{className:"agent-bar-tool-icon",children:Ze}),o.jsx("span",{className:"agent-bar-tool-name",children:Be.tool})]},`tool-${ke}-${Be.key}`)}),_&&(()=>{const ke=H.getAreaForAgent(_.id),Be=m.get(_.id),Ke=rr(_.class,y),ze=H.getAgentSupervisorHistory(_.id),Ze=ze.length>0?ze[ze.length-1]:void 0,lt=Date.now()-(_.createdAt||Date.now()),et=Math.floor(lt/6e4),ct=Math.floor(et/60),st=ct>0?`${ct}h ${et%60}m`:`${et}m`,bt=nt=>nt>=1e6?`${(nt/1e6).toFixed(1)}M`:nt>=1e3?`${(nt/1e3).toFixed(1)}K`:nt.toString(),Tt=_.contextLimit>0?Math.round(_.contextUsed/_.contextLimit*100):0,he=nt=>{switch(nt){case"on_track":return"#4aff9e";case"completed":return"#4a9eff";case"stalled":return"#ff9e4a";case"blocked":return"#ff4a4a";case"idle":return"#888888";default:return"#888888"}},_e=D.current.get(_.id),We={};if(_e){const nt=_e.getBoundingClientRect();We.position="fixed",We.left=nt.left+nt.width/2,We.bottom=window.innerHeight-nt.top+12}return o.jsxs("div",{className:"agent-bar-tooltip",style:We,children:[o.jsxs("div",{className:"agent-bar-tooltip-header",children:[o.jsx("span",{className:"agent-bar-tooltip-icon",children:Ke.icon}),o.jsxs("span",{className:"agent-bar-tooltip-name",children:[o.jsx("img",{src:_.provider==="codex"?"/assets/codex.png":_.provider==="opencode"?"/assets/opencode.png":"/assets/claude.png",alt:_.provider,className:"agent-bar-provider-icon",title:_.provider==="codex"?"Codex Agent":_.provider==="opencode"?"OpenCode Agent":"Claude Agent"}),_.name]}),o.jsx("span",{className:"agent-bar-tooltip-status",style:{color:Yb(_.status)},children:ge(_.status)})]}),o.jsxs("div",{className:"agent-bar-tooltip-info",children:[o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.class"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[_.class," — ",Ke.description]})]}),ke&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.area"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-area",style:{color:ke.color},children:ke.name})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.directory"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-path",children:_.cwd})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.uptime"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",children:st})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.tokens"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[bt(_.tokensUsed)," ",i("common:agentPopup.used")]})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.context"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",style:{color:Tt>80?"#ff4a4a":Tt>60?"#ff9e4a":void 0},children:[bt(_.contextUsed)," / ",bt(_.contextLimit)," (",Tt,"%)"]})]}),_.currentTool&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.tool"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:[is[_.currentTool]||is.default," ",_.currentTool]})]}),_.taskLabel&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsx("span",{className:"agent-bar-tooltip-label",children:"📋 Task:"}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:_.taskLabel})]}),_.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.task"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[_.currentTask.substring(0,150),_.currentTask.length>150?"...":""]})]}),_.lastAssignedTask&&!_.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.assignedTask"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[_.lastAssignedTask.substring(0,200),_.lastAssignedTask.length>200?"...":""]})]}),Be&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.lastQuery"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[Be.text.substring(0,300),Be.text.length>300?"...":""]})]}),Ze&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"agent-bar-tooltip-divider"}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:agentPopup.supervisor"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",style:{color:he(Ze.analysis.progress)},children:Ze.analysis.progress.replace("_"," ")})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.status"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:Ze.analysis.statusDescription})]}),Ze.analysis.recentWorkSummary&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.summary"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:[Ze.analysis.recentWorkSummary.substring(0,300),Ze.analysis.recentWorkSummary.length>300?"...":""]})]}),Ze.analysis.concerns&&Ze.analysis.concerns.length>0&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[i("common:labels.concerns"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-concerns",children:Ze.analysis.concerns.join("; ")})]})]})]})]})})()]})});function vW({activeTool:t,onExit:e}){const{t:n}=ht(["notifications","terminal"]);if(!t||t==="select")return null;const s=n(t==="rectangle"?"notifications:drawing.rectangleTool":"notifications:drawing.circleTool"),a=t==="rectangle"?"▭":"○";return o.jsxs("div",{className:"drawing-mode-indicator",children:[o.jsxs("div",{className:"drawing-mode-content",children:[o.jsx("span",{className:"drawing-mode-icon",children:a}),o.jsxs("div",{className:"drawing-mode-text",children:[o.jsxs("span",{className:"drawing-mode-title",children:[n("terminal:drawingMode.drawingArea"),": ",s]}),o.jsxs("span",{className:"drawing-mode-hint",children:[n("terminal:drawingMode.clickAndDrag")," • ",n("terminal:drawingMode.pressEscape")]})]})]}),o.jsx("button",{className:"drawing-mode-exit",onClick:e,title:n("terminal:drawingMode.exitDrawingMode"),children:"✕"})]})}const wW={idle:"common:status.idle",working:"common:status.working",waiting:"common:status.waiting",error:"common:status.error",offline:"common:status.offline"},Xg=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString(),kW=t=>{switch(t){case"on_track":return"#4aff9e";case"completed":return"#4a9eff";case"stalled":return"#ff9e4a";case"blocked":return"#ff4a4a";case"idle":return"#888888";default:return"#888888"}},SW=b.memo(function({agent:e,screenPos:n,onClose:s}){const{t:a}=ht(["common"]),r=ar(),i=H.getAreaForAgent(e.id),c=H.getState().lastPrompts.get(e.id),d=rr(e.class,r),f=H.getAgentSupervisorHistory(e.id),h=f.length>0?f[f.length-1]:void 0,m=Date.now()-(e.createdAt||Date.now()),x=Math.floor(m/6e4),y=Math.floor(x/60),v=y>0?`${y}h ${x%60}m`:`${x}m`,S=e.contextLimit>0?Math.round(e.contextUsed/e.contextLimit*100):0,A=b.useMemo(()=>{let j=n.x-150,E=n.y-320-10;return typeof window<"u"&&(j<10?j=10:j+300>window.innerWidth-10&&(j=window.innerWidth-300-10),E<10&&(E=n.y+10)),{position:"fixed",left:j,top:E,zIndex:1e4,maxWidth:300,maxHeight:320,fontSize:"0.85em"}},[n.x,n.y]);return o.jsxs("div",{className:"agent-hover-popup",style:A,onMouseLeave:s,children:[o.jsxs("div",{className:"agent-bar-tooltip-header",children:[o.jsx("span",{className:"agent-bar-tooltip-icon",children:d.icon}),o.jsx("span",{className:"agent-bar-tooltip-name",children:e.name}),o.jsx("span",{className:"agent-bar-tooltip-status",style:{color:Yb(e.status)},children:a(wW[e.status]||"common:status.unknown")})]}),o.jsxs("div",{className:"agent-bar-tooltip-info",children:[o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.class"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[e.class," — ",d.description]})]}),i&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.area"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-area",style:{color:i.color},children:i.name})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.directory"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-path",children:e.cwd})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.uptime"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",children:v})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.tokens"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[Xg(e.tokensUsed)," ",a("common:agentPopup.used")]})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.context"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",style:{color:S>80?"#ff4a4a":S>60?"#ff9e4a":void 0},children:[Xg(e.contextUsed)," / ",Xg(e.contextLimit)," (",S,"%)"]})]}),e.currentTool&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.tool"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-tool",children:[is[e.currentTool]||is.default," ",e.currentTool]})]}),e.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.task"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value",children:[e.currentTask.substring(0,150),e.currentTask.length>150?"...":""]})]}),e.lastAssignedTask&&!e.currentTask&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.assignedTask"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[e.lastAssignedTask.substring(0,200),e.lastAssignedTask.length>200?"...":""]})]}),c&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.lastQuery"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-query",children:[c.text.substring(0,300),c.text.length>300?"...":""]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"agent-bar-tooltip-divider"}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:agentPopup.supervisor"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value",style:{color:kW(h.analysis.progress)},children:h.analysis.progress.replace("_"," ")})]}),o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.status"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:h.analysis.statusDescription})]}),h.analysis.recentWorkSummary&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.summary"),":"]}),o.jsxs("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-supervisor",children:[h.analysis.recentWorkSummary.substring(0,300),h.analysis.recentWorkSummary.length>300?"...":""]})]}),h.analysis.concerns&&h.analysis.concerns.length>0&&o.jsxs("div",{className:"agent-bar-tooltip-row",children:[o.jsxs("span",{className:"agent-bar-tooltip-label",children:[a("common:labels.concerns"),":"]}),o.jsx("span",{className:"agent-bar-tooltip-value agent-bar-tooltip-concerns",children:h.analysis.concerns.join("; ")})]})]})]})]})});function NA(t){if(t===0)return"0 B";const e=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,s)).toFixed(1))+" "+n[s]}function TA(t){const n=Date.now()-t,s=Math.floor(n/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return s>0?`${s}h ${a}m`:`${a}m`}const _A={30:"#1a1a1a",31:"#e74c3c",32:"#2ecc71",33:"#f39c12",34:"#3498db",35:"#9b59b6",36:"#00bcd4",37:"#ecf0f1",90:"#7f8c8d",91:"#ff6b6b",92:"#4ade80",93:"#fbbf24",94:"#60a5fa",95:"#c084fc",96:"#22d3ee",97:"#ffffff"};function CW(t){const e=[],n=/\x1B\[([0-9;]*)m/g;let s=0,a=null,r;for(;(r=n.exec(t))!==null;){if(r.index>s){const c=t.slice(s,r.index);a?e.push(o.jsx("span",{style:{color:a},children:c},e.length)):e.push(c)}const i=r[1].split(";").map(Number);for(const c of i)c===0||c===39?a=null:_A[c]&&(a=_A[c]);s=n.lastIndex}if(s<t.length){const i=t.slice(s);a?e.push(o.jsx("span",{style:{color:a},children:i},e.length)):e.push(i)}return e.length>0?e:[t]}const AW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){var z,W,V,Y,P,K,Q,q,be,ue,Z,de,Ce,xe,Ne,qe,Ge,X,se,Ee;const{t:c}=ht(["terminal","common"]),[d,f]=b.useState(!1),[h,m]=b.useState(null),[x,y]=b.useState(!1),v=b.useRef(null),S=b.useRef(h);S.current=h;const{buildingLogs:A}=Ts(),k=H.getBuildingLogs(e.id),N=(z=e.pm2)==null?void 0:z.enabled,j=(W=e.docker)==null?void 0:W.enabled,E=b.useRef(null),D=b.useRef(null),_=b.useCallback(Ve=>{Ve.preventDefault();const at=S.current?S.current.x:0,we=S.current?S.current.y:0;v.current={mouseX:Ve.clientX,mouseY:Ve.clientY,popupX:at,popupY:we},y(!0),E.current=$e=>{if(!v.current)return;const ie=$e.clientX-v.current.mouseX,fe=$e.clientY-v.current.mouseY;m({x:v.current.popupX+ie,y:v.current.popupY+fe})},D.current=()=>{y(!1),v.current=null,E.current&&document.removeEventListener("mousemove",E.current),D.current&&document.removeEventListener("mouseup",D.current)},document.addEventListener("mousemove",E.current),document.addEventListener("mouseup",D.current)},[]);b.useEffect(()=>()=>{E.current&&document.removeEventListener("mousemove",E.current),D.current&&document.removeEventListener("mouseup",D.current)},[]);const B=Ve=>{if(Ve==="logs"){if((N||j)&&r){r();return}H.sendBuildingCommand(e.id,Ve),f(!0)}else H.sendBuildingCommand(e.id,Ve)},O=(Ve,at)=>{if(Ve){const we=`http://localhost:${Ve}`;at&&i?i(we):window.open(we,"_blank")}},T=((V=e.pm2Status)==null?void 0:V.ports)||[],M=((P=(Y=e.dockerStatus)==null?void 0:Y.ports)==null?void 0:P.map(Ve=>Ve.host))||[],R=N?T:j?M:[],F=N?!!((K=e.pm2)!=null&&K.script):j?!!((Q=e.docker)!=null&&Q.image)||((q=e.docker)==null?void 0:q.mode)==="compose"||((be=e.docker)==null?void 0:be.mode)==="existing":!!((ue=e.commands)!=null&&ue.start),$=N?!!((Z=e.pm2)!=null&&Z.script):j?!0:!!((de=e.commands)!=null&&de.stop),U=N?!!((Ce=e.pm2)!=null&&Ce.script):j?!0:!!((xe=e.commands)!=null&&xe.restart),L=b.useMemo(()=>{const at=d?400:250;let we=n.x+20,$e=n.y-80;return typeof window<"u"&&!h&&(n.x+20+280>window.innerWidth&&(we=n.x-280-20),n.y-80<0?$e=10:n.y-80+at>window.innerHeight&&($e=window.innerHeight-at-10)),{position:"fixed",left:we+((h==null?void 0:h.x)||0),top:$e+((h==null?void 0:h.y)||0),zIndex:1e3,cursor:x?"grabbing":void 0}},[n.x,n.y,d,h,x]);return o.jsxs("div",{className:"building-action-popup",style:L,onClick:Ve=>Ve.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header ${x?"dragging":""}`,onMouseDown:_,children:[o.jsx("span",{className:"building-popup-name",children:e.name}),R.length>0&&o.jsx("span",{className:"building-popup-ports",children:R.map(Ve=>o.jsxs("a",{href:`http://localhost:${Ve}`,className:"building-popup-port-link",onClick:at=>{at.preventDefault(),at.stopPropagation(),O(Ve,at.altKey)},onMouseDown:at=>at.stopPropagation(),title:`Open http://localhost:${Ve} (Alt+Click for modal)`,children:[":",Ve]},Ve))}),o.jsx("span",{className:"building-popup-status",style:{backgroundColor:ub[e.status]},children:e.status}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),N&&e.pm2Status&&o.jsxs("div",{className:"building-popup-metrics",children:[o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"PID"}),o.jsx("span",{className:"value",children:e.pm2Status.pid||"-"})]}),o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"CPU"}),o.jsxs("span",{className:"value",children:[((Ne=e.pm2Status.cpu)==null?void 0:Ne.toFixed(1))||"0","%"]})]}),o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"MEM"}),o.jsx("span",{className:"value",children:NA(e.pm2Status.memory||0)})]}),e.pm2Status.restarts!==void 0&&e.pm2Status.restarts>0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"RST"}),o.jsx("span",{className:"value",children:e.pm2Status.restarts})]}),e.pm2Status.uptime&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"UP"}),o.jsx("span",{className:"value",children:TA(e.pm2Status.uptime)})]})]}),j&&e.dockerStatus&&o.jsxs("div",{className:"building-popup-metrics",children:[o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"ID"}),o.jsx("span",{className:"value",children:e.dockerStatus.containerId||"-"})]}),e.dockerStatus.cpu!==void 0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"CPU"}),o.jsxs("span",{className:"value",children:[e.dockerStatus.cpu.toFixed(1),"%"]})]}),e.dockerStatus.memory!==void 0&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"MEM"}),o.jsx("span",{className:"value",children:NA(e.dockerStatus.memory)})]}),e.dockerStatus.health&&e.dockerStatus.health!=="none"&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"HEALTH"}),o.jsx("span",{className:"value",style:{color:e.dockerStatus.health==="healthy"?"#4ade80":e.dockerStatus.health==="unhealthy"?"#f87171":"#fbbf24"},children:e.dockerStatus.health==="healthy"?"✓":e.dockerStatus.health==="unhealthy"?"✗":"..."})]}),e.dockerStatus.startedAt&&o.jsxs("span",{className:"metric",children:[o.jsx("span",{className:"label",children:"UP"}),o.jsx("span",{className:"value",children:TA(e.dockerStatus.startedAt)})]})]}),j&&((qe=e.dockerStatus)==null?void 0:qe.services)&&e.dockerStatus.services.length>0&&o.jsx("div",{className:"building-popup-services",children:e.dockerStatus.services.map((Ve,at)=>o.jsxs("span",{className:"service-item",title:`${Ve.name}: ${Ve.status}`,children:[o.jsx("span",{className:"service-indicator",style:{backgroundColor:Ve.status==="running"?"#4ade80":"#f87171"}}),o.jsx("span",{className:"service-name",children:Ve.name})]},at))}),(e.lastError||N&&((Ge=e.pm2Status)==null?void 0:Ge.status)==="errored"||j&&((X=e.dockerStatus)==null?void 0:X.status)==="dead")&&o.jsxs("div",{className:"building-popup-error",children:[e.lastError||c("terminal:building.processFailedToStart"),N&&((se=e.pm2Status)==null?void 0:se.restarts)&&e.pm2Status.restarts>5&&o.jsxs("span",{className:"error-hint",children:[" - ",c("terminal:building.checkLogsOrConfig")]}),j&&((Ee=e.dockerStatus)==null?void 0:Ee.health)==="unhealthy"&&o.jsxs("span",{className:"error-hint",children:[" - ",c("terminal:building.healthCheckFailing")]})]}),o.jsxs("div",{className:"building-popup-actions",children:[o.jsxs("button",{className:"action-btn start",onClick:()=>B("start"),disabled:!F||e.status==="running"||e.status==="starting",title:c(F?"terminal:buildingAction.start":"terminal:buildingAction.noStartCommand"),children:[o.jsx("span",{className:"icon",children:"▶"}),c("terminal:buildingAction.start")]}),o.jsxs("button",{className:"action-btn stop",onClick:()=>B("stop"),disabled:!$||e.status==="stopped"||e.status==="stopping",title:c($?"terminal:buildingAction.stop":"terminal:buildingAction.noStopCommand"),children:[o.jsx("span",{className:"icon",children:"■"}),c("terminal:buildingAction.stop")]}),o.jsxs("button",{className:"action-btn restart",onClick:()=>B("restart"),disabled:!U,title:c(U?"terminal:buildingAction.restart":"terminal:buildingAction.noRestartCommand"),children:[o.jsx("span",{className:"icon",children:"↺"}),c("terminal:buildingAction.restart")]}),o.jsxs("button",{className:"action-btn logs",onClick:()=>B("logs"),title:c("terminal:buildingAction.viewLogs"),children:[o.jsx("span",{className:"icon",children:"📄"}),c("terminal:logs.title")]}),R.length===1&&o.jsxs("button",{className:"action-btn open-url",onClick:Ve=>O(R[0],Ve.altKey),title:`Open http://localhost:${R[0]} (Alt+Click for modal)`,children:[o.jsx("span",{className:"icon",children:"🔗"}),c("terminal:buildingAction.openInBrowser")]}),R.length>1&&o.jsxs("div",{className:"action-btn-group",children:[o.jsxs("span",{className:"action-btn-label",children:[c("terminal:buildingAction.openInBrowser"),":"]}),R.map(Ve=>o.jsxs("button",{className:"action-btn open-url port-btn",onClick:at=>O(Ve,at.altKey),title:`Open http://localhost:${Ve} (Alt+Click for modal)`,children:[":",Ve]},Ve))]})]}),d&&k.length>0&&o.jsxs("div",{className:"building-popup-logs",children:[o.jsxs("div",{className:"logs-header",children:[o.jsx("span",{children:c("terminal:logs.title")}),o.jsx("button",{onClick:()=>H.clearBuildingLogs(e.id),children:c("terminal:logs.clear")})]}),o.jsx("div",{className:"logs-content",children:k.slice(-50).map((Ve,at)=>o.jsx("pre",{children:CW(Ve)},at))})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:c("terminal:buildingAction.fullSettings")})]})});function jW(t){if(t===0)return"0 B";const e=1024,n=["B","KB","MB","GB"],s=Math.floor(Math.log(t)/Math.log(e));return parseFloat((t/Math.pow(e,s)).toFixed(1))+" "+n[s]}function NW(t){const n=Date.now()-t,s=Math.floor(n/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return s>0?`${s}h ${a}m`:`${a}m`}const TW=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenLogsModal:r,onOpenUrlInModal:i}){const{t:c}=ht(["terminal","common"]),[d,f]=b.useState(null),[h,m]=b.useState(!1),x=b.useRef(null),y=b.useRef(d);y.current=d;const{buildings:v}=Ts(),A=(e.subordinateBuildingIds||[]).map(T=>v.get(T)).filter(T=>T!==void 0),k=b.useRef(null),N=b.useRef(null),j=b.useCallback(T=>{T.preventDefault();const M=y.current?y.current.x:0,R=y.current?y.current.y:0;x.current={mouseX:T.clientX,mouseY:T.clientY,popupX:M,popupY:R},m(!0),k.current=F=>{if(!x.current)return;const $=F.clientX-x.current.mouseX,U=F.clientY-x.current.mouseY;f({x:x.current.popupX+$,y:x.current.popupY+U})},N.current=()=>{m(!1),x.current=null,k.current&&document.removeEventListener("mousemove",k.current),N.current&&document.removeEventListener("mouseup",N.current)},document.addEventListener("mousemove",k.current),document.addEventListener("mouseup",N.current)},[]);b.useEffect(()=>()=>{k.current&&document.removeEventListener("mousemove",k.current),N.current&&document.removeEventListener("mouseup",N.current)},[]);const E=T=>{H.sendBossBuildingCommand(e.id,T)},D=A.reduce((T,M)=>(T[M.status]=(T[M.status]||0)+1,T),{}),_=A.some(T=>{var M;return(M=T.pm2)==null?void 0:M.enabled}),B=(T,M)=>{const R=`http://localhost:${T}`;M&&i?i(R):window.open(R,"_blank")},O=b.useMemo(()=>{let R=n.x+20,F=n.y-80;return typeof window<"u"&&!d&&(n.x+20+340>window.innerWidth&&(R=n.x-340-20),n.y-80<0?F=10:n.y-80+350>window.innerHeight&&(F=window.innerHeight-350-10)),{position:"fixed",left:R+((d==null?void 0:d.x)||0),top:F+((d==null?void 0:d.y)||0),zIndex:1e3,cursor:h?"grabbing":void 0}},[n.x,n.y,d,h]);return o.jsxs("div",{className:"building-action-popup boss-building-popup",style:O,onClick:T=>T.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header boss-header ${h?"dragging":""}`,onMouseDown:j,children:[o.jsx("span",{className:"boss-icon",children:"👑"}),o.jsx("span",{className:"building-popup-name",children:e.name}),o.jsx("span",{className:"subordinate-count",children:c("terminal:building.unitsCount",{count:A.length})}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),o.jsxs("div",{className:"boss-status-overview",children:[Object.entries(D).map(([T,M])=>o.jsxs("span",{className:"status-badge",style:{backgroundColor:ub[T]||"#666"},children:[M," ",T]},T)),A.length===0&&o.jsx("span",{className:"no-subordinates",children:c("terminal:building.noSubordinates")})]}),A.length>0&&o.jsx("div",{className:"subordinate-list",children:A.map(T=>{var M,R,F;return o.jsxs("div",{className:"subordinate-item",children:[o.jsx("span",{className:"sub-status-dot",style:{backgroundColor:ub[T.status]}}),o.jsx("span",{className:"sub-name",children:T.name}),((M=T.pm2Status)==null?void 0:M.ports)&&T.pm2Status.ports.length>0&&o.jsx("span",{className:"sub-port",children:T.pm2Status.ports.map($=>o.jsxs("a",{href:`http://localhost:${$}`,className:"building-popup-port-link",onClick:U=>{U.preventDefault(),U.stopPropagation(),B($,U.altKey)},title:`Open http://localhost:${$} (Alt+Click for modal)`,children:[":",$]},$))}),T.pm2Status&&o.jsxs("span",{className:"sub-metrics",children:[(R=T.pm2Status.cpu)==null?void 0:R.toFixed(0),"% | ",jW(T.pm2Status.memory||0)]}),((F=T.pm2Status)==null?void 0:F.uptime)&&o.jsx("span",{className:"sub-uptime",children:NW(T.pm2Status.uptime)})]},T.id)})}),o.jsxs("div",{className:"building-popup-actions boss-actions",children:[o.jsxs("button",{className:"action-btn start",onClick:()=>E("start_all"),disabled:A.length===0,title:c("terminal:building.startAllSubs"),children:[o.jsx("span",{className:"icon",children:"▶"}),c("terminal:building.startAll")]}),o.jsxs("button",{className:"action-btn stop",onClick:()=>E("stop_all"),disabled:A.length===0,title:c("terminal:building.stopAllSubs"),children:[o.jsx("span",{className:"icon",children:"■"}),c("terminal:building.stopAll")]}),o.jsxs("button",{className:"action-btn restart",onClick:()=>E("restart_all"),disabled:A.length===0,title:c("terminal:building.restartAllSubs"),children:[o.jsx("span",{className:"icon",children:"↺"}),c("terminal:building.restartAll")]}),_&&o.jsxs("button",{className:"action-btn logs",onClick:r,title:c("terminal:building.viewUnifiedLogs"),children:[o.jsx("span",{className:"icon",children:"📄"}),c("terminal:building.logs")]})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:c("terminal:building.fullSettings")})]})}),_W=b.memo(function({building:e,screenPos:n,onClose:s,onOpenSettings:a,onOpenDatabasePanel:r}){var D;const{t:i}=ht(["terminal","common"]),[c,d]=b.useState(null),[f,h]=b.useState(!1),m=b.useRef(null),x=b.useRef(c);x.current=c;const y=px(e.id),v=((D=e.database)==null?void 0:D.connections)??[],S=b.useRef(null),A=b.useRef(null),k=b.useCallback(_=>{_.preventDefault();const B=x.current?x.current.x:0,O=x.current?x.current.y:0;m.current={mouseX:_.clientX,mouseY:_.clientY,popupX:B,popupY:O},h(!0),S.current=T=>{if(!m.current)return;const M=T.clientX-m.current.mouseX,R=T.clientY-m.current.mouseY;d({x:m.current.popupX+M,y:m.current.popupY+R})},A.current=()=>{h(!1),m.current=null,S.current&&document.removeEventListener("mousemove",S.current),A.current&&document.removeEventListener("mouseup",A.current)},document.addEventListener("mousemove",S.current),document.addEventListener("mouseup",A.current)},[]);b.useEffect(()=>()=>{S.current&&document.removeEventListener("mousemove",S.current),A.current&&document.removeEventListener("mouseup",A.current)},[]);const N=_=>{H.testDatabaseConnection(e.id,_)},j=_=>y.connectionStatus.get(_),E=b.useMemo(()=>{let O=n.x+20,T=n.y-80;return typeof window<"u"&&!c&&(n.x+20+320>window.innerWidth&&(O=n.x-320-20),n.y-80<0?T=10:n.y-80+300>window.innerHeight&&(T=window.innerHeight-300-10)),{position:"fixed",left:O+((c==null?void 0:c.x)||0),top:T+((c==null?void 0:c.y)||0),zIndex:1e3,cursor:f?"grabbing":void 0}},[n.x,n.y,c,f]);return o.jsxs("div",{className:"building-action-popup database-building-popup",style:E,onClick:_=>_.stopPropagation(),children:[o.jsxs("div",{className:`building-popup-header database-header ${f?"dragging":""}`,onMouseDown:k,children:[o.jsx("span",{className:"database-icon",children:"🗄️"}),o.jsx("span",{className:"building-popup-name",children:e.name}),o.jsx("span",{className:"connection-count",children:i("terminal:building.connCount",{count:v.length})}),o.jsx("button",{className:"building-popup-close",onClick:s,children:"x"})]}),v.length>0?o.jsx("div",{className:"database-connection-list",children:v.map(_=>{var O;const B=j(_.id);return o.jsxs("div",{className:"database-connection-item",children:[o.jsx("span",{className:"conn-engine",children:((O=AL[_.engine])==null?void 0:O.icon)??"🗄️"}),o.jsx("span",{className:"conn-name",children:_.name}),o.jsx("span",{className:"conn-host",children:_.engine==="sqlite"?_.filepath||_.database||":memory:":`${_.host}:${_.port}`}),B&&o.jsx("span",{className:`conn-status ${B.connected?"connected":"disconnected"}`,children:B.connected?"●":"○"}),o.jsx("button",{className:"conn-test-btn",onClick:()=>N(_.id),title:i("terminal:building.testConnection"),children:"↻"})]},_.id)})}):o.jsxs("div",{className:"database-no-connections",children:[o.jsx("p",{children:i("terminal:building.noConnections")}),o.jsx("p",{className:"hint",children:i("terminal:building.clickSettingsToAdd")})]}),o.jsxs("div",{className:"building-popup-actions database-actions",children:[o.jsxs("button",{className:"action-btn query",onClick:r,disabled:v.length===0,title:i("terminal:building.openDbExplorer"),children:[o.jsx("span",{className:"icon",children:"⌨"}),i("terminal:building.query")]}),o.jsxs("button",{className:"action-btn test-all",onClick:()=>v.forEach(_=>N(_.id)),disabled:v.length===0,title:i("terminal:building.testAllConnections"),children:[o.jsx("span",{className:"icon",children:"↻"}),i("terminal:building.testAll")]})]}),o.jsx("button",{className:"building-popup-settings",onClick:a,children:i("common:buttons.settings")})]})});function EW({visible:t=!0,position:e="top-right"}){const[n,s]=b.useState(0),[a,r]=b.useState([]),[i,c]=b.useState(null),[d,f]=b.useState([]),[h,m]=b.useState(null),[x,y]=b.useState(null),[v,S]=b.useState(!1),[A,k]=b.useState("fps"),[N,j]=b.useState(null),[E,D]=b.useState(null),[_,B]=b.useState(null),[O,T]=b.useState(typeof window<"u"?window.innerWidth:1024),[M,R]=b.useState(null);b.useEffect(()=>{const Z=()=>T(window.innerWidth);return window.addEventListener("resize",Z),()=>window.removeEventListener("resize",Z)},[]);const F=xp(),$=b.useMemo(()=>{const Z=F.filter(Ce=>Ce.memoryUsageMB!==void 0&&Ce.memoryUsageMB>0);return{totalMB:Z.reduce((Ce,xe)=>Ce+(xe.memoryUsageMB||0),0),agentCount:Z.length,agents:Z.map(Ce=>({name:Ce.name,memoryMB:Ce.memoryUsageMB||0,status:Ce.status})).sort((Ce,xe)=>xe.memoryMB-Ce.memoryMB)}},[F]),U=b.useRef([]),L=b.useRef(null);if(b.useEffect(()=>{U.current=d},[d]),b.useEffect(()=>{L.current=h},[h]),b.useEffect(()=>{if(!t)return;const Z=async()=>{try{const Ce=await Pt(Ot("/api/perf"));if(Ce.ok){const xe=await Ce.json();D(xe)}}catch{}};Z();const de=setInterval(Z,v?3e3:1e4);return()=>clearInterval(de)},[t,v]),b.useEffect(()=>{if(!t)return;const Z=Oc.getUsage();Z&&M===null&&R(Z.usedMB);const de=setInterval(()=>{var at,we;Kd.update();const Ce=Kd.getStats();s(Ce.current),r($e=>[...$e,Ce.current].slice(-60));const xe=Oc.getUsage();xe&&c(xe);const Ne=window.__tideScene;if(Ne){const $e=(at=Ne.getMemoryDiagnostics)==null?void 0:at.call(Ne);$e!=null&&$e.threeJs&&m($e.threeJs);const ie=Ne.renderer;if((we=ie==null?void 0:ie.info)!=null&&we.memory){const fe=ie.info.memory.textures||0,Ue=Math.round(fe*1);B({count:fe,estimatedMB:Ue})}}const qe=document.getElementsByTagName("*"),Ge=document.getElementsByTagName("canvas"),X=document.getElementsByTagName("img"),se=document.getElementsByTagName("video");let Ee=0;for(let $e=0;$e<Math.min(qe.length,500);$e++){const ie=qe[$e];ie.onclick&&Ee++,ie.onmousedown&&Ee++,ie.onkeydown&&Ee++}Ee+=10,j({nodeCount:qe.length,listenerCount:Ee,canvasCount:Ge.length,imageCount:X.length,videoCount:se.length}),xe&&f($e=>{const ie=L.current,fe={timestamp:Date.now(),heapMB:xe.usedMB,geometries:(ie==null?void 0:ie.geometries)??0,textures:(ie==null?void 0:ie.textures)??0};return[...$e,fe].slice(-120)});const Ve=U.current;if(Ve.length>=10){const $e=Ve[0],ie=Ve[Ve.length-1],fe=(ie.timestamp-$e.timestamp)/1e3/60;fe>.1&&y((ie.heapMB-$e.heapMB)/fe)}},1e3);return()=>{clearInterval(de)}},[t,M]),!t)return null;const z=Z=>{const de=Math.floor(Z/3600),Ce=Math.floor(Z%3600/60),xe=Z%60;return de>0?`${de}h ${Ce}m`:Ce>0?`${Ce}m ${xe}s`:`${xe}s`},W=Z=>Z>=55?"#4aff9e":Z>=30?"#ffcc00":"#ff4a4a",V=(Z,de)=>{const Ce=Z/de;return Ce<.5?"#4aff9e":Ce<.8?"#ffcc00":"#ff4a4a"},Y=Z=>Z===null?"#888":Z<1?"#4aff9e":Z<5?"#ffcc00":"#ff4a4a",P=Kd.getStats(),Q=O<=768?80:10,q={"top-left":{top:10,left:10},"top-right":{top:10,right:10},"bottom-left":{bottom:Q,left:10},"bottom-right":{bottom:Q,right:10}},be=M&&i?i.usedMB-M:0,ue=Z=>({padding:"2px 8px",fontSize:"9px",border:"none",background:A===Z?"rgba(74, 158, 255, 0.4)":"rgba(255, 255, 255, 0.1)",color:A===Z?"#4a9eff":"#888",borderRadius:"3px",cursor:"pointer"});return o.jsxs("div",{style:{position:"fixed",...q[e],zIndex:99999,fontFamily:"monospace",fontSize:"11px",background:"rgba(0, 0, 0, 0.9)",border:"1px solid rgba(255, 255, 255, 0.2)",borderRadius:"4px",padding:"6px 10px",color:"#fff",userSelect:"none",minWidth:v?"260px":"120px",maxWidth:"calc(100vw - 20px)",maxHeight:v?"calc(100vh - 100px)":"auto",overflowY:v?"auto":"visible",transition:"all 0.2s ease"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},onClick:()=>S(!v),children:[o.jsx("span",{style:{color:W(n),fontWeight:"bold",fontSize:"14px"},children:n}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"FPS"}),i&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#444"},children:"|"}),o.jsx("span",{style:{color:V(i.usedMB,i.totalMB),fontWeight:"bold"},children:i.usedMB}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"MB"})]}),x!==null&&Math.abs(x)>.5&&o.jsxs("span",{style:{color:Y(x),fontSize:"10px",marginLeft:"4px"},children:[x>0?"+":"",x.toFixed(1),"/m"]}),E&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"#444"},children:"|"}),o.jsx("span",{style:{color:"#ff9e4a",fontWeight:"bold"},children:E.process.rssMB}),o.jsx("span",{style:{color:"#666",fontSize:"10px"},children:"SRV"})]}),o.jsx("span",{style:{color:"#444",marginLeft:"auto",fontSize:"10px"},children:v?"▼":"▶"})]}),v&&o.jsxs("div",{style:{marginTop:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"},children:[o.jsxs("div",{style:{display:"flex",gap:"4px",marginBottom:"8px",flexWrap:"wrap"},children:[o.jsx("button",{style:ue("fps"),onClick:()=>k("fps"),children:"FPS"}),o.jsx("button",{style:ue("memory"),onClick:()=>k("memory"),children:"Memory"}),o.jsx("button",{style:ue("threejs"),onClick:()=>k("threejs"),children:"3D"}),o.jsx("button",{style:ue("dom"),onClick:()=>k("dom"),children:"DOM"}),o.jsx("button",{style:ue("server"),onClick:()=>k("server"),children:"Server"}),o.jsx("button",{style:ue("http"),onClick:()=>k("http"),children:"HTTP"})]}),A==="fps"&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Current:"}),o.jsx("span",{style:{color:W(P.current)},children:P.current}),o.jsx("span",{style:{color:"#888"},children:"Min:"}),o.jsx("span",{style:{color:W(P.min)},children:P.min}),o.jsx("span",{style:{color:"#888"},children:"Max:"}),o.jsx("span",{style:{color:W(P.max)},children:P.max}),o.jsx("span",{style:{color:"#888"},children:"Avg:"}),o.jsx("span",{style:{color:W(P.avg)},children:P.avg})]}),o.jsxs("div",{style:{marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"60s History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"30px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:a.slice(-60).map((Z,de)=>o.jsx("div",{style:{width:"3px",height:`${Math.min(100,Z/60*100)}%`,background:W(Z),opacity:.8}},de))})]})]}),A==="memory"&&i&&o.jsxs("div",{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Used:"}),o.jsxs("span",{style:{color:V(i.usedMB,i.totalMB)},children:[i.usedMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Total:"}),o.jsxs("span",{children:[i.totalMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Limit:"}),o.jsxs("span",{children:[i.limitMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Baseline:"}),o.jsxs("span",{children:[M??"—"," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Growth:"}),o.jsxs("span",{style:{color:be>50?"#ff4a4a":be>20?"#ffcc00":"#4aff9e"},children:[be>0?"+":"",be," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Rate:"}),o.jsx("span",{style:{color:Y(x)},children:x!==null?`${x.toFixed(2)} MB/min`:"—"})]}),o.jsx("div",{style:{marginBottom:"8px"},children:o.jsx("div",{style:{height:"8px",background:"rgba(255,255,255,0.1)",borderRadius:"4px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${i.usedMB/i.limitMB*100}%`,background:V(i.usedMB,i.totalMB),transition:"width 0.3s ease"}})})}),d.length>1&&o.jsxs("div",{children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"Memory History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"40px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:d.slice(-60).map((Z,de)=>{const Ce=Math.min(...d.map(Ge=>Ge.heapMB)),Ne=Math.max(...d.map(Ge=>Ge.heapMB))-Ce||1,qe=(Z.heapMB-Ce)/Ne*100;return o.jsx("div",{style:{width:"3px",height:`${Math.max(5,qe)}%`,background:Z.heapMB>(M??0)+50?"#ff4a4a":"#4a9eff",opacity:.8},title:`${Z.heapMB}MB`},de)})})]}),$.agentCount>0&&o.jsxs("div",{style:{marginTop:"8px"},children:[o.jsxs("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:["Agent Memory (",$.agentCount,"):"]}),o.jsxs("div",{style:{fontSize:"10px"},children:[o.jsxs("div",{style:{color:"#4aff9e",fontWeight:"bold",marginBottom:"2px"},children:["Total: ",$.totalMB,"MB"]}),o.jsx("div",{style:{maxHeight:"50px",overflowY:"auto"},children:$.agents.slice(0,4).map((Z,de)=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:Z.status==="working"?"#4aff9e":"#666",maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:Z.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[Z.memoryMB,"MB"]})]},de))})]})]}),o.jsxs("div",{style:{marginTop:"8px",padding:"6px",background:"rgba(0,0,0,0.3)",borderRadius:"4px"},children:[o.jsx("div",{style:{color:"#888",fontSize:"9px",marginBottom:"4px"},children:"Memory Breakdown (estimated):"}),o.jsxs("div",{style:{fontSize:"9px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#4a9eff"},children:"JS Heap"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[i.usedMB," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#ff9e4a"},children:"GPU/Textures"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:["~",(_==null?void 0:_.estimatedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsxs("span",{style:{color:"#9e4aff"},children:["DOM (",(N==null?void 0:N.nodeCount.toLocaleString())??0," nodes)"]}),o.jsxs("span",{style:{color:"#9e4aff"},children:["~",Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"4px",marginTop:"4px"},children:[o.jsx("span",{style:{color:"#fff",fontWeight:"bold"},children:"Est. Total"}),o.jsxs("span",{style:{color:"#fff",fontWeight:"bold"},children:["~",i.usedMB+((_==null?void 0:_.estimatedMB)??0)+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)," MB"]})]})]})]})]}),A==="threejs"&&o.jsx("div",{children:h?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Geometries:"}),o.jsx("span",{style:{color:"#4aff9e"},children:h.geometries}),o.jsx("span",{style:{color:"#888"},children:"Textures:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:h.textures}),o.jsx("span",{style:{color:"#888"},children:"Programs:"}),o.jsx("span",{style:{color:"#9e4aff"},children:h.programs})]}),d.length>1&&o.jsxs("div",{children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"2px"},children:"Resource History:"}),o.jsx("div",{style:{display:"flex",alignItems:"flex-end",height:"40px",gap:"1px",background:"rgba(0,0,0,0.3)",padding:"2px",borderRadius:"2px"},children:d.slice(-60).map((Z,de)=>{const Ce=Math.max(...d.map(xe=>xe.textures))||1;return o.jsx("div",{style:{width:"3px",height:`${Z.textures/Ce*100}%`,background:"#ff9e4a",opacity:.8},title:`${Z.textures} textures`},de)})})]}),o.jsx("div",{style:{color:"#666",fontSize:"9px",marginTop:"8px"},children:"Tip: Watch textures count. If it keeps increasing, there's a leak."})]}):o.jsxs("div",{style:{color:"#666",fontSize:"10px"},children:["Three.js stats unavailable.",o.jsx("br",{}),"SceneManager not exposed."]})}),A==="dom"&&o.jsx("div",{children:N?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"DOM Nodes:"}),o.jsx("span",{style:{color:N.nodeCount>5e3?"#ff4a4a":N.nodeCount>2e3?"#ffcc00":"#4aff9e"},children:N.nodeCount.toLocaleString()}),o.jsx("span",{style:{color:"#888"},children:"Canvases:"}),o.jsx("span",{style:{color:"#4a9eff"},children:N.canvasCount}),o.jsx("span",{style:{color:"#888"},children:"Images:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:N.imageCount}),o.jsx("span",{style:{color:"#888"},children:"Videos:"}),o.jsx("span",{style:{color:"#9e4aff"},children:N.videoCount})]}),_&&o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsx("span",{style:{color:"#888"},children:"GPU Textures:"}),o.jsx("span",{style:{color:"#ff9e4a"},children:_.count}),o.jsx("span",{style:{color:"#888"},children:"Est. VRAM:"}),o.jsxs("span",{style:{color:_.estimatedMB>100?"#ff4a4a":"#4aff9e"},children:["~",_.estimatedMB," MB"]})]}),o.jsxs("div",{style:{marginTop:"8px",padding:"6px",background:"rgba(0,0,0,0.3)",borderRadius:"4px"},children:[o.jsx("div",{style:{color:"#888",fontSize:"9px",marginBottom:"4px"},children:"Memory Breakdown (estimated):"}),o.jsxs("div",{style:{fontSize:"9px"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#4a9eff"},children:"JS Heap"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[(i==null?void 0:i.usedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#ff9e4a"},children:"GPU/Textures"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:["~",(_==null?void 0:_.estimatedMB)??0," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[o.jsx("span",{style:{color:"#9e4aff"},children:"DOM (~0.5KB/node)"}),o.jsxs("span",{style:{color:"#9e4aff"},children:["~",Math.round(N.nodeCount*.5/1024)," MB"]})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"4px",marginTop:"4px"},children:[o.jsx("span",{style:{color:"#fff",fontWeight:"bold"},children:"Est. Total"}),o.jsxs("span",{style:{color:"#fff",fontWeight:"bold"},children:["~",((i==null?void 0:i.usedMB)??0)+((_==null?void 0:_.estimatedMB)??0)+Math.round(N.nodeCount*.5/1024)," MB"]})]})]})]}),o.jsx("div",{style:{color:"#666",fontSize:"9px",marginTop:"8px"},children:"Note: Task Manager shows more due to browser overhead, decoded images, and WebGL buffers."})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading DOM stats..."})}),A==="server"&&o.jsx("div",{children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Uptime:"}),o.jsx("span",{style:{color:"#4aff9e"},children:z(E.uptime)}),o.jsx("span",{style:{color:"#888"},children:"Heap Used:"}),o.jsxs("span",{style:{color:E.process.heapUsedMB>500?"#ff4a4a":"#4aff9e"},children:[E.process.heapUsedMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"Heap Total:"}),o.jsxs("span",{children:[E.process.heapTotalMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"RSS:"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[E.process.rssMB," MB"]}),o.jsx("span",{style:{color:"#888"},children:"External:"}),o.jsxs("span",{children:[E.process.externalMB," MB"]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px",marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"System:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"Load Avg:"}),o.jsx("span",{style:{color:E.system.loadAvg[0]>E.system.cpuCount?"#ff4a4a":"#4aff9e"},children:E.system.loadAvg.join(" ")}),o.jsx("span",{style:{color:"#888"},children:"CPUs:"}),o.jsx("span",{children:E.system.cpuCount}),o.jsx("span",{style:{color:"#888"},children:"Sys Memory:"}),o.jsxs("span",{children:[E.system.totalMemMB-E.system.freeMemMB," / ",E.system.totalMemMB," MB"]})]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px",marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"WebSocket:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"Clients:"}),o.jsx("span",{style:{color:"#4a9eff"},children:E.websocket.clients}),o.jsx("span",{style:{color:"#888"},children:"Sent:"}),o.jsx("span",{children:E.websocket.messagesSent.toLocaleString()}),o.jsx("span",{style:{color:"#888"},children:"Received:"}),o.jsx("span",{children:E.websocket.messagesReceived.toLocaleString()})]})]}),E.agents.total>0&&o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsxs("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:["Agents (",E.agents.working,"w / ",E.agents.idle,"i / ",E.agents.total,"t):"]}),o.jsx("div",{style:{maxHeight:"80px",overflowY:"auto",fontSize:"10px"},children:E.agents.processes.map(Z=>o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"1px"},children:[o.jsx("span",{style:{color:Z.status==="working"?"#4aff9e":Z.status==="idle"?"#888":"#ff4a4a",maxWidth:"100px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Z.name}),o.jsxs("span",{style:{color:"#4a9eff"},children:[Z.memoryMB!=null?`${Z.memoryMB}MB`:"—",Z.pid?` (${Z.pid})`:""]})]},Z.id))})]})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading server metrics..."})}),A==="http"&&o.jsx("div",{children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px",marginBottom:"8px"},children:[o.jsx("span",{style:{color:"#888"},children:"Req/sec (30s):"}),o.jsx("span",{style:{color:"#4aff9e"},children:E.http.reqPerSec}),o.jsx("span",{style:{color:"#888"},children:"Avg Latency:"}),o.jsxs("span",{style:{color:E.http.avgLatencyMs>100?"#ff4a4a":E.http.avgLatencyMs>50?"#ffcc00":"#4aff9e"},children:[E.http.avgLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Max Latency:"}),o.jsxs("span",{style:{color:E.http.maxLatencyMs>500?"#ff4a4a":E.http.maxLatencyMs>200?"#ffcc00":"#4aff9e"},children:[E.http.maxLatencyMs," ms"]}),o.jsx("span",{style:{color:"#888"},children:"Recent Reqs:"}),o.jsx("span",{children:E.http.recentRequests})]}),o.jsxs("div",{style:{marginBottom:"8px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"Avg Latency:"}),o.jsx("div",{style:{height:"8px",background:"rgba(255,255,255,0.1)",borderRadius:"4px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${Math.min(100,E.http.avgLatencyMs/500*100)}%`,background:E.http.avgLatencyMs>100?"#ff4a4a":E.http.avgLatencyMs>50?"#ffcc00":"#4aff9e",transition:"width 0.3s ease"}})}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"8px",color:"#444",marginTop:"2px"},children:[o.jsx("span",{children:"0ms"}),o.jsx("span",{children:"500ms"})]})]}),o.jsxs("div",{style:{borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"6px"},children:[o.jsx("div",{style:{color:"#666",fontSize:"9px",marginBottom:"4px"},children:"Server Process:"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"2px 10px",fontSize:"10px"},children:[o.jsx("span",{style:{color:"#888"},children:"CPU (user):"}),o.jsxs("span",{style:{color:"#4a9eff"},children:[E.process.cpuUser," ms"]}),o.jsx("span",{style:{color:"#888"},children:"CPU (system):"}),o.jsxs("span",{style:{color:"#ff9e4a"},children:[E.process.cpuSystem," ms"]}),o.jsx("span",{style:{color:"#888"},children:"WS Clients:"}),o.jsx("span",{style:{color:"#4aff9e"},children:E.websocket.clients})]})]})]}):o.jsx("div",{style:{color:"#666",fontSize:"10px"},children:"Loading HTTP metrics..."})}),o.jsxs("div",{style:{display:"flex",gap:"4px",marginTop:"8px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px",flexWrap:"wrap"},children:[o.jsx("button",{onClick:Z=>{Z.stopPropagation();const de=["=== Tide Commander Performance Stats ===",`Timestamp: ${new Date().toISOString()}`,"","--- FPS ---",`Current: ${P.current}`,`Min: ${P.min}`,`Max: ${P.max}`,`Avg: ${P.avg}`];i&&de.push("","--- Memory ---",`Heap Used: ${i.usedMB} MB`,`Heap Total: ${i.totalMB} MB`,`Heap Limit: ${i.limitMB} MB`,`Baseline: ${M??"N/A"} MB`,`Growth: ${be>0?"+":""}${be} MB`,`Growth Rate: ${x!==null?`${x.toFixed(2)} MB/min`:"N/A"}`),h&&de.push("","--- Three.js ---",`Geometries: ${h.geometries}`,`Textures: ${h.textures}`,`Programs: ${h.programs}`),$.agentCount>0&&(de.push("","--- Agent Memory ---",`Total: ${$.totalMB} MB`,`Agents: ${$.agentCount}`),$.agents.slice(0,5).forEach(xe=>{de.push(` ${xe.name}: ${xe.memoryMB} MB (${xe.status})`)})),N&&de.push("","--- DOM ---",`DOM Nodes: ${N.nodeCount.toLocaleString()}`,`Canvases: ${N.canvasCount}`,`Images: ${N.imageCount}`,`Videos: ${N.videoCount}`),_&&de.push("","--- Estimated Memory ---",`GPU Textures: ${_.count}`,`Est. VRAM: ~${_.estimatedMB} MB`,`Est. DOM: ~${Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)} MB`,`Est. Total: ~${((i==null?void 0:i.usedMB)??0)+_.estimatedMB+Math.round(((N==null?void 0:N.nodeCount)??0)*.5/1024)} MB`),E&&(de.push("","--- Server ---",`Uptime: ${z(E.uptime)}`,`Heap: ${E.process.heapUsedMB}/${E.process.heapTotalMB} MB`,`RSS: ${E.process.rssMB} MB`,`Load Avg: ${E.system.loadAvg.join(" ")}`,`System Memory: ${E.system.totalMemMB-E.system.freeMemMB}/${E.system.totalMemMB} MB`,"","--- WebSocket ---",`Clients: ${E.websocket.clients}`,`Sent: ${E.websocket.messagesSent}`,`Received: ${E.websocket.messagesReceived}`,"","--- HTTP ---",`Req/sec: ${E.http.reqPerSec}`,`Avg Latency: ${E.http.avgLatencyMs} ms`,`Max Latency: ${E.http.maxLatencyMs} ms`),E.agents.processes.length>0&&(de.push("","--- Agent Processes ---",`Total: ${E.agents.total} (${E.agents.working} working, ${E.agents.idle} idle)`),E.agents.processes.forEach(xe=>{de.push(` ${xe.name}: ${xe.memoryMB!=null?`${xe.memoryMB}MB`:"N/A"} (${xe.status})${xe.pid?` PID:${xe.pid}`:""}`)})));const Ce=de.join(`
|
|
153
|
+
`);navigator.clipboard.writeText(Ce).then(()=>{const xe=Z.currentTarget,Ne=xe.textContent;xe.textContent="Copied!",setTimeout(()=>{xe.textContent=Ne},1e3)})},style:{flex:1,background:"rgba(74, 255, 158, 0.3)",border:"1px solid rgba(74, 255, 158, 0.5)",color:"#4aff9e",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Copy Stats"}),o.jsx("button",{onClick:Z=>{Z.stopPropagation(),Oc.report();const de=window.__tideScene;de!=null&&de.logMemoryDiagnostics&&de.logMemoryDiagnostics()},style:{flex:1,background:"rgba(74, 158, 255, 0.3)",border:"1px solid rgba(74, 158, 255, 0.5)",color:"#4a9eff",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Console"}),o.jsx("button",{onClick:Z=>{Z.stopPropagation(),gb.clear(),Kd.reset(),Oc.reset(),r([]),f([]);const de=Oc.getUsage();de&&R(de.usedMB)},style:{flex:1,background:"rgba(255, 74, 74, 0.3)",border:"1px solid rgba(255, 74, 74, 0.5)",color:"#ff4a4a",padding:"4px 6px",borderRadius:"3px",fontSize:"9px",cursor:"pointer"},children:"Reset"})]})]})]})}function MW(){const t=Fj(),e=b.useCallback(n=>{H.setViewMode(n)},[]);return[t,e]}const DW=["3d","2d","dashboard"],RW=b.memo(function({className:e=""}){const{t:n}=ht(["common"]),[s,a]=MW(),r=b.useRef(null),[i,c]=b.useState(null);b.useLayoutEffect(()=>{const f=r.current;if(!f)return;const h=f.querySelector(".view-mode-toggle__btn--active");h&&c({left:h.offsetLeft,width:h.offsetWidth})},[s]);const d=b.useCallback(f=>{if(f!==s){if(typeof window<"u"&&window.dispatchEvent(new CustomEvent("tide:viewmode-switch-pressed",{detail:{mode:f}})),f==="3d"){requestAnimationFrame(()=>a(f));return}a(f)}},[s,a]);return o.jsxs("div",{className:`view-mode-toggle ${e}`,ref:r,children:[i&&o.jsx("div",{className:"view-mode-toggle__indicator",style:{left:i.left,width:i.width}}),DW.map(f=>o.jsxs("button",{className:`view-mode-toggle__btn ${s===f?"view-mode-toggle__btn--active":""}`,onClick:()=>d(f),title:n(`common:viewMode.descriptions.${f}`),children:[o.jsxs("span",{className:"view-mode-toggle__icon",children:[f==="2d"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]}),f==="3d"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),o.jsx("path",{d:"M2 17l10 5 10-5"}),o.jsx("path",{d:"M2 12l10 5 10-5"})]}),f==="dashboard"&&o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"7",height:"9",rx:"1"}),o.jsx("rect",{x:"14",y:"3",width:"7",height:"5",rx:"1"}),o.jsx("rect",{x:"14",y:"12",width:"7",height:"9",rx:"1"}),o.jsx("rect",{x:"3",y:"16",width:"7",height:"5",rx:"1"})]})]}),o.jsx("span",{className:"view-mode-toggle__label",children:n(`common:viewMode.labels.${f}`)})]},f))]})});function ET({className:t}){const{t:e}=ht(["terminal"]),[n,s]=b.useState(!1),[a,r]=b.useState(null),i=Jx(),c=b.useCallback(async y=>{if(y.trim()){console.log("[VoiceAssistant] Transcribed:",y),s(!0),r(null);try{const S=await(await Pt(Ot("/api/voice-assistant/process"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:y})})).json();if(S.success&&S.response)console.log("[VoiceAssistant] Response:",S.response),i.speak(S.response);else{const A=S.error||e("terminal:voiceAssistant.failedToProcess");console.error("[VoiceAssistant] Error:",A),r(A),i.speak(A)}}catch(v){console.error("[VoiceAssistant] Request failed:",v);const S=e("terminal:voiceAssistant.unavailable");r(S),i.speak(S)}finally{s(!1)}}},[i]),d=wT({language:"Spanish",model:"medium",onTranscription:c}),f=d.recording||d.transcribing||n||i.speaking,h=()=>d.error?`${e("terminal:voiceAssistant.error")}: ${d.error}`:a?`${e("terminal:voiceAssistant.error")}: ${a}`:d.recording?e("terminal:voiceAssistant.recording"):d.transcribing?e("terminal:voiceAssistant.transcribing"):n?e("terminal:voiceAssistant.processing"):i.speaking?e("terminal:voiceAssistant.speaking"):e("terminal:voiceAssistant.title"),m=()=>{const y=["voice-assistant-btn",t].filter(Boolean);return d.recording&&y.push("recording"),(d.transcribing||n)&&y.push("processing"),i.speaking&&y.push("speaking"),(a||d.error)&&y.push("error"),y.join(" ")},x=()=>{if(r(null),i.speaking){i.stop();return}d.transcribing||n||d.toggleRecording()};return o.jsxs("button",{className:m(),onClick:x,title:d.supported?h():e("terminal:voiceAssistant.notSupported"),disabled:!d.supported||d.transcribing||n,children:[d.recording?o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[o.jsx("path",{d:"M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"}),o.jsx("path",{d:"M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"})]}):i.speaking?o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",fill:"currentColor"}),o.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),o.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})]}):o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("path",{d:"M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"}),o.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),o.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),o.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),f&&o.jsx("span",{className:"voice-assistant-indicator"})]})}const OW=b.memo(function({isOpen:e,onToggle:n,onShowTerminal:s,onOpenSidebar:a,onOpenToolbox:r,onOpenCommander:i,onOpenSupervisor:c,onOpenControls:d,onOpenSkills:f,onOpenSnapshots:h,onTakeSnapshot:m,canTakeSnapshot:x,mobileView:y}){const{t:v}=ht(["terminal","common"]),S=Ir(),A=k=>{k(),n()};return o.jsxs(o.Fragment,{children:[S.experimentalVoiceAssistant&&o.jsx(ET,{className:"mobile-voice-assistant"}),y!=="terminal"&&o.jsx("button",{className:`mobile-fab-toggle ${e?"open":""}`,onClick:n,onTouchStart:k=>k.stopPropagation(),title:v(e?"terminal:mobileFab.closeMenu":"terminal:mobileFab.openMenu"),children:e?"✕":"☰"}),y==="3d"&&o.jsxs("div",{className:`mobile-fab-menu ${e?"open":""}`,children:[o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(s),onTouchEnd:k=>{k.preventDefault(),A(s)},title:v("terminal:mobileFab.showTerminal"),children:"💬"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(a),onTouchEnd:k=>{k.preventDefault(),A(a)},title:v("terminal:header.openSidebar"),children:"📋"}),x&&o.jsx("button",{className:"mobile-fab-option mobile-fab-option--highlight",onClick:()=>A(m),onTouchEnd:k=>{k.preventDefault(),A(m)},title:v("terminal:mobileFab.takeSnapshot"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(r),onTouchEnd:k=>{k.preventDefault(),A(r)},title:v("common:floatingButtons.settingsAndTools"),children:"⚙️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(i),onTouchEnd:k=>{k.preventDefault(),A(i)},title:v("common:floatingButtons.commanderView"),children:"📊"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(c),onTouchEnd:k=>{k.preventDefault(),A(c)},title:v("common:floatingButtons.supervisorOverview"),children:"🎖️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(d),onTouchEnd:k=>{k.preventDefault(),A(d)},title:v("common:floatingButtons.controls"),children:"⌨️"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(f),onTouchEnd:k=>{k.preventDefault(),A(f)},title:v("common:floatingButtons.manageSkills"),children:"⭐"}),o.jsx("button",{className:"mobile-fab-option",onClick:()=>A(h),onTouchEnd:k=>{k.preventDefault(),A(h)},title:v("common:floatingButtons.viewSnapshots"),children:"📸"})]})]})}),LW=b.memo(function({onOpenToolbox:e,onOpenCommander:n,onOpenSupervisor:s,onOpenControls:a,onOpenSkills:r,onOpenSnapshots:i,isGeneratingReport:c,pip:d}){const{t:f}=ht(["common","terminal"]),h=Ir();return o.jsxs(o.Fragment,{children:[h.experimentalVoiceAssistant&&o.jsx(ET,{}),o.jsx(Jn,{content:f("common:floatingButtons.settingsAndTools"),position:"left",children:o.jsx("button",{className:"floating-settings-btn",onClick:e,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("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"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.commanderView"),position:"left",children:o.jsx("button",{className:"commander-toggle-btn",onClick:n,children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),o.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),o.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),o.jsx("rect",{x:"14",y:"14",width:"7",height:"7"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.viewSnapshots"),position:"left",children:o.jsx("button",{className:"snapshots-toggle-btn",onClick:i,children:"📸"})}),o.jsx(Jn,{content:f(c?"terminal:supervisor.generating":"common:floatingButtons.supervisorOverview"),position:"left",children:o.jsxs("button",{className:`supervisor-toggle-btn ${c?"generating":""}`,onClick:s,children:["🎖️",c&&o.jsx("span",{className:"supervisor-generating-indicator"})]})}),o.jsx(Jn,{content:f("common:floatingButtons.controls"),position:"left",children:o.jsx("button",{className:"shortcuts-toggle-btn",onClick:a,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),o.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),o.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),o.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),o.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),o.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),o.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})})}),o.jsx(Jn,{content:f("common:floatingButtons.manageSkills"),position:"left",children:o.jsx("button",{className:"skills-toggle-btn",onClick:r,children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})})})}),o.jsx(Jn,{content:d.isSupported?d.isOpen?f("common:floatingButtons.closePip"):f("common:floatingButtons.openPip"):f("common:floatingButtons.pipNotSupported"),position:"left",disabled:!d.isSupported,children:o.jsx("button",{className:`pip-toggle-btn ${d.isOpen?"active":""}`,onClick:()=>d.isSupported&&d.toggle({width:320,height:400}),disabled:!d.isSupported,children:o.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o.jsx("rect",{x:"12",y:"9",width:"8",height:"6",rx:"1"})]})})})]})}),PW=je.lazy(()=>vt(()=>import("./SpawnModal-DbfTe3y2.js"),__vite__mapDeps([17,3,1,4])).then(t=>({default:t.SpawnModal}))),IW=je.lazy(()=>vt(()=>import("./BossSpawnModal-SPvzti1i.js"),__vite__mapDeps([18,3,1,4])).then(t=>({default:t.BossSpawnModal}))),BW=je.lazy(()=>vt(()=>import("./SubordinateAssignmentModal-DdANoM7g.js"),__vite__mapDeps([19,3,1,4])).then(t=>({default:t.SubordinateAssignmentModal}))),FW=je.lazy(()=>vt(()=>import("./index-dnQQyjiL.js"),__vite__mapDeps([20,3,1,4,21])).then(t=>({default:t.Toolbox}))),zW=je.lazy(()=>vt(()=>import("./index-Ez0uF12M.js"),__vite__mapDeps([22,3,1,4])).then(t=>({default:t.BuildingConfigModal}))),$W=je.lazy(()=>vt(()=>import("./index-DlFukYeW.js"),__vite__mapDeps([23,24,3,1,4])).then(t=>({default:t.CommanderView}))),HW=je.lazy(()=>vt(()=>import("./SupervisorPanel-CE7sMgHN.js"),__vite__mapDeps([25,3,1,4])).then(t=>({default:t.SupervisorPanel}))),UW=je.lazy(()=>vt(()=>import("./index-CvetF6vL.js").then(t=>t.y),[]).then(t=>({default:t.FileExplorerPanel}))),WW=je.lazy(()=>vt(()=>import("./index-B_0CIcus.js"),__vite__mapDeps([26,3,1,4])).then(t=>({default:t.Spotlight}))),qW=je.lazy(()=>vt(()=>import("./ControlsModal-A489_yUU.js"),__vite__mapDeps([27,3,1,4])).then(t=>({default:t.ControlsModal}))),VW=je.lazy(()=>vt(()=>import("./SkillsPanel-IE07LIWC.js"),__vite__mapDeps([28,3,1,4])).then(t=>({default:t.SkillsPanel}))),GW=je.lazy(()=>vt(()=>Promise.resolve().then(()=>N2),void 0).then(t=>({default:t.AgentEditModal}))),YW=je.lazy(()=>vt(()=>import("./SnapshotManager-Cs7fZ_aA.js"),__vite__mapDeps([29,3,1,4])).then(t=>({default:t.SnapshotManager}))),KW=je.lazy(()=>vt(()=>import("./RestoreArchivedAreaModal-BtuMbJVE.js"),__vite__mapDeps([30,3,1,4])).then(t=>({default:t.RestoreArchivedAreaModal}))),QW=je.lazy(()=>vt(()=>import("./IntegrationsPanel-D4rlShHL.js"),__vite__mapDeps([31,3,1,4])).then(t=>({default:t.IntegrationsPanel}))),XW=je.lazy(()=>vt(()=>import("./MonitoringModal-GCxQ22tf.js"),__vite__mapDeps([32,3,1,4])).then(t=>({default:t.MonitoringModal}))),JW=je.lazy(()=>vt(()=>import("./WorkflowEditorPanel-BM9nnUIT.js"),__vite__mapDeps([33,3,1,4])).then(t=>({default:t.WorkflowEditorPanel}))),ZW=je.lazy(()=>vt(()=>import("./TriggerManagerPanel-Cyb1Sf8s.js"),__vite__mapDeps([34,3,1,4])).then(t=>({default:t.TriggerManagerPanel})));function eq({spawnModal:t,bossSpawnModal:e,subordinateModal:n,toolboxModal:s,commanderModal:a,deleteConfirmModal:r,supervisorModal:i,spotlightModal:c,controlsModal:d,skillsModal:f,integrationsModal:h,monitoringModal:m,workflowEditorModal:x,triggerManagerModal:y,buildingModal:v,agentEditModal:S,snapshotsModal:A,restoreArchivedModal:k,explorerModal:N,contextMenu:j,spawnPosition:E,spawnAreaId:D,explorerFolderPath:_,contextMenuActions:B,buildingInitialPosition:O,sceneConfig:T,onConfigChange:M,onToolChange:R,onOpenAreaExplorer:F,onDeleteSelectedAgents:$,pendingBuildingDelete:U,onCancelBuildingDelete:L,onConfirmBuildingDelete:z,showBackNavModal:W,onCloseBackNavModal:V,onLeave:Y,onOpenPM2LogsModal:P,onOpenBossLogsModal:K,onOpenDatabasePanel:Q,onSyncScene:q}){const be=Ts(),ue=Array.from(be.snapshots.values()),Z=be.snapshotsLoading;be.currentSnapshot,b.useEffect(()=>{A.isOpen&&H.fetchSnapshots()},[A.isOpen]);const de=U==="selected",Ce=U&&U!=="selected"?be.buildings.get(U):null,xe=be.selectedBuildingIds.size;return o.jsxs(b.Suspense,{fallback:null,children:[o.jsx(FW,{config:T,onConfigChange:M,onToolChange:R,isOpen:s.isOpen,onClose:s.close,onOpenBuildingModal:Ne=>v.open(Ne||null),onOpenAreaExplorer:F,onOpenIntegrationsModal:Ne=>h.open(Ne),onOpenMonitoringModal:()=>m.open(),onOpenWorkflowEditor:()=>x.open(),onOpenTriggerManager:()=>y.open()}),o.jsx(zW,{isOpen:v.isOpen,onClose:v.close,buildingId:v.data,initialPosition:O||void 0}),o.jsx(PW,{isOpen:t.isOpen,onClose:t.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:E,spawnAreaId:D}),o.jsx(IW,{isOpen:e.isOpen,onClose:e.close,onSpawnStart:()=>{},onSpawnEnd:()=>{},spawnPosition:E}),o.jsx(BW,{isOpen:n.isOpen,bossId:n.data||"",onClose:n.close}),S.isOpen&&S.data&&(()=>{const Ne=be.agents.get(S.data);return Ne?o.jsx(GW,{agent:Ne,isOpen:S.isOpen,onClose:S.close}):null})(),r.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:r.close,onKeyDown:Ne=>{Ne.key==="Escape"&&r.close(),Ne.key==="Enter"&&$()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ne=>Ne.stopPropagation(),children:[o.jsx("div",{className:"modal-header",children:"Remove Agents"}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[o.jsxs("p",{children:["Remove ",be.selectedAgentIds.size," selected agent",be.selectedAgentIds.size>1?"s":""," from the battlefield?"]}),o.jsx("p",{className:"confirm-modal-note",children:"Claude Code sessions will continue running in the background."})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:r.close,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:$,autoFocus:!0,children:"Remove"})]})]})}),(Ce||de)&&o.jsx("div",{className:"modal-overlay visible",onClick:L,onKeyDown:Ne=>{Ne.key==="Escape"&&L(),Ne.key==="Enter"&&z()},children:o.jsxs("div",{className:"modal confirm-modal",onClick:Ne=>Ne.stopPropagation(),children:[o.jsxs("div",{className:"modal-header",children:["Delete Building",de&&xe>1?"s":""]}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[de?o.jsxs("p",{children:["Delete ",xe," selected building",xe>1?"s":"","?"]}):o.jsxs("p",{children:["Delete ",o.jsx("strong",{children:Ce==null?void 0:Ce.name}),"?"]}),o.jsxs("p",{className:"confirm-modal-note",children:["This will permanently remove the building",de&&xe>1?"s":""," and ",de&&xe>1?"their":"its"," configuration."]})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:L,children:"Cancel"}),o.jsx("button",{className:"btn btn-danger",onClick:z,autoFocus:!0,children:"Delete"})]})]})}),W&&o.jsx("div",{className:"modal-overlay navigation-confirm-overlay visible",onClick:V,onKeyDown:Ne=>{Ne.key==="Escape"&&V()},children:o.jsxs("div",{className:"modal confirm-modal navigation-confirm-modal",onClick:Ne=>Ne.stopPropagation(),children:[o.jsx("div",{className:"modal-header",children:"Leave Tide Commander?"}),o.jsxs("div",{className:"modal-body confirm-modal-body",children:[o.jsx("p",{children:"Are you sure you want to leave this page?"}),o.jsx("p",{className:"confirm-modal-note",children:"Active Claude Code sessions will continue running in the background."})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:V,autoFocus:!0,children:"Stay"}),o.jsx("button",{className:"btn btn-danger",onClick:Y,children:"Leave"})]})]})}),o.jsx(b.Profiler,{id:"CommanderView",onRender:Qc,children:o.jsx($W,{isOpen:a.isOpen,onClose:a.close})}),o.jsx(HW,{isOpen:i.isOpen,onClose:i.close}),o.jsx(UW,{isOpen:N.isOpen||_!==null||be.explorerAreaId!==null,areaId:N.id||be.explorerAreaId||null,folderPath:_,onChangeArea:Ne=>N.open(Ne),onClose:()=>{N.close(),H.closeFileExplorer()}}),o.jsx(WW,{isOpen:c.isOpen,onClose:c.close,onOpenSpawnModal:()=>t.open(),onOpenCommanderView:()=>a.open(),onOpenToolbox:()=>s.open(),onOpenSupervisor:()=>i.open(),onOpenFileExplorer:Ne=>N.open(Ne),onOpenPM2LogsModal:P,onOpenBossLogsModal:K,onOpenDatabasePanel:Q,onOpenMonitoringModal:()=>m.open()}),o.jsx(qW,{isOpen:d.isOpen,onClose:d.close}),o.jsx(VW,{isOpen:f.isOpen,onClose:f.close}),o.jsx(QW,{isOpen:h.isOpen,onClose:h.close,initialTab:h.data}),o.jsx(XW,{isOpen:m.isOpen,onClose:m.close}),o.jsx(JW,{isOpen:x.isOpen,onClose:x.close}),o.jsx(ZW,{isOpen:y.isOpen,onClose:y.close}),o.jsx(KW,{isOpen:k.isOpen,restorePosition:k.data??null,onClose:k.close,onRestored:q}),A.isOpen&&o.jsx("div",{className:"modal-overlay visible",onClick:A.close,children:o.jsx("div",{className:"modal snapshot-manager-modal",onClick:Ne=>Ne.stopPropagation(),children:o.jsx(YW,{snapshots:ue,isLoading:Z,onViewSnapshot:async Ne=>{await H.loadSnapshot(Ne),be.selectedAgentIds.clear(),H.setTerminalOpen(!0),A.close()},onDeleteSnapshot:async Ne=>{await H.deleteSnapshot(Ne),await H.fetchSnapshots()},onRestoreSnapshot:async Ne=>{await H.restoreFiles(Ne)},onExportSnapshot:async Ne=>{await H.loadSnapshot(Ne),A.close()},onClose:A.close})})}),o.jsx(fo,{isOpen:j.isOpen,position:j.screenPosition,worldPosition:j.worldPosition,actions:B,onClose:j.close})]})}function tq({pip:t,title:e="Tide Commander",children:n}){return b.useEffect(()=>{t.pipWindow&&e&&(t.pipWindow.document.title=e)},[t.pipWindow,e]),!t.isOpen||!t.pipContainer?null:Dl.createPortal(n,t.pipContainer)}function ey(t){switch(t){case"working":return"⚡";case"waiting":return"⏳";case"waiting_permission":return"🔐";case"error":return"❌";case"offline":return"💤";case"orphaned":return"👻";case"idle":default:return"●"}}function ty(t){switch(t){case"working":return"#4aff9e";case"waiting":return"#ff9e4a";case"waiting_permission":return"#ff4a9e";case"error":return"#ff4a4a";case"offline":return"#666";case"orphaned":return"#9e4aff";case"idle":default:return"#888"}}function ny(t){const e=lo[t.class];return(e==null?void 0:e.icon)||"🤖"}function Jg({agent:t,onClick:e}){const n=ty(t.status),s=ey(t.status),a=ny(t);return o.jsxs("div",{className:`pip-agent-card pip-status-${t.status}`,onClick:()=>e(t.id),title:"Click to view conversation",children:[o.jsxs("div",{className:"pip-agent-header",children:[o.jsx("span",{className:"pip-agent-icon",children:a}),o.jsx("span",{className:"pip-agent-name",children:t.name}),o.jsx("span",{className:"pip-agent-status",style:{color:n},children:s})]}),t.taskLabel&&o.jsxs("div",{className:"pip-agent-task",children:["📋 ",t.taskLabel]}),!t.taskLabel&&t.status==="working"&&t.currentTask&&o.jsx("div",{className:"pip-agent-task",children:t.currentTask.length>60?t.currentTask.slice(0,60)+"...":t.currentTask}),t.currentTool&&o.jsxs("div",{className:"pip-agent-tool",children:[o.jsx("span",{className:"pip-tool-label",children:"Tool:"})," ",t.currentTool]}),o.jsxs("div",{className:"pip-agent-context",children:[o.jsx("div",{className:"pip-context-bar",children:o.jsx("div",{className:"pip-context-fill",style:{width:`${Math.min(Math.round(t.contextUsed/t.contextLimit*100),100)}%`,backgroundColor:t.contextUsed/t.contextLimit*100>80?"#ff4a4a":t.contextUsed/t.contextLimit*100>50?"#ff9e4a":"#4aff9e"}})}),o.jsxs("span",{className:"pip-context-percent",children:[Math.round(t.contextUsed/t.contextLimit*100),"%"]})]})]})}function Kc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}const EA={systemPrompt:"#4a9eff",systemTools:"#9e4aff",messages:"#4aff9e",freeSpace:"rgba(255,255,255,0.1)",autocompactBuffer:"#ff9e4a"},MA={systemPrompt:"System Prompt",systemTools:"System Tools",messages:"Messages",freeSpace:"Free Space",autocompactBuffer:"Autocompact Buffer"};function nq({agent:t,onBack:e}){const n=ny(t),s=ty(t.status),a=t.contextStats,r=Math.round(t.contextUsed/t.contextLimit*100),i=t.contextUsed/t.contextLimit*100>80?"#ff4a4a":t.contextUsed/t.contextLimit*100>50?"#ff9e4a":"#4aff9e",c=["systemPrompt","systemTools","messages","autocompactBuffer","freeSpace"];return o.jsxs("div",{className:"pip-container pip-stats-container",children:[o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to conversation",children:"←"}),o.jsx("span",{className:"pip-agent-icon",children:n}),o.jsx("span",{className:"pip-title",children:t.name}),o.jsx("span",{className:"pip-agent-status-small",style:{color:s},children:ey(t.status)})]}),o.jsx("div",{className:"pip-stats-content",children:a?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"pip-model-info",children:[o.jsxs("div",{className:"pip-model-info-item",children:[o.jsx("div",{className:"pip-model-info-label",children:"Model"}),o.jsx("div",{className:"pip-model-info-value",children:a.model})]}),o.jsxs("div",{className:"pip-model-info-item",children:[o.jsx("div",{className:"pip-model-info-label",children:"Window"}),o.jsx("div",{className:"pip-model-info-value",children:Kc(a.contextWindow)})]})]}),o.jsxs("div",{className:"pip-stats-section",children:[o.jsxs("div",{className:"pip-usage-header",children:[o.jsx("span",{className:"pip-usage-label",children:"Context Usage"}),o.jsxs("span",{className:"pip-usage-value",style:{color:i},children:[Kc(a.totalTokens)," / ",Kc(a.contextWindow)," (",a.usedPercent,"%)"]})]}),o.jsx("div",{className:"pip-stacked-bar",children:c.map(d=>{const f=a.categories[d];return!f||f.percent<=0?null:o.jsx("div",{className:"pip-stacked-bar-segment",style:{width:`${f.percent}%`,backgroundColor:EA[d]},title:`${MA[d]}: ${Kc(f.tokens)}`},d)})})]}),o.jsxs("div",{className:"pip-stats-section",children:[o.jsx("h3",{className:"pip-stats-title",children:"Token Breakdown"}),o.jsx("div",{className:"pip-category-list",children:c.map(d=>{const f=a.categories[d];if(!f)return null;const h=d==="freeSpace";return o.jsxs("div",{className:`pip-category-item ${h?"free-space":""}`,children:[o.jsx("div",{className:"pip-category-color",style:{backgroundColor:EA[d]}}),o.jsxs("div",{className:"pip-category-info",children:[o.jsx("div",{className:"pip-category-name",children:MA[d]}),o.jsxs("div",{className:"pip-category-tokens",children:[Kc(f.tokens)," (",f.percent.toFixed(1),"%)"]})]})]},d)})})]}),o.jsxs("div",{className:"pip-stats-updated",children:["Updated: ",new Date(a.lastUpdated).toLocaleTimeString()]})]}):o.jsxs("div",{className:"pip-stats-section",children:[o.jsx("h3",{className:"pip-stats-title",children:"Context Usage"}),o.jsxs("div",{className:"pip-stats-bar-container",children:[o.jsx("div",{className:"pip-stats-bar",children:o.jsx("div",{className:"pip-stats-bar-fill",style:{width:`${Math.min(r,100)}%`,backgroundColor:i}})}),o.jsxs("span",{className:"pip-stats-percent",style:{color:i},children:[r,"%"]})]}),o.jsx("div",{className:"pip-stats-info",children:o.jsx("p",{className:"pip-stats-info-text",children:"Context usage represents how much of the conversation window is filled. Detailed breakdown not available yet."})})]})})]})}function sq({agentId:t,onBack:e}){const n=ix(t),s=Tj(t),a=Ij(),r=Bj(),i=lx(),c=b.useRef(null),d=b.useRef(null),[f,h]=b.useState(""),[m,x]=b.useState(!1),[y]=b.useState("simple"),v=!!(n!=null&&n.sessionId),S=Sj({selectedAgentId:t,hasSessionId:v,reconnectCount:a,historyRefreshTrigger:r,lastPrompts:i,outputScrollRef:c}),A=cT({outputs:s,viewMode:y}),k=b.useMemo(()=>{const{history:$}=S,U=new Map;for(const z of $)z.type==="tool_result"&&z.toolUseId&&U.set(z.toolUseId,z.content);return(z=>z.map(W=>{if(W.type==="tool_use"&&W.toolName==="Bash"&&W.toolUseId){const V=U.get(W.toolUseId);let Y;try{Y=(W.toolInput||(W.content?JSON.parse(W.content):{})).command}catch{}return{...W,_bashOutput:V,_bashCommand:Y}}return W}))($.filter(z=>z.type==="user"||z.type==="assistant"||z.type==="tool_use"))},[S.history]),[N,j]=b.useState({top:!1,bottom:!0}),E=b.useCallback(()=>{if(!c.current)return;const{scrollTop:$,scrollHeight:U,clientHeight:L}=c.current;j({top:$>20,bottom:$<U-L-20})},[]);b.useEffect(()=>{c.current&&(c.current.scrollTop=c.current.scrollHeight,E())},[s.length,k.length,E]);const D=b.useCallback(()=>{c.current&&c.current.scrollBy({top:-200,behavior:"smooth"})},[]),_=b.useCallback(()=>{c.current&&c.current.scrollBy({top:200,behavior:"smooth"})},[]),B=b.useCallback(()=>{const $=f.trim();!$||!n||(H.sendCommand(t,$),h(""),setTimeout(()=>{var U;return(U=d.current)==null?void 0:U.focus()},50))},[f,t,n]),O=b.useCallback($=>{h($.target.value)},[]),T=b.useCallback($=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),B())},[B]);b.useEffect(()=>{const $=setTimeout(()=>{var U;return(U=d.current)==null?void 0:U.focus()},100);return()=>clearTimeout($)},[t]);const M=b.useCallback(($,U)=>{const L=jp($,n==null?void 0:n.cwd),z=L.line?{...U||{},targetLine:L.line}:U;H.setFileViewerPath(L.path,z,n==null?void 0:n.cwd)},[n==null?void 0:n.cwd]);if(!n)return o.jsx("div",{className:"pip-container",children:o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to agents list",children:"←"}),o.jsx("span",{className:"pip-title",children:"Agent not found"})]})});const R=ny(n),F=ty(n.status);return m?o.jsx(nq,{agent:n,onBack:()=>x(!1)}):o.jsxs("div",{className:"pip-container pip-conversation-container",children:[o.jsxs("div",{className:"pip-header pip-header-conversation",children:[o.jsx("button",{className:"pip-back-btn",onClick:e,title:"Back to agents list",children:"←"}),o.jsx("span",{className:"pip-agent-icon",children:R}),o.jsx("span",{className:"pip-title",children:n.name}),o.jsx("span",{className:"pip-agent-status-small",style:{color:F},children:ey(n.status)})]}),o.jsx("div",{className:"pip-context-section",children:o.jsx(Xj,{contextInfo:vp(n),onClick:()=>x(!0)})}),o.jsxs("div",{className:"pip-conversation-wrapper",children:[o.jsxs("div",{className:"pip-conversation guake-output",ref:c,onScroll:E,children:[!S.loadingHistory&&S.hasMore&&o.jsx("div",{className:"guake-load-more pip-load-more",children:S.loadingMore?o.jsx("span",{children:"Loading older messages..."}):o.jsxs("button",{onClick:S.loadMoreHistory,children:["Load more (",S.totalCount-S.history.length," older)"]})}),S.loadingHistory&&o.jsx("div",{className:"pip-loading-indicator",children:o.jsxs("span",{className:"loading-dots",children:[o.jsx("span",{children:"."}),o.jsx("span",{children:"."}),o.jsx("span",{children:"."})]})}),k.map(($,U)=>o.jsx(_T,{message:$,agentId:t,simpleView:!0,onFileClick:M},`h-${U}`)),A.map(($,U)=>o.jsx(Zx,{output:$,agentId:t,onFileClick:M},`o-${U}`)),!S.loadingHistory&&k.length===0&&A.length===0&&n.status!=="working"&&o.jsx("div",{className:"pip-empty",children:o.jsx("p",{children:"No conversation yet"})})]}),o.jsxs("div",{className:"pip-scroll-controls",children:[N.top&&o.jsx("button",{className:"pip-scroll-btn pip-scroll-up",onClick:D,title:"Scroll up",children:"↑"}),N.bottom&&o.jsx("button",{className:"pip-scroll-btn pip-scroll-down",onClick:_,title:"Scroll down",children:"↓"})]})]}),n.currentTool&&o.jsx("div",{className:"pip-current-tool",children:o.jsxs("span",{className:"pip-tool-indicator",children:["Using: ",n.currentTool]})}),o.jsxs("div",{className:"pip-input-area",children:[o.jsx("input",{ref:d,type:"text",className:"pip-input",placeholder:`Message ${n.name}...`,value:f,onChange:O,onKeyDown:T,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),o.jsx("button",{className:"pip-send-btn",onClick:B,disabled:!f.trim(),title:"Send message",children:"➤"})]})]})}function aq({onSelectAgent:t}){const e=xp(),n=e.filter(c=>c.status==="working"),s=e.filter(c=>c.status==="waiting"||c.status==="waiting_permission"),a=e.filter(c=>c.status!=="working"&&c.status!=="waiting"&&c.status!=="waiting_permission"),r=e.length,i=n.length+s.length;return o.jsxs("div",{className:"pip-container",children:[o.jsxs("div",{className:"pip-header",children:[o.jsx("span",{className:"pip-title",children:"Tide Commander"}),o.jsxs("span",{className:"pip-stats",children:[i,"/",r," active"]})]}),o.jsxs("div",{className:"pip-agents-list",children:[n.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Working (",n.length,")"]}),n.map(c=>o.jsx(Jg,{agent:c,onClick:t},c.id))]}),s.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Waiting (",s.length,")"]}),s.map(c=>o.jsx(Jg,{agent:c,onClick:t},c.id))]}),a.length>0&&o.jsxs("div",{className:"pip-section",children:[o.jsxs("div",{className:"pip-section-title",children:["Idle (",a.length,")"]}),a.map(c=>o.jsx(Jg,{agent:c,onClick:t},c.id))]}),e.length===0&&o.jsx("div",{className:"pip-empty",children:o.jsx("p",{children:"No agents spawned yet"})})]})]})}function rq(){const[t,e]=b.useState(null),n=a=>{e(a)},s=()=>{e(null)};return t?o.jsx(sq,{agentId:t,onBack:s}):o.jsx(aq,{onSelectAgent:n})}function iq(t){const e=t.trim();if(!e)return{ok:!0,normalizedUrl:""};let n;try{n=new URL(e)}catch{return{ok:!1,normalizedUrl:"",error:"Invalid URL format. Use http://host:port"}}return n.protocol!=="http:"&&n.protocol!=="https:"?{ok:!1,normalizedUrl:"",error:"Unsupported protocol. Use http or https"}:{ok:!0,normalizedUrl:e}}async function oq(t,e=5e3,n=fetch){if(!t)return{ok:!0};const a=`${t.replace(/\/$/,"")}/api/health`,r=new AbortController,i=setTimeout(()=>r.abort(),e);try{const c=await n(a,{method:"GET",cache:"no-store",signal:r.signal});return c.ok?{ok:!0}:{ok:!1,error:`Host reachable but unhealthy (${c.status})`}}catch(c){return c instanceof Error&&c.name==="AbortError"?{ok:!1,error:"Connection timed out while checking host"}:{ok:!1,error:"Host unreachable. Check URL, host, and port"}}finally{clearTimeout(i)}}const lq=4e3;function cq(){const t=Ej(),[e,n]=b.useState(!1),[s,a]=b.useState(!1),[r,i]=b.useState(!0),[c,d]=b.useState(!1),[f,h]=b.useState(()=>Jb()),[m,x]=b.useState(!1),[y,v]=b.useState(null),[S,A]=b.useState(null),k=b.useRef(!0),N=b.useRef(!1),j=b.useCallback((O=7e3)=>H.getState().isConnected?Promise.resolve(!0):new Promise(T=>{let M=!1;const R=U=>{M||(M=!0,clearTimeout($),F(),T(U))},F=H.subscribe(()=>{H.getState().isConnected&&R(!0)}),$=setTimeout(()=>R(!1),O)}),[]);b.useEffect(()=>{const O=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(O)},[]),b.useEffect(()=>{if(t){N.current=!0,d(!1);return}if(N.current){i(!0),d(!0);const O=setTimeout(()=>{i(!1),d(!1)},1e4);return()=>clearTimeout(O)}},[t]),b.useEffect(()=>()=>{k.current=!1},[]),b.useEffect(()=>YD(O=>{h(O)}),[]);const E=b.useCallback(()=>{navigator.clipboard.writeText("bunx tide-commander").then(()=>{a(!0),setTimeout(()=>a(!1),2e3)}).catch(()=>{})},[]),D=b.useCallback(async()=>{if(m)return;const O=Date.now(),T=()=>lq-(Date.now()-O);v(null),A("Validating URL");const M=f.trim()||"http://localhost:6200",R=iq(M);if(!R.ok){A(null),v(R.error||"Invalid backend URL");return}x(!0),A("Checking host reachability");const F=T();if(F<=0){x(!1),A(null),v("Connection timeout after 4 seconds");return}const $=await oq(R.normalizedUrl,F);if(!$.ok){if(!k.current)return;x(!1),A(null),T()<=0?v("Connection timeout after 4 seconds"):v($.error||"Failed to reach host");return}GD(R.normalizedUrl),A("Connecting to server"),HR();const U=T();if(U<=0){x(!1),A(null),v("Connection timeout after 4 seconds");return}const L=await j(U);if(k.current){if(!L){x(!1),A(null),T()<=0?v("Connection timeout after 4 seconds"):v("Could not establish WebSocket connection. Verify host and auth token, then retry");return}x(!1),A("Connected"),v(null)}},[f,m,j]),_=b.useCallback(O=>{O.key==="Enter"&&!m&&D()},[D,m]),B=b.useCallback(()=>{n(!0)},[]);return t||e?null:r&&c?o.jsxs("div",{className:"reconnecting-toast",children:[o.jsx("span",{className:"reconnecting-spinner"}),"Reconnecting..."]}):r?null:o.jsx("div",{className:"not-connected-overlay",children:o.jsxs("div",{className:"not-connected-panel",children:[o.jsx("h2",{className:"not-connected-title",children:"Tide Commander"}),o.jsx("p",{className:"not-connected-description",children:"A visual multi-agent orchestrator for Claude Code and Codex. Deploy, control, and monitor your AI team from an RTS-inspired interface."}),o.jsx("p",{className:"not-connected-privacy",children:"Tide Commander syncs with Claude Code instances running on your local machine. No files or code are sent to this server."}),o.jsxs("div",{className:"not-connected-setup",children:[o.jsx("p",{className:"not-connected-setup-label",children:"Get started:"}),o.jsxs("div",{className:"not-connected-code",onClick:E,title:"Click to copy",children:[o.jsx("span",{children:"bunx tide-commander"}),o.jsx("span",{className:"not-connected-copy-icon",children:s?"✓":"⧉"})]})]}),o.jsxs("div",{className:"not-connected-url-section",children:[o.jsx("label",{className:"not-connected-url-label",htmlFor:"backend-url",children:"Backend URL"}),o.jsx("div",{className:"not-connected-url-row",children:o.jsx("input",{id:"backend-url",type:"text",className:"not-connected-url-input",placeholder:"http://localhost:6200",value:f,disabled:m,onChange:O=>{const T=O.target.value;h(T),y&&v(null)},onKeyDown:_})}),o.jsx("span",{className:"config-hint",children:"Leave empty for auto-detect"}),S&&!y&&o.jsx("div",{className:"not-connected-status","aria-live":"polite",children:S}),y&&o.jsx("div",{className:"not-connected-error","aria-live":"assertive",children:y})]}),o.jsxs("div",{className:"not-connected-actions",children:[o.jsx("button",{className:"not-connected-btn not-connected-btn-retry",onClick:()=>{D()},disabled:m,children:m?"Connecting...":"↻ Connect"}),o.jsx("button",{className:"not-connected-btn not-connected-btn-explore",onClick:B,children:"Explore"})]})]})})}const DA="tide-onboarding-dismissed";function uq({onCreateAgent:t}){const{t:e}=ht("common"),n=Ej(),s=Nj(),[a,r]=b.useState(()=>sessionStorage.getItem(DA)==="1"),i=n&&!a&&s===0,c=b.useCallback(()=>{r(!0),sessionStorage.setItem(DA,"1")},[]),d=b.useCallback(()=>{c(),t()},[c,t]),f=b.useCallback(h=>{h.key==="Escape"&&c()},[c]);return i?o.jsx(ir,{children:o.jsx("div",{className:"modal-overlay visible",onClick:c,onKeyDown:f,children:o.jsxs("div",{className:"modal onboarding-modal",onClick:h=>h.stopPropagation(),children:[o.jsxs("div",{className:"onboarding-header",children:[o.jsx("h2",{children:e("onboarding.title")}),o.jsx("p",{className:"onboarding-subtitle",children:e("onboarding.subtitle")})]}),o.jsxs("div",{className:"onboarding-steps",children:[o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"1"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step1Title")}),o.jsx("p",{children:e("onboarding.step1Desc")})]})]}),o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"2"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step2Title")}),o.jsx("p",{children:e("onboarding.step2Desc")})]})]}),o.jsxs("div",{className:"onboarding-step",children:[o.jsx("span",{className:"onboarding-step-number",children:"3"}),o.jsxs("div",{children:[o.jsx("strong",{children:e("onboarding.step3Title")}),o.jsx("p",{children:e("onboarding.step3Desc")})]})]})]}),o.jsxs("div",{className:"onboarding-actions",children:[o.jsx("button",{className:"btn onboarding-cta",onClick:d,autoFocus:!0,children:e("onboarding.createFirst")}),o.jsx("button",{className:"btn btn-secondary",onClick:c,children:e("onboarding.explore")})]})]})})}):null}function MT(){return{"Content-Type":"application/json","X-Auth-Token":ji()}}async function dq(t){const e=await fetch(`${Aa()}/api/areas/${t}/organize`,{method:"POST",headers:MT()});if(!e.ok)throw new Error(`Failed to organize area: ${e.statusText}`);const n=await e.json();return{organized:Array.isArray(n.organized)?n.organized:[],buildings:Array.isArray(n.buildings)?n.buildings:[]}}async function fq(){const t=await fetch(`${Aa()}/api/areas/organize-all`,{method:"POST",headers:MT()});if(!t.ok)throw new Error(`Failed to organize all areas: ${t.statusText}`);const e=await t.json();return Array.isArray(e.organized)?{organized:e.organized,buildings:Array.isArray(e.buildings)?e.buildings:[]}:(Array.isArray(e.results)?e.results:[]).reduce((n,s)=>(n.organized.push(...s.organized),n.buildings.push(...s.buildings),n),{organized:[],buildings:[]})}function DT(t,e){var s,a;const n=H.getState();for(const r of t.organized){const i=n.agents.get(r.agentId);if(i){const c={...i,position:r.position};H.updateAgent(c),(s=e.current)==null||s.updateAgent(c,!0)}}for(const r of t.buildings){const i=n.buildings.get(r.buildingId);i&&(H.updateBuilding(r.buildingId,{position:r.position}),(a=e.current)==null||a.updateBuilding({...i,position:r.position}))}}function pq(t,e,n,s,a,r){const i=[];if(e.type==="agent"&&e.id){const d=n.get(e.id);if(d)return i.push({id:"select-agent",label:`Select ${d.name}`,icon:"👆",onClick:()=>{var f;H.selectAgent(e.id),(f=r.sceneRef.current)==null||f.refreshSelectionVisuals()}}),i.push({id:"focus-agent",label:"Focus Camera",icon:"🎯",onClick:()=>{var f;(f=r.sceneRef.current)==null||f.focusAgent(e.id)}}),i.push({id:"open-terminal",label:"Open Terminal",icon:"💬",onClick:()=>{H.selectAgent(e.id),H.setTerminalOpen(!0)}}),i.push({id:"edit-agent",label:"Edit Agent",icon:"✏️",onClick:()=>{r.openAgentEditModal(e.id)}}),i.push({id:"divider-agent",label:"",divider:!0,onClick:()=>{}}),i.push({id:"delete-agent",label:`Remove ${d.name}`,icon:"❌",danger:!0,onClick:()=>{var f;H.removeAgentFromServer(e.id),(f=r.sceneRef.current)==null||f.removeAgent(e.id),r.showToast("info","Agent Removed",`${d.name} removed from view`)}}),i}if(e.type==="area"&&e.id){const d=s.get(e.id);if(d)return i.push({id:"select-area",label:`Select "${d.name}"`,icon:"📐",onClick:()=>{H.selectArea(e.id),r.openToolboxModal()}}),d.directories&&d.directories.length>0&&i.push({id:"open-explorer",label:"Open File Explorer",icon:"📁",onClick:()=>{r.openExplorerModal(e.id)}}),i.push({id:"spawn-in-area",label:"Spawn Agent",icon:"🤖",onClick:()=>{window.dispatchEvent(new CustomEvent("tide:open-spawn-modal",{detail:{areaId:e.id,position:{x:d.center.x,z:d.center.z}}}))}}),i.push({id:"divider-area-layer",label:"",divider:!0,onClick:()=>{}}),i.push({id:"bring-to-front",label:"Bring to Front",icon:"⬆️",onClick:()=>{var f;H.bringAreaToFront(e.id),(f=r.sceneRef.current)==null||f.syncAreas()}}),i.push({id:"send-to-back",label:"Send to Back",icon:"⬇️",onClick:()=>{var f;H.sendAreaToBack(e.id),(f=r.sceneRef.current)==null||f.syncAreas()}}),d.assignedAgentIds.length>0&&i.push({id:"organize-area",label:"Organize Area",icon:"✨",onClick:()=>{dq(e.id).then(f=>{DT(f,r.sceneRef),r.showToast("success","Area Organized",`Arranged ${f.organized.length} agent${f.organized.length!==1?"s":""} in "${d.name}"`)}).catch(f=>{console.error("organize area error:",f),r.showToast("error","Organize Failed",f.message||"Failed to organize area")})}}),i.push({id:"divider-area",label:"",divider:!0,onClick:()=>{}}),i.push({id:"archive-area",label:`Archive "${d.name}"`,icon:"📦",onClick:()=>{var m,x;const f=d.assignedAgentIds.length;H.archiveArea(e.id,y=>H.stopAgent(y)),(m=r.sceneRef.current)==null||m.syncAreas(),(x=r.sceneRef.current)==null||x.syncAgents(Array.from(H.getState().agents.values()));const h=f>0?` (${f} agent${f>1?"s":""} stopped)`:"";r.showToast("info","Zone Archived",`"${d.name}" has been archived${h}`)}}),i.push({id:"delete-area",label:`Delete "${d.name}"`,icon:"🗑️",danger:!0,onClick:()=>{var f;H.deleteArea(e.id),(f=r.sceneRef.current)==null||f.syncAreas(),r.showToast("info","Area Deleted",`"${d.name}" has been deleted`)}}),i}if(e.type==="building"&&e.id){const d=a.get(e.id);if(d)return i.push({id:"select-building",label:`Select "${d.name}"`,icon:"🏢",onClick:()=>{H.selectBuilding(e.id),r.openToolboxModal()}}),i.push({id:"edit-building",label:"Edit Building",icon:"✏️",onClick:()=>{r.openBuildingModal(e.id)}}),i.push({id:"clone-building",label:"Clone Building",icon:"📋",onClick:()=>{const f={name:`${d.name} (Copy)`,type:d.type,style:d.style,color:d.color,scale:d.scale,position:{x:d.position.x+2,z:d.position.z+2},cwd:d.cwd,folderPath:d.folderPath,commands:d.commands,pm2:d.pm2,docker:d.docker,database:d.database,urls:d.urls,subordinateBuildingIds:d.subordinateBuildingIds};H.createBuilding(f),r.showToast("success","Building Cloned",`Created "${f.name}"`)}}),d.type==="folder"&&d.folderPath&&i.push({id:"open-folder",label:"Open Folder",icon:"📁",onClick:()=>{H.openFileExplorer(d.folderPath)}}),i.push({id:"divider-building",label:"",divider:!0,onClick:()=>{}}),i.push({id:"delete-building",label:`Delete "${d.name}"`,icon:"🗑️",danger:!0,onClick:()=>{r.requestBuildingDelete(e.id)}}),i}i.push({id:"spawn-agent",label:"Spawn Agent Here",icon:"🤖",shortcut:"N",onClick:()=>{r.setSpawnPosition(t),r.openSpawnModal()}}),i.push({id:"spawn-boss",label:"Spawn Boss Here",icon:"👑",onClick:()=>{r.setSpawnPosition(t),r.openBossSpawnModal()}}),i.push({id:"divider-1",label:"",divider:!0,onClick:()=>{}}),i.push({id:"draw-area",label:"Draw Area",icon:"📐",onClick:()=>{var d;(d=r.sceneRef.current)==null||d.setDrawingTool("rectangle"),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool("rectangle"),r.showToast("info","Rectangle Tool","Click and drag on the battlefield to draw an area")}}),i.push({id:"new-building",label:"Place Building",icon:"🏢",onClick:()=>{r.openBuildingModal(null)}});const c=Array.from(s.values()).filter(d=>d.archived).length;return c>0&&i.push({id:"restore-archived",label:`Restore Archived Zone (${c})`,icon:"📦",onClick:()=>{r.openRestoreArchivedModal(t)}}),i.push({id:"divider-2",label:"",divider:!0,onClick:()=>{}}),i.push({id:"open-settings",label:"Settings",icon:"⚙️",onClick:()=>{r.openToolboxModal()}}),i.push({id:"open-commander",label:"Commander View",icon:"📊",shortcut:"⌘K",onClick:()=>{r.openCommanderModal()}}),i}const hq=je.lazy(()=>vt(()=>import("./index-DahUmubU.js"),__vite__mapDeps([35,3,1,4,36])).then(t=>({default:t.DatabasePanel}))),mq=je.lazy(()=>vt(()=>import("./PM2LogsModal-BFJ1_6O0.js"),__vite__mapDeps([37,38,3,1,4])).then(t=>({default:t.PM2LogsModal}))),gq=je.lazy(()=>vt(()=>import("./DockerLogsModal-Bexhv2Eo.js"),__vite__mapDeps([39,38,3,1,4])).then(t=>({default:t.DockerLogsModal}))),bq=je.lazy(()=>vt(()=>import("./BossLogsModal-gE17BBT9.js"),__vite__mapDeps([40,38,3,1,4])).then(t=>({default:t.BossLogsModal}))),xq=je.lazy(()=>vt(()=>import("./Scene2DCanvas-CToncCYk.js"),__vite__mapDeps([41,3,1,4,42])).then(t=>({default:t.Scene2DCanvas}))),yq=je.lazy(()=>vt(()=>import("./index-bXLSkGdM.js"),__vite__mapDeps([43,3,1,4,44])).then(t=>({default:t.DashboardView}))),vq=je.lazy(()=>vt(()=>import("./IframeModal-AIthNZLG.js"),__vite__mapDeps([45,3,1,4,46])).then(t=>({default:t.IframeModal}))),wq=je.lazy(()=>vt(()=>import("./SaveSnapshotModal-BUn9mntc.js"),__vite__mapDeps([47,3,1,4])).then(t=>({default:t.SaveSnapshotModal})));function kq(){const{t}=ht(["common","notifications"]),e=b.useRef(null),n=b.useRef(null),s=ts(),a=ts(),r=ts(),i=ts(),c=ts(),d=ts(),f=ts(),h=ts(),m=ts(),x=ts(),y=ts(),v=ts(),S=ts(),A=ts(),k=ts(),N=ts(),j=ts(),E=ts(),D=ts(),_=KD(),B=tL(),O=QD(),T=oR(),[M,R]=b.useState(null),F=XR(),[$,U]=b.useState(!1),[L,z]=b.useState(null),[W,V]=b.useState(null),[Y,P]=b.useState(null),[K,Q]=b.useState(null),[q,be]=b.useState(null),[ue,Z]=b.useState(null),[de,Ce]=b.useState(null),[xe,Ne]=b.useState(null),[qe,Ge]=b.useState(null),[X,se]=b.useState(null),Ee=b.useCallback(me=>{se(me),me&&localStorage.setItem("tide-commander-last-database-building",me)},[]),Ve=b.useCallback(()=>Ee(null),[Ee]),{handleMouseDown:at,handleClick:we}=Sa(Ve),$e=b.useCallback(()=>Ge(null),[]),{handleMouseDown:ie,handleClick:fe}=Sa($e),Ue=b.useRef(ue);Ue.current=ue;const it=b.useCallback(me=>{Z(me)},[]),ot=b.useCallback(()=>Ue.current,[]),ce=b.useRef(null),[J,ae]=b.useState(wj),[Se,ee]=b.useState(0),[ge,Re]=b.useState(!1),[Fe,oe]=b.useState(()=>localStorage.getItem("tide-commander-sidebar-collapsed")==="true"),[Le,te]=b.useState(!1),[pe,ke]=b.useState(!1),Be=Rj(),Ke=Fj(),ze=ux(),Ze=dx(),lt=Dj(),{showToast:et}=Hj(),{showAgentNotification:ct}=EL(),{showBackNavModal:st,setShowBackNavModal:bt,handleLeave:Tt}=hO();oO({showToast:et,showAgentNotification:ct});const[he,_e]=b.useState(!1);b.useEffect(()=>{const me=tt=>{var en;((en=tt.detail)==null?void 0:en.mode)==="3d"&&_e(!0)};return window.addEventListener("tide:viewmode-switch-pressed",me),()=>{window.removeEventListener("tide:viewmode-switch-pressed",me)}},[]),b.useEffect(()=>{Ke==="3d"&&_e(!0)},[Ke]);const We=iO({canvasRef:e,selectionBoxRef:n,viewMode:Ke,sceneMountKey:Se,showToast:et,showAgentNotification:ct,toolboxModal:i,contextMenu:O,setHoveredAgentPopup:be,setBuildingPopup:it,getBuildingPopup:ot,openBuildingModal:me=>k.open(me),openPM2LogsModal:me=>Ce(me),openBossLogsModal:me=>Ne(me),openDatabasePanel:me=>Ee(me),onSceneLoadingChange:_e}),nt=Nj(),_t=sr(),Bt=cx(),Ct=ox(),$t=KO(),Vt=YO(),gt=GO(),ut=Ir(),ft=XO(),Ft=fL(),cn=pL(),Dn=b.useMemo(()=>Array.from(Ct),[Ct]),ss=b.useRef(!1);uj("AppContent"),lO(We),cO(We),uO(We),bO(),dO(We,Vt),fO(We,ut.powerSaving),b.useEffect(()=>{var me;document.title=((me=ut.tabTitle)==null?void 0:me.trim())||"Tide Commander"},[ut.tabTitle]),b.useEffect(()=>{var On,ks;if(ss.current||typeof window>"u")return;const me=new URLSearchParams(window.location.search),tt=(On=me.get("agentId"))==null?void 0:On.trim(),At=(ks=me.get("agentName"))==null?void 0:ks.trim();if(!tt&&!At||nt===0)return;const en=H.getState().agents,Pn=me.get("openTerminal"),zt=Pn?["1","true","yes"].includes(Pn.toLowerCase()):!0;let jt=tt?en.get(tt):void 0;if(!jt&&At){const Ba=At.toLowerCase();jt=Array.from(en.values()).find(la=>la.name.toLowerCase()===Ba)}if(!jt){console.warn("[DeepLink] No matching agent found for query params",{rawAgentId:tt,rawAgentName:At}),ss.current=!0;return}H.selectAgent(jt.id),zt&&H.setTerminalOpen(!0),me.delete("agentId"),me.delete("agentName"),me.delete("openTerminal");const jn=me.toString(),ws=`${window.location.pathname}${jn?`?${jn}`:""}${window.location.hash}`;window.history.replaceState({},document.title,ws),ss.current=!0},[nt]),pO({sceneRef:We,spawnModal:s,commanderModal:c,explorerModal:_,spotlightModal:h,deleteConfirmModal:d,onRequestBuildingDelete:()=>Q("selected"),onOpenDatabasePanel:Ee,onCloseDatabasePanel:Ve,databasePanelOpen:X!==null}),Qt("spawn-modal",s.isOpen,s.close),Qt("boss-spawn-modal",a.isOpen,a.close),Qt("subordinate-modal",r.isOpen,r.close),Qt("toolbox-modal",i.isOpen,i.close),Qt("commander-modal",c.isOpen,c.close),Qt("delete-confirm-modal",d.isOpen,d.close),Qt("supervisor-modal",f.isOpen,f.close),Qt("spotlight-modal",h.isOpen,h.close),Qt("controls-modal",m.isOpen,m.close),Qt("skills-modal",x.isOpen,x.close),Qt("integrations-modal",y.isOpen,y.close),Qt("monitoring-modal",v.isOpen,v.close),Qt("workflow-editor-modal",S.isOpen,S.close),Qt("trigger-manager-modal",A.isOpen,A.close),Qt("building-modal",k.isOpen,k.close),Qt("agent-edit-modal",N.isOpen,N.close),Qt("snapshots-modal",j.isOpen,j.close),Qt("save-snapshot-modal",E.isOpen,E.close),Qt("explorer-modal",_.isOpen||B!==null,()=>{_.close(),H.closeFileExplorer()}),Qt("context-menu",O.isOpen,O.close),Qt("mobile-sidebar",ge,()=>Re(!1)),Qt("mobile-fab-menu",pe,()=>ke(!1)),Qt("file-viewer",ze!==null,()=>H.clearFileViewerPath()),Qt("context-modal",Ze!==null,()=>H.closeContextModal()),Qt("terminal",lt,()=>H.setTerminalOpen(!1)),Qt("pm2-logs-modal",de!==null,()=>Ce(null)),Qt("boss-logs-modal",xe!==null,()=>Ne(null)),Qt("database-panel",X!==null,Ve),Qt("terminal-modal",qe!==null,$e);const zs=b.useRef(lt),Ia=b.useRef(x),$s=b.useRef(m);Ia.current=x,$s.current=m,b.useEffect(()=>{zs.current&&!lt&&(Ia.current.close(),$s.current.close()),zs.current=lt},[lt]),b.useEffect(()=>{},[]),b.useEffect(()=>{if(Be!=="3d"||Ke!=="3d")return;const me=setTimeout(()=>window.dispatchEvent(new Event("resize")),80);return()=>clearTimeout(me)},[Be,Ke]);const ra=b.useCallback(me=>{var tt,At,en,Pn,zt,jt,jn,ws,On,ks;ae(me),aO(me),(tt=We.current)==null||tt.setCharacterScale(me.characterScale),(At=We.current)==null||At.setScale3D(me.scale3d),(en=We.current)==null||en.setTimeMode(me.timeMode),(Pn=We.current)==null||Pn.setTerrainConfig(me.terrain),(zt=We.current)==null||zt.setFloorStyle(me.terrain.floorStyle),(jt=We.current)==null||jt.setGridVisible(me.gridVisible),(jn=We.current)==null||jn.setAgentModelStyle(me.modelStyle),(ws=We.current)==null||ws.setIdleAnimation(me.animations.idleAnimation),(On=We.current)==null||On.setWorkingAnimation(me.animations.workingAnimation),(ks=We.current)==null||ks.setFpsLimit(me.fpsLimit)},[We]),ms=b.useCallback(me=>{var tt;if((tt=We.current)==null||tt.setDrawingTool(me),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(me),me==="rectangle"||me==="circle"){const At=t(me==="rectangle"?"notifications:drawing.rectangleTool":"notifications:drawing.circleTool");et("info",At,t("notifications:drawing.clickAndDrag"),3e3)}},[We,et]),Et=b.useCallback(me=>{var tt;(tt=We.current)==null||tt.focusAgent(me)},[We]),Zn=b.useCallback(me=>{H.killAgent(me)},[]),Vn=b.useCallback(me=>{var tt;(tt=We.current)==null||tt.callSubordinates(me)},[We]),kn=b.useCallback(me=>{_.open(me)},[_]),$r=b.useCallback(()=>{k.open(null)},[k]),Hr=b.useCallback(()=>{var me;(me=We.current)==null||me.setDrawingTool("rectangle"),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool("rectangle"),et("info",t("notifications:drawing.rectangleTool"),t("notifications:drawing.clickAndDrag"),3e3)},[We,et]),gs=b.useCallback(me=>{R(me)},[]),ia=b.useCallback(()=>{R(null)},[]),Pl=b.useCallback(()=>{const me=Array.from(H.getState().selectedAgentIds);me.forEach(tt=>{var At;H.removeAgentFromServer(tt),(At=We.current)==null||At.removeAgent(tt)}),d.close(),et("info",t("notifications:toast.agentsRemoved"),t("notifications:toast.agentsRemovedMsg",{count:me.length}))},[et,d,We,t]),Ur=b.useCallback(()=>{var me,tt;if(K==="selected"){const At=$t.size;H.deleteSelectedBuildings(),(me=We.current)==null||me.syncBuildings(),et("info",t("notifications:toast.buildingsDeleted"),t("notifications:toast.buildingsDeletedMsg",{count:At}))}else if(K){const At=Bt.get(K);H.deleteBuilding(K),(tt=We.current)==null||tt.syncBuildings(),et("info",t("notifications:toast.buildingDeleted"),t("notifications:toast.buildingDeletedMsg",{name:(At==null?void 0:At.name)||"Building"}))}Q(null)},[K,Bt,$t.size,et,We,t]),bo=b.useMemo(()=>pq(O.worldPosition,O.target,H.getState().agents,_t,Bt,{showToast:et,openSpawnModal:()=>s.open(),openBossSpawnModal:()=>a.open(),openToolboxModal:()=>i.open(),openCommanderModal:()=>c.open(),openExplorerModal:me=>_.open(me),openBuildingModal:me=>k.open(me),openAgentEditModal:me=>N.open(me),requestBuildingDelete:me=>Q(me),setSpawnPosition:z,openRestoreArchivedModal:me=>D.open(me),sceneRef:We}),[O.worldPosition,O.target,_t,Bt,s,a,k,i,c,_,N,D,et,We]);b.useEffect(()=>{!s.isOpen&&!a.isOpen&&(z(null),P(null))},[s.isOpen,a.isOpen]),b.useEffect(()=>{const me=zt=>{const jt=zt.detail;P((jt==null?void 0:jt.areaId)||null),z((jt==null?void 0:jt.position)||null),s.open()},tt=zt=>{var ws,On;const jt=zt.detail;if(!(jt!=null&&jt.buildingId))return;const jn=H.getState().buildings.get(jt.buildingId);jn&&(jn.type==="server"&&((ws=jn.pm2)!=null&&ws.enabled)?Ce(jt.buildingId):jn.type==="boss"?Ne(jt.buildingId):jn.type==="database"?Ee(jt.buildingId):jn.type==="folder"&&jn.folderPath?H.openFileExplorer(jn.folderPath):jn.type==="terminal"&&((On=jn.terminalStatus)!=null&&On.url)?Ge(jt.buildingId):k.open(jt.buildingId))},At=zt=>{const jt=zt.detail;jt!=null&&jt.buildingId&&k.open(jt.buildingId)},en=zt=>{const jt=zt.detail;V((jt==null?void 0:jt.position)||null),k.open(null)},Pn=zt=>{const jt=zt.detail;jt!=null&&jt.buildingId?Ge(jt.buildingId):jt!=null&&jt.url&&R(jt.url)};return window.addEventListener("tide:open-spawn-modal",me),window.addEventListener("tide:building-action",tt),window.addEventListener("tide:building-edit",At),window.addEventListener("tide:building-create",en),window.addEventListener("tide:open-iframe-modal",Pn),()=>{window.removeEventListener("tide:open-spawn-modal",me),window.removeEventListener("tide:building-action",tt),window.removeEventListener("tide:building-edit",At),window.removeEventListener("tide:building-create",en),window.removeEventListener("tide:open-iframe-modal",Pn)}},[s,k]);const Hs=gt==="rectangle"||gt==="circle",ja=b.useCallback(()=>{var me;(me=We.current)==null||me.setDrawingTool(null),typeof window<"u"&&window.__tideScene2D_setDrawingTool&&window.__tideScene2D_setDrawingTool(null)},[We]),oa=b.useCallback(()=>ke(me=>!me),[]),os=b.useCallback(()=>H.setMobileView("terminal"),[]),as=b.useCallback(()=>Re(!0),[]),xo=Dn.length===1&&H.getOutputs(Dn[0]).length>0;return o.jsxs("div",{className:`app ${lt?"terminal-open":""} ${Hs?"drawing-mode":""} ${Fe?"sidebar-collapsed":""} mobile-view-${Be} view-mode-${Ke}`,children:[o.jsx(cq,{}),o.jsx(uq,{onCreateAgent:s.open}),o.jsx(EW,{visible:ut.showFPS,position:"bottom-right"}),o.jsxs("div",{className:"app-top-bar",children:[o.jsx(RW,{className:"app-view-mode-toggle"}),o.jsx(xj,{}),o.jsxs("button",{className:"app-organize-all-btn",disabled:$,title:"Auto-organize all agents in their areas",onClick:()=>{U(!0),fq().then(me=>{DT(me,We),et("success","Organized",`Arranged ${me.organized.length} agent${me.organized.length!==1?"s":""}`)}).catch(me=>{console.error("organize all error:",me),et("error","Organize Failed",me.message||"Failed to organize")}).finally(()=>U(!1))},children:[$?"⏳":"✨"," Organize"]})]}),o.jsxs("main",{className:"main-content",children:[o.jsxs("div",{className:"battlefield-container",children:[F&&o.jsxs("div",{className:"workspace-switch-overlay",children:[o.jsx("div",{className:"workspace-switch-spinner"}),o.jsx("span",{className:"workspace-switch-text",children:"Switching workspace..."})]}),o.jsx(je.Suspense,{fallback:null,children:Ke==="dashboard"?o.jsx(yq,{onSelectAgent:me=>H.selectAgent(me),onFocusAgent:me=>{H.setViewMode("3d"),Et(me)},onKillAgent:Zn,onSelectBuilding:me=>H.selectBuilding(me),onOpenTerminal:me=>{H.selectAgent(me),H.setTerminalOpen(!0)},onFocusZone:me=>{H.setViewMode("3d");const tt=H.getState().areas.get(me);tt&&tt.assignedAgentIds.length>0&&Et(tt.assignedAgentIds[0])}}):Ke==="2d"?o.jsx(xq,{onAgentClick:(me,tt)=>{tt?H.addToSelection(me):H.selectAgent(me)},onAgentDoubleClick:me=>{if(window.innerWidth<=768){H.openTerminalOnMobile(me);return}H.selectAgent(me),H.setTerminalOpen(!0)},onBuildingClick:(me,tt)=>{H.selectBuilding(me);const At=H.getState().buildings.get(me);(At==null?void 0:At.type)==="folder"&&At.folderPath?H.openFileExplorer(At.folderPath):((At==null?void 0:At.type)==="server"||(At==null?void 0:At.type)==="boss"||(At==null?void 0:At.type)==="database")&&(ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{it({buildingId:me,screenPos:tt,fromClick:!0}),ce.current=null},150))},onBuildingDoubleClick:me=>{var At;ce.current&&(clearTimeout(ce.current),ce.current=null),it(null);const tt=H.getState().buildings.get(me);(tt==null?void 0:tt.type)==="server"&&((At=tt.pm2)!=null&&At.enabled)?Ce(me):(tt==null?void 0:tt.type)==="boss"?Ne(me):(tt==null?void 0:tt.type)==="database"?Ee(me):(tt==null?void 0:tt.type)==="folder"&&tt.folderPath?H.openFileExplorer(tt.folderPath):k.open(me)},onGroundClick:()=>{H.selectAgent(null),H.selectBuilding(null)},onAreaDoubleClick:me=>{H.selectArea(me),i.open()},onContextMenu:(me,tt,At)=>{const en=At?{type:At.type,id:At.id}:{type:"ground"};O.open(me,tt,en)},onMoveCommand:(me,tt)=>{const en=me.length,Pn=[];if(en===1)Pn.push({x:tt.x,y:0,z:tt.z});else if(en<=6){const zt=1.2*Math.max(1,en/3);for(let jt=0;jt<en;jt++){const jn=jt/en*Math.PI*2-Math.PI/2;Pn.push({x:tt.x+Math.cos(jn)*zt,y:0,z:tt.z+Math.sin(jn)*zt})}}else{const zt=Math.ceil(Math.sqrt(en)),jt=Math.ceil(en/zt),jn=(zt-1)*1.2/2,ws=(jt-1)*1.2/2;for(let On=0;On<en;On++){const ks=On%zt,Ba=Math.floor(On/zt);Pn.push({x:tt.x+ks*1.2-jn,y:0,z:tt.z+Ba*1.2-ws})}}me.forEach((zt,jt)=>{H.moveAgent(zt,Pn[jt])})},onBuildingDragMove:(me,tt)=>{var en;const At=H.getState().buildings.get(me);At&&(H.getState().buildings.set(me,{...At,position:{x:tt.x,z:tt.z}}),(en=window.__tideScene2D)==null||en.syncBuildings())},onBuildingDragEnd:(me,tt)=>{H.updateBuildingPosition(me,tt)},scale2d:J.scale2d,showTaskLabels:J.show2DTaskLabels,showGrid:J.gridVisible,fpsLimit:J.fpsLimit}):o.jsxs(je.Fragment,{children:[o.jsx("canvas",{ref:e,id:"battlefield",tabIndex:0}),o.jsx("div",{ref:n,id:"selection-box"})]},Se)}),he&&o.jsxs("div",{className:"scene-loading-overlay",children:[o.jsx("div",{className:"scene-loading-overlay__spinner"}),o.jsx("span",{className:"scene-loading-overlay__label",children:"Loading 3D scene…"})]})]}),o.jsx(OW,{isOpen:pe,onToggle:oa,onShowTerminal:os,onOpenSidebar:as,onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,onTakeSnapshot:E.open,canTakeSnapshot:xo,mobileView:Be}),ge&&o.jsx("div",{className:"sidebar-overlay",onClick:()=>Re(!1)}),!1,o.jsx("button",{className:`sidebar-collapse-edge-btn ${Fe?"is-collapsed":""} ${Le?"can-pin":""}`,onClick:()=>{if(window.innerWidth<=768)Re(!ge);else{const tt=!Fe;oe(tt),localStorage.setItem("tide-commander-sidebar-collapsed",String(tt))}},title:Fe?"Open sidebar":"Close sidebar",children:o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Le?o.jsxs(o.Fragment,{children:[o.jsx("circle",{cx:"12",cy:"10",r:"3"}),o.jsx("line",{x1:"12",y1:"13",x2:"12",y2:"21"}),o.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"})]}):o.jsx("polyline",{points:Fe?"15 18 9 12 15 6":"9 18 15 12 9 6"})})}),o.jsxs("aside",{className:`sidebar ${ge?"sidebar-open":""} ${Fe?"sidebar-collapsed":""}`,children:[o.jsx("button",{className:"sidebar-close-btn show-on-mobile",onClick:()=>Re(!1),title:"Close sidebar",children:"✕"}),Dn.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Qc,children:o.jsx(oS,{onFocusAgent:Et,onKillAgent:Zn,onCallSubordinates:Vn,onOpenAreaExplorer:kn})})}),o.jsx("div",{className:"sidebar-section tool-history-section",children:o.jsx(b.Profiler,{id:"ToolHistory",onRender:Qc,children:o.jsx(R4,{agentIds:Dn})})})]}):o.jsx("div",{className:"sidebar-section unit-section",children:o.jsx(b.Profiler,{id:"UnitPanel",onRender:Qc,children:o.jsx(oS,{onFocusAgent:Et,onKillAgent:Zn,onCallSubordinates:Vn,onOpenAreaExplorer:kn})})})]}),o.jsx(b.Profiler,{id:"GuakeOutputPanel",onRender:Qc,children:o.jsx(cW,{onSaveSnapshot:E.open})})]}),o.jsx(LW,{onOpenToolbox:i.open,onOpenCommander:c.open,onOpenSupervisor:f.open,onOpenControls:m.open,onOpenSkills:x.open,onOpenSnapshots:j.open,isGeneratingReport:ft,pip:T}),o.jsx(vW,{activeTool:gt,onExit:ja}),q&&(()=>{const me=H.getState().agents.get(q.agentId);return me?o.jsx(SW,{agent:me,screenPos:q.screenPos,onClose:()=>be(null)}):null})(),ue&&(()=>{const me=Bt.get(ue.buildingId);if(!me)return null;const tt=()=>it(null);return me.type==="boss"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:tt}),o.jsx(TW,{building:me,screenPos:ue.screenPos,onClose:tt,onOpenSettings:()=>{tt(),k.open(ue.buildingId)},onOpenLogsModal:()=>{tt(),Ne(ue.buildingId)},onOpenUrlInModal:gs})]}):me.type==="database"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:tt}),o.jsx(_W,{building:me,screenPos:ue.screenPos,onClose:tt,onOpenSettings:()=>{tt(),k.open(ue.buildingId)},onOpenDatabasePanel:()=>{tt(),Ee(ue.buildingId)}})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"building-popup-backdrop",onClick:tt}),o.jsx(AW,{building:me,screenPos:ue.screenPos,onClose:tt,onOpenSettings:()=>{tt(),k.open(ue.buildingId)},onOpenLogsModal:()=>{Ce(ue.buildingId)},onOpenUrlInModal:gs})]})})(),de&&(()=>{var tt;const me=Bt.get(de);return me?(tt=me.docker)!=null&&tt.enabled?o.jsx(gq,{building:me,isOpen:!0,onClose:()=>Ce(null)}):o.jsx(mq,{building:me,isOpen:!0,onClose:()=>Ce(null)}):null})(),xe&&(()=>{const me=Bt.get(xe);return me?o.jsx(bq,{building:me,isOpen:!0,onClose:()=>Ne(null)}):null})(),X&&(()=>{const me=Bt.get(X);return me?o.jsx("div",{className:"modal-overlay visible",onMouseDown:at,onClick:we,children:o.jsx("div",{className:"database-panel-modal",children:o.jsx(hq,{building:me,onClose:Ve})})}):null})(),qe&&(()=>{var tt;const me=Bt.get(qe);return!me||!((tt=me.terminalStatus)!=null&&tt.url)?null:o.jsx("div",{className:"modal-overlay visible",onMouseDown:ie,onClick:fe,children:o.jsxs("div",{className:"terminal-modal-container",children:[o.jsxs("div",{className:"terminal-modal-header",children:[o.jsxs("span",{className:"terminal-modal-title",children:["Terminal - ",me.name]}),o.jsx("button",{className:"terminal-modal-close",onClick:$e,children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),o.jsx(Wb,{terminalUrl:me.terminalStatus.url,visible:!0})]})})})(),o.jsx(tq,{pip:T,title:"Tide Commander - Agents",children:o.jsx(rq,{})}),o.jsx(vq,{url:M||"",title:M?`Preview - ${M}`:"",isOpen:!!M,onClose:ia}),E.isOpen&&Dn.length===1&&(()=>{const me=Dn[0],tt=H.getState().agents.get(me);if(!tt)return null;const At=H.getOutputs(me);return o.jsx(wq,{isOpen:E.isOpen,onClose:E.close,agent:tt,outputCount:At.length,onSave:async en=>{try{const Pn=At.map(zt=>({type:"message",content:zt.text,timestamp:new Date(zt.timestamp).toISOString()}));await H.createSnapshot(en.agentId,tt.name,en.title,en.description,Pn,[]),E.close(),et("success",t("notifications:toast.snapshotSaved"),t("notifications:toast.snapshotSavedMsg"))}catch(Pn){const zt=Pn instanceof Error?Pn.message:t("notifications:toast.snapshotFailedMsg");et("error",t("notifications:toast.snapshotFailed"),zt)}},isSaving:Ft,error:cn||void 0})})(),o.jsx(yW,{onFocusAgent:Et,onSpawnClick:s.open,onSpawnBossClick:a.open,onNewBuildingClick:$r,onNewAreaClick:Hr}),o.jsx(eq,{spawnModal:s,bossSpawnModal:a,subordinateModal:r,toolboxModal:i,commanderModal:c,deleteConfirmModal:d,supervisorModal:f,spotlightModal:h,controlsModal:m,skillsModal:x,integrationsModal:y,monitoringModal:v,workflowEditorModal:S,triggerManagerModal:A,buildingModal:k,buildingInitialPosition:W,agentEditModal:N,snapshotsModal:j,restoreArchivedModal:D,explorerModal:_,contextMenu:O,spawnPosition:L,spawnAreaId:Y,explorerFolderPath:B,contextMenuActions:bo,sceneConfig:J,onConfigChange:ra,onToolChange:ms,onOpenAreaExplorer:kn,onDeleteSelectedAgents:Pl,pendingBuildingDelete:K,onCancelBuildingDelete:()=>Q(null),onConfirmBuildingDelete:Ur,showBackNavModal:st,onCloseBackNavModal:()=>bt(!1),onLeave:Tt,onOpenPM2LogsModal:me=>Ce(me),onOpenBossLogsModal:me=>Ne(me),onOpenDatabasePanel:me=>Ee(me),onSyncScene:()=>{var me,tt;(me=We.current)==null||me.syncAreas(),(tt=We.current)==null||tt.syncAgents(Array.from(H.getState().agents.values()))}})]})}function Sq(){return o.jsx(SL,{children:o.jsx(_L,{children:o.jsx(kq,{})})})}class Cq extends b.Component{constructor(n){super(n);Je(this,"handleReload",()=>{window.location.reload()});Je(this,"handleDismiss",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){console.error("[Tide] React Error:",n,s),this.setState({errorInfo:s})}render(){if(this.state.hasError){const{error:n,errorInfo:s}=this.state;return o.jsx("div",{style:{position:"fixed",inset:0,background:"#1a1a2e",color:"#fff",fontFamily:"monospace",padding:"32px",overflow:"auto",zIndex:99999},children:o.jsxs("div",{style:{maxWidth:"900px",margin:"0 auto"},children:[o.jsxs("h1",{style:{color:"#ff4a4a",fontSize:"24px",marginBottom:"16px",display:"flex",alignItems:"center",gap:"12px"},children:[o.jsx("span",{style:{fontSize:"32px"},children:"💥"}),Tn.t("errors:crash.title")]}),o.jsx("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:o.jsxs("div",{style:{color:"#ff6b6b",fontSize:"18px",marginBottom:"8px"},children:[n==null?void 0:n.name,": ",n==null?void 0:n.message]})}),o.jsxs("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[o.jsx("div",{style:{color:"#888",marginBottom:"8px",fontSize:"12px"},children:Tn.t("errors:crash.stackTrace")}),o.jsx("pre",{style:{color:"#ccc",fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:n==null?void 0:n.stack})]}),(s==null?void 0:s.componentStack)&&o.jsxs("div",{style:{background:"#2a2a3e",borderRadius:"8px",padding:"16px",marginBottom:"16px"},children:[o.jsx("div",{style:{color:"#888",marginBottom:"8px",fontSize:"12px"},children:Tn.t("errors:crash.componentStack")}),o.jsx("pre",{style:{color:"#ccc",fontSize:"12px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},children:s.componentStack})]}),o.jsxs("div",{style:{display:"flex",gap:"12px"},children:[o.jsx("button",{onClick:this.handleReload,style:{background:"#4a9eff",color:"#fff",border:"none",borderRadius:"6px",padding:"12px 24px",fontSize:"14px",cursor:"pointer"},children:Tn.t("common:buttons.reloadPage")}),o.jsx("button",{onClick:this.handleDismiss,style:{background:"#444",color:"#fff",border:"none",borderRadius:"6px",padding:"12px 24px",fontSize:"14px",cursor:"pointer"},children:Tn.t("common:buttons.tryToContinue")})]}),o.jsx("div",{style:{marginTop:"24px",color:"#666",fontSize:"12px"},children:Tn.t("errors:crash.checkConsole")})]})})}return this.props.children}}o6();document.addEventListener("wheel",t=>{if(Math.abs(t.deltaX)>Math.abs(t.deltaY)&&Math.abs(t.deltaX)>0){const e=t.target;if(e.tagName==="CANVAS"){t.preventDefault();return}let n=e;for(;n&&n!==document.documentElement;){if(n.scrollWidth>n.clientWidth)return;n=n.parentElement}t.preventDefault()}},{passive:!1});const RT=document.getElementById("app");if(!RT)throw new Error("Could not find #app container");const Aq=AM.createRoot(RT);Aq.render(o.jsx(je.StrictMode,{children:o.jsx(b.Suspense,{fallback:o.jsx("div",{style:{background:"#0a0a0a",height:"100vh"}}),children:o.jsx(Cq,{children:o.jsx(Sq,{})})})}));console.log("[Tide] Tide Commander initialized");export{ef as $,ML as A,zj as B,VD as C,AL as D,Kb as E,uV as F,Gb as G,Ml as H,cx as I,sr as J,ox as K,nL as L,ar as M,Hq as N,DL as O,ka as P,pV as Q,DU as R,pt as S,is as T,aV as U,Pt as V,Yj as W,fV as X,j2 as Y,lu as Z,tf as _,px as a,Pp as a$,og as a0,Ja as a1,yp as a2,sV as a3,ix as a4,Hf as a5,Mq as a6,CL as a7,ub as a8,Zq as a9,qD as aA,L5 as aB,d6 as aC,f6 as aD,g6 as aE,Vq as aF,Tj as aG,Yq as aH,Kq as aI,Qb as aJ,Xb as aK,Af as aL,hV as aM,vt as aN,a1 as aO,dV as aP,r1 as aQ,i1 as aR,fu as aS,Mr as aT,Dr as aU,y6 as aV,v6 as aW,Hj as aX,Ug as aY,w6 as aZ,fo as a_,ji as aa,Eq as ab,Qq as ac,Vx as ad,Xs as ae,pu as af,lp as ag,Aa as ah,ir as ai,Jb as aj,YD as ak,Tn as al,HR as am,GD as an,eV as ao,tV as ap,nV as aq,Jq as ar,Ij as as,Ik as at,$q as au,_j as av,Qt as aw,n5 as ax,lT as ay,jp as az,cL as b,s1 as b0,sa as b1,u1 as b2,C6 as b3,Gx as b4,Ob as b5,C4 as b6,Oj as b7,Lq as b8,Uq as b9,Pq as ba,Wq as bb,qq as bc,zq as bd,Bq as be,Gq as bf,xp as bg,$L as bh,k2 as bi,C2 as bj,rV as bk,lo as bl,_u as bm,RL as bn,iV as bo,cV as bp,oV as bq,Fq as br,Iq as bs,lV as bt,UR as bu,WR as bv,Oc as bw,Zb as bx,Xq as c,uL as d,qx as e,Ts as f,RU as g,Sa as h,kl as i,o as j,Xk as k,ea as l,Cn as m,Rq as n,Dq as o,Kd as p,ax as q,b as r,H as s,Oq as t,ht as u,fb as v,Ot as w,KR as x,QR as y,je as z};
|